Universal Crypto Library: Confidentiality and Disclaimer

Universal Crypto Library 2.5.18
Confidentiality and Disclaimer

Documentation Confidentiality

This document contains confidential information that is the strict property of Maxim Integrated, and may only be disclosed with written permission from Maxim Integrated itself. Any copy, reproduction, modification, use or disclosure of all or part of this document, if not expressly authorized by Maxim Integrated, is prohibited. This information is protected under trade secret, unfair competition and copying laws. This information has been provided under a Non Disclosure Agreement. Violations thereof may result in legal pursuits and fines.

Maxim Integrated reserves the right to change the information contained in this document to improve design, description or otherwise. Maxim Integrated does not assume any liability arising from the use or application of this information, or of any error or omission of such information. Except if expressly provided by Maxim Integrated in a written licence agreement, the availability of this document does not give the recipient licence to any intellectual property rights, including any patent rights covering the information in this document.

Copyright 2018 Maxim Integrated. All rights reserved. Do not disclose.

Disclaimer

To our valued customers:

We constantly strive to improve the quality of all our products and documentation. We have spent an exceptional amount of time ensuring that the information contained in this document is accurate. However, should you find any information that is missing or appears incorrect, please contact Maxim Integrated support. We appreciate your assistance in improving the quality of this document.

Maxim Integrated 2.5.18


Universal Crypto Library: Configuration and Use

Configuration and Use

Configuration

In order to use the UCL you have to:

  • Include at least the following headers:
    • ucl_config.h
  • Modify and include the header types.h if the UCL types are not already defined in your context.


Universal Crypto Library: Integration

Integration

Introduction

There are two different ways to use the Universal Crypto Library:

  • With an archive.
  • With a shared library in the case of an os.

UCL Archive

Add the archive libucl.a to the list of the linked library.

UCL Shared library

Add the shared library (libucl.so for Linux) to the list of the linked library.


Universal Crypto Library: References

References

Cryptographic References: Standard.

ANSI X9.31 Accredited Standards Committee X9. Digital Signatures Using Reversible Public Key Cryptography for the Financial Services Industry (rDSA). 1998.

ANSI X9.42 Accredited Standards Committee X9. Public Key Cryptography for the Financial Services Industry: Agreement of Symmetric Keys Using Discrete Logarithm Cryptography. 2003.

ANSI X9.62 Accredited Standards Committee X9. Public Key Cryptography for the Financial Services Industry: The Elliptic Curve Digital Signature Algorithm (ECDSA). 1998.

ANSI X9.63 Accredited Standards Committee X9. Public Key Cryptography for the Financial Services Industry: Key Agreement and Key Transport Using Elliptic Curve Cryptography. 2001.

FIPS PUB 46�3 NIST. FIPS 46-3: Data Encryption Standard (DES). October 25, 1999.
URL: http://csrc.nist.gov/publications/fips/index.html

FIPS PUB 74 NIST. FIPS 74: Guidelines for Implementing and Using the NBS Data Encryption Standard. April 1, 1981.
URL: http://csrc.nist.gov/publications/fips/index.html

FIPS PUB 81 NIST. FIPS 81: DES Modes of Operation. December 1980.
URL: http://csrc.nist.gov/publications/fips/index.html

FIPS PUB 113 NIST. FIPS 113: Computer Data Authentication. May 30, 1985.
URL: http://csrc.nist.gov/publications/fips/index.html

FIPS PUB 180-2 NIST. FIPS 180-2: Secure Hash Standard. August 1, 2002.
URL: http://csrc.nist.gov/publications/fips/index.html

FIPS PUB 186-2 NIST. FIPS 186-2: Digital Signature Standard. January 27, 2000.
URL: http://csrc.nist.gov/publications/fips/index.html

FIPS PUB 197 NIST. FIPS 197: Advanced Encryption Standard (AES). November 26, 2001.
URL: http://csrc.nist.gov/publications/fips/index.html

IEEE Std 1363-2000: Standard Specifications for Public Key Cryptography. IEEE, August 2000.

IEEE P1363a D10: Standard Specifications for Public Key Cryptography: Additional Techniques. November 1, 2001.
URL: http://grouper.ieee.org/groups/1363/

ISO/IEC 8824-1 ISO. Information Technology– Abstract Syntax Notation One (ASN.1): Specification of Basic Notation. 2002.

ISO/IEC 8825-1 ISO. Information Technology�ASN.1 Encoding Rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER), and Distinguished Encoding Rules (DER). 2002.

ISO/IEC 9594-1 ISO. Information Technology � Open Systems Interconnection � The Directory: Overview of Concepts, Models and Services.

  1. ISO/IEC 9594-8 ISO. Information Technology � Open Systems Interconnection � The Directory: Public-key and Attribute Certificate Frameworks. 2001.

    ISO/IEC 9796-2 ISO. Information Technology � Security Techniques � Digital Signature Scheme Giving Message Recovery � Part 2: Integer factorization based mechanisms. 2002.

    PKCS #1 RSA Laboratories. RSA Cryptography Standard. v2.1, June 14, 2002.
    URL: http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/index.html

    PKCS #3 RSA Laboratories. Diffie-Hellman Key-Agreement Standard. v1.4, November 1993.
    URL: http://www.rsasecurity.com/rsalabs/pkcs/pkcs-3/index.html

    PKCS #5 RSA Laboratories. Password-Based Encryption Standard. v2.0, March 25, 1999.
    URL: http://www.rsasecurity.com/rsalabs/pkcs/pkcs-5/index.html

    PKCS #7 RSA Laboratories. Cryptographic Message Syntax Standard. v1.5, November 1993.
    URL: http://www.rsasecurity.com/rsalabs/pkcs/pkcs-7/index.html

    PKCS #8 RSA Laboratories. Private-Key Information Syntax Standard. v1.2, November 1993.
    URL: http://www.rsasecurity.com/rsalabs/pkcs/pkcs-8/index.html

    PKCS #11-C RSA Laboratories. PKCS #11: Conformance Profile Specification, October 2000.
    URL: http://www.rsasecurity.com/rsalabs/pkcs/pkcs-11/index.html

    PKCS #11-P RSA Laboratories. PKCS #11 Profiles for mobile devices, June 2003.
    URL: http://www.rsasecurity.com/rsalabs/pkcs/pkcs-11/index.html

    PKCS #12 RSA Laboratories. Personal Information Exchange Syntax Standard. v1.0, June 1999.
    URL: http://www.rsasecurity.com/rsalabs/pkcs/pkcs-12/index.html

    RFC 1319 B. Kaliski. RFC 1319: The MD2 Message-Digest Algorithm. RSA Laboratories, April 1992.
    URL: http://ietf.org/rfc/rfc1319.txt

    RFC 1321 R. Rivest. RFC 1321: The MD5 Message-Digest Algorithm. MIT Laboratory for Computer Science and RSA Data Security, Inc., April 1992.
    URL: http://ietf.org/rfc/rfc1321.txt

    RFC 1421 J. Linn. RFC 1421: Privacy Enhancement for Internet Electronic Mail: Part I: Message Encryption and Authentication Procedures. IAB IRTF PSRG, IETF PEM WG, February 1993.
    URL:http://ietf.org/rfc/rfc1421.txt

    RFC 2246 T. Dierks & C. Allen. RFC 2246: The TLS Protocol Version 1.0. Certicom, January 1999.
    URL: http://ietf.org/rfc/rfc2246.txt

    RFC 2279 F. Yergeau. RFC 2279: UTF-8, a transformation format of ISO 10646 Alis Technologies, January 1998.
    URL: http://ietf.org/rfc/rfc2279.txt

    RFC 2630 R. Housley. RFC 2630: Cryptographic Message Syntax. June 1999.
    URL: http://ietf.org/rfc/rfc2630.txt

    RFC 2743 J. Linn. RFC 2743: Generic Security Service Application Program Interface Version 2, Update 1. RSA Laboratories, January 2000.
    URL: http://ietf.org/rfc/rfc2743.txt

    RFC 2744 J. Wray. RFC 2744: Generic Security Services API Version 2: Cbindings. Iris Associates, January 2000.
    URL:http://ietf.org/rfc/rfc2744.txt

    SEC 1 Standards for Efficient Cryptography Group (SECG). Standards for Efficient Cryptography (SEC) 1: Elliptic Curve Cryptography. Version 1.0, September 20, 2000.

    SEC 2 Standards for Efficient Cryptography Group (SECG). Standards for Efficient Cryptography (SEC) 2: Recommended Elliptic Curve Domain Parameters. Version 1.0, September 20, 2000.

    TLS IETF. RFC 2246: The TLS Protocol Version 1.0 . January

  1. URL: http://ietf.org/rfc/rfc2246.txt

    X.500 ITU-T. Information Technology � Open Systems Interconnection � The Directory: Overview of Concepts, Models and Services. February 2001. Identical to ISO/IEC 9594-1

    X.509 ITU-T. Information Technology � Open Systems Interconnection � The Directory: Public-key and Attribute Certificate Frameworks. March 2000. Identical to ISO/IEC 9594-8

    X.680 ITU-T. Information Technology � Abstract Syntax Notation One (ASN.1): Specification of Basic Notation. July 2002. Identical to ISO/IEC 8824-1

    X.690 ITU-T. Information Technology � ASN.1 Encoding Rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER), and Distinguished Encoding Rules (DER). July 2002. Identical to ISO/IEC 8825-1


Universal Crypto Library: Release Notes

Release Notes

Version 2.5.18

New Functionalities

  • SP800-90A HASH DRBG prediction resistance added.
  • sha256_whitening reads replaced with sp800-90a hash drbg reads internally.
  • MAX32670 support added.
  • Code size optimized for HMAC and PKCS1 functions
  • Crypto and TRNG clocks enabled in UCL init for max32620, max32621, max3230 and max32631.

Bug Fixes

  • max32620, max32621, max32630, max32631 CTR mode decryption error fixed.

Version 2.5.17

New Functionalities

  • MAX32520/MAX32570 TRNG implementation added
  • MAX32520/MAX32570 ECDSA SCA implementation added for p256r1, p384r1, p521r1.
  • MAX32520/MAX32570 scalar point multiplication is done by using SCA block for EC key generation.
  • ECDSA performance and security have been improved.

Version 2.5.16

New Functionalities

  • RSA CRT parameters generation in a non FIPS 186-4-compliant way added
  • ECC public key generation from private key
  • ECC key consistency check
  • SHA256 very fast cortex-M software implementation added
  • ECDSA very fast cortex-M software implementation added
  • RSA MAA memory improvement

Bug Fixes

  • RSA CRT computation might be erroneous
  • SHA-3 returned digest was larger than expected
  • AES GCM byte by byte handling correction
  • AES CCM wrong computation for AAD len = 0, 14 or 30

Version 2.5.15

New Functionalities

  • ucl_perror() function added for having error coded string messages
  • AES GCM multi-chunk AAD and multi-chunk payload management
  • RSA SSA PSS salt can be a fixed value (for validation purpose)

Bug Fixes

  • crypto controller initialization was not guaranteed: it is now performed in ucl_init()
  • AES-CCM was wrong for AAD len =0, 14 or 30; it is corrected
  • HMAC concurrent use, with different contexts, was not possible; it is corrected
  • symbols conflicts with CMSIS SDK on the MAA; it is corrected
  • RSA SSA PSS results were incorrect in some cases; it is corrected
  • Innova Card was mentioned in the documentation; every occurence is now replaced by Maxim Integrated
  • documentation for ucl_rng_read() and ucl_lowlevel_rng_read() was incorrect; it is corrected
  • in RSA, it was checked that the message shall less or equal to the modulus; the check is now strictly less than the modulus
  • AES CBC input and output parameters must not be identical; they now can be
  • the ucl_3des_dpa.h include file content could be misleading; it is not clearer

Version 2.5.14

New Functionalities

  • MAX32652 support improved (TRNG, public key cryptography)
  • MAX32665/MAX32666 support
  • SP800-90A additional_input parameter for sha256_generate is now supported
  • anti-glitch protection on AES and 3DES for any platform, except x86
  • RSA PKCS1: MGF1 hash function is now configurable (android test suite)
  • ucl_get_chip_version stored in the global variable ucl_chip_version (for DSF compliance)

Bug Fixes

  • RSA PKCS#1 1.5 overflow for RSA CRT on large keys (3072-bit and more)
  • RSA PKCS#1: ASN-1 OID for SHA-224 was incorrect
  • RSA PKCS#1 SSA-PSS incorrect formatting
  • SP800-90A: buffer overflow in ucl_sp80090a_reseeding_sha256
  • AES-CTR: on platform not using AES hardware, the CTR processing was incorrect
  • RSA CRT parameters computation is wrong in ucl_rsa_crt_parameters_regeneration

Version 2.5.13

New Functionalities

  • RSA PKCS1: SSA-PSS, ES-OAEP, SSA-PKCS1.5 support pre-hashed data
  • C++ support in any include file
  • SP800-90A hash DRBG compliant with CAVP

Bug Fixes

  • returned result was erroneous in RSA KAT B33
  • RSA private exponent computation was not FIPS 186-4 compliant
  • ECDSA Brainpool curves signatures verification failure for non-MAA targets

Version 2.5.12

New Functionalities

  • RSA PKCS1-ES PKCS1.5 output length control has been improved

Bug Fixes

  • ucl_data_int2os buffer read overflow correction
  • AES ECB,CTR and CBC context API documentation was missing
  • extra data for ECDSA were present
  • UCL stack release was not correctly performed in RSA KAT B33

Version 2.5.11

New Functionalities

  • AES-GCM available in multi-block (init, core, finish) API
  • ECDSA handles hash digests with a different size than the curve length (UCL_HASH_FIPS_INPUT define)
  • RSA PKCS1-SSA verification memory footprint decreased
  • AES-GCM m0 table initialization usage clarified

Bug Fixes

  • SP800-56 CDH curve context correction
  • ucl_rsa_decryptBlock and ucl_rsa_encryptBlock return codes were not consistent
  • ucl_rng_attach corrected
  • AES-GCM large data support

Version 2.5.10

Bug Fixes

  • SP800-90A reseeding counter management
  • incorrect defines for MAX32565/66

Version 2.5.9

New Functionalities

  • security and performances improvements on ECDSA
  • secp256k1 elliptic curve support
  • PKCS5 supports SHA-256
  • PKCS1 signatures can operate on already signed data
  • 3DES anti-glitch protection on MAX32590
  • defines added for C++ support

Version 2.5.8

New Functionalities

  • FIPS 140 TRNG health test
  • FIPS 140 TRNG random numbers with max entropy generation
  • SP800-90A hash DRBG pseudorandom bits generation function

Bug Fixes

  • 3DES include files modification
  • dependancy to pkc/rsa.h removed
  • u64 duplicated declaration in ucl_sha512.h removed

Version 2.5.7

New Functionalities

  • raw TRNG and SHA256-postprocessed TRNG health test function: int ucl_rng_stest(void)
  • RSA prime numbers p and q generation from n and d using SP800-56B
  • montgomery init computation results (transparent) reuse improvement
  • software-only RSA routines improvement
  • CTR mode support for AES
  • multi-part AES API key context support for ECB, CBC and CTR
  • RSA verification-only self-test function added: ucl_pkc_public_rsa_stest(void)
  • FIPS 186-4 RSA key generation method B3.3 supports 4096-bit keys
  • FIPS 186-4 RSA key generation method B3.6 supports 2048-bit and 3072-bit keys
  • MAA full usage for RSA keys generation on MAX32621 and MAX32631
  • ucl_rng_read uses the PRNG output on MAX32621 and MAX32631
  • RSA parameters conversion from n,d to n,p,q: ucl_rsa_recover_primes_from_secret_exponent(u8 *p,u8 *q,u8 *n,u8 *d,u8 *e,int modulus_bytes_size)
  • MAX32652 support

Bug Fixes

  • 3DES license correction
  • 2048-bit or more RSA keys generation was leading to deadlock on MAX326x: corrected
  • Diffie-Hellman structure size define correction for support on x86
  • UCL_DATA_TO_SMALL define corrected into UCL_DATA_TOO_SMALL

Version 2.5.6

New Functionalities

  • 3DES software implementation for MAX32550 revisions A
  • SM2 public key encryption
  • SM3 KDF
  • SM2 key generation
  • SM3-based random number whitening function
  • RSA PKCS1v1.5 SSA SHA512 support
  • FIPS 186-4 RSA keys generation speed improvment
  • FIPS 186-4 RSA keys generation specific functions for CAVP (RSA2VS) support
  • AES ucl_aes_ecb_init documentation clarification

Version 2.5.5

New Functionalities

  • 3DES software implementation for MAX32550 revisions A
  • RSA SSA PSS SHA512 support

Version 2.5.4

New Functionalities

  • support for MAX32565, MAX32566
  • SP800-90A Hash DRBG
  • AES GCM/GMAC with 192-bit and 256-bit keys
  • SHA-256 whitening for keys generation and PKCS1 masks
  • AES GCM/GMAC r table initialization not needed any more
  • SHA3 support

Bug Fixes

  • TRNG initialization may lead to a deadlock

Version 2.5.3

New Functionalities

  • support for MAX32620, MAX32630, MAX32621, MAX32631

Bug Fixes

  • use of SHA on max32550 may lead to deadlock

Version 2.5.2

New Functionalities

  • ucl_rsa_private_key structure type modified for a more flexible structure fields use
  • MAX32550 B2 version identification added
  • possible selection of SHA hardware or software version on MAX32550 B1/B2

Bug Fixes

  • 3DES initialization corrected
  • void parameter missing in ECDSA self-test prototype

Version 2.5.1

New Functionalities

  • MAX32600 support
  • RSA PKCS1 SSA PSS supports non-zero-length salt
  • RSA keys generation available from u8 API

Bug Fixes

  • ucl_pkcs1_ssa_pss_sha256_verify_ is now documented
  • SHA digest output does not need to be aligned on MAX32550
  • modulus loading is now performed for ECC on curve point verification
  • __ API __ has been removed from the documentation
  • sia256 header does not contain any reference to sha256

Version 2.5.0

New Functionalities

  • MAX32550 B1 support (3DES, SHA)
  • MAX32550 revision dynamic identification
  • AES RFC 3394 Key wrap
  • chinese block cipher SM4 support added
  • RSA keys generation memory use improvement

Bug Fixes

Version 2.4.12

New Functionalities

  • AES CMAC and 3DES CMAC modes are supported
  • ECDH functions using the new ECC API are available
  • ECIES uses smaller ECC code

Bug Fixes

  • 3DES CBC MAC data byte len shall be a multiple of 8
  • ECIES doxygen documentation added
  • ECDH (SP800-56A) doxygen documenation added

Version 2.4.11

New Functionalities

  • ECDSA self tests functions using the new API are available

Bug Fixes

  • ECDSA self tests functions doxygen documentation added

Version 2.4.10

New Functionalities

  • RSA CRT decryption available without any protection: ucl_rsa_crt_decryptBlock_without_protection

Version 2.4.9

New Functionalities

  • new SM2 and EC DSA new API with dedicated curves domains structures parameters
  • MAX32555 support of SHA-256 hardware
  • correct handling of RSA keys longer than what MAA supports

Bug Fixes

  • null vector correct handling with SHA-256 engine on MAX32555
  • TRNG correct handling on MAX32555
  • ECC P-521 keys generation correct handling
  • AES CCM multi-block handling corrected

Version 2.4.8

New Functionalities

  • AES CCM mode

Bug Fixes

  • RNG ucl_rng_read function matches the documentation
  • RNG whitening function corrected
  • RNG x86 random numbers are more random (while still not secure)

Version 2.4.7

New Functionalities

  • EMV unpredictable number generation functions (see EMV bulletin no144)
  • RNG whitening post-process using SHA-256
  • MAX32550 support of AES hardware
  • MAX32550 RSA keys generation performances improved

Bug Fixes

  • RNG private functions are not exported any more

Version 2.4.6

New Functionalities

  • MAX32550 support with MAA and TRNG hardware use
  • MAX32590 linux performances of AES, 3DES used through crypto API improved

Bug Fixes

  • double jacobian corrected for BP512 on MAX32590
  • protection corrected for P521
  • functions declarations in include files improved
  • multiplication null length management
  • DES modes handling corrected for MAX32590 linux

Version 2.4.5

New Functionalities

  • protection on ECDSA improved

Bug Fixes

none

Version 2.4.4

New Functionalities

  • hash functions defines management improved

Bug Fixes

none

Version 2.4.3

New Functionalities

none

Bug Fixes

  • RSA keys bitlengths not multiple of 4 were not efficient on MAX32590

Version 2.4.2

New Functionalities

  • ECDSA P256 precomputation on-the-fly routines

Bug Fixes

none

Version 2.4.1

New Functionalities

  • MAX32590 Linux 2.6.36 support with AES, 3DES and TRNG hardware use

Bug Fixes

  • bug in pkcs1 ssa pkcs1v15 encode function
  • bug infinite affine point verification
  • compilation warnings removed

Version 2.4.0

New Functionalities

  • MAX32590 Linux 2.6.36 support with AES, 3DES and TRNG hardware use

Version 2.3.21

New Functionalities

  • FIPS 186-4 compliant RSA keys generation routines added

Version 2.3.20

New Functionalities

  • compilation warnings removed

Bug Fixes

  • bug in RSA SSA PSS since 2.3.18

Version 2.3.19

New Functionalities

  • ARM Cortex M3 support

Version 2.3.18

New Functionalities

  • AES GCM and GMAC added

Version 2.3.17

New Functionalities

  • self-test functions object files split by algorithm: 3DES, AES, RSA, DSA, ECDSA
  • new build scripts and options (-O3 for RELEASE version)

Bug Fixes

  • RSA key generation prototypes were not declared in one single include file.

Version 2.3.16

New Functionalities

  • SM2 P256 curve and algorithm support
  • SM3 hash function support

Bug Fixes

  • wrong ucl_stack_free use in some functions
  • missing parameters (curve) in some ECDSA functions
  • MAA reset was not correctly managed

Version 2.3.15

New Functionalities

  • pre-hashed data (for SHA1 and SHA256) for X9.31 SSA, pkcs1 SSA PKCS1v1.5, SSA PSS

Bug Fixes

  • SHA-256 ISO/IEC 10118 ID was wrong in X9.31

Version 2.3.14

New Functionalities

  • library build in thumb mode on MAX32590
  • support for Brainpool P256, P384 and P512 ECDSA
  • support for SM2 DSA algorithm
  • support for SM3 hash algorithm
  • support for PROFILE_1 build option

Bug Fixes

  • DSA PRECOMP_R option support (#3352)

Version 2.3.13

New Functionalities

  • RSA CRT keys generation functions provide full-length private exponent
  • ECC p384r1, p521r1, MD5, RIPEMD-160 functions removed

Bug Fixes

none

Version 2.3.12

New Functionalities

  • RSA X9.31 is now supporting SHA-256

Bug Fixes

  • AES-192 was not correctly functioning

Version 2.3.11

New Functionalities

none

Bug Fixes

  • 2048-bit DSA key generation did not match the spec
  • DSA configuration parameter did not match the spec
  • ECIES include file was missing
  • X9.31 SHA256 and X9.31 SHA1 include files were missing
  • ucl_rsa_crt_parameters was not declared in include file
  • HMAC self-test routines were not declared in include file

Version 2.3.10

New Functionalities

  • on JIBE, ECDSA verification improved by x2 with smaller precomputation
  • on JIBE, use of hardware blocks for AES, 3DES, RSA, ECDSA
  • on JIBE, protections against SPA/DPA
  • on JIBE, ucl_dsa_keygen added

Bug Fixes

none.

Known Issues

secp521r1 does not work any more

hypertext documentation is not available for the new algorithms. please refer to SPEC98T07.

Version 2.3.9

New Functionalities

  • on JIBE, ECDSA P256 verification improved by x2 with precomputation
  • on JIBE, ECDSA P256 signature improved by 20%

Bug Fixes

none.

Known Issues

secp521r1 does not work any more

hypertext documentation is not available for the new algorithms. please refer to SPEC98T07.

Version 2.3.8

New Functionalities

  • ECDSA uses MAA on JIBE

Bug Fixes

none.

Known Issues

hypertext documentation is not available for the new algorithms. please refer to SPEC98T07.

Version 2.3.7

New Functionalities

  • ECDSA generic API
  • ECDSA parameters precomputation management

Bug Fixes

none.

Known Issues

hypertext documentation is not available for the new algorithms. please refer to SPEC98T07.

Version 2.3.6

New Functionalities

  • DSA self-test added.
  • RSA X9.31 added.
  • SP800-56 KDF with SHA-1 added.
  • SP800-56 Full Unified ECC CDH with SHA-1 added.
  • Elliptic Curve key generation added.
  • Elliptic Curve point check added.
  • 3DES-EEE CBC added.
  • RSA CRT parameters re-generation added.

Bug Fixes

none.

Known Issues

hypertext documentation is not available for the new algorithms. please refer to SPEC98T07.

Version 2.3.5

New Functionalities

  • DSA added.
  • SHA-224 added.
  • SHA-384 added.
  • SHA-512 added.
  • SHA self-tests added.
  • HMAC SHA-224 added.
  • HMAC SHA-384 added.
  • HMAC SHA-512 added.
  • HMAC self-tests added.
  • ECDSA P-160 (secp160r1) added.
  • ECDSA P-192 (secp192r1) added.
  • ECDSA P-224 (secp224r1) added.
  • ECDSA P-256 (secp256r1) added.
  • ECDSA P-384 (secp384r1) added.
  • ECDSA P-521 (secp521r1) added.

Bug Fixes

none.

Known Issues

hypertext documentation is not available for the new algorithms.

Version 2.3.4

New Functionalities

support for all algorithms, software implementation, no countermeasures.

Bug Fixes

multiplication_16to32 overflow corrected

Known Issues

No known issue.

Version 2.3.3

New Functionalities

support for all algorithms, software implementation, no countermeasures.

Bug Fixes

full support for ARMv5 architecture

Known Issues

No known issue.

Version 2.3.2

New Functionalities

Support / optimizations for ARMv5 architecture.

Bug Fixes

No bug fix.

Known Issues

No known issue.

Version 2.3.1

New Functionalities

Add PKCS1 function for computation per blocks for SHA256. See ucl_pkcs1_emsa_pss_sha256_verify_digest.

Bug Fixes

No bug fix.

Known Issues

No known issue.

Version 2.3.0

New Functionalities

Add PKCS1 function for computation per blocks. See ucl_pkcs1_emsa_pss_sha1_verify_digest.

Bug Fixes

No bug fix.

Known Issues

No known issue.

Version 2.2.2

Add x86 architecture support.

New Functionalities

No new functionality.

Bug Fixes

  • fixes ucl_pkcs1_eme_pkcs1v15_decode issue
  • fixes ucl_pkcs1_eme_pkcs1v15_encode issue

Known Issues

  • DES and related functions does not work on x86 platform
  • PSS verify functions have issue for RIPEMD16 and MD5

Version 2.2.1

Add x86 architecture support.

New Functionalities

  • ucl_init return an error if the file /dev/hwrandom does not exist

Bug Fixes

  • ucl_pkcs1_ssa_pss_sha1_verify issue correction
  • ucl_pkcs1_ssa_pss_sha256_verify issue correction
  • RSA generated keys have always the most significant bit equal to 1

Known Issues

  • DES and related functions does not work on x86 platform
  • PSS verify functions have issue for RIPEMD16 and MD5

Version 2.1.1

This version corrects some bugs

New Functionalities

No functionalities added.

Bug Fixes

  • ucl_pkcs1_es_oaep_sha1_decrypt loops sometimes indefinitely
  • RSA keypairs generation for 1856 and 1920-bit moduli is not possible
  • RSA keypairs generation for odd bitlength moduli is not possible
  • p192_os.h, b191_os.h and b163_os.h include files missing

Known Issues

There is a bug related to ucl_pkcs1_ssa_pss_sha1_verify which returns falsely an error

Version 2.1.0

New Functionalities

  • See ucl_init

Bug Fixes

No bug fix.

Known Issues

There are not currently new bugs reported.

Version 2.0.2

Minor correction release.

Bug Fixes

 @li ucl_pkcs1_ssa_pkcs1v15_sha1_verify always returns success

Known Issues

There are currently not new bug reported.

Version 2.0.1

Minor correction release.

Bug Fixes

  • DES stack overflow in EABI production version

Known Issues

There are currently not new bug reported.

Version 2.0.0

This version provides Elliptic Curve Cryptography [ECC].

New Functionalities

  • Add the ECC and ECDSA (#UCL_ECDSA)
  • Add the possibility to attach another RNG (#UCL_RNG)

Bug Fixes

  • Double call to ucl_init return error (no action)

Known Issues

There are currently not new bug reported.

  • Point compression on GF(2^m) not implemented

Others

  • Documentations corrections

Version 1.4.2

This version provides corrections.

Bug Fixes

  • Correction of modular inversion for RSA

Known Issues

There are currently not new bug reported.

Version 1.4.1

This version provides corrections.

Bug Fixes

  • Correction of modular inversion for ECC
  • Bug fixed for HMAC SHA256
  • Documentations corrections

Known Issues

There are currently not new bug reported.

Others

  • C++ compatibility for headers
  • Rename ucl/info.h to ucl/ucl_info.h (Keep info.h for compatibility)
  • Rename ucl/types.h to ucl/ucl_types.h (Keep types.h for compatibility)
  • Low level optimization for large number library
  • Add Diffie Hellman example
  • Add RSA parameters generation example
  • Add ECC NIST curve example
  • Add PKCS example

Version 1.4.0

This version provides the basic ECC operations.

New Functionalities

  • Module ECC (see Elliptic Curves.)

Bug Fixes

  • Documentation issues correction

Known Issues

There are not currently new bugs reported.

Version 1.3.0

This version provides corrections and new features.

New Functionalities

  • RSA parameters generation (see RSA)
  • Remove self test from ucl_init
  • Add self tests module (see Self Tests)
  • Add ucl/ucl_types.h

Bug Fixes

  • TRNG interface bug fixed
  • PKCS1 V1.5 SSA SH256 bug fixed

Known Issues

There are not currently new bugs reported.

Version 1.2.2

This version provides minor corrections.

New Functionalities

Nothing.

Bug Fixes

Nothing.

  • Correct a minor bug of the function ucl_init

Known Issues

There are not currently new bugs reported.

Version 1.2.1

This version provide minor corrections.

New Functionalities

Minor Changes:

  • Add functions ucl_get_build
  • Change the return of the function ucl_get_version

Bug Fixes

  • Correct a minor bug of the function ucl_init

Known Issues

There are not currently new bugs reported.

Version 1.2.0

This version add some algorithms.

New Functionalities

Major Changes:

  • Add the software AES (see AES)
  • Add the USIP® AES interface (see USIP AES Interface)
  • Enable the long key capabilities for 3DES and AES.
  • Add the Diffie-Hellman key exchange protocol
  • Some optimizations

Bug Fixes

No bug fix.

Known Issues

  • ucl_init false return: The function ucl_init return an error vector (DES and TDES error) although there are not error.

Version 1.1.0

This version facilitates the integration in various OS, especially Linux.

New Functionalities

Major Changes:

  • Substitute "crypto" by "ucl" to avoid conflicts with OS.
  • Use typedef u8, u16, u32.
  • Use "_t" extension instead of "_type" for typedef, and "ctx" instead of "context"
  • Modification of the ucl_init function.
  • dynamical use the UCL

Use ucl_olddefs.h to use the older types and definitionss.

Bug Fixes

  • not aligned data handling for des & 3des.

Known Issues

There are not currently new bugs reported.

Version 1.0.1

This version corrects some bugs.

New Functionalities

No functionalities added.

Bug Fixs

  • HAL out of range.
  • Data alignment problems in hash functions.
  • Use of memccpy instead of memcpy in ucl_tdes_cbc_mac

Known Issues

Data alignment needed by des and 3des.

Version 1.0

This version is the first release of the USIP® Cryptographic Library.
There are major changes comparatively with the previous beta versions, including many improvements and optimizations, bug fixes and the addition of many functionalities.

Note
The previous API is always available excepted the functions which are in the deprecated list. They are not any more documented.

New Functionalities

The major improvement of the USIP® Cryptographic library is the development of the end user API. This API provides all the cryptographic algorithms regarding the inputs/outputs as octet strings. Furthermore, this API implements RSA standard PKCS #1 V2.1.

Major Changes:

  • Add 8-bit API.
  • Add PKCS #1 V2.1 functionalities.
  • Add PKCS #5 v2.0 functionalities.
  • Add UCL Stack.
  • Add UCL System functionalities [!].
  • Add USIP TRNG interface.

Bug Fixes

Many minor bugs were fixed and are not described here.
The following list includes the major bugs fixes.

  • Calculation error during the treatment of an interruption.
  • 2048-bit RSA calculation error due to a memory lack.


Universal Crypto Library: Version Information

Version Information

The library is based on different modules and for certification process each module has its own version.

Module Versions

  • Big Number Library 1.0
  • Block Cipher 1.0
  • Data & Memory Manipulation 1.0
  • Elliptic Curves. 1.0
  • Secure Hash Function 1.0
  • Message Authentication Code 1.0
  • Public Key Algorithm 1.0
  • PKCS #1 V2.1 1.2
  • PKCS #5 v2.0 1.0
  • Random 1.0


Universal Crypto Library: Warning and Recommendations

Warning and Recommendations

Recommendations

Warning

Implementers shall take into account the following points:

  • Do not forget to save the register acx when context saving occured.


Universal Crypto Library: Deprecated List

Deprecated List
Class RSA_PrKEY
This structure is not any more used
Class RSA_PuKEY
This structure is not any more used
Class RSACRT_KEY
This structure is not any more used
Global ucl_rsa_crt_decryptBlock (u32 *decryptedBlock, u32 *cipherBlock, RSACRT_KEY key, RSA_PuKEY keyPu)
Prototype changed
Global ucl_rsa_decryptBlock (u32 *decryptedBlock, u32 *cipherBlock, RSA_PrKEY key)
Prototype changed
Global ucl_rsa_encryptBlock (u32 *cipherBlock, u32 *plainBlock, RSA_PuKEY key)
Prototype changed


Universal Crypto Library: Modules

Modules
Here is a list of all modules:
[detail level 1234]
▼ Registers | Registers, Bit Masks and Bit Positions for the CRYPTO Peripheral Module
Register Offsets | CRYPTO Peripheral Register Offsets from the CRYPTO Base Peripheral Address
CTRL_Register | Crypto Control Register
CIPHER_CTRL_Register | Cipher Control Register
HASH_CTRL_Register | HASH Control Register
CRC_CTRL_Register | CRC Control Register
DMA_SRC_Register | Crypto DMA Source Address
DMA_DEST_Register | Crypto DMA Destination Address
DMA_CNT_Register | Crypto DMA Byte Count
DIN_Register | Crypto Data Input
DOUT_Register | Crypto Data Output
CRC_POLY_Register | CRC Polynomial
CRC_VAL_Register | CRC Value
CRC_PRNG_Register | Pseudo Random Value
HAM_ECC_Register | Hamming ECC Register
CIPHER_INIT_Register | Initial Vector
CIPHER_KEY_Register | Cipher Key
HASH_DIGEST_Register | This register holds the calculated hash value
HASH_MSG_SZ_Register | Message Size
3DES CMAC | Process CMAC authentication with 3DES
AES CMAC | Process CMAC authentication with AES
AES CTR | Encrypt / Decrypt with AES in CTR (Electronic Codebook) mode
AES GCM | Encrypt / Decrypt with AES in GCM (Galois Counter Mode) provide authentication with GMAC (Galois MAC)
AES Key Wrap | AES keys wrap compliant with RFC 3394
▼ Definitions |
Defines |
Definitions of returns |
User Defines | Defines and typedef which must be set by user
Information | General Library Information
UCL Linux Configuration | List of configuration parameters
UCL System | UCL System Functions
Big Number Library | Big Number Library
▼ Block Cipher | Symmetric-key block ciphers of the cryptolib
SM4 | SM4, see http://www1.cnnic.cn/ScientificResearch/LeadingEdge/soea/sm4/201312/t20131204_43351.htm
3DES | The Triple DES, see FIPS 46-3 and NIST SP 800-67
AES | The AES, see FIPS-197
DES | The Data Encryption Standard (DES), see FIPS PUB 46.3 NIST
USIP AES Interface | Interface for Hardware AES
▼ Data & Memory Manipulation | Data & Memory Manipulation
Data Conversion | Data Conversion
UCL Stack | UCL Stack Management
▼ Secure Hash Function | Secure Hash Function of the UCL
HDES | Hash function two padding method 3, based on ISO/IEC 10118-2
SHA224 | Secure Hash Algorithm 224, from FIPS 180-2
SHA256 | Secure Hash Algorithm 256, from FIPS 180-2
SHA3 | Secure Hash Algorithm 3, from FIPS 202
SHA384 | Secure Hash Algorithm 384, from FIPS 180-2
SIA256 | Variant of the Secure Hash Algorithm 256, from FIPS 180-2
SM3 | Secure Hash Algorithm 256, from FIPS 180-2
▼ Message Authentication Code | Message Authentication Code
▼ CBC MAC | MAC with Cipher Block Chaining
AES CBC_MAC | Encrypt / Decrypt with AES in CBC_MAC (Cipher Block Chaining) mode
DES CBC MAC | ISO/IEC 9797-1:1999 MAC Algorithm 1 with DES
TDES CBC MAC | ISO/IEC 9797 Part I MAC Algorithm 3 with DES
▼ HMAC | Keying Hash Functions for Message Authentication: HMAC
HMAC MD5 |
HMAC RIPEMD160 |
HMAC SHA1 |
HMAC SHA224 |
HMAC SHA256 |
HMAC SHA384 |
HMAC SHA512 |
▼ Miscellaneous functions | Functions of UCL which don't belong to another module
Mathematical functions | Mathematical miscellaneous functions
Self Tests | Integrity Tests
▼ Operation Modes | Operation Modes
▼ CBC | Cipher Block Chaining
3DES CBC | Encrypt / Decrypt with 3DES in CBC (Cipher Block Chaining) mode
AES CBC | Encrypt / Decrypt with AES in CBC (Cipher Block Chaining) mode
DES CBC | Encrypt / Decrypt with DES in CBC (Cipher Block Chaining) mode
USIP AES CBC | Encrypt / Decrypt with USIP® AES in CBC (Cipher Block Chaining) mode
▼ CCM | Counter with CBC-MAC
AES CCM | Encrypt / Decrypt with AES in CCM (Counter with CBC-MAC) mode
▼ CFB | Cipher Feedback mode
3DES CFB | Encrypt/Decrypt with 3DES in 64bits CFB (Cipher Feedback) mode
DES CFB | Encrypt/Decrypt with DES in 64bits CFB (Cipher Feedback) mode
▼ ECB | Electronic Codebook
3DES ECB | Encrypt/Decrypt with 3DES in ECB (Electronic Codebook) mode
AES ECB | Encrypt / Decrypt with AES in ECB (Electronic Codebook) mode
DES ECB | Encrypt/Decrypt with DES in ECB (Electronic Codebook) mode
USIP AES ECB | Encrypt/Decrypt with USIP® AES in ECB (Electronic Codebook) mode
▼ OFB | Output Feedback
3DES OFB | Encrypt/Decrypt with 3DES in 64-bit OFB (Output Feedback) mode
DES OFB | Encrypt/Decrypt with DES in 64-bit OFB (Output Feedback) mode
▼ Public Key Algorithm | Public Key Algorithm of the Libcrypto
Diffie-Hellman | Diffie-Hellman Key Exchange Protocol
▼ Elliptic Curves. | ECC Elliptic Curves
ECDSA | Elliptic Curve Digital signature Algorithm
ECC keys generation. | ECC keys generation
ECC public keys generation. | ECC public keys generation
ECIES computation. | ECIES computation
SP800-56 ECDH computation |
▼ RSA | The RSA cryptosystem
DSA | DSA cryptosystem
RSA2VS | The RSA2VS validation program
RSA Deprecated Prototypes | Old RSA prototypes
▼ PKCS #1 V2.1 | RSA Cryptography Standard
RSAES-PKCS1-v1.5 | PKCS #1 V2.1 Section 7.2: RSAES-PKCS1-v1_5
PKCS1v21-MGF1 | MGF1 hash functions management
▼ RSAES-OAEP | PKCS #1 V2.1 Section 7.1: RSAES-OAEP
RSA OAEP MD5 | Encrypt/Decrypt with RSA OAEP using the hash function MD5
RSA OAEP RIPEMD160 | Encrypt/Decrypt with RSA OAEP using the hash function RIPEMD160
RSA OAEP SHA1 | Encrypt/Decrypt with RSA OAEP using the hash function SHA1
RSA OAEP SHA224 | Encrypt/Decrypt with RSA OAEP using the hash function SHA224
RSA OAEP SHA256 | Encrypt/Decrypt with RSA OAEP using the hash function SHA256
RSA OAEP SHA384 | Encrypt/Decrypt with RSA OAEP using the hash function SHA384
RSA OAEP SHA512 | Encrypt/Decrypt with RSA OAEP using the hash function SHA512
▼ RSASSA-PKCS1-v1.5 | PKCS #1 V2.1 Section 8.2: RSASSA-PKCS1-v1.5
RSASSA-PKCS1V15 | Signature scheme RSA PKCS#1 V1.5 using pre-hashed data (SHA1 and SHA256)
RSASSA-PKCS1V15 MD5 | Signature scheme RSA PKCS#1 V1.5 using the hash function MD5
RSASSA-PKCS1V15 RIPEMD160 | Signature scheme RSA PKCS#1 V1.5 using the hash function RIPEMD160
RSASSA-PKCS1V15 SHA1 | Signature scheme RSA PKCS#1 V1.5 using the hash function SHA1
RSASSA-PKCS1V15 SHA224 | Signature scheme RSA PKCS#1 V1.5 using the hash function SHA224
RSASSA-PKCS1V15 SHA256 | Signature scheme RSA PKCS#1 V1.5 using the hash function SHA256
RSASSA-PKCS1V15 SHA384 | Signature scheme RSA PKCS#1 V1.5 using the hash function SHA384
RSASSA-PKCS1V15 SHA512 | Signature scheme RSA PKCS#1 V1.5 using the hash function SHA512
▼ RSASSA-PSS | RSAPSS with pre-hashed data
RSASSA-PSS-MD5 | RSAPSS with the hash function MD5
RSASSA-PSS-RIPEMD160 | RSAPSS with the hash function RIPEMD160
RSASSA-PSS-SHA1 | RSAPSS with the hash function SHA1
RSASSA-PSS-SHA224 | RSAPSS with the hash function SHA224
RSASSA-PSS-SHA256 | RSAPSS with the hash function SHA256
RSASSA-PSS-SHA384 | RSAPSS with the hash function SHA384
RSASSA-PSS-SHA512 | RSAPSS with the hash function SHA512
▼ PKCS #5 v2.0 | Password-Based Cryptography Standard
▼ PBKDF | Password Base Key derivation functions
▼ PBKDF2 | PKCS #5 v2.0 Section 5.2: PBKDF2
PBKDF2 HMAC-SHA1 | PBKDF2 using HMAC-SHA1
PBKDF2 HMAC-SHA256 | PBKDF2 using HMAC-SHA256
PBKDF2 HMAC-SHA512 | PBKDF2 using HMAC-SHA512
PBKDF2 HMAC-SHA384 | PBKDF2 using HMAC-SHA384
▼ Random | Random Number Generation
RNG Interface | Interface for Random Number Generator
SP800-90A interface | SP800-90A Hash DRBG-compliant source for random numbers
USIP TRNG | USIP® True Random Number Generation


Universal Crypto Library: Registers

Modules | Data Structures
Registers

Registers, Bit Masks and Bit Positions for the CRYPTO Peripheral Module. More...

+ Collaboration diagram for Registers:

Modules

Register Offsets
CRYPTO Peripheral Register Offsets from the CRYPTO Base Peripheral Address.
CTRL_Register
Crypto Control Register.
CIPHER_CTRL_Register
Cipher Control Register.
HASH_CTRL_Register
HASH Control Register.
CRC_CTRL_Register
CRC Control Register.
DMA_SRC_Register
Crypto DMA Source Address.
DMA_DEST_Register
Crypto DMA Destination Address.
DMA_CNT_Register
Crypto DMA Byte Count.
DIN_Register
Crypto Data Input.
DOUT_Register
Crypto Data Output.
CRC_POLY_Register
CRC Polynomial.
CRC_VAL_Register
CRC Value.
CRC_PRNG_Register
Pseudo Random Value.
HAM_ECC_Register
Hamming ECC Register.
CIPHER_INIT_Register
Initial Vector.
CIPHER_KEY_Register
Cipher Key.
HASH_DIGEST_Register
This register holds the calculated hash value.
HASH_MSG_SZ_Register
Message Size.

Data Structures

struct me13_mxc_crypto_regs_t
Structure type to access the CRYPTO Registers. More...

Detailed Description

Registers, Bit Masks and Bit Positions for the CRYPTO Peripheral Module.

The Cryptographic Accelerator used to assist the computationally intensive operations of several common algorithms.


Universal Crypto Library: Register Offsets

Macros
Register Offsets
Registers

CRYPTO Peripheral Register Offsets from the CRYPTO Base Peripheral Address. More...

+ Collaboration diagram for Register Offsets:

Macros

#define | UCL_ME13_MXC_R_CRYPTO_CTRL ((uint32_t)0x00000000UL)
Offset from CRYPTO Base Address: 0x0x000.
#define | UCL_ME13_MXC_R_CRYPTO_CIPHER_CTRL ((uint32_t)0x00000004UL)
Offset from CRYPTO Base Address: 0x0x004.
#define | UCL_ME13_MXC_R_CRYPTO_HASH_CTRL ((uint32_t)0x00000008UL)
Offset from CRYPTO Base Address: 0x0x008.
#define | UCL_ME13_MXC_R_CRYPTO_CRC_CTRL ((uint32_t)0x0000000CUL)
Offset from CRYPTO Base Address: 0x0x00C.
#define | UCL_ME13_MXC_R_CRYPTO_DMA_SRC ((uint32_t)0x00000010UL)
Offset from CRYPTO Base Address: 0x0x010.
#define | UCL_ME13_MXC_R_CRYPTO_DMA_DEST ((uint32_t)0x00000014UL)
Offset from CRYPTO Base Address: 0x0x014.
#define | UCL_ME13_MXC_R_CRYPTO_DMA_CNT ((uint32_t)0x00000018UL)
Offset from CRYPTO Base Address: 0x0x018.
#define | UCL_ME13_MXC_R_CRYPTO_DIN ((uint32_t)0x00000020UL)
Offset from CRYPTO Base Address: 0x0x020.
#define | UCL_ME13_MXC_R_CRYPTO_DOUT ((uint32_t)0x00000030UL)
Offset from CRYPTO Base Address: 0x0x030.
#define | UCL_ME13_MXC_R_CRYPTO_CRC_POLY ((uint32_t)0x00000040UL)
Offset from CRYPTO Base Address: 0x0x040.
#define | UCL_ME13_MXC_R_CRYPTO_CRC_VAL ((uint32_t)0x00000044UL)
Offset from CRYPTO Base Address: 0x0x044.
#define | UCL_ME13_MXC_R_CRYPTO_CRC_PRNG ((uint32_t)0x00000048UL)
Offset from CRYPTO Base Address: 0x0x048.
#define | UCL_ME13_MXC_R_CRYPTO_HAM_ECC ((uint32_t)0x0000004CUL)
Offset from CRYPTO Base Address: 0x0x04C.
#define | UCL_ME13_MXC_R_CRYPTO_CIPHER_INIT ((uint32_t)0x00000050UL)
Offset from CRYPTO Base Address: 0x0x050.
#define | UCL_ME13_MXC_R_CRYPTO_CIPHER_KEY ((uint32_t)0x00000060UL)
Offset from CRYPTO Base Address: 0x0x060.
#define | UCL_ME13_MXC_R_CRYPTO_HASH_DIGEST ((uint32_t)0x00000080UL)
Offset from CRYPTO Base Address: 0x0x080.
#define | UCL_ME13_MXC_R_CRYPTO_HASH_MSG_SZ ((uint32_t)0x000000C0UL)
Offset from CRYPTO Base Address: 0x0x0C0.

Detailed Description

CRYPTO Peripheral Register Offsets from the CRYPTO Base Peripheral Address.


Universal Crypto Library: CTRL_Register

Macros
CTRL_Register
Registers

Crypto Control Register. More...

+ Collaboration diagram for CTRL_Register:

Macros

#define | UCL_ME13_MXC_F_CRYPTO_CTRL_RST_POS (0)
CTRL_RST Position.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_RST ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CTRL_RST_POS))
CTRL_RST Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_RST_RESET ((uint32_t)0x1)
CTRL_RST_RESET Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_RST_RESET (UCL_ME13_MXC_V_CRYPTO_CTRL_RST_RESET << UCL_ME13_MXC_F_CRYPTO_CTRL_RST_POS)
CTRL_RST_RESET Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_RST_RESET_DONE ((uint32_t)0x0)
CTRL_RST_RESET_DONE Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_RST_RESET_DONE (UCL_ME13_MXC_V_CRYPTO_CTRL_RST_RESET_DONE << UCL_ME13_MXC_F_CRYPTO_CTRL_RST_POS)
CTRL_RST_RESET_DONE Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_RST_BUSY ((uint32_t)0x1)
CTRL_RST_BUSY Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_RST_BUSY (UCL_ME13_MXC_V_CRYPTO_CTRL_RST_BUSY << UCL_ME13_MXC_F_CRYPTO_CTRL_RST_POS)
CTRL_RST_BUSY Setting.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_INTR_POS (1)
CTRL_INTR Position.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_INTR ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CTRL_INTR_POS))
CTRL_INTR Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_INTR_DIS ((uint32_t)0x0)
CTRL_INTR_DIS Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_INTR_DIS (UCL_ME13_MXC_V_CRYPTO_CTRL_INTR_DIS << UCL_ME13_MXC_F_CRYPTO_CTRL_INTR_POS)
CTRL_INTR_DIS Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_INTR_EN ((uint32_t)0x1)
CTRL_INTR_EN Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_INTR_EN (UCL_ME13_MXC_V_CRYPTO_CTRL_INTR_EN << UCL_ME13_MXC_F_CRYPTO_CTRL_INTR_POS)
CTRL_INTR_EN Setting.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_SRC_POS (2)
CTRL_SRC Position.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_SRC ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CTRL_SRC_POS))
CTRL_SRC Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_SRC_INPUTFIFO ((uint32_t)0x0)
CTRL_SRC_INPUTFIFO Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_SRC_INPUTFIFO (UCL_ME13_MXC_V_CRYPTO_CTRL_SRC_INPUTFIFO << UCL_ME13_MXC_F_CRYPTO_CTRL_SRC_POS)
CTRL_SRC_INPUTFIFO Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_SRC_OUTPUTFIFO ((uint32_t)0x1)
CTRL_SRC_OUTPUTFIFO Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_SRC_OUTPUTFIFO (UCL_ME13_MXC_V_CRYPTO_CTRL_SRC_OUTPUTFIFO << UCL_ME13_MXC_F_CRYPTO_CTRL_SRC_POS)
CTRL_SRC_OUTPUTFIFO Setting.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_BSO_POS (4)
CTRL_BSO Position.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_BSO ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CTRL_BSO_POS))
CTRL_BSO Mask.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_BSI_POS (5)
CTRL_BSI Position.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_BSI ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CTRL_BSI_POS))
CTRL_BSI Mask.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_WAIT_EN_POS (6)
CTRL_WAIT_EN Position.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_WAIT_EN ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CTRL_WAIT_EN_POS))
CTRL_WAIT_EN Mask.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_WAIT_POL_POS (7)
CTRL_WAIT_POL Position.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_WAIT_POL ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CTRL_WAIT_POL_POS))
CTRL_WAIT_POL Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_WAIT_POL_ACTIVELO ((uint32_t)0x0)
CTRL_WAIT_POL_ACTIVELO Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_WAIT_POL_ACTIVELO (UCL_ME13_MXC_V_CRYPTO_CTRL_WAIT_POL_ACTIVELO << UCL_ME13_MXC_F_CRYPTO_CTRL_WAIT_POL_POS)
CTRL_WAIT_POL_ACTIVELO Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_WAIT_POL_ACTIVEHI ((uint32_t)0x1)
CTRL_WAIT_POL_ACTIVEHI Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_WAIT_POL_ACTIVEHI (UCL_ME13_MXC_V_CRYPTO_CTRL_WAIT_POL_ACTIVEHI << UCL_ME13_MXC_F_CRYPTO_CTRL_WAIT_POL_POS)
CTRL_WAIT_POL_ACTIVEHI Setting.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_WRSRC_POS (8)
CTRL_WRSRC Position.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_WRSRC ((uint32_t)(0x3 << UCL_ME13_MXC_F_CRYPTO_CTRL_WRSRC_POS))
CTRL_WRSRC Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_WRSRC_NONE ((uint32_t)0x0)
CTRL_WRSRC_NONE Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_WRSRC_NONE (UCL_ME13_MXC_V_CRYPTO_CTRL_WRSRC_NONE << UCL_ME13_MXC_F_CRYPTO_CTRL_WRSRC_POS)
CTRL_WRSRC_NONE Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_WRSRC_CIPHEROUTPUT ((uint32_t)0x1)
CTRL_WRSRC_CIPHEROUTPUT Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_WRSRC_CIPHEROUTPUT (UCL_ME13_MXC_V_CRYPTO_CTRL_WRSRC_CIPHEROUTPUT << UCL_ME13_MXC_F_CRYPTO_CTRL_WRSRC_POS)
CTRL_WRSRC_CIPHEROUTPUT Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_WRSRC_READFIFO ((uint32_t)0x2)
CTRL_WRSRC_READFIFO Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_WRSRC_READFIFO (UCL_ME13_MXC_V_CRYPTO_CTRL_WRSRC_READFIFO << UCL_ME13_MXC_F_CRYPTO_CTRL_WRSRC_POS)
CTRL_WRSRC_READFIFO Setting.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_RDSRC_POS (10)
CTRL_RDSRC Position.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_RDSRC ((uint32_t)(0x3 << UCL_ME13_MXC_F_CRYPTO_CTRL_RDSRC_POS))
CTRL_RDSRC Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_RDSRC_DMADISABLED ((uint32_t)0x0)
CTRL_RDSRC_DMADISABLED Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_RDSRC_DMADISABLED (UCL_ME13_MXC_V_CRYPTO_CTRL_RDSRC_DMADISABLED << UCL_ME13_MXC_F_CRYPTO_CTRL_RDSRC_POS)
CTRL_RDSRC_DMADISABLED Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_RDSRC_DMAORAPB ((uint32_t)0x1)
CTRL_RDSRC_DMAORAPB Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_RDSRC_DMAORAPB (UCL_ME13_MXC_V_CRYPTO_CTRL_RDSRC_DMAORAPB << UCL_ME13_MXC_F_CRYPTO_CTRL_RDSRC_POS)
CTRL_RDSRC_DMAORAPB Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_RDSRC_RNG ((uint32_t)0x2)
CTRL_RDSRC_RNG Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_RDSRC_RNG (UCL_ME13_MXC_V_CRYPTO_CTRL_RDSRC_RNG << UCL_ME13_MXC_F_CRYPTO_CTRL_RDSRC_POS)
CTRL_RDSRC_RNG Setting.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_FLAG_MODE_POS (14)
CTRL_FLAG_MODE Position.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_FLAG_MODE ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CTRL_FLAG_MODE_POS))
CTRL_FLAG_MODE Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_FLAG_MODE_UNRES_WR ((uint32_t)0x0)
CTRL_FLAG_MODE_UNRES_WR Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_FLAG_MODE_UNRES_WR (UCL_ME13_MXC_V_CRYPTO_CTRL_FLAG_MODE_UNRES_WR << UCL_ME13_MXC_F_CRYPTO_CTRL_FLAG_MODE_POS)
CTRL_FLAG_MODE_UNRES_WR Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_FLAG_MODE_RES_WR ((uint32_t)0x1)
CTRL_FLAG_MODE_RES_WR Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_FLAG_MODE_RES_WR (UCL_ME13_MXC_V_CRYPTO_CTRL_FLAG_MODE_RES_WR << UCL_ME13_MXC_F_CRYPTO_CTRL_FLAG_MODE_POS)
CTRL_FLAG_MODE_RES_WR Setting.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_DMADNEMSK_POS (15)
CTRL_DMADNEMSK Position.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_DMADNEMSK ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CTRL_DMADNEMSK_POS))
CTRL_DMADNEMSK Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_DMADNEMSK_NOT_USED ((uint32_t)0x0)
CTRL_DMADNEMSK_NOT_USED Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_DMADNEMSK_NOT_USED (UCL_ME13_MXC_V_CRYPTO_CTRL_DMADNEMSK_NOT_USED << UCL_ME13_MXC_F_CRYPTO_CTRL_DMADNEMSK_POS)
CTRL_DMADNEMSK_NOT_USED Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_DMADNEMSK_USED ((uint32_t)0x1)
CTRL_DMADNEMSK_USED Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_DMADNEMSK_USED (UCL_ME13_MXC_V_CRYPTO_CTRL_DMADNEMSK_USED << UCL_ME13_MXC_F_CRYPTO_CTRL_DMADNEMSK_POS)
CTRL_DMADNEMSK_USED Setting.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_DMA_DONE_POS (24)
CTRL_DMA_DONE Position.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_DMA_DONE ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CTRL_DMA_DONE_POS))
CTRL_DMA_DONE Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_DMA_DONE_NOTDONE ((uint32_t)0x0)
CTRL_DMA_DONE_NOTDONE Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_DMA_DONE_NOTDONE (UCL_ME13_MXC_V_CRYPTO_CTRL_DMA_DONE_NOTDONE << UCL_ME13_MXC_F_CRYPTO_CTRL_DMA_DONE_POS)
CTRL_DMA_DONE_NOTDONE Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_DMA_DONE_DONE ((uint32_t)0x1)
CTRL_DMA_DONE_DONE Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_DMA_DONE_DONE (UCL_ME13_MXC_V_CRYPTO_CTRL_DMA_DONE_DONE << UCL_ME13_MXC_F_CRYPTO_CTRL_DMA_DONE_POS)
CTRL_DMA_DONE_DONE Setting.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_GLS_DONE_POS (25)
CTRL_GLS_DONE Position.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_GLS_DONE ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CTRL_GLS_DONE_POS))
CTRL_GLS_DONE Mask.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_HSH_DONE_POS (26)
CTRL_HSH_DONE Position.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_HSH_DONE ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CTRL_HSH_DONE_POS))
CTRL_HSH_DONE Mask.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_CPH_DONE_POS (27)
CTRL_CPH_DONE Position.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_CPH_DONE ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CTRL_CPH_DONE_POS))
CTRL_CPH_DONE Mask.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_ERR_POS (29)
CTRL_ERR Position.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_ERR ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CTRL_ERR_POS))
CTRL_ERR Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_ERR_NOERROR ((uint32_t)0x0)
CTRL_ERR_NOERROR Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_ERR_NOERROR (UCL_ME13_MXC_V_CRYPTO_CTRL_ERR_NOERROR << UCL_ME13_MXC_F_CRYPTO_CTRL_ERR_POS)
CTRL_ERR_NOERROR Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_ERR_ERROR ((uint32_t)0x1)
CTRL_ERR_ERROR Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_ERR_ERROR (UCL_ME13_MXC_V_CRYPTO_CTRL_ERR_ERROR << UCL_ME13_MXC_F_CRYPTO_CTRL_ERR_POS)
CTRL_ERR_ERROR Setting.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_RDY_POS (30)
CTRL_RDY Position.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_RDY ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CTRL_RDY_POS))
CTRL_RDY Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_RDY_BUSY ((uint32_t)0x0)
CTRL_RDY_BUSY Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_RDY_BUSY (UCL_ME13_MXC_V_CRYPTO_CTRL_RDY_BUSY << UCL_ME13_MXC_F_CRYPTO_CTRL_RDY_POS)
CTRL_RDY_BUSY Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CTRL_RDY_READY ((uint32_t)0x1)
CTRL_RDY_READY Value.
#define | UCL_ME13_MXC_S_CRYPTO_CTRL_RDY_READY (UCL_ME13_MXC_V_CRYPTO_CTRL_RDY_READY << UCL_ME13_MXC_F_CRYPTO_CTRL_RDY_POS)
CTRL_RDY_READY Setting.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_DONE_POS (31)
CTRL_DONE Position.
#define | UCL_ME13_MXC_F_CRYPTO_CTRL_DONE ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CTRL_DONE_POS))
CTRL_DONE Mask.

Detailed Description

Crypto Control Register.


Universal Crypto Library: CIPHER_CTRL_Register

Macros
CIPHER_CTRL_Register
Registers

Cipher Control Register. More...

+ Collaboration diagram for CIPHER_CTRL_Register:

Macros

#define | UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_ENC_POS (0)
CIPHER_CTRL_ENC Position.
#define | UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_ENC ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_ENC_POS))
CIPHER_CTRL_ENC Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_ENC_ENCRYPT ((uint32_t)0x0)
CIPHER_CTRL_ENC_ENCRYPT Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_ENC_ENCRYPT (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_ENC_ENCRYPT << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_ENC_POS)
CIPHER_CTRL_ENC_ENCRYPT Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_ENC_DECRYPT ((uint32_t)0x1)
CIPHER_CTRL_ENC_DECRYPT Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_ENC_DECRYPT (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_ENC_DECRYPT << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_ENC_POS)
CIPHER_CTRL_ENC_DECRYPT Setting.
#define | UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_KEY_POS (1)
CIPHER_CTRL_KEY Position.
#define | UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_KEY ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_KEY_POS))
CIPHER_CTRL_KEY Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_KEY_COMPLETE ((uint32_t)0x0)
CIPHER_CTRL_KEY_COMPLETE Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_KEY_COMPLETE (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_KEY_COMPLETE << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_KEY_POS)
CIPHER_CTRL_KEY_COMPLETE Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_KEY_START ((uint32_t)0x1)
CIPHER_CTRL_KEY_START Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_KEY_START (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_KEY_START << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_KEY_POS)
CIPHER_CTRL_KEY_START Setting.
#define | UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_SRC_POS (2)
CIPHER_CTRL_SRC Position.
#define | UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_SRC ((uint32_t)(0x3 << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_SRC_POS))
CIPHER_CTRL_SRC Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_SRC_CIPHERKEY ((uint32_t)0x0)
CIPHER_CTRL_SRC_CIPHERKEY Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_SRC_CIPHERKEY (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_SRC_CIPHERKEY << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_SRC_POS)
CIPHER_CTRL_SRC_CIPHERKEY Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_SRC_REGFILE ((uint32_t)0x2)
CIPHER_CTRL_SRC_REGFILE Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_SRC_REGFILE (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_SRC_REGFILE << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_SRC_POS)
CIPHER_CTRL_SRC_REGFILE Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_SRC_QSPIKEY_REGFILE ((uint32_t)0x3)
CIPHER_CTRL_SRC_QSPIKEY_REGFILE Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_SRC_QSPIKEY_REGFILE (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_SRC_QSPIKEY_REGFILE << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_SRC_POS)
CIPHER_CTRL_SRC_QSPIKEY_REGFILE Setting.
#define | UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_CIPHER_POS (4)
CIPHER_CTRL_CIPHER Position.
#define | UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_CIPHER ((uint32_t)(0x7 << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_CIPHER_POS))
CIPHER_CTRL_CIPHER Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_CIPHER_DIS ((uint32_t)0x0)
CIPHER_CTRL_CIPHER_DIS Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_CIPHER_DIS (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_CIPHER_DIS << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_CIPHER_POS)
CIPHER_CTRL_CIPHER_DIS Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_CIPHER_AES128 ((uint32_t)0x1)
CIPHER_CTRL_CIPHER_AES128 Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_CIPHER_AES128 (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_CIPHER_AES128 << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_CIPHER_POS)
CIPHER_CTRL_CIPHER_AES128 Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_CIPHER_AES192 ((uint32_t)0x2)
CIPHER_CTRL_CIPHER_AES192 Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_CIPHER_AES192 (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_CIPHER_AES192 << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_CIPHER_POS)
CIPHER_CTRL_CIPHER_AES192 Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_CIPHER_AES256 ((uint32_t)0x3)
CIPHER_CTRL_CIPHER_AES256 Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_CIPHER_AES256 (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_CIPHER_AES256 << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_CIPHER_POS)
CIPHER_CTRL_CIPHER_AES256 Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_CIPHER_DES ((uint32_t)0x4)
CIPHER_CTRL_CIPHER_DES Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_CIPHER_DES (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_CIPHER_DES << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_CIPHER_POS)
CIPHER_CTRL_CIPHER_DES Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_CIPHER_TDES ((uint32_t)0x5)
CIPHER_CTRL_CIPHER_TDES Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_CIPHER_TDES (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_CIPHER_TDES << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_CIPHER_POS)
CIPHER_CTRL_CIPHER_TDES Setting.
#define | UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_MODE_POS (8)
CIPHER_CTRL_MODE Position.
#define | UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_MODE ((uint32_t)(0x7 << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_MODE_POS))
CIPHER_CTRL_MODE Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_MODE_ECB ((uint32_t)0x0)
CIPHER_CTRL_MODE_ECB Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_MODE_ECB (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_MODE_ECB << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_MODE_POS)
CIPHER_CTRL_MODE_ECB Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_MODE_CBC ((uint32_t)0x1)
CIPHER_CTRL_MODE_CBC Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_MODE_CBC (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_MODE_CBC << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_MODE_POS)
CIPHER_CTRL_MODE_CBC Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_MODE_CFB ((uint32_t)0x2)
CIPHER_CTRL_MODE_CFB Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_MODE_CFB (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_MODE_CFB << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_MODE_POS)
CIPHER_CTRL_MODE_CFB Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_MODE_OFB ((uint32_t)0x3)
CIPHER_CTRL_MODE_OFB Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_MODE_OFB (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_MODE_OFB << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_MODE_POS)
CIPHER_CTRL_MODE_OFB Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_MODE_CTR ((uint32_t)0x4)
CIPHER_CTRL_MODE_CTR Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_MODE_CTR (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_MODE_CTR << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_MODE_POS)
CIPHER_CTRL_MODE_CTR Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_MODE_GCM ((uint32_t)0x5)
CIPHER_CTRL_MODE_GCM Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_MODE_GCM (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_MODE_GCM << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_MODE_POS)
CIPHER_CTRL_MODE_GCM Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_MODE_CCM ((uint32_t)0x6)
CIPHER_CTRL_MODE_CCM Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_MODE_CCM (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_MODE_CCM << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_MODE_POS)
CIPHER_CTRL_MODE_CCM Setting.
#define | UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_DTYPE_POS (12)
CIPHER_CTRL_DTYPE Position.
#define | UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_DTYPE ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_DTYPE_POS))
CIPHER_CTRL_DTYPE Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_DTYPE_AAD ((uint32_t)0x0)
CIPHER_CTRL_DTYPE_AAD (Additional Authenticated Data) Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_DTYPE_AAD (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_DTYPE_AAD << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_DTYPE_POS)
CIPHER_CTRL_DTYPE_AAD Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_DTYPE_PLD ((uint32_t)0x1)
CIPHER_CTRL_DTYPE_PLD (Payload) Value.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_DTYPE_PLD (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_DTYPE_PLD << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_DTYPE_POS)
CIPHER_CTRL_DTYPE_PLD Setting.
#define | UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_CCM_M_POS (13)
CIPHER_CTRL_CCM_M Position.
#define | UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_CCM_M ((uint32_t)(0x7 << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_CCM_M_POS))
CIPHER_CTRL_CCM_M Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_CCM_M_ENCODE(M) ((uint32_t)(((M)>>1)-1))
CIPHER_CTRL_CCM_M Encode.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_CCM_M(M) (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_CCM_M_ENCODE(M) << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_CCM_M_POS)
CIPHER_CTRL_CCM_M Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_CCM_M_DECODE(M_) ((uint32_t)(((M_)+1)<<1))
CIPHER_CTRL_CCM_M Decode.
#define | UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_CCM_L_POS (16)
CIPHER_CTRL_CCM_L Position.
#define | UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_CCM_L ((uint32_t)(0x7 << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_CCM_L_POS))
CIPHER_CTRL_CCM_L Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_CCM_L_ENCODE(L) ((uint32_t)((L)-1))
CIPHER_CTRL_CCM_L Encode.
#define | UCL_ME13_MXC_S_CRYPTO_CIPHER_CTRL_CCM_L(L) (UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_CCM_L_ENCODE(L) << UCL_ME13_MXC_F_CRYPTO_CIPHER_CTRL_CCM_L_POS)
CIPHER_CTRL_CCM_L Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CIPHER_CTRL_CCM_L_DECODE(L_) ((uint32_t)((L_)+1))
CIPHER_CTRL_CCM_L Decode.

Detailed Description

Cipher Control Register.


Universal Crypto Library: HASH_CTRL_Register

Macros
HASH_CTRL_Register
Registers

HASH Control Register. More...

+ Collaboration diagram for HASH_CTRL_Register:

Macros

#define | UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_INIT_POS (0)
HASH_CTRL_INIT Position.
#define | UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_INIT ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_INIT_POS))
HASH_CTRL_INIT Mask.
#define | UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_INIT_NOP ((uint32_t)0x0)
HASH_CTRL_INIT_NOP Value.
#define | UCL_ME13_MXC_S_CRYPTO_HASH_CTRL_INIT_NOP (UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_INIT_NOP << UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_INIT_POS)
HASH_CTRL_INIT_NOP Setting.
#define | UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_INIT_START ((uint32_t)0x1)
HASH_CTRL_INIT_START Value.
#define | UCL_ME13_MXC_S_CRYPTO_HASH_CTRL_INIT_START (UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_INIT_START << UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_INIT_POS)
HASH_CTRL_INIT_START Setting.
#define | UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_XOR_POS (1)
HASH_CTRL_XOR Position.
#define | UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_XOR ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_XOR_POS))
HASH_CTRL_XOR Mask.
#define | UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_XOR_DIS ((uint32_t)0x0)
HASH_CTRL_XOR_DIS Value.
#define | UCL_ME13_MXC_S_CRYPTO_HASH_CTRL_XOR_DIS (UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_XOR_DIS << UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_XOR_POS)
HASH_CTRL_XOR_DIS Setting.
#define | UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_XOR_EN ((uint32_t)0x1)
HASH_CTRL_XOR_EN Value.
#define | UCL_ME13_MXC_S_CRYPTO_HASH_CTRL_XOR_EN (UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_XOR_EN << UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_XOR_POS)
HASH_CTRL_XOR_EN Setting.
#define | UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_HASH_POS (2)
HASH_CTRL_HASH Position.
#define | UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_HASH ((uint32_t)(0x7 << UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_HASH_POS))
HASH_CTRL_HASH Mask.
#define | UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_HASH_DIS ((uint32_t)0x0)
HASH_CTRL_HASH_DIS Value.
#define | UCL_ME13_MXC_S_CRYPTO_HASH_CTRL_HASH_DIS (UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_HASH_DIS << UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_HASH_POS)
HASH_CTRL_HASH_DIS Setting.
#define | UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_HASH_SHA1 ((uint32_t)0x1)
HASH_CTRL_HASH_SHA1 Value.
#define | UCL_ME13_MXC_S_CRYPTO_HASH_CTRL_HASH_SHA1 (UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_HASH_SHA1 << UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_HASH_POS)
HASH_CTRL_HASH_SHA1 Setting.
#define | UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_HASH_SHA224 ((uint32_t)0x2)
HASH_CTRL_HASH_SHA224 Value.
#define | UCL_ME13_MXC_S_CRYPTO_HASH_CTRL_HASH_SHA224 (UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_HASH_SHA224 << UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_HASH_POS)
HASH_CTRL_HASH_SHA224 Setting.
#define | UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_HASH_SHA256 ((uint32_t)0x3)
HASH_CTRL_HASH_SHA256 Value.
#define | UCL_ME13_MXC_S_CRYPTO_HASH_CTRL_HASH_SHA256 (UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_HASH_SHA256 << UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_HASH_POS)
HASH_CTRL_HASH_SHA256 Setting.
#define | UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_HASH_SHA384 ((uint32_t)0x4)
HASH_CTRL_HASH_SHA384 Value.
#define | UCL_ME13_MXC_S_CRYPTO_HASH_CTRL_HASH_SHA384 (UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_HASH_SHA384 << UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_HASH_POS)
HASH_CTRL_HASH_SHA384 Setting.
#define | UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_HASH_SHA512 ((uint32_t)0x5)
HASH_CTRL_HASH_SHA512 Value.
#define | UCL_ME13_MXC_S_CRYPTO_HASH_CTRL_HASH_SHA512 (UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_HASH_SHA512 << UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_HASH_POS)
HASH_CTRL_HASH_SHA512 Setting.
#define | UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_LAST_POS (5)
HASH_CTRL_LAST Position.
#define | UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_LAST ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_LAST_POS))
HASH_CTRL_LAST Mask.
#define | UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_LAST_NOEFFECT ((uint32_t)0x0)
HASH_CTRL_LAST_NOEFFECT Value.
#define | UCL_ME13_MXC_S_CRYPTO_HASH_CTRL_LAST_NOEFFECT (UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_LAST_NOEFFECT << UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_LAST_POS)
HASH_CTRL_LAST_NOEFFECT Setting.
#define | UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_LAST_LASTMSGDATA ((uint32_t)0x1)
HASH_CTRL_LAST_LASTMSGDATA Value.
#define | UCL_ME13_MXC_S_CRYPTO_HASH_CTRL_LAST_LASTMSGDATA (UCL_ME13_MXC_V_CRYPTO_HASH_CTRL_LAST_LASTMSGDATA << UCL_ME13_MXC_F_CRYPTO_HASH_CTRL_LAST_POS)
HASH_CTRL_LAST_LASTMSGDATA Setting.

Detailed Description

HASH Control Register.


Universal Crypto Library: CRC_CTRL_Register

Macros
CRC_CTRL_Register
Registers

CRC Control Register. More...

+ Collaboration diagram for CRC_CTRL_Register:

Macros

#define | UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_CRC_POS (0)
CRC_CTRL_CRC Position.
#define | UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_CRC ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_CRC_POS))
CRC_CTRL_CRC Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CRC_CTRL_CRC_DIS ((uint32_t)0x0)
CRC_CTRL_CRC_DIS Value.
#define | UCL_ME13_MXC_S_CRYPTO_CRC_CTRL_CRC_DIS (UCL_ME13_MXC_V_CRYPTO_CRC_CTRL_CRC_DIS << UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_CRC_POS)
CRC_CTRL_CRC_DIS Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CRC_CTRL_CRC_EN ((uint32_t)0x1)
CRC_CTRL_CRC_EN Value.
#define | UCL_ME13_MXC_S_CRYPTO_CRC_CTRL_CRC_EN (UCL_ME13_MXC_V_CRYPTO_CRC_CTRL_CRC_EN << UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_CRC_POS)
CRC_CTRL_CRC_EN Setting.
#define | UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_MSB_POS (1)
CRC_CTRL_MSB Position.
#define | UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_MSB ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_MSB_POS))
CRC_CTRL_MSB Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CRC_CTRL_MSB_LSBFIRST ((uint32_t)0x0)
CRC_CTRL_MSB_LSBFIRST Value.
#define | UCL_ME13_MXC_S_CRYPTO_CRC_CTRL_MSB_LSBFIRST (UCL_ME13_MXC_V_CRYPTO_CRC_CTRL_MSB_LSBFIRST << UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_MSB_POS)
CRC_CTRL_MSB_LSBFIRST Setting.
#define | UCL_ME13_MXC_V_CRYPTO_CRC_CTRL_MSB_MSBFIRST ((uint32_t)0x1)
CRC_CTRL_MSB_MSBFIRST Value.
#define | UCL_ME13_MXC_S_CRYPTO_CRC_CTRL_MSB_MSBFIRST (UCL_ME13_MXC_V_CRYPTO_CRC_CTRL_MSB_MSBFIRST << UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_MSB_POS)
CRC_CTRL_MSB_MSBFIRST Setting.
#define | UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_PRNG_POS (2)
CRC_CTRL_PRNG Position.
#define | UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_PRNG ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_PRNG_POS))
CRC_CTRL_PRNG Mask.
#define | UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_ENT_POS (3)
CRC_CTRL_ENT Position.
#define | UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_ENT ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_ENT_POS))
CRC_CTRL_ENT Mask.
#define | UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_HAM_POS (4)
CRC_CTRL_HAM Position.
#define | UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_HAM ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_HAM_POS))
CRC_CTRL_HAM Mask.
#define | UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_HRST_POS (5)
CRC_CTRL_HRST Position.
#define | UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_HRST ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_HRST_POS))
CRC_CTRL_HRST Mask.
#define | UCL_ME13_MXC_V_CRYPTO_CRC_CTRL_HRST_RESET ((uint32_t)0x1)
CRC_CTRL_HRST_RESET Value.
#define | UCL_ME13_MXC_S_CRYPTO_CRC_CTRL_HRST_RESET (UCL_ME13_MXC_V_CRYPTO_CRC_CTRL_HRST_RESET << UCL_ME13_MXC_F_CRYPTO_CRC_CTRL_HRST_POS)
CRC_CTRL_HRST_RESET Setting.

Detailed Description

CRC Control Register.


Universal Crypto Library: DMA_SRC_Register

Macros
DMA_SRC_Register
Registers

Crypto DMA Source Address. More...

+ Collaboration diagram for DMA_SRC_Register:

Macros

#define | UCL_ME13_MXC_F_CRYPTO_DMA_SRC_ADDR_POS (0)
DMA_SRC_ADDR Position.
#define | UCL_ME13_MXC_F_CRYPTO_DMA_SRC_ADDR ((uint32_t)(0xFFFFFFFF << UCL_ME13_MXC_F_CRYPTO_DMA_SRC_ADDR_POS))
DMA_SRC_ADDR Mask.

Detailed Description

Crypto DMA Source Address.


Universal Crypto Library: DMA_DEST_Register

Macros
DMA_DEST_Register
Registers

Crypto DMA Destination Address. More...

+ Collaboration diagram for DMA_DEST_Register:

Macros

#define | UCL_ME13_MXC_F_CRYPTO_DMA_DEST_ADDR_POS (0)
DMA_DEST_ADDR Position.
#define | UCL_ME13_MXC_F_CRYPTO_DMA_DEST_ADDR ((uint32_t)(0xFFFFFFFF << UCL_ME13_MXC_F_CRYPTO_DMA_DEST_ADDR_POS))
DMA_DEST_ADDR Mask.

Detailed Description

Crypto DMA Destination Address.


Universal Crypto Library: DMA_CNT_Register

Macros
DMA_CNT_Register
Registers

Crypto DMA Byte Count. More...

+ Collaboration diagram for DMA_CNT_Register:

Macros

#define | UCL_ME13_MXC_F_CRYPTO_DMA_CNT_ADDR_POS (0)
DMA_CNT_ADDR Position.
#define | UCL_ME13_MXC_F_CRYPTO_DMA_CNT_ADDR ((uint32_t)(0xFFFFFFFF << UCL_ME13_MXC_F_CRYPTO_DMA_CNT_ADDR_POS))
DMA_CNT_ADDR Mask.

Detailed Description

Crypto DMA Byte Count.


Universal Crypto Library: DIN_Register

Macros
DIN_Register
Registers

Crypto Data Input. More...

+ Collaboration diagram for DIN_Register:

Macros

#define | UCL_ME13_MXC_F_CRYPTO_DIN_DATA_POS (0)
DIN_DATA Position.
#define | UCL_ME13_MXC_F_CRYPTO_DIN_DATA ((uint32_t)(0xFFFFFFFF << UCL_ME13_MXC_F_CRYPTO_DIN_DATA_POS))
DIN_DATA Mask.

Detailed Description

Crypto Data Input.

Data input can be written to this register instead of using the DMA. This register writes to the FIFO. This register occupies four successive words to allow the use of multi-store instructions. Words can be written to any location, they will be placed in the FIFO in the order they are written. The endian swap input control bit affects this register.


Universal Crypto Library: DOUT_Register

Macros
DOUT_Register
Registers

Crypto Data Output. More...

+ Collaboration diagram for DOUT_Register:

Macros

#define | UCL_ME13_MXC_F_CRYPTO_DOUT_DATA_POS (0)
DOUT_DATA Position.
#define | UCL_ME13_MXC_F_CRYPTO_DOUT_DATA ((uint32_t)(0xFFFFFFFF << UCL_ME13_MXC_F_CRYPTO_DOUT_DATA_POS))
DOUT_DATA Mask.

Detailed Description

Crypto Data Output.

Resulting data from cipher calculation. Data is placed in the lower words of these four registers depending on the algorithm. For block cipher modes, this register holds the result of most recent encryption or decryption operation. These registers are affected by the endian swap bits.


Universal Crypto Library: CRC_POLY_Register

Macros
CRC_POLY_Register
Registers

CRC Polynomial. More...

+ Collaboration diagram for CRC_POLY_Register:

Macros

#define | UCL_ME13_MXC_F_CRYPTO_CRC_POLY_POLY_POS (0)
CRC_POLY_POLY Position.
#define | UCL_ME13_MXC_F_CRYPTO_CRC_POLY_POLY ((uint32_t)(0xFFFFFFFF << UCL_ME13_MXC_F_CRYPTO_CRC_POLY_POLY_POS))
CRC_POLY_POLY Mask.

Detailed Description

CRC Polynomial.

The polynomial to be used for Galois Field calculations (CRC or LFSR) should be written to this register. This register is affected by the MSB control bit.


Universal Crypto Library: CRC_VAL_Register

Macros
CRC_VAL_Register
Registers

CRC Value. More...

+ Collaboration diagram for CRC_VAL_Register:

Macros

#define | UCL_ME13_MXC_F_CRYPTO_CRC_VAL_VAL_POS (0)
CRC_VAL_VAL Position.
#define | UCL_ME13_MXC_F_CRYPTO_CRC_VAL_VAL ((uint32_t)(0xFFFFFFFF << UCL_ME13_MXC_F_CRYPTO_CRC_VAL_VAL_POS))
CRC_VAL_VAL Mask.

Detailed Description

CRC Value.

This is the state for the Galois Field. This register holds the result of a CRC calculation or the current state of the LFSR. This register is affected by the MSB control bit.


Universal Crypto Library: CRC_PRNG_Register

Macros
CRC_PRNG_Register
Registers

Pseudo Random Value. More...

+ Collaboration diagram for CRC_PRNG_Register:

Macros

#define | UCL_ME13_MXC_F_CRYPTO_CRC_PRNG_PRNG_POS (0)
CRC_PRNG_PRNG Position.
#define | UCL_ME13_MXC_F_CRYPTO_CRC_PRNG_PRNG ((uint32_t)(0xFFFFFFFF << UCL_ME13_MXC_F_CRYPTO_CRC_PRNG_PRNG_POS))
CRC_PRNG_PRNG Mask.

Detailed Description

Pseudo Random Value.

Output of the Galois Field shift register. This holds the resulting pseudo-random number if entropy is disabled or true random number if entropy is enabled.


Universal Crypto Library: HAM_ECC_Register

Macros
HAM_ECC_Register
Registers

Hamming ECC Register. More...

+ Collaboration diagram for HAM_ECC_Register:

Macros

#define | UCL_ME13_MXC_F_CRYPTO_HAM_ECC_ECC_POS (0)
HAM_ECC_ECC Position.
#define | UCL_ME13_MXC_F_CRYPTO_HAM_ECC_ECC ((uint32_t)(0xFFFF << UCL_ME13_MXC_F_CRYPTO_HAM_ECC_ECC_POS))
HAM_ECC_ECC Mask.
#define | UCL_ME13_MXC_F_CRYPTO_HAM_ECC_PAR_POS (16)
HAM_ECC_PAR Position.
#define | UCL_ME13_MXC_F_CRYPTO_HAM_ECC_PAR ((uint32_t)(0x1 << UCL_ME13_MXC_F_CRYPTO_HAM_ECC_PAR_POS))
HAM_ECC_PAR Mask.
#define | UCL_ME13_MXC_V_CRYPTO_HAM_ECC_PAR_EVEN ((uint32_t)0x0)
HAM_ECC_PAR_EVEN Value.
#define | UCL_ME13_MXC_S_CRYPTO_HAM_ECC_PAR_EVEN (UCL_ME13_MXC_V_CRYPTO_HAM_ECC_PAR_EVEN << UCL_ME13_MXC_F_CRYPTO_HAM_ECC_PAR_POS)
HAM_ECC_PAR_EVEN Setting.
#define | UCL_ME13_MXC_V_CRYPTO_HAM_ECC_PAR_ODD ((uint32_t)0x1)
HAM_ECC_PAR_ODD Value.
#define | UCL_ME13_MXC_S_CRYPTO_HAM_ECC_PAR_ODD (UCL_ME13_MXC_V_CRYPTO_HAM_ECC_PAR_ODD << UCL_ME13_MXC_F_CRYPTO_HAM_ECC_PAR_POS)
HAM_ECC_PAR_ODD Setting.

Detailed Description

Hamming ECC Register.


Universal Crypto Library: CIPHER_INIT_Register

Macros
CIPHER_INIT_Register
Registers

Initial Vector. More...

+ Collaboration diagram for CIPHER_INIT_Register:

Macros

#define | UCL_ME13_MXC_F_CRYPTO_CIPHER_INIT_IVEC_POS (0)
CIPHER_INIT_IVEC Position.
#define | UCL_ME13_MXC_F_CRYPTO_CIPHER_INIT_IVEC ((uint32_t)(0xFFFFFFFF << UCL_ME13_MXC_F_CRYPTO_CIPHER_INIT_IVEC_POS))
CIPHER_INIT_IVEC Mask.

Detailed Description

Initial Vector.

For block cipher operations that use CBC, CFB, OFB, or CNTR modes, this register holds the initial value. This register is updated with each encryption or decryption operation. This register is affected by the endian swap bits.


Universal Crypto Library: CIPHER_KEY_Register

Macros
CIPHER_KEY_Register
Registers

Cipher Key. More...

+ Collaboration diagram for CIPHER_KEY_Register:

Macros

#define | UCL_ME13_MXC_F_CRYPTO_CIPHER_KEY_KEY_POS (0)
CIPHER_KEY_KEY Position.
#define | UCL_ME13_MXC_F_CRYPTO_CIPHER_KEY_KEY ((uint32_t)(0xFFFFFFFF << UCL_ME13_MXC_F_CRYPTO_CIPHER_KEY_KEY_POS))
CIPHER_KEY_KEY Mask.

Detailed Description

Cipher Key.

This register holds the key used for block cipher operations. The lower words are used for block ciphers that use shorter key lengths. This register is affected by the endian swap input control bits.


Universal Crypto Library: HASH_DIGEST_Register

Macros
HASH_DIGEST_Register
Registers

This register holds the calculated hash value. More...

+ Collaboration diagram for HASH_DIGEST_Register:

Macros

#define | UCL_ME13_MXC_F_CRYPTO_HASH_DIGEST_HASH_POS (0)
HASH_DIGEST_HASH Position.
#define | UCL_ME13_MXC_F_CRYPTO_HASH_DIGEST_HASH ((uint32_t)(0xFFFFFFFF << UCL_ME13_MXC_F_CRYPTO_HASH_DIGEST_HASH_POS))
HASH_DIGEST_HASH Mask.

Detailed Description

This register holds the calculated hash value.

This register is affected by the endian swap bits.


Universal Crypto Library: HASH_MSG_SZ_Register

Macros
HASH_MSG_SZ_Register
Registers

Message Size. More...

+ Collaboration diagram for HASH_MSG_SZ_Register:

Macros

#define | UCL_ME13_MXC_F_CRYPTO_HASH_MSG_SZ_MSGSZ_POS (0)
HASH_MSG_SZ_MSGSZ Position.
#define | UCL_ME13_MXC_F_CRYPTO_HASH_MSG_SZ_MSGSZ ((uint32_t)(0xFFFFFFFF << UCL_ME13_MXC_F_CRYPTO_HASH_MSG_SZ_MSGSZ_POS))
HASH_MSG_SZ_MSGSZ Mask.

Detailed Description

Message Size.

This register holds the lowest 32-bit of message size in bytes.


Universal Crypto Library: me13_mxc_crypto_regs_t Struct Reference

Data Fields
me13_mxc_crypto_regs_t Struct Reference
Registers

Structure type to access the CRYPTO Registers. More...

Data Fields

__IO uint32_t | ctrl
0x00:<> CRYPTO CTRL Register
__IO uint32_t | cipher_ctrl
0x04:<> CRYPTO CIPHER_CTRL Register
__IO uint32_t | hash_ctrl
0x08:<> CRYPTO HASH_CTRL Register
__IO uint32_t | crc_ctrl
0x0C:<> CRYPTO CRC_CTRL Register
__IO uint32_t | dma_src
0x10:<> CRYPTO DMA_SRC Register
__IO uint32_t | dma_dest
0x14:<> CRYPTO DMA_DEST Register
__IO uint32_t | dma_cnt
0x18:<> CRYPTO DMA_CNT Register
__O uint32_t | din [4]
0x20:<> CRYPTO DIN Register
__I uint32_t | dout [4]
0x30:<> CRYPTO DOUT Register
__IO uint32_t | crc_poly
0x40:<> CRYPTO CRC_POLY Register
__IO uint32_t | crc_val
0x44:<> CRYPTO CRC_VAL Register
__I uint32_t | crc_prng
0x48:<> CRYPTO CRC_PRNG Register
__IO uint32_t | ham_ecc
0x4C:<> CRYPTO HAM_ECC Register
__IO uint32_t | cipher_init [4]
0x50:<> CRYPTO CIPHER_INIT Register
__O uint32_t | cipher_key [8]
0x60:<> CRYPTO CIPHER_KEY Register
__IO uint32_t | hash_digest [16]
0x80:<> CRYPTO HASH_DIGEST Register
__IO uint32_t | hash_msg_sz [4]
0xC0:<> CRYPTO HASH_MSG_SZ Register

Detailed Description

Structure type to access the CRYPTO Registers.


Universal Crypto Library: 3DES CMAC

Functions
3DES CMAC

process CMAC authentication with 3DES More...

Functions

int | ucl_3des_subkey_generation (u8 *k1, u8 *k2, u8 *key, u32 keylen)
3DES-CMAC. More...
int | ucl_3des_cmac_compute (u8 *t, int tlen, u8 *src, u32 len, u8 *key, u32 keylen)
3DES-CMAC. More...
int | ucl_3des_cmac_verify (u8 *t, int tlen, u8 *src, u32 len, u8 *key, u32 keylen)
3DES-CMAC. More...

Detailed Description

process CMAC authentication with 3DES

Header:
ucl_3des_cmac.h

Function Documentation

◆ ucl_3des_cmac_compute()

int ucl_3des_cmac_compute | ( | u8 * | t,
 |  | int | tlen,
 |  | u8 * | src,
 |  | u32 | len,
 |  | u8 * | key,
 |  | u32 | keylen
 | ) |  |

3DES-CMAC.

3DES CMAC tag computation

Parameters
[out] | t | Pointer to the computed CMAC
[in] | tlen | computed CMAC byte length (caution: in the SP800-38D, this is expressed in bit)
[in] | src | Pointer to the message data
[in] | len | message byte length
[in] | key | Pointer to the 3DES Key
[in] keylen Key byte length:
  • #UCL_3DES_KEYSIZE
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | One of the output is the pointer NULL
UCL_ERROR | an error has occured in subkeys generation

restrictions tlen is expressed in number of bytes len is expressed in number of bytes

◆ ucl_3des_cmac_verify()

int ucl_3des_cmac_verify | ( | u8 * | t,
 |  | int | tlen,
 |  | u8 * | src,
 |  | u32 | len,
 |  | u8 * | key,
 |  | u32 | keylen
 | ) |  |

3DES-CMAC.

3DES CMAC tag verification

Parameters
[in] | t | Pointer to the proposed CMAC tag
[in] | tlen | CMAC byte length (caution: in the SP800-38D, this is expressed in bit)
[in] | src | Pointer to the message data
[in] | len | message byte length
[in] | key | Pointer to the 3DES Key
[in] keylen Key byte length:
  • #UCL_3DES_KEYSIZE
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | One of the output is the pointer NULL
UCL_ERROR | the tag is not verified or an error occured in tag recomputation restrictions tlen is expressed in number of bytes len is expressed in number of bytes

◆ ucl_3des_subkey_generation()

int ucl_3des_subkey_generation | ( | u8 * | k1,
 |  | u8 * | k2,
 |  | u8 * | key,
 |  | u32 | keylen
 | ) |  |

3DES-CMAC.

3DES CMAC sub keys generation K1 and K2 are the 64-bit sub-keys generated from the initial key using algorithm defined in NIST SP800-38D, section 6.1

Parameters
[out] | k1 | Pointer to the subkey k1
[in] | k2 | Pointer to the subkey k2
[in] | key | Pointer to the initial 3DES Key
[in] keylen Key byte length:
  • #UCL_3DES_KEYSIZE
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | One of the output is the pointer NULL


Universal Crypto Library: AES CMAC

Functions
AES CMAC

process CMAC authentication with AES More...

Functions

int | ucl_aes_subkey_generation (u8 *k1, u8 *k2, u8 *key, u32 keylen)
AES-CMAC. More...
int | ucl_aes_cmac_compute (u8 *t, int tlen, u8 *src, u32 len, u8 *key, u32 keylen)
AES-CMAC. More...
int | ucl_aes_cmac_verify (u8 *t, int tlen, u8 *src, u32 len, u8 *key, u32 keylen)
AES-CMAC. More...
int | ucl_aes_cmac_verify_init_rw20 (ucl_aes_ctx_t *ctx, int key_id)
RW20 AES-CMAC verifiy Init. More...
int | ucl_aes_cmac_verify_core_rw20 (u8 *t, int tlen, ucl_aes_ctx_t *ctx, u8 *src, u32 len)
RW20 AES-CMAC verify Core. More...
int | ucl_aes_cmac_verify_finish_rw20 (ucl_aes_ctx_t *ctx)
RW20 AES-CMAC verify Finish. More...

Detailed Description

process CMAC authentication with AES

Header:
ucl_aes_cmac.h

Function Documentation

◆ ucl_aes_cmac_compute()

int ucl_aes_cmac_compute | ( | u8 * | t,
 |  | int | tlen,
 |  | u8 * | src,
 |  | u32 | len,
 |  | u8 * | key,
 |  | u32 | keylen
 | ) |  |

AES-CMAC.

AES CMAC tag computation

Parameters
[out] | t | Pointer to the computed CMAC
[in] | tlen | computed CMAC byte length (caution: in the SP800-38D, this is expressed in bit)
[in] | src | Pointer to the message data
[in] | len | message byte length
[in] | key | Pointer to the AES Key
[in] keylen Key byte length:
  • UCL_AES_KEYLEN_128
  • UCL_AES_KEYLEN_192
  • UCL_AES_KEYLEN_256
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | One of the output is the pointer NULL
UCL_ERROR | an error has occured in subkeys generation

restrictions tlen is expressed in number of bytes len is expressed in number of bytes

◆ ucl_aes_cmac_verify()

int ucl_aes_cmac_verify | ( | u8 * | t,
 |  | int | tlen,
 |  | u8 * | src,
 |  | u32 | len,
 |  | u8 * | key,
 |  | u32 | keylen
 | ) |  |

AES-CMAC.

AES CMAC tag verification

Parameters

◆ ucl_aes_cmac_verify_core_rw20()

int ucl_aes_cmac_verify_core_rw20 | ( | u8 * | t,
 |  | int | tlen,
 |  | ucl_aes_ctx_t * | ctx,
 |  | u8 * | src,
 |  | u32 | len
 | ) |  |

RW20 AES-CMAC verify Core.

Process the Data verification.

Parameters
[out] | t | Pointer to the CMAC data
[in] | tlen | CMAC byte length
[in,out] | ctx | Pointer to the context
[in] | src | Pointer to the data
[in] | len | Data byte length
Precondition
The byte length must be a multiple of UCL_AES_BLOCKSIZE.
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | The output is the pointer NULL
UCL_INVALID_ARG | The data byte length is not a multiple of UCL_AES_BLOCKSIZE

◆ ucl_aes_cmac_verify_finish_rw20()

int ucl_aes_cmac_verify_finish_rw20 ( ucl_aes_ctx_t * ctx )

RW20 AES-CMAC verify Finish.

Finalize the verification and Zeroize the context.

Parameters
[in,out] ctx Pointer to the context
Returns
Error code
Return values
UCL_OK | No error occurred: CMAC verification is successful
UCL_INVALID_OUTPUT | The output is the pointer NULL

◆ ucl_aes_cmac_verify_init_rw20()

int ucl_aes_cmac_verify_init_rw20 | ( | ucl_aes_ctx_t * | ctx,
 |  | int | key_id
 | ) |  |

RW20 AES-CMAC verifiy Init.

Initialise AES CMAC Context.

Parameters
[out] | ctx | Pointer to the context
[in] | key_id | AES Key index: MK_KEY for MK, K_KEY for K
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | The input is the pointer NULL
UCL_INVALID_OUTPUT | The output is the pointer NULL

◆ ucl_aes_subkey_generation()

int ucl_aes_subkey_generation | ( | u8 * | k1,
 |  | u8 * | k2,
 |  | u8 * | key,
 |  | u32 | keylen
 | ) |  |

AES-CMAC.

AES CMAC sub keys generation K1 and K2 are the 128-bit sub-keys generated from the initial key using algorithm defined in NIST SP800-38D, section 6.1

Parameters
[out] | k1 | Pointer to the subkey k1
[in] | k2 | Pointer to the subkey k2
[in] | key | Pointer to the initial AES Key
[in] keylen Key byte length:
  • UCL_AES_KEYLEN_128
  • UCL_AES_KEYLEN_192
  • UCL_AES_KEYLEN_256
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | One of the output is the pointer NULL


Universal Crypto Library: AES CTR

Functions
AES CTR

Encrypt / Decrypt with AES in CTR (Electronic Codebook) mode. More...

Functions

int | ucl_aes_ctr (u8 *dst, u8 *src, u32 len, u8 *counter, u8 *key, u32 keylen, int mode)
AES-CTR. More...
int | ucl_aes_ctr_init (ucl_aes_ctx_t *ctx, u8 *key, u32 keylen, int mode)
AES-CTR Init. More...
int | ucl_aes_ctr_core (u8 *dst, ucl_aes_ctx_t *ctx, u8 *src, u32 len, u8 *counter)
AES-CTR Core. More...
int | ucl_aes_ctr_finish (ucl_aes_ctx_t *ctx)
AES-CTR Finish. More...
int | ucl_aes_ctr_core_context (u8 *dst, ucl_aes_ctx_t *ctx, u8 *src, u32 len, u8 *counter)
AES-CTR Core. More...

Detailed Description

Encrypt / Decrypt with AES in CTR (Electronic Codebook) mode.

Header:
ucl_aes_ctr.h

Function Documentation

◆ ucl_aes_ctr()

int ucl_aes_ctr | ( | u8 * | dst,
 |  | u8 * | src,
 |  | u32 | len,
 |  | u8 * | counter,
 |  | u8 * | key,
 |  | u32 | keylen,
 |  | int | mode
 | ) |  |

AES-CTR.

Complete process.

Parameters
[out] | dst | Pointer to the output data
[in] | src | Pointer to the input data
[in] | len | Data byte length

◆ ucl_aes_ctr_core()

int ucl_aes_ctr_core | ( | u8 * | dst,
 |  | ucl_aes_ctx_t * | ctx,
 |  | u8 * | src,
 |  | u32 | len,
 |  | u8 * | counter
 | ) |  |

AES-CTR Core.

Process the Data.

Parameters
[out] | dst | Pointer to the output data
[in,out] | ctx | AES context
[in,out] | counter | CTR mode counter
[in] | src | Pointer to the input data
[in] | len | Data byte length
Precondition
The byte length must be a multiple of UCL_AES_BLOCKSIZE.
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | The output is the pointer NULL
UCL_INVALID_ARG | The byte length is not a multiple of UCL_AES_BLOCKSIZE

◆ ucl_aes_ctr_core_context()

int ucl_aes_ctr_core_context | ( | u8 * | dst,
 |  | ucl_aes_ctx_t * | ctx,
 |  | u8 * | src,
 |  | u32 | len,
 |  | u8 * | counter
 | ) |  |

AES-CTR Core.

Process the Data.

Parameters
[out] | dst | Pointer to the output data
[in,out] | ctx | AES context
[in] | src | Pointer to the input data
[in] | len | Data byte length
Precondition
The byte length must be a multiple of UCL_AES_BLOCKSIZE.
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | The output is the pointer NULL
UCL_INVALID_ARG | The byte length is not a multiple of UCL_AES_BLOCKSIZE

◆ ucl_aes_ctr_finish()

int ucl_aes_ctr_finish ( ucl_aes_ctx_t * ctx )

AES-CTR Finish.

Zeroize the context.

Parameters
[in,out] ctx Pointer to the context
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_OUTPUT | The output is the pointer NULL

◆ ucl_aes_ctr_init()

int ucl_aes_ctr_init | ( | ucl_aes_ctx_t * | ctx,
 |  | u8 * | key,
 |  | u32 | keylen,
 |  | int | mode
 | ) |  |

AES-CTR Init.

Initialise AES CTR Context.

Warning
on platforms using a AES hardware block, this function is required to change the key the use of another context in the ucl_aes_core function will not mean using the other context key
Parameters
[out] | ctx | Pointer to the context
[in] | key | Pointer to the AES Key
[in] keylen Key byte length:
  • UCL_AES_KEYLEN_128
  • UCL_AES_KEYLEN_192
  • UCL_AES_KEYLEN_256
[in] mode The mode (Encryption/Decryption):
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | The input is the pointer NULL
UCL_INVALID_OUTPUT | The output is the pointer NULL
UCL_INVALID_ARG | keylen is invalid
UCL_INVALID_MODE | The mode is not one of those uaescribed


Universal Crypto Library: AES GCM

Functions
AES GCM

Encrypt / Decrypt with AES in GCM (Galois Counter Mode) provide authentication with GMAC (Galois MAC). More...

Functions

void | ucl_gcm_init_r (void)
AES-GCM. More...
int | ucl_aes_gcm_auth (u8 *auth_tag, int auth_tag_bit_len, u8 *c, u8 *p, int input_bit_len_high, int input_bit_len_low, u8 *aad, int aad_bit_len_high, int aad_bit_len_low, u8 *key, u8 *iv, int iv_bit_len_high, int iv_bit_len_low, int mode)
AES-GCM. More...
int | ucl_aes_gmac_auth (u8 *auth_tag, int auth_tag_bit_len, u8 *aad, int aad_bit_len_high, int aad_bit_len_low, u8 *key, u8 *iv, int iv_bit_len_high, int iv_bit_len_low)
AES-GMAC. More...
int | ucl_aes_gcm (u8 *auth_tag, int auth_tag_bit_len, u8 *c, u8 *p, int input_bit_len_high, int input_bit_len_low, u8 *aad, int aad_bit_len_high, int aad_bit_len_low, u8 *key, u32 keylen, u8 *iv, int iv_bit_len_high, int iv_bit_len_low, int mode)
AES-GCM. More...
int | ucl_aes_gmac (u8 *auth_tag, int auth_tag_bit_len, u8 *aad, int aad_bit_len_high, int aad_bit_len_low, u8 *key, u32 keylen, u8 *iv, int iv_bit_len_high, int iv_bit_len_low)
AES-GMAC. More...
int | ucl_aes_gcm_init (u8 *res, u8 *h, u8 *eky0, u8 *y, u8 *aad, int aad_bit_len_high, int aad_bit_len_low, u8 *key, u32 keylen, u8 *iv, int iv_bit_len_high, int iv_bit_len_low, int mode)
AES-GCM multi-block initialization. More...
int | ucl_aes_gcm_core (u8 *res, int auth_tag_bit_len, u8 *c, u8 *p, int input_bit_len_high, int input_bit_len_low, int aad_bit_len_high, int aad_bit_len_low, u8 *h, u8 *y, u8 *key, u32 keylen, int mode)
AES-GCM multi-block core processing. More...
int | ucl_aes_gcm_finish (u8 *auth_tag, int auth_tag_bit_len, u8 *res, u8 *c, u8 *p, int input_bit_len_high, int input_bit_len_low, int inputtot_bit_len_high, int inputtot_bit_len_low, int aad_bit_len_high, int aad_bit_len_low, u8 *h, u8 *eky0, u8 *y, u8 *key, u32 keylen, int mode)
AES-GCM multi-block final processing. More...
int | ucl_aes_gcm_h_init (u8 *key, int keylen)
AES-GCM. More...
int | ucl_aes_gcm_ghash_init_aad (u8 *x)
AES-GCM. More...
int | ucl_aes_gcm_ghash_load_aad (u8 *x, u8 *a, int aad_bit_len_high, int aad_bit_len_low)
AES-GCM. More...
int | ucl_aes_gcm_ghash_end_aad (u8 *x)
AES-GCM. More...
int | ucl_aes_gcm_init_iv_feed (u8 *h, u8 *eky0, u8 *y, u8 *key, u32 keylen, u8 *iv, int iv_bit_len_high, int iv_bit_len_low, int mode)
AES-GCM. More...
int | ucl_aes_gcm_core_init (u8 *y, u8 *key, u32 keylen)
AES-GCM. More...
int | ucl_aes_gcm_core_load_bytes (u8 *res, int auth_tag_bit_len, u8 *c, int *c_bytes_len, u8 *p, int input_bit_len_high, int input_bit_len_low, u8 *y, u8 *key, u32 keylen, int mode)
AES-GCM. More...
int | ucl_aes_gcm_finish_bytes (u8 *auth_tag, int auth_tag_bit_len, u8 *res, u8 *c, u8 *p, int input_bit_len_high, int input_bit_len_low, int inputtot_bit_len_high, int inputtot_bit_len_low, int aad_bit_len_high, int aad_bit_len_low, u8 *eky0, u8 *y, u8 *key, u32 keylen, int mode)
AES-GCM. More...

Detailed Description

Encrypt / Decrypt with AES in GCM (Galois Counter Mode) provide authentication with GMAC (Galois MAC).

Header:
ucl_aes_gcm.h

Function Documentation

◆ ucl_aes_gcm()

int ucl_aes_gcm | ( | u8 * | auth_tag,
 |  | int | auth_tag_bit_len,
 |  | u8 * | c,
 |  | u8 * | p,
 |  | int | input_bit_len_high,
 |  | int | input_bit_len_low,
 |  | u8 * | aad,
 |  | int | aad_bit_len_high,
 |  | int | aad_bit_len_low,
 |  | u8 * | key,
 |  | u32 | keylen,
 |  | u8 * | iv,
 |  | int | iv_bit_len_high,
 |  | int | iv_bit_len_low,
 |  | int | mode
 | ) |  |

AES-GCM.

computes the GCM data (crypto+tag) from plaintext and authenticated add. data

Parameters
[out] | auth_tag | result, u8 array representing the tag
[in] | auth_tag_bit_len | number of bits of the result tag; values between 64 and 128
[out] | c | the result u8 array representing the output (crypto in encryption, plain in decryption); its size is the same than the plaintext one
[in] | p | the input u8 array representing the input (plain in encryption, crypto in decryption);
[in] | input_bit_length_high,input_bit_len_low | two words representing the bit size of the input;the maximum value is 2^39-256
[in] | aad | the input u8 array representing the add.authenticated data
[in] | aad_bit_length_high,aad_bit_len_low | two words representing the bit size of the AAD; the maximum value is 2^64
[in] | key | the u8 array representing the AES key
[in] | keylen | a u32 value representing the AES key len in bytes
[in] | iv | the input u8 array representing the IV
[in] | iv_bit_length_high,iv_bit_len_low | two words representing the bit size of the IV; the maximum value is 2^64
[in] | mode | UCL_CIPHER_ENCRYPT or UCL_CIPHER_DECRYPT; determines if p is encrypted or decrypted
Returns
Error code
Return values
UCL_OK | no error occurred
UCL_INVALID_INPUT | one of the input is the pointer NULL
UCL_INVALID_OUTPUT | one of the output is the pointer NULL

◆ ucl_aes_gcm_auth()

int ucl_aes_gcm_auth | ( | u8 * | auth_tag,
 |  | int | auth_tag_bit_len,
 |  | u8 * | c,
 |  | u8 * | p,
 |  | int | input_bit_len_high,
 |  | int | input_bit_len_low,
 |  | u8 * | aad,
 |  | int | aad_bit_len_high,
 |  | int | aad_bit_len_low,
 |  | u8 * | key,
 |  | u8 * | iv,
 |  | int | iv_bit_len_high,
 |  | int | iv_bit_len_low,
 |  | int | mode
 | ) |  |

AES-GCM.

computes the GCM data (crypto+tag) from plaintext and authenticated add. data

Parameters
[out] | auth_tag | result, u8 array representing the tag
[in] | auth_tag_bit_len | number of bits of the result tag; values between 64 and 128
[out] | c | the result u8 array representing the output (crypto in encryption, plain in decryption); its size is the same than the plaintext one
[in] | p | the input u8 array representing the input (plain in encryption, crypto in decryption);
[in] | input_bit_length_high,input_bit_len_low | two words representing the bit size of the input;the maximum value is 2^39-256
[in] | aad | the input u8 array representing the add.authenticated data
[in] | aad_bit_length_high,aad_bit_len_low | two words representing the bit size of the AAD; the maximum value is 2^64
[in] | key | the u8 array representing the AES key
[in] | iv | the input u8 array representing the IV
[in] | iv_bit_length_high,iv_bit_len_low | two words representing the bit size of the IV; the maximum value is 2^64
[in] | mode | UCL_CIPHER_ENCRYPT or UCL_CIPHER_DECRYPT; determines if p is encrypted or decrypted
Returns
Error code
Return values
UCL_OK | no error occurred
UCL_INVALID_INPUT | one of the input is the pointer NULL
UCL_INVALID_OUTPUT | one of the output is the pointer NULL

◆ ucl_aes_gcm_core()

int ucl_aes_gcm_core | ( | u8 * | res,
 |  | int | auth_tag_bit_len,
 |  | u8 * | c,
 |  | u8 * | p,
 |  | int | input_bit_len_high,
 |  | int | input_bit_len_low,
 |  | int | aad_bit_len_high,
 |  | int | aad_bit_len_low,
 |  | u8 * | h,
 |  | u8 * | y,
 |  | u8 * | key,
 |  | u32 | keylen,
 |  | int | mode
 | ) |  |

AES-GCM multi-block core processing.

the AES-GCM multi-block processing defines three steps: initialization, blocks core processing, final processing this function is the blocks core processing this function handles only full AES blocks, i.e. a multiple of 128 bits if the input length is a multiple of 128 bits, the last block shall not be processed in this core processing but in the final processing

Parameters
[out] | res | ghash intermediate value
[in] | auth_tag_bit_len | the length of the tag, in bits (usually 128 bits)
[out] | c | output of the AES processing (either encryption or decryption, determined by mode)
[in] | p | input of the AES processing
[in] | input_bit_length_high,input_bit_len_low | two words representing the bit size of the input (p); the maximum value is 2^64; it has to correspond to a multiple of 128 bits (i.e. full AES blocks)
[in] | aad_bit_length_high,aad_bit_len_low | two words representing the bit size of the AAD; the maximum value is 2^64
[in] | h | encryption of the null vector
[out] | y | the Y value (incremented for each new block)
[in] | key | the u8 array representing the AES key
[in] | keylen | a u32 value representing the AES key len in bytes
[in] | mode | UCL_CIPHER_ENCRYPT or UCL_CIPHER_DECRYPT; determines if p is encrypted or decrypted
Returns
Error code
Return values
UCL_OK | no error occurred
UCL_INVALID_INPUT | one of the input is the pointer NULL
UCL_INVALID_OUTPUT | one of the output is the pointer NULL

◆ ucl_aes_gcm_core_init()

int ucl_aes_gcm_core_init | ( | u8 * | y,
 |  | u8 * | key,
 |  | u32 | keylen
 | ) |  |

AES-GCM.

GCM payload loading When the payload (ciphertext or plaintext) is not available at once, a specific sequence of operations shall be performed: 1-payload loading initialization 2-payload loading, chunk by chunk 3-payload loading completion

this routine performs the payload loading initialization (step 1) Depending on the payload availability, successive calls of the function can be performed. There is no constraint on the payload size except it shall be a round number of bytes.

Parameters

◆ ucl_aes_gcm_core_load_bytes()

int ucl_aes_gcm_core_load_bytes | ( | u8 * | res,
 |  | int | auth_tag_bit_len,
 |  | u8 * | c,
 |  | int * | c_bytes_len,
 |  | u8 * | p,
 |  | int | input_bit_len_high,
 |  | int | input_bit_len_low,
 |  | u8 * | y,
 |  | u8 * | key,
 |  | u32 | keylen,
 |  | int | mode
 | ) |  |

AES-GCM.

GCM payload loading When the payload (ciphertext or plaintext) is not available at once, a specific sequence of operations shall be performed: 1-payload loading initialization 2-payload loading, chunk by chunk 3-payload loading completion

this routine performs the payload loading operation (step 2) Depending on the payload availability, successive calls of the function can be performed. There is no constraint on the payload size except it shall be a round number of bytes.

Parameters
[out] | res | a pointer to a 16-byte u8 array, used for transient results
[in] | auth_tag_bit_length | a int parameter representing the bit size of the authentication tag; usual values are about hundred bits
[out] | c | a pointer to a u8 array, being the result of the cipher process, either the ciphertext (for encryption) or the plaintext (for decryption)
[out] | c_bytes_len | a pointer to a int value, being a transient value
[in] | p | a pointer to a u8 array, being the input of the cipher process, either the plaintext (for encryption) or the ciphertext (for the decryption)
[in] | input_bit_length_high,input_bit_len_low | two words representing the bit size of the effectively provided input data

◆ ucl_aes_gcm_finish()

int ucl_aes_gcm_finish | ( | u8 * | auth_tag,
 |  | int | auth_tag_bit_len,
 |  | u8 * | res,
 |  | u8 * | c,
 |  | u8 * | p,
 |  | int | input_bit_len_high,
 |  | int | input_bit_len_low,
 |  | int | inputtot_bit_len_high,
 |  | int | inputtot_bit_len_low,
 |  | int | aad_bit_len_high,
 |  | int | aad_bit_len_low,
 |  | u8 * | h,
 |  | u8 * | eky0,
 |  | u8 * | y,
 |  | u8 * | key,
 |  | u32 | keylen,
 |  | int | mode
 | ) |  |

AES-GCM multi-block final processing.

the AES-GCM multi-block processing defines three steps: initialization, blocks processing, final processing this function is the final processing

Parameters
[out] | auth_tag | the final tag value
[in] | auth_tag_bit_len | the length of the tag, in bits (usually 128 bits)

◆ ucl_aes_gcm_finish_bytes()

int ucl_aes_gcm_finish_bytes | ( | u8 * | auth_tag,
 |  | int | auth_tag_bit_len,
 |  | u8 * | res,
 |  | u8 * | c,
 |  | u8 * | p,
 |  | int | input_bit_len_high,
 |  | int | input_bit_len_low,
 |  | int | inputtot_bit_len_high,
 |  | int | inputtot_bit_len_low,
 |  | int | aad_bit_len_high,
 |  | int | aad_bit_len_low,
 |  | u8 * | eky0,
 |  | u8 * | y,
 |  | u8 * | key,
 |  | u32 | keylen,
 |  | int | mode
 | ) |  |

AES-GCM.

GCM payload loading When the payload (ciphertext or plaintext) is not available at once, a specific sequence of operations shall be performed: 1-payload loading initialization 2-payload loading, chunk by chunk 3-payload loading completion

this routine performs the payload loading operation completion (step 3) it is not possible to load any payload data at this stage. They shall have been all loaded at step 2.

Parameters
[out] | auth_tag | a pointer to a 16-byte u8 array, representing the authentication tag
[in] | auth_tag_bit_length | a int variable representing the bit size of the authentication tag; usual values are about hundred bits
[in] | res | a pointer to a 16-byte u8 array, used for transient results
[out] | c | a pointer to a u8 array, being the result of the cipher process, either the ciphertext (for encryption) or the plaintext (for decryption)
[in] | p | a pointer to a u8 array, being the input of the cipher process, either the plaintext (for encryption) or the ciphertext (for the decryption)
[in] | input_bit_length_high,input_bit_len_low | two words representing the bit size of the effectively provided input data
[in] | inputtot_bit_length_high,inputtot_bit_len_low | two words representing the bit size of the wholly provided input data
[in] | aad_bit_length_high,aad_bit_len_low | two words representing the bit size of the AAD data; the maximum value is 2^64 and the minimum size is 1

◆ ucl_aes_gcm_ghash_end_aad()

int ucl_aes_gcm_ghash_end_aad ( u8 * x )

AES-GCM.

GCM AAD loading initialization When the AAD data are not available at once, a specific sequence of operations shall be performed: 1-AAD loading initialization 2-AAD loading, chunk by chunk 3-AAD loading completion 4-IV loading

this routine performs the AAD loading completion (step 3) it is not possible to load any AAD data at this stage. They shall have been all loaded at step 2.

Parameters

◆ ucl_aes_gcm_ghash_init_aad()

int ucl_aes_gcm_ghash_init_aad ( u8 * x )

AES-GCM.

GCM AAD loading initialization When the AAD data are not available at once, a specific sequence of operations shall be performed: 1-AAD loading initialization 2-AAD loading, chunk by chunk 3-AAD loading completion

this routine prepares the AAD (Additional Authentication Data) loading (step 1)

Parameters

◆ ucl_aes_gcm_ghash_load_aad()

int ucl_aes_gcm_ghash_load_aad | ( | u8 * | x,
 |  | u8 * | a,
 |  | int | aad_bit_len_high,
 |  | int | aad_bit_len_low
 | ) |  |

AES-GCM.

GCM AAD loading initialization When the AAD data are not available at once, a specific sequence of operations shall be performed: 1-AAD loading initialization 2-AAD loading, chunk by chunk 3-AAD loading completion 4-IV loading

this routine performs the AAD loading, chunk by chunk (step 2) all AAD data shall be loaded at this stage. Depending on their availability, successive calls of the function can be performed. There is no constraint on the AAD chunk size except it shall be a round number of bytes.

Parameters

◆ ucl_aes_gcm_h_init()

int ucl_aes_gcm_h_init | ( | u8 * | key,
 |  | int | keylen
 | ) |  |

AES-GCM.

GCM and GMAC internal table precomputation this precomputation depends on the key each time the key changes, this routine shall be executed.

Parameters
[in] | a | pointer to key: the u8 array representing the AES key
[in] | keylen | a u32 value representing the AES key len in bytes
Returns
Error code
Return values
UCL_OK no error occurred

◆ ucl_aes_gcm_init()

int ucl_aes_gcm_init | ( | u8 * | res,
 |  | u8 * | h,
 |  | u8 * | eky0,
 |  | u8 * | y,
 |  | u8 * | aad,
 |  | int | aad_bit_len_high,
 |  | int | aad_bit_len_low,
 |  | u8 * | key,
 |  | u32 | keylen,
 |  | u8 * | iv,
 |  | int | iv_bit_len_high,
 |  | int | iv_bit_len_low,
 |  | int | mode
 | ) |  |

AES-GCM multi-block initialization.

the AES-GCM multi-block processing defines three steps: initialization, blocks processing, final processing this function is the initialization step the initialization step performs the H, Y_0 and the ghash initialization it then requires the additional authenticated data, the IV and the key

Parameters
[out] | res | ghash starting value
[out] | h | encryption of the null vector
[out] | eky0 | the encryption of the Y_0 value
[out] | y | the Y_0 value (usually the IV)
[in] | aad | the input u8 array representing the add.authenticated data
[in] | aad_bit_length_high,aad_bit_len_low | two words representing the bit size of the AAD; the maximum value is 2^64
[in] | key | the u8 array representing the AES key
[in] | keylen | a u32 value representing the AES key len in bytes
[in] | iv | the input u8 array representing the IV
[in] | iv_bit_length_high,iv_bit_len_low | two words representing the bit size of the IV; the maximum value is 2^64
[in] | mode | UCL_CIPHER_ENCRYPT or UCL_CIPHER_DECRYPT; determines if p is encrypted or decrypted
Returns
Error code
Return values
UCL_OK | no error occurred
UCL_INVALID_INPUT | one of the input is the pointer NULL
UCL_INVALID_OUTPUT | one of the output is the pointer NULL

◆ ucl_aes_gcm_init_iv_feed()

int ucl_aes_gcm_init_iv_feed | ( | u8 * | h,
 |  | u8 * | eky0,
 |  | u8 * | y,
 |  | u8 * | key,
 |  | u32 | keylen,
 |  | u8 * | iv,
 |  | int | iv_bit_len_high,
 |  | int | iv_bit_len_low,
 |  | int | mode
 | ) |  |

AES-GCM.

GCM IV loading When the AAD data are not available at once, a specific sequence of operations shall be performed: 1-AAD loading initialization 2-AAD loading, chunk by chunk 3-AAD loading completion 4-IV loading

this routine performs the IV loading operation (step 4)

Parameters
[out] | h | a pointer to a 16-byte u8 array
[out] | eky0 | a pointer to a 16-byte u8 array, being the encryption of Y0
[out] | y | a pointer to a 16-byte u8 array, being Y0, computed from the IV
[in] | key | a pointer to a 16-byte u8 array, being the secret AES key
[in] | keylen | a int value representing the secret AES key length in bytes
[in] | iv | a pointer to a u8 array, being the IV, Initialization Vector
[in] | iv_bit_length_high,iv_bit_len_low | two words representing the bit size of the IV; the maximum value is 2^64 and the minimum size is 1
[in] | mode,either | UCL_CIPHER_ENCRYPT or UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | no error occurred
UCL_ERROR | if the encryption mode is not valid, or the encryption failed
UCL_INVALID_INPUT | one of the provided pointers is the NULL pointer

◆ ucl_aes_gmac()

int ucl_aes_gmac | ( | u8 * | auth_tag,
 |  | int | auth_tag_bit_len,
 |  | u8 * | aad,
 |  | int | aad_bit_len_high,
 |  | int | aad_bit_len_low,
 |  | u8 * | key,
 |  | u32 | keylen,
 |  | u8 * | iv,
 |  | int | iv_bit_len_high,
 |  | int | iv_bit_len_low
 | ) |  |

AES-GMAC.

computes the GMAC data (tag) from authenticated add. data

Parameters
[out] | auth_tag | result, u8 array representing the tag
[in] | auth_tag_bit_len | number of bits of the result tag; values between 64 and 128
[in] | aad | the input u8 array representing the add.authenticated data
[in] | aad_bit_length_high,aad_bit_len_low | two words representing the bit size of the AAD; the maximum value is 2^64
[in] | key | the u8 array representing the AES key
[in] | keylen | a u32 value representing the AES key len in bytes
[in] | iv | the input u8 array representing the IV
[in] | iv_bit_length_high,iv_bit_len_low | two words representing the bit size of the IV; the maximum value is 2^64
[in] | mode | UCL_CIPHER_ENCRYPT or UCL_CIPHER_DECRYPT; determines if p is encrypted or decrypted
Returns
Error code
Return values
UCL_OK | no error occurred
UCL_INVALID_INPUT | one of the input is the pointer NULL
UCL_INVALID_OUTPUT | one of the output is the pointer NULL

◆ ucl_aes_gmac_auth()

int ucl_aes_gmac_auth | ( | u8 * | auth_tag,
 |  | int | auth_tag_bit_len,
 |  | u8 * | aad,
 |  | int | aad_bit_len_high,
 |  | int | aad_bit_len_low,
 |  | u8 * | key,
 |  | u8 * | iv,
 |  | int | iv_bit_len_high,
 |  | int | iv_bit_len_low
 | ) |  |

AES-GMAC.

computes the GMAC data (tag) from authenticated add. data

Parameters
[out] | auth_tag | result, u8 array representing the tag
[in] | auth_tag_bit_len | number of bits of the result tag; values between 64 and 128
[in] | aad | the input u8 array representing the add.authenticated data
[in] | aad_bit_length_high,aad_bit_len_low | two words representing the bit size of the AAD; the maximum value is 2^64
[in] | key | the u8 array representing the AES key
[in] | iv | the input u8 array representing the IV
[in] | iv_bit_length_high,iv_bit_len_low | two words representing the bit size of the IV; the maximum value is 2^64
[in] | mode | UCL_CIPHER_ENCRYPT or UCL_CIPHER_DECRYPT; determines if p is encrypted or decrypted
Returns
Error code
Return values
UCL_OK | no error occurred
UCL_INVALID_INPUT | one of the input is the pointer NULL
UCL_INVALID_OUTPUT | one of the output is the pointer NULL

◆ ucl_gcm_init_r()

void ucl_gcm_init_r ( void )

AES-GCM.

GCM and GMAC internal table initialization. from 2.5.4, this function call is useless as the table is now hardcoded


Universal Crypto Library: AES Key Wrap

Functions
AES Key Wrap

AES keys wrap compliant with RFC 3394. More...

Functions

int | ucl_aes_RFC3394_wrap (u8 *c, u8 *p, int byte_p_size, u8 *key)
AES Key wrap. More...
int | ucl_aes_RFC3394_unwrap (u8 *p, u8 *c, int byte_c_size, u8 *key)
AES Key unwrap. More...

Detailed Description

AES keys wrap compliant with RFC 3394.

it uses the Advanced Encryption Standard (AES) as a primitive to securely encrypt plaintext key(s) with any associated integrity information and data, such that the combination could be longer than the width of the AES block size (128-bits).

Function Documentation

◆ ucl_aes_RFC3394_unwrap()

int ucl_aes_RFC3394_unwrap | ( | u8 * | p,
 |  | u8 * | c,
 |  | int | byte_c_size,
 |  | u8 * | key
 | ) |  |

AES Key unwrap.

this function unwraps an encrypted key with AES

Parameters
[out] | p | output, the pointer to the key unwrapped with the AES
[in] | c | input, the pointer to the wrapped key, to be unwrapped with the AES
[in] | c_size | input, the size in bytes of the plain key to be wrapped
[in] | key | input, the pointer to the AES key used for wrapping
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_aes_RFC3394_wrap()

int ucl_aes_RFC3394_wrap | ( | u8 * | c,
 |  | u8 * | p,
 |  | int | byte_p_size,
 |  | u8 * | key
 | ) |  |

AES Key wrap.

this function wraps a plain key with AES

Parameters
[out] | c | output, the pointer to the key wrapped with the AES
[in] | p | input, the pointer to the plain key, to be wrapped with the AES
[in] | p_size | input, the size in bytes of the plain key to be wrapped
[in] | key | input, the pointer to the AES key used for wrapping
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL


Universal Crypto Library: Definitions

Modules
Definitions
+ Collaboration diagram for Definitions:

Modules

Defines
Definitions of returns
User Defines
Defines and typedef which must be set by user.

Detailed Description

Maxim Integrated 2.5.18


Universal Crypto Library: Defines

Defines
Definitions
+ Collaboration diagram for Defines:


Universal Crypto Library: Definitions of returns

Macros
Definitions of returns
Definitions
+ Collaboration diagram for Definitions of returns:

Macros

#define | UCL_CARRY 1
Carry.
#define | UCL_TRUE 1
True.
#define | UCL_FALSE 0
False.
#define | UCL_OK 0
No error occured.
#define | UCL_ERROR -1
Generic Error.
#define | UCL_NOP -2
Not a failure but no operation was performed.
#define | UCL_INVALID_CIPHER -3
Invalid cipher specified.
#define | UCL_INVALID_HASH -4
Invalid hash specified.
#define | UCL_INVALID_ARG -5
Generic invalid argument.
#define | UCL_INVALID_INPUT -6
Invalid argument input.
#define | UCL_INVALID_OUTPUT -7
Invalid argument output.
#define | UCL_INVALID_PRECISION -8
Invalid precision for Fixed-Precision Aritmetic.
#define | UCL_INVALID_RSAPUBKEY -9
Invalid RSA public key.
#define | UCL_INVALID_RSAPRIVKEY -10
Invalid RSA private key.
#define | UCL_INVALID_RSACRTKEY -11
Invalid RSA CRT key.
#define | UCL_INVALID_RSACRTALTKEY -12
Invalid RSA CRT alternative key.
#define | UCL_RSACRT_ERROR -13
Error during CRT recomposition.
#define | UCL_DIVISION_BY_ZERO -14
Error, division by zero.
#define | UCL_INVALID_MODE -15
Invalid chosen mode.
#define | UCL_INVALID_SIGN -16
Large number with invalid sign.
#define | UCL_RSA_INVALID_INPUT -17
Invalid input for RSA.
#define | UCL_RNGTIMEOUT -18
TRNG timeout.
#define | UCL_RSAPKCS1_DECRYPTERR -19
RSA PKCS1-v1.5 decryption error.
#define | UCL_OVERFLOW -20
Overflow.
#define | UCL_FUNCTION_DISABLED -21
Error in the case of the function is disabled.
#define | UCL_INTEGER_NOT_ODD -22
(Big) Integer not odd.
#define | UCL_RSA_INVALID_EXPONENT -23
Invalid exponant of RSA key.
#define | UCL_STACK_OVERFLOW -24
UCL Stack overflow. More...
#define | UCL_STACK_NOT_INIT -25
UCL Stack not init. More...
#define | UCL_STACK_INVALID_FREE -26
Invalid UCL Stack free.
#define | UCL_STACK_DEFAULT -27
The UCL Stack is disabled.
#define | UCL_STACK_ERROR -28
Use default UCL stack.
#define | UCL_WARNING -29
General Warning.
#define | UCL_PKCS1_INVALID_SIGNATURE -30
PKCS1V25 Error - Invalid Signature .
#define | UCL_NO_UAES_INTERFACE -31
No Interface for USIP® AES.
#define | UCL_UAES_CORRUPTED -32
USIP® AES Corrupted.
#define | UCL_UAES_ERROR -33
USIP® AES Error.
#define | UCL_TRNG_ERROR -34
USIP® TRNG Error.
#define | UCL_NO_TRNG_INTERFACE -35
No Interface for USIP® TRNG.
#define | UCL_TRNG_CORRUPTED -36
No Interface for USIP® TRNG.
#define | UCL_NOT_INIT -37
USIP® UCL Not Init.
#define | UCL_ECC_INVALID_KEY -38
ECC key is invalid.
#define | UCL_RNG_ERROR -39
RNG Interface Error.
#define | UCL_INVALID_LENGTH -41
Functionality not implemented.
#define | UCL_NOT_IMPLEMENTED -99
the provided length does not match the computed length.

Detailed Description

Header:
ucl_retdefs.h

Macro Definition Documentation

◆ UCL_STACK_NOT_INIT

#define UCL_STACK_NOT_INIT -25

UCL Stack not init.

See also
ucl_stack_init

◆ UCL_STACK_OVERFLOW

#define UCL_STACK_OVERFLOW -24

UCL Stack overflow.

Not enough memory.


Universal Crypto Library: User Defines

Macros | Typedefs
User Defines
Definitions

Defines and typedef which must be set by user. More...

+ Collaboration diagram for User Defines:

Macros

#define NULL 0x0
The NULL pointer.

Typedefs

typedef unsigned int | u32
Unsigned 32-bits word.
typedef unsigned short | u16
Unsigned 16-bits word.
typedef unsigned char | u8
Unsigned 8-bits word.

Detailed Description

Defines and typedef which must be set by user.


Universal Crypto Library: Information

Functions
Information

General Library Information. More...

Functions

const char *__API__ | ucl_get_version (void)
Get Version. More...
const char *__API__ | ucl_get_copyright (void)
Get Copyright. More...
const char *__API__ | ucl_get_build_date (void)
Get Build Date. More...
const char *__API__ | ucl_get_options (void)
Get Options. More...

Detailed Description

General Library Information.

Header:
ucl_info.h

Function Documentation

◆ ucl_get_build_date()

const char* __API__ ucl_get_build_date ( void )

Get Build Date.

Get the library build date.

Returns
string

◆ ucl_get_copyright()

const char* __API__ ucl_get_copyright ( void )

Get Copyright.

Get the library copyright.

Returns
string

◆ ucl_get_options()

const char* __API__ ucl_get_options ( void )

Get Options.

Get the library options.

Returns
string

◆ ucl_get_version()

const char* __API__ ucl_get_version ( void )

Get Version.

Get the library version number.

Returns
string


Universal Crypto Library: UCL Linux Configuration

Macros
UCL Linux Configuration

List of configuration parameters. More...

Macros

#define UCL_UTRNG_DEV "/dev/urandom"
Dev to access USIP TRNG. More...

Detailed Description

List of configuration parameters.

Macro Definition Documentation

◆ UCL_UTRNG_DEV

#define UCL_UTRNG_DEV "/dev/urandom"

Dev to access USIP TRNG.

'/dev/hwrandom'.

Note
To create the device: mknode /dev/hwrandom c 10 183


Universal Crypto Library: UCL System

Functions
UCL System

UCL System Functions. More...

Functions

int | ucl_perror (char *message, int error_code)
UCL Errors information. More...
int | ucl_init (u32 *buffer, u32 size)
UCL Init. More...
int | ucl_get_chip_version (void)
Chip identification. More...
void | ucl_crypto_block_reset (void)
Crypto Controller reset. More...

Detailed Description

UCL System Functions.

Header:
ucl_sys.h

Function Documentation

◆ ucl_crypto_block_reset()

void ucl_crypto_block_reset ( void )

Crypto Controller reset.

crypto controller FSM and registers clearing no returned value

◆ ucl_get_chip_version()

int ucl_get_chip_version ( void )

Chip identification.

chip and chip version identification

Returns
error code
Return values
MAX32550_A1_CHIP
MAX32550_A2_CHIP
MAX32550_A3_CHIP
MAX32550_B1_CHIP
UNDEFINED_CHIP

◆ ucl_init()

int ucl_init | ( | u32 * | buffer,
 |  | u32 | size
 | ) |  |

UCL Init.

Cryptographic Library Initialisation. Initialisation of stack and hardware interfaces (if available).

Parameters
[in] | buffer | Work buffer for pkc
[in] | size | Size of the buffer (number of unsigned ints)
Precondition
size must greater than or equal to 1024.
Note
The UCL Stack error does not matter if you don't use #UCL_PKC functions.
The error "USIP(R) TRNG not available" occurs for USIP Linux platform if the file '/dev/hwrandom' does not exist.
Returns
UCL_OK or Error vector
Return values
The error vector is a combination of:
  • 0x001: UCL Stack error (Buffer NULL or invalid size)
  • 0x010: USIP AES not available
  • 0x020: USIP AES Corrrupted
  • 0x100: USIP TRNG not available
  • 0x200: USIP TRNG Corrupted
Warning
After the version 2.1.0 the buffer is mandatory

◆ ucl_perror()

int ucl_perror | ( | char * | message,
 |  | int | error_code
 | ) |  |

UCL Errors information.

Cryptographic Library Error information. Getting detailed information message from an error code

Parameters
[out] | message | a string containing the error message
[in] | error_code | a integer value representing the error code
Returns
UCL_OK if everything is ok
UCL_INVALID_INPUT if the provided error code is not known


Universal Crypto Library: Big Number Library

Big Number Library

Big Number Library. More...

Big Number Library.

The efficiency of a particular cryptographic scheme based on any one of algebraic structures will depend on a number of factors, such as parameter size, time-memory tradeoffs, processing power available, software and/or hardware optimization, and mathematical algorithms. This part of the UCL provide mathematical algorithms for efficiently carrying out computations with large numbers.

Warning
The API documentation is not currently available.
Note
Module Version 1.0


Universal Crypto Library: Block Cipher

Modules | Macros
Block Cipher

Symmetric-key block ciphers of the cryptolib. More...

+ Collaboration diagram for Block Cipher:

Modules

SM4
the SM4, see http://www1.cnnic.cn/ScientificResearch/LeadingEdge/soea/sm4/201312/t20131204_43351.htm
3DES
The Triple DES, see FIPS 46-3 and NIST SP 800-67.
AES
The AES, see FIPS-197.
DES
The Data Encryption Standard (DES), see FIPS PUB 46.3 NIST.
USIP AES Interface
Interface for Hardware AES.

Macros

#define | UCL_CIPHER_ENCRYPT 0x0
Encryption Mode. More...
#define | UCL_CIPHER_DECRYPT 0x1
Decryption Mode. More...
#define | UCL_CIPHER_ENCRYPT_EEE 0x2
EEE Encryption Mode. More...
#define | UCL_CIPHER_DECRYPT_EEE 0x3
DDD Decryption Mode. More...

Detailed Description

Symmetric-key block ciphers of the cryptolib.

In main use, they provide confidentiality. As a fundamental building block, their versatility allows construction of pseudorandom number generators, stream ciphers, MACs, and hash functions. They may furthermore serve as a central component in message authentication techniques, data integrity mechanisms, entity authentication protocols, and (symmetric-key)digital signature schemes.
The most know algorithm is the DES, but it has been replaced by AES since 2002.

Note
Module Version 1.0

Macro Definition Documentation

◆ UCL_CIPHER_DECRYPT

#define UCL_CIPHER_DECRYPT 0x1

Decryption Mode.

Cipher in Decryption Mode.

◆ UCL_CIPHER_DECRYPT_EEE

#define UCL_CIPHER_DECRYPT_EEE 0x3

DDD Decryption Mode.

Cipher in Decryption Mode for EEE mode

◆ UCL_CIPHER_ENCRYPT

#define UCL_CIPHER_ENCRYPT 0x0

Encryption Mode.

Cipher in Encryption Mode.

◆ UCL_CIPHER_ENCRYPT_EEE

#define UCL_CIPHER_ENCRYPT_EEE 0x2

EEE Encryption Mode.

Cipher in Encryption Mode for EEE mode.


Universal Crypto Library: SM4

Data Structures | Functions
SM4
Block Cipher

the SM4, see http://www1.cnnic.cn/ScientificResearch/LeadingEdge/soea/sm4/201312/t20131204_43351.htm More...

+ Collaboration diagram for SM4:

Data Structures

struct sm4_context
SM4 Key. More...

Functions

int | sm4_setkey_enc (sm4_context *ctx, unsigned char key[16])
SM4 key schedule (128-bit, encryption) More...
int | sm4_setkey_dec (sm4_context *ctx, unsigned char key[16])
SM4 key schedule (128-bit, decryption) More...
int | sm4_crypt_ecb (sm4_context *ctx, int mode, int length, unsigned char *input, unsigned char *output)
SM4 for ECB blocks processing . More...
int | sm4_crypt_cbc (sm4_context *ctx, int mode, int length, unsigned char iv[16], unsigned char *input, unsigned char *output)
SM4 for CBC blocks processing . More...

Detailed Description

the SM4, see http://www1.cnnic.cn/ScientificResearch/LeadingEdge/soea/sm4/201312/t20131204_43351.htm

Header:
sm4.h

SM4 Descriptor:

  • Length of Input/Output Block: 128 bits
  • Length of Key: 128 bits

For messages longer than 128 bits, use an Operation mode.

See also
Operation Modes

Function Documentation

◆ sm4_crypt_cbc()

int sm4_crypt_cbc | ( | sm4_context * | ctx,
 |  | int | mode,
 |  | int | length,
 |  | unsigned char | iv[16],
 |  | unsigned char * | input,
 |  | unsigned char * | output
 | ) |  |

SM4 for CBC blocks processing .

The complete SM4 for several blocks.

Parameters
[out] | output | Output data (encrypted/decrypted)
[in] | input | Input data to encrypt/decrypt
[in] | length | the Input data length in bytes
[in] | iv | the 128-bit initial value, IV
[in] | ctx | a SM4 key structure
[in] | mode | The SM4 mode (SM4_ENCRYPT/SM4_DECRYPT)
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | One of the output is the pointer NULL
UCL_INVALID_MODE | The mode is not one of those described

◆ sm4_crypt_ecb()

int sm4_crypt_ecb | ( | sm4_context * | ctx,
 |  | int | mode,
 |  | int | length,
 |  | unsigned char * | input,
 |  | unsigned char * | output
 | ) |  |

SM4 for ECB blocks processing .

The complete SM4 for several blocks.

Parameters
[out] | output | Output data (encrypted/decrypted)
[in] | input | Input data to encrypt/decrypt
[in] | length | the Input data length in bytes
[in] | ctx | a SM4 key structure
[in] | mode | The SM4 mode (SM4_ENCRYPT/SM4_DECRYPT)
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | One of the output is the pointer NULL
UCL_INVALID_MODE | The mode is not one of those described

◆ sm4_setkey_dec()

int sm4_setkey_dec | ( | sm4_context * | ctx,
 |  | unsigned char | key[16]
 | ) |  |

SM4 key schedule (128-bit, decryption)

Parameters
ctx | SM4 context to be initialized
key | 16-byte secret key SM4 key context setup for encryption . The complete SM4 setup for encryption key
[out] | ctx | SM4 key context structure
[in] | key | 128-bit SM4 key
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_OUTPUT | One of the output is the pointer NULL

◆ sm4_setkey_enc()

int sm4_setkey_enc | ( | sm4_context * | ctx,
 |  | unsigned char | key[16]
 | ) |  |

SM4 key schedule (128-bit, encryption)

Parameters
ctx | SM4 context to be initialized
key | 16-byte secret key SM4 key context setup for encryption . The complete SM4 setup for encryption key
[out] | ctx | SM4 key context structure
[in] | key | 128-bit SM4 key
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_OUTPUT | One of the output is the pointer NULL


Universal Crypto Library: sm4_context Struct Reference

sm4_context Struct Reference
Block Cipher » SM4

SM4 Key. More...

Detailed Description

SM4 Key.


Universal Crypto Library: 3DES

Data Structures | Macros | Functions
3DES
Block Cipher

The Triple DES, see FIPS 46-3 and NIST SP 800-67. More...

+ Collaboration diagram for 3DES:

Data Structures

struct ucl_3des_ctx_t
3DES Context. More...

Macros

#define | UCL_3DES_KEYNUMBER 3
3DES Key size. More...
#define | ucl_3des_ctx_t ucl_3des_ctx_t
3DES Context.

Functions

int ucl_3des (u8 *dst, u8 *src, u8 *key, int mode)
3DES for Single Block. More...

Detailed Description

The Triple DES, see FIPS 46-3 and NIST SP 800-67.

Header:
ucl_3des.h

3DES Descriptor:

  • Length of Input/Output Block: 64 bits
  • Length of Key: 192 (24 parity bits) (see note).
Note
A Triple des key K is the concatenation of three DES key: K0, K1 and K2. K is a 128-bit Triple des key if K0 = K2.

For messages longer than 64 bits use an Operation mode.

See also
Operation Modes

Macro Definition Documentation

◆ UCL_3DES_KEYNUMBER

#define UCL_3DES_KEYNUMBER 3

3DES Key size.

Number of DES key for a 3DES.

Function Documentation

◆ ucl_3des()

int ucl_3des | ( | u8 * | dst,
 |  | u8 * | src,
 |  | u8 * | key,
 |  | int | mode
 | ) |  |

3DES for Single Block.

The complete 3DES for only one block.

Parameters
[out] | dst | Output Block (encrypted/decrypted).
[in] | src | Input Block to encrypt/decrypt.
[in] | key | A 3DES key.
[in] | mode | The 3DES mode (Encryption/Decryption).
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if one of the input is the pointer NULL
UCL_INVALID_OUTPUT | if one of the output is the pointer NULL
UCL_INVALID_MODE | if the mode is not one of those described
Note
For more than one block use an Operation Modes .


Universal Crypto Library: ucl_3des_ctx_t Struct Reference

Data Fields
ucl_3des_ctx_t Struct Reference
Block Cipher » 3DES

3DES Context. More...

Data Fields

int | mode
Ciphering Mode. More...
u8 | memory [8]
Intermediate state. More...
u32 index
index. More...
u32 | subKeys [UCL_3DES_KEYNUMBER *UCL_DES_NB_SUBKEYS *2]
3DES Sub-keys. More...

Detailed Description

3DES Context.

This structure is involved in the operation modes.

See also
Operation Modes

Field Documentation

◆ index

u32 ucl_3des_ctx_t::index

index.

◆ memory

u8 ucl_3des_ctx_t::memory[8]

Intermediate state.

◆ mode

int ucl_3des_ctx_t::mode

Ciphering Mode.

◆ subKeys

u32 ucl_3des_ctx_t::subKeys[UCL_3DES_KEYNUMBER *UCL_DES_NB_SUBKEYS *2]

3DES Sub-keys.

See also
UCL_3DES_KEYNUMBER
UCL_DES_NB_SUBKEYS


Universal Crypto Library: AES

Data Structures | Macros | Functions
AES
Block Cipher

The AES, see FIPS-197. More...

+ Collaboration diagram for AES:

Data Structures

struct | ucl_aes_key_t
AES Key. More...
struct | ucl_aes_ctx_t
AES Context. More...

Macros

#define | UCL_AES_BLOCKSIZE 16
AES Block Size. More...
#define | UCL_AES_KEYLEN_128 16
128-bits AES Key byte length.
#define | UCL_AES_KEYLEN_192 24
192-bits AES Key byte length.
#define | UCL_AES_KEYLEN_256 32
256-bits AES Key byte length.
#define | UCL_AES_MAXNR 14
AES maximum round number.

Functions

int ucl_aes (u8 *dst, u8 *src, u8 *key, u32 keylen, int mode)
AES for Single Block. More...

Detailed Description

The AES, see FIPS-197.

Header:
ucl_aes.h

AES Descriptor:

  • Length of Input/Output Block: 128 bits
  • Length of Key: 128, 192 or 256 bits

For messages longer than 128 bits use an Operation mode.

See also
Operation Modes

Macro Definition Documentation

◆ UCL_AES_BLOCKSIZE

#define UCL_AES_BLOCKSIZE 16

AES Block Size.

The byte length of the DES core data block.

Function Documentation

◆ ucl_aes()

int ucl_aes | ( | u8 * | dst,
 |  | u8 * | src,
 |  | u8 * | key,
 |  | u32 | keylen,
 |  | int | mode
 | ) |  |

AES for Single Block.

The complete AES for only one block.

Parameters
[out] | dst | Output Block (encrypted/decrypted)
[in] | src | Input Block to encrypt/decrypt
[in] | key | An AES key
[in] | keylen | AES key byte length
[in] | mode | The AES mode (Encryption/Decryption)
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | One of the output is the pointer NULL
UCL_INVALID_MODE | The mode is not one of those described
Note
For more than one block use an Operation Modes .


Universal Crypto Library: ucl_aes_key_t Struct Reference

Data Fields
ucl_aes_key_t Struct Reference
Block Cipher » AES

AES Key. More...

Data Fields

u32 | rd_key [4 *(UCL_AES_MAXNR+1)]
Round key. More...
int | rounds
Number of rounds. More...

Detailed Description

AES Key.

Field Documentation

◆ rd_key

u32 ucl_aes_key_t::rd_key[4 *(UCL_AES_MAXNR+1)]

Round key.

◆ rounds

int ucl_aes_key_t::rounds

Number of rounds.


Universal Crypto Library: ucl_aes_ctx_t Struct Reference

Data Fields
ucl_aes_ctx_t Struct Reference
Block Cipher » AES

AES Context. More...

Data Fields

int | mode
Ciphering Mode. More...
u8 memory [UCL_AES_BLOCKSIZE]
Intermediate state. More...
u32 index
index. More...
u8 origin_key [UCL_AES_KEYLEN_256]
origin key, w/o modification
ucl_aes_key_t | key
AES Sub-keys. More...

Detailed Description

AES Context.

This structure is involved in the operation modes.

See also
Operation Modes

Field Documentation

◆ index

u32 ucl_aes_ctx_t::index

index.

◆ key

ucl_aes_key_t ucl_aes_ctx_t::key

AES Sub-keys.

◆ memory

u8 ucl_aes_ctx_t::memory[UCL_AES_BLOCKSIZE]

Intermediate state.

◆ mode

int ucl_aes_ctx_t::mode

Ciphering Mode.


Universal Crypto Library: DES

Data Structures | Macros | Functions
DES
Block Cipher

The Data Encryption Standard (DES), see FIPS PUB 46.3 NIST. More...

+ Collaboration diagram for DES:

Data Structures

struct ucl_des_ctx_t
DES Context. More...

Macros

#define | UCL_DES_BLOCKSIZE 8
DES Block Size. More...
#define | UCL_DES_KEYSIZE 8
DES Key Size. More...
#define | UCL_DES_NB_SUBKEYS 16
Number of subkeys invovled in DES. More...
#define | ucl_des_ctx_t ucl_des_ctx_t
DES Context typedef.

Functions

int ucl_des (u8 *dst, u8 *src, u8 *key, int mode)
DES for Single Block. More...

Detailed Description

The Data Encryption Standard (DES), see FIPS PUB 46.3 NIST.

Header:
ucl_des.h

DES is a Feistel cipher which processes plaintext blocks of 64 bits, producing 64-bit ciphertext blocks. The effective size of the secret key is 56 bits; more precisely, the input key is specified as a 64-bit key, 8 bits of which (bits 8; 16; ... ; 64) may be used as parity bits.
To encrypt/decrypt a block, process the key schedule and then, the main part of the DES.
Many implementation of the DES can be provided, with different levels of security.

DES Descriptor:

  • Length of Input/Output Block: 64 bits
  • Length of key: 64 bits (8 parity bits)

For messages longer than 64 bits use an Operation Modes.

See also
Operation Modes

Macro Definition Documentation

◆ UCL_DES_BLOCKSIZE

#define UCL_DES_BLOCKSIZE 8

DES Block Size.

The byte length of the DES core data block.

◆ UCL_DES_KEYSIZE

#define UCL_DES_KEYSIZE 8

DES Key Size.

The byte length of the DES key.

◆ UCL_DES_NB_SUBKEYS

#define UCL_DES_NB_SUBKEYS 16

Number of subkeys invovled in DES.

The number of subkeys depend on the implementation.

Function Documentation

◆ ucl_des()

int ucl_des | ( | u8 * | dst,
 |  | u8 * | src,
 |  | u8 * | key,
 |  | int | mode
 | ) |  |

DES for Single Block.

This function apply the DES to a single block. For message longer than 64 bits use an Operation Modes .

Parameters
[out] | dst | The decrypted/encrypted block
[in] | src | A block to process
[in] | key | A 64-bit DES key
[in] mode The mode (Encryption/Decryption) :
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | One of the output is the pointer NULL
UCL_INVALID_MODE | The mode is not one of those described
Note
For more than one block use an Operation Modes .


Universal Crypto Library: ucl_des_ctx_t Struct Reference

Data Fields
ucl_des_ctx_t Struct Reference
Block Cipher » DES

DES Context. More...

Data Fields

int | mode
Ciphering Mode. More...
u8 | memory [8]
Intermediate state. More...
u32 index
Index. More...
u32 | subKeys [UCL_DES_NB_SUBKEYS *2]
DES Sub-keys. More...

Detailed Description

DES Context.

DES Context typedef.

This structure is involved in the operation modes.

Field Documentation

◆ index

u32 ucl_des_ctx_t::index

Index.

◆ memory

u8 ucl_des_ctx_t::memory[8]

Intermediate state.

◆ mode

int ucl_des_ctx_t::mode

Ciphering Mode.

◆ subKeys

u32 ucl_des_ctx_t::subKeys[UCL_DES_NB_SUBKEYS *2]

DES Sub-keys.

See also
UCL_DES_NB_SUBKEYS


Universal Crypto Library: USIP AES Interface

Data Structures | Macros | Functions
USIP AES Interface
Block Cipher

Interface for Hardware AES. More...

+ Collaboration diagram for USIP AES Interface:

Data Structures

struct | usip_aes_t
USIP® AES Interface definition . More...
struct | ucl_uaes_ctx_t
USIP® AES Context. More...

Macros

#define | UCL_UAES_KEY_SIZE 16
UAES Key Byte Size.
#define | UCL_UAES_BLOCK_SIZE 16
UAES Block Byte Size.
#define | UCL_UAES_SET_KEY 0
USIP® AES Set Key Option. More...
#define | UCL_UAES_SET_KEY_AND_DKEY 1
USIP® AES Set Key Option. More...
#define | UCL_UAES_SET_DKEY 2
USIP® AES Set Key Option. More...
#define | UCL_UAES_SET_DKEY_AND_KEY 3
USIP® AES Set Key Option. More...

Functions

int | ucl_uaes_setkey (const u8 *key, int option)
USIP® AES Set Key The function configure the USIP® AES. More...
int | ucl_uaes_decrypt (u8 *plaintext, u8 *ciphertext)
USIP® AES Decryption The function decrypts an AES enciphered message. More...
int | ucl_uaes_encrypt (u8 *ciphertext, u8 *plaintext)
USIP® AES Encryption The function encrypts a message with the AES algorithm. More...

Detailed Description

Interface for Hardware AES.

Header:
ucl_uaes.h

USIP® AES Descriptor:

  • Length of Input/Output Block: 128 bits
  • Length of key: 128 bits

For messages longer than 128 bits use an Operation Modes.

See also
Operation Modes

Macro Definition Documentation

◆ UCL_UAES_SET_DKEY

#define UCL_UAES_SET_DKEY 2

USIP® AES Set Key Option.

The function ucl_uaes_setkey precalculates the decryption key with the current key.

◆ UCL_UAES_SET_DKEY_AND_KEY

#define UCL_UAES_SET_DKEY_AND_KEY 3

USIP® AES Set Key Option.

The function ucl_uaes_setkey precalculates the decryption key with the current key and set a new key.

◆ UCL_UAES_SET_KEY

#define UCL_UAES_SET_KEY 0

USIP® AES Set Key Option.

The function ucl_uaes_setkey set an encryption key.

◆ UCL_UAES_SET_KEY_AND_DKEY

#define UCL_UAES_SET_KEY_AND_DKEY 1

USIP® AES Set Key Option.

The function ucl_uaes_setkey set a key, and precalculates the decryption key.

Function Documentation

◆ ucl_uaes_decrypt()

int ucl_uaes_decrypt | ( | u8 * | plaintext,
 |  | u8 * | ciphertext
 | ) |  |

USIP® AES Decryption The function decrypts an AES enciphered message.

Parameters
[out] | plaintext | A pointer to the 128 bit plain text.
[in] | ciphertext | A pointer to the 128 bit ciphered text.
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If dataIn is NULL
UCL_INVALID_OUTPUT | If dataOut is NULL
UCL_NO_UAES_INTERFACE | If there is not interface to the USIP® AES

◆ ucl_uaes_encrypt()

int ucl_uaes_encrypt | ( | u8 * | ciphertext,
 |  | u8 * | plaintext
 | ) |  |

USIP® AES Encryption The function encrypts a message with the AES algorithm.

Parameters
[out] | ciphertext | A pointer to the 128 bit ciphered text.
[in] | plaintext | A pointer to the 128 bit plain text.
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If dataIn is NULL
UCL_INVALID_OUTPUT | If dataOut is NULL
UCL_NO_UAES_INTERFACE | If there is not interface to the USIP® AES

◆ ucl_uaes_setkey()

int ucl_uaes_setkey | ( | const u8 * | key,
 |  | int | option
 | ) |  |

USIP® AES Set Key The function configure the USIP® AES.

Parameters
[in] key Pointer to an 128-bit AES key.
[in] option A configuration option between:
  • UCL_UAES_SET_KEY
  • UCL_UAES_SET_KEY_AND_DKEY
  • UCL_UAES_SET_DKEY
  • UCL_UAES_SET_DKEY_AND_KEY
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If key is NULL and option is not
UCL_INVALID_ARG | If option is not one of the possbile values
UCL_NO_UAES_INTERFACE | If there is not interface to the USIP® AES


Universal Crypto Library: usip_aes_t Struct Reference

Data Fields
usip_aes_t Struct Reference
Block Cipher » USIP AES Interface

USIP® AES Interface definition . More...

Data Fields

int(* | setkey )(const u8 *key)
Set key.
int(* | dkeygen )(void)
Generate decryption key.
int(* | decrypt )(u8 *dataOut, u8 *dataIn)
Decryption.
int(* | encrypt )(u8 *dataOut, u8 *dataIn)
Encryption.

Detailed Description

USIP® AES Interface definition .

USIP® AES Interface typedef.


Universal Crypto Library: ucl_uaes_ctx_t Struct Reference

Data Fields
ucl_uaes_ctx_t Struct Reference
Block Cipher » USIP AES Interface

USIP® AES Context. More...

Data Fields

int | mode
Ciphering mode. More...
u8 | memory [16]
Intermediate state. More...
u8 | key [16]
USIP® AES Key. More...

Detailed Description

USIP® AES Context.

This structure is involved in the operation rmac.

Field Documentation

◆ key

u8 ucl_uaes_ctx_t::key[16]

USIP® AES Key.

◆ memory

u8 ucl_uaes_ctx_t::memory[16]

Intermediate state.

◆ mode

int ucl_uaes_ctx_t::mode

Ciphering mode.


Universal Crypto Library: Data & Memory Manipulation

Modules
Data & Memory Manipulation

Data & Memory Manipulation. More...

+ Collaboration diagram for Data & Memory Manipulation:

Modules

Data Conversion
Data Conversion.
UCL Stack
UCL Stack Management.

Detailed Description

Data & Memory Manipulation.

Note
Module Version 1.0


Universal Crypto Library: Data Conversion

Functions
Data Conversion
Data & Memory Manipulation

Data Conversion. More...

+ Collaboration diagram for Data Conversion:

Functions

int | ucl_data_wsb (u32 *output, u32 *input, u32 len)
Words swap byte. More...
int | ucl_data_os2int (u32 *it, u32 it_length, u8 *os, u32 os_length)
PKCS #1 OS2IP. More...
int | ucl_data_int2os (u8 *os, u32 os_length, u32 *it, u32 it_length)
PKCS #1 I2OSP. More...

Detailed Description

Data Conversion.

Header:
ucl_data_conv.h

Function Documentation

◆ ucl_data_int2os()

int ucl_data_int2os | ( | u8 * | os,
 |  | u32 | os_length,
 |  | u32 * | it,
 |  | u32 | it_length
 | ) |  |

PKCS #1 I2OSP.

Converts a nonnegative integer to an octet string of a specified length.

Parameters
[out] | os | Octet string
[in] | os_length | Octet string length
[in] | it | Non negative integer
[in] | it_length | Integer precision
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_OUTPUT | If os is the pointer NULL
UCL_INVALID_INPUT | If it is the pointer NULL
UCL_INVALID_ARG | If 4 x os_length < it_length

◆ ucl_data_os2int()

int ucl_data_os2int | ( | u32 * | it,
 |  | u32 | it_length,
 |  | u8 * | os,
 |  | u32 | os_length
 | ) |  |

PKCS #1 OS2IP.

Converts an octet string to a nonnegative integer.

Parameters
[out] | it | Non negative integer
[in] | it_length | Integer precision
[in] | os | Octet string
[in] | os_length | Octet string length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_OUTPUT | If it is the pointer NULL
UCL_INVALID_INPUT | If os is the pointer NULL
UCL_INVALID_ARG | If it_length < 4 x os_length

◆ ucl_data_wsb()

int ucl_data_wsb | ( | u32 * | output,
 |  | u32 * | input,
 |  | u32 | len
 | ) |  |

Words swap byte.

Convet the endianess of 32-bit words array.

Parameters
[out] | output | 32-bit words data
[in] | input | 32-bit words data
[in] | len | 32-bit Word length of the data
Returns
Error code
Return values
UCL_INVALID_OUTPUT | If output is the pointer NULL
UCL_INVALID_INPUT | If input is the pointer NULL
UCL_NOP | If len = 0


Universal Crypto Library: UCL Stack

Functions
UCL Stack
Data & Memory Manipulation

UCL Stack Management. More...

+ Collaboration diagram for UCL Stack:

Functions

int | ucl_stack_init (u32 *pt_stack, int size)
UCL Stack Initialisation. More...
int | ucl_stack_alloc (u32 **pt, int nbWord)
UCL Stack Allocation. More...
int | ucl_stack_free (u32 **pt)
Free UCL Stack Allocation. More...
int | ucl_stack_size (void)
UCL Stack Size. More...

Detailed Description

UCL Stack Management.

Header:
ucl_stack.h

To optimize the temporary data size used by cryptolib, a special data zone called UCL Stack (CS) with management functions has been implemented.
The CS size is fixed (it is a global variable in section .data) at the compilation and the management of the memory is exactly as the system stack.

The CS allows to allocate temporary memory in the critical applications like RSA. It is a simply dynamic allocation with implementation according to the embedded system constraints.

It is possible to use another memory space instead of the default stack.

Function Documentation

◆ ucl_stack_alloc()

int ucl_stack_alloc | ( | u32 ** | pt,
 |  | int | nbWord
 | ) |  |

UCL Stack Allocation.

Parameters
[out] | pt | Pointer to the UCL stack pointer
[in] | nbWord | UCL stack allocation size
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_STACK_NOT_INIT | UCL stack is not initialized
UCL_STACK_OVERFLOW | Size is greater than memory available

◆ ucl_stack_free()

int ucl_stack_free ( u32 ** pt )

Free UCL Stack Allocation.

Parameters
[in,out] pt Pointer to UCL stack pointer
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_STACK_NOT_INIT | if UCL stack is not initialized

◆ ucl_stack_init()

int ucl_stack_init | ( | u32 * | pt_stack,
 |  | int | size
 | ) |  |

UCL Stack Initialisation.

Reserve memory for stack.

This function initialize the stack. It is possible to use an another memory space than the default. If the preconditions are not verified the default UCL stack is used.

Precondition
pt_stack is not NULL and size is greater than 1024
size must be a multiple of 4
Parameters
[in] | pt_stack | Pointer to a memory space
[in] | size | 32-bit word size
Returns
Error code
Return values
UCL_STACK_DEFAULT | use default UCL stack
UCL_OK | use an another mermory space for UCL stack

◆ ucl_stack_size()

int ucl_stack_size ( void )

UCL Stack Size.

Returns
UCL Stack size or Error code
Return values
UCL_STACK_NOT_INIT if UCL stack is not initialized


Universal Crypto Library: Secure Hash Function

Modules
Secure Hash Function

Secure Hash Function of the UCL. More...

+ Collaboration diagram for Secure Hash Function:

Modules

HDES
Hash function two padding method 3, based on ISO/IEC 10118-2.
SHA224
Secure Hash Algorithm 224, from FIPS 180-2.
SHA256
Secure Hash Algorithm 256, from FIPS 180-2.
SHA3
Secure Hash Algorithm 3, from FIPS 202.
SHA384
Secure Hash Algorithm 384, from FIPS 180-2.
SIA256
Variant of the Secure Hash Algorithm 256, from FIPS 180-2.
SM3
Secure Hash Algorithm 256, from FIPS 180-2.

Detailed Description

Secure Hash Function of the UCL.

Use for data integrity and message authentication, they compute a condensed secured representation of a message. The following functions are called secure because, for a given algorithm, it is computationally infeasible:

  • To find a message that corresponds to a given message digest
  • Or to find two different messages that produce the same message digest

Any change to a message will, with a very high probability, result in a different message digest. This will result in a verification failure when the secure hash algorithm is used with a digital signature algorithm or a keyed-hash message authentication algorithm.

For each secure hash function two ways to compute the digest are available:

  • One-time computation.
  • Step-by-step computation.

The last one allows to process data on-the-fly.

Note
Module Version 1.0


Universal Crypto Library: HDES

Data Structures | Macros | Functions
HDES
Secure Hash Function

Hash function two padding method 3, based on ISO/IEC 10118-2. More...

+ Collaboration diagram for HDES:

Data Structures

struct ucl_hdes_ctx_t
The HDES context. More...

Macros

#define | UCL_HDES_BLOCKSIZE 8
HDES core block size. More...
#define | UCL_HDES_HASHSIZE 16
HDES hash size. More...
#define | ucl_hdes_ctx_t ucl_hdes_ctx_t
The HDES context.

Functions

int | ucl_hdes (u8 *hash, u8 *data, u32 data_byteLen)
HDES. More...
int | ucl_hdes_init (ucl_hdes_ctx_t *context)
HDES Init. More...
int | ucl_hdes_core (ucl_hdes_ctx_t *context, u8 *data, u32 data_byteLen)
HDES Core. More...
int | ucl_hdes_finish (u8 *hash, ucl_hdes_ctx_t *context)
HDES Finish. More...

Detailed Description

Hash function two padding method 3, based on ISO/IEC 10118-2.

Header:
ucl_hdes.h

ISO/IEC 10118-2, "Information Technology - Security Techniques - Hash functions, Part 2: Hash functions using an n-bit block cipher algorithm", 1994.

HDES Descriptor:

  • Block length : 64 bits (8 bytes)
  • Hash length : 128 bits (4 bytes)

Macro Definition Documentation

◆ UCL_HDES_BLOCKSIZE

#define UCL_HDES_BLOCKSIZE 8

HDES core block size.

Byte size of a HDES core block.

◆ UCL_HDES_HASHSIZE

#define UCL_HDES_HASHSIZE 16

HDES hash size.

Byte size of the HDES output.

Function Documentation

◆ ucl_hdes()

int ucl_hdes | ( | u8 * | hash,
 |  | u8 * | data,
 |  | u32 | data_byteLen
 | ) |  |

HDES.

The complete process of HDES.

Parameters
[out] | hash | Pointer to the digest
[in] | data | Pointer to the data
[in] | data_byteLen | Data byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL

◆ ucl_hdes_core()

int ucl_hdes_core | ( | ucl_hdes_ctx_t * | context,
 |  | u8 * | data,
 |  | u32 | data_byteLen
 | ) |  |

HDES Core.

The core of HDES.

Parameters
[in,out] | context | Pointer to the context
[in] | data | Pointer to the data
[in] | data_byteLen | Data byte length
Warning
ucl_hdes_init must be processed before, and ucl_hdes_finish must be processed to get the final hash.
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the inputs are the pointer NULL
UCL_NOP | If data_byteLen = 0

◆ ucl_hdes_finish()

int ucl_hdes_finish | ( | u8 * | hash,
 |  | ucl_hdes_ctx_t * | context
 | ) |  |

HDES Finish.

Finish the process of HDES.

Parameters
[out] | hash | Pointer to the digest
[in] | context | Pointer to the context
Warning
ucl_hdes_init and ucl_hdes_core must be processed before.
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_OUTPUT | If @ hash is the pointer NULL
UCL_INVALID_INPUT | If context is the pointer NULL

◆ ucl_hdes_init()

int ucl_hdes_init ( ucl_hdes_ctx_t * context )

HDES Init.

The initialisation of HDES.

Parameters
[in,out] context
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If context is NULL


Universal Crypto Library: ucl_hdes_ctx_t Struct Reference

Data Fields
ucl_hdes_ctx_t Struct Reference
Secure Hash Function » HDES

The HDES context. More...

Data Fields

u32 | state [4]
Intermediate and then final hash.
u32 | count [2]
Counter in bits.
u8 | buffer [8]
Buffer.

Detailed Description

The HDES context.

This structure is associated to the 'step by step' process.


Universal Crypto Library: SHA224

Macros | Functions
SHA224
Secure Hash Function

Secure Hash Algorithm 224, from FIPS 180-2. More...

+ Collaboration diagram for SHA224:

Macros

#define | UCL_SHA224_BLOCKSIZE 64
Core block size. More...
#define | UCL_SHA224 2
Hash size. More...
#define | UCL_SHA224_HASHW32SIZE 7
Hash size. More...

Functions

int | ucl_sha224 (u8 *hash, u8 *data, u32 data_byteLen)
SHA224. More...
int | ucl_sha224_init (ucl_sha224_ctx_t *context)
SHA224 Init. More...
int | ucl_sha224_core (ucl_sha224_ctx_t *context, u8 *data, u32 data_byteLen)
SHA224 Core. More...
int | ucl_sha224_finish (u8 *hash, ucl_sha224_ctx_t *context)
SHA224 Finish. More...

Detailed Description

Secure Hash Algorithm 224, from FIPS 180-2.

Header:
ucl_sha224.h

SHA-224 is a data-digest algorithm and a component of the Standard FIPS 180-2. The algorithm takes as input a data of arbitrary length and produces as output a 224-bit "fingerprint" or "data digest" of the input.

Given a data of any length, a single "1" bit is appended at the end of the data. This bit must always be added. Then, a set of "0" bits are also appended so that the data length is 448 modulo 512. Finally, the length of the data is appended.

SHA224 Descriptor:

  • Block length : 512 bits
  • Hash length : 224 bits

Macro Definition Documentation

◆ UCL_SHA224

#define UCL_SHA224 2

Hash size.

Byte size of the output of SHA224.

◆ UCL_SHA224_BLOCKSIZE

#define UCL_SHA224_BLOCKSIZE 64

Core block size.

Byte size of a SHA224 core block.

◆ UCL_SHA224_HASHW32SIZE

#define UCL_SHA224_HASHW32SIZE 7

Hash size.

32-bits word size of the output of SHA224.

Function Documentation

◆ ucl_sha224()

int ucl_sha224 | ( | u8 * | hash,
 |  | u8 * | data,
 |  | u32 | data_byteLen
 | ) |  |

SHA224.

The complete process of SHA224.

Precondition
Hash byte length is equal to 32
Parameters
[out] | hash | Pointer to the digest
[in] | data | Pointer to the data
[in] | data_byteLen | Data byte length
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if hash is NULL

◆ ucl_sha224_core()

int ucl_sha224_core | ( | ucl_sha224_ctx_t * | context,
 |  | u8 * | data,
 |  | u32 | data_byteLen
 | ) |  |

SHA224 Core.

The core of SHA224.

Parameters
[in,out] | context | Pointer to the context
[in] | data | Pointer to the data
[in] | data_byteLen | Data byte length
Warning
ucl_sha224_init must be processed before, and ucl_sha224_finish should be processed to get the final hash.
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_NOP | if data_byteLen = 0 or if data is the pointer NULL

◆ ucl_sha224_finish()

int ucl_sha224_finish | ( | u8 * | hash,
 |  | ucl_sha224_ctx_t * | context
 | ) |  |

SHA224 Finish.

Finish the process of SHA224.

Precondition
Hash byte length is equal to 32
Parameters
[out] | hash | Pointer to the digest
[in,out] | context | Pointer to the context
Warning
ucl_sha224_init and ucl_sha224_core must be processed before.
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if hash is the pointer NULL
UCL_INVALID_INPUT | if context is the pointer NULL

◆ ucl_sha224_init()

int ucl_sha224_init ( ucl_sha224_ctx_t * context )

SHA224 Init.

The initialisation of SHA224.

Parameters
[in,out] context Pointer to the context
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if context is NULL


Universal Crypto Library: SHA256

Data Structures | Macros | Functions
SHA256
Secure Hash Function

Secure Hash Algorithm 256, from FIPS 180-2. More...

+ Collaboration diagram for SHA256:

Data Structures

struct ucl_sha256_ctx_t
The SHA256 context. More...

Macros

#define | UCL_SHA256_BLOCKSIZE 64
Core block size. More...
#define | UCL_SHA256 1
Hash size. More...
#define | UCL_SHA256_HASHW32SIZE 8
Hash size. More...
#define | ucl_sha256_ctx_t ucl_sha256_ctx_t
The SHA256 context.

Functions

int | ucl_sha256 (u8 *hash, u8 *data, u32 data_byteLen)
SHA256. More...
int | ucl_sha256_init (ucl_sha256_ctx_t *context)
SHA256 Init. More...
int | ucl_sha256_core (ucl_sha256_ctx_t *context, u8 *data, u32 data_byteLen)
SHA256 Core. More...
int | ucl_sha256_finish (u8 *hash, ucl_sha256_ctx_t *context)
SHA256 Finish. More...

Detailed Description

Secure Hash Algorithm 256, from FIPS 180-2.

Header:
ucl_sha256.h

SHA-256 is a data-digest algorithm and a component of the Standard FIPS 180-2. The algorithm takes as input a data of arbitrary length and produces as output a 256-bit "fingerprint" or "data digest" of the input.

Given a data of any length, a single "1" bit is appended at the end of the data. This bit must always be added. Then, a set of "0" bits are also appended so that the data length is 448 modulo 512. Finally, the length of the data is appended.

SHA256 Descriptor:

  • Block length : 512 bits
  • Hash length : 256 bits

Macro Definition Documentation

◆ UCL_SHA256

#define UCL_SHA256 1

Hash size.

Byte size of the output of SHA256.

◆ UCL_SHA256_BLOCKSIZE

#define UCL_SHA256_BLOCKSIZE 64

Core block size.

Byte size of a SHA256 core block.

◆ UCL_SHA256_HASHW32SIZE

#define UCL_SHA256_HASHW32SIZE 8

Hash size.

32-bits word size of the output of SHA256.

Function Documentation

◆ ucl_sha256()

int ucl_sha256 | ( | u8 * | hash,
 |  | u8 * | data,
 |  | u32 | data_byteLen
 | ) |  |

SHA256.

The complete process of SHA256.

Precondition
Hash byte length is equal to 32
Parameters
[out] | hash | Pointer to the digest
[in] | data | Pointer to the data
[in] | data_byteLen | Data byte length
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if hash is NULL

◆ ucl_sha256_core()

int ucl_sha256_core | ( | ucl_sha256_ctx_t * | context,
 |  | u8 * | data,
 |  | u32 | data_byteLen
 | ) |  |

SHA256 Core.

The core of SHA256.

Parameters
[in,out] | context | Pointer to the context
[in] | data | Pointer to the data
[in] | data_byteLen | Data byte length
Warning
ucl_sha256_init must be processed before, and ucl_sha256_finish should be processed to get the final hash.
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if data_byteLen = 0 or if data is the pointer NULL

◆ ucl_sha256_finish()

int ucl_sha256_finish | ( | u8 * | hash,
 |  | ucl_sha256_ctx_t * | context
 | ) |  |

SHA256 Finish.

Finish the process of SHA256.

Precondition
Hash byte length is equal to 32
Parameters
[out] | hash | Pointer to the digest
[in,out] | context | Pointer to the context
Warning
ucl_sha256_init and ucl_sha256_core must be processed before.
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if hash is the pointer NULL
UCL_INVALID_INPUT | if context is the pointer NULL

◆ ucl_sha256_init()

int ucl_sha256_init ( ucl_sha256_ctx_t * context )

SHA256 Init.

The initialisation of SHA256.

Parameters
[in,out] context Pointer to the context
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if context is NULL


Universal Crypto Library: ucl_sha256_ctx_t Struct Reference

Data Fields
ucl_sha256_ctx_t Struct Reference
Secure Hash Function » SHA256

The SHA256 context. More...

Data Fields

u32 | state [8]
Intermediate and then final hash. More...
u32 | count [2]
Counter in bits. More...
u8 | buffer [64]
Buffer. More...

Detailed Description

The SHA256 context.

The SHA224 context.

This structure is associated to the 'step by step' process.

This structure is associated to the 'step by step' process. The SHA224 context.

Field Documentation

◆ buffer

u8 ucl_sha224_ctx_t::buffer[64]

Buffer.

◆ count

u32 ucl_sha224_ctx_t::count[2]

Counter in bits.

◆ state

u32 ucl_sha224_ctx_t::state[8]

Intermediate and then final hash.


Universal Crypto Library: SHA3

Data Structures | Functions
SHA3
Secure Hash Function

Secure Hash Algorithm 3, from FIPS 202. More...

+ Collaboration diagram for SHA3:

Data Structures

struct sha3_ctx
The SHA3 context. More...

Functions

int | ucl_sha3_224_init (ucl_sha3_ctx_t *ctx)
SHA3-224 Init. More...
int | ucl_sha3_256_init (ucl_sha3_ctx_t *ctx)
SHA3-256 Init. More...
int | ucl_sha3_384_init (ucl_sha3_ctx_t *ctx)
SHA3-384 Init. More...
int | ucl_sha3_512_init (ucl_sha3_ctx_t *ctx)
SHA3-512 Init. More...
int | ucl_sha3_core (ucl_sha3_ctx_t *ctx, const u8 *msg, u32 size)
SHA3 Core. More...
int | ucl_sha3_finish (u8 *hash, ucl_sha3_ctx_t *ctx)
SHA3 Finish. More...
int | ucl_sha3_224 (u8 *digest, u8 *msg, u32 msg_Len)
SHA3-224. More...
int | ucl_sha3_256 (u8 *digest, u8 *msg, u32 msg_Len)
SHA3-256. More...
int | ucl_sha3_384 (u8 *digest, u8 *msg, u32 msg_Len)
SHA3-384. More...
int | ucl_sha3_512 (u8 *digest, u8 *msg, u32 msg_Len)
SHA3-512. More...

Detailed Description

Secure Hash Algorithm 3, from FIPS 202.

Header:
ucl_sha3.h

SHA-3 is a data-digest algorithm and a component of the Standard FIPS 202. The algorithm takes as input a data of arbitrary length and produces as output 224-bit, 256-bit, 384-bit or 512-bit "fingerprint" or "data digest" of the input.

SHA3 Descriptor:

  • Hash length : 224/256/384/512 bits

Function Documentation

◆ ucl_sha3_224()

int ucl_sha3_224 | ( | u8 * | digest,
 |  | u8 * | msg,
 |  | u32 | msg_Len
 | ) |  |

SHA3-224.

The complete process of SHA3-224.

Precondition
Hash byte length is equal to 28
Parameters
[out] | hash | Pointer to the digest
[in] | data | Pointer to the data
[in] | data_byteLen | Data byte length
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if hash is NULL

◆ ucl_sha3_224_init()

int ucl_sha3_224_init ( ucl_sha3_ctx_t * ctx )

SHA3-224 Init.

The initialisation of SHA3-224.

Parameters
[in,out] context Pointer to the context
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if context is NULL

◆ ucl_sha3_256()

int ucl_sha3_256 | ( | u8 * | digest,
 |  | u8 * | msg,
 |  | u32 | msg_Len
 | ) |  |

SHA3-256.

The complete process of SHA3-256.

Precondition
Hash byte length is equal to 32
Parameters
[out] | hash | Pointer to the digest
[in] | data | Pointer to the data
[in] | data_byteLen | Data byte length
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if hash is NULL

◆ ucl_sha3_256_init()

int ucl_sha3_256_init ( ucl_sha3_ctx_t * ctx )

SHA3-256 Init.

The initialisation of SHA3-256.

Parameters
[in,out] context Pointer to the context
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if context is NULL

◆ ucl_sha3_384()

int ucl_sha3_384 | ( | u8 * | digest,
 |  | u8 * | msg,
 |  | u32 | msg_Len
 | ) |  |

SHA3-384.

The complete process of SHA3-384.

Precondition
Hash byte length is equal to 48
Parameters
[out] | hash | Pointer to the digest
[in] | data | Pointer to the data
[in] | data_byteLen | Data byte length
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if hash is NULL

◆ ucl_sha3_384_init()

int ucl_sha3_384_init ( ucl_sha3_ctx_t * ctx )

SHA3-384 Init.

The initialisation of SHA3-384.

Parameters
[in,out] context Pointer to the context
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if context is NULL

◆ ucl_sha3_512()

int ucl_sha3_512 | ( | u8 * | digest,
 |  | u8 * | msg,
 |  | u32 | msg_Len
 | ) |  |

SHA3-512.

The complete process of SHA3-512.

Precondition
Hash byte length is equal to 64
Parameters
[out] | hash | Pointer to the digest
[in] | data | Pointer to the data
[in] | data_byteLen | Data byte length
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if hash is NULL

◆ ucl_sha3_512_init()

int ucl_sha3_512_init ( ucl_sha3_ctx_t * ctx )

SHA3-512 Init.

The initialisation of SHA3-512.

Parameters
[in,out] context Pointer to the context
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if context is NULL

◆ ucl_sha3_core()

int ucl_sha3_core | ( | ucl_sha3_ctx_t * | ctx,
 |  | const u8 * | msg,
 |  | u32 | size
 | ) |  |

SHA3 Core.

The core of SHA3, common to all SHA3 hash functions.

Parameters
[in,out] | context | Pointer to the context
[in] | data | Pointer to the data
[in] | data_byteLen | Data byte length
Warning
#ucl_sha3-*_init must be processed before, and ucl_sha3_finish should be processed to get the final hash.
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_NOP | if data_byteLen = 0 or if data is the pointer NULL

◆ ucl_sha3_finish()

int ucl_sha3_finish | ( | u8 * | hash,
 |  | ucl_sha3_ctx_t * | ctx
 | ) |  |

SHA3 Finish.

Finish the process of SHA3, common to all SHA3 hash functions.

Precondition
Hash byte length is equal to SHA3_KECCAK_SPONGE_WORDS*8 so 200 bytes
Parameters
[out] | hash | Pointer to the large digest array
[in,out] | context | Pointer to the context
Warning
#ucl_sha3_*_init and ucl_sha3_core must be processed before.
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if hash is the pointer NULL
UCL_INVALID_INPUT | if context is the pointer NULL


Universal Crypto Library: sha3_ctx Struct Reference

sha3_ctx Struct Reference
Secure Hash Function » SHA3

The SHA3 context. More...

Detailed Description

The SHA3 context.

This structure is associated to the 'step by step' process.


Universal Crypto Library: SHA384

Macros | Typedefs | Functions
SHA384
Secure Hash Function

Secure Hash Algorithm 384, from FIPS 180-2. More...

+ Collaboration diagram for SHA384:

Macros

#define | UCL_SHA384_BLOCKSIZE 128
Core block size. More...
#define | UCL_SHA384_HASHSIZE 48
Hash size. More...
#define | UCL_SHA384 3
Hash size. More...

Typedefs

typedef struct ucl_sha512_ctx ucl_sha384_ctx_t
The SHA384 context. More...

Functions

int | ucl_sha384 (u8 *hash, u8 *data, u32 data_byteLen)
SHA384. More...
int | ucl_sha384_init (ucl_sha384_ctx_t *context)
SHA384 Init. More...
int | ucl_sha384_core (ucl_sha384_ctx_t *context, u8 *data, u32 data_byteLen)
SHA384 Core. More...
int | ucl_sha384_finish (u8 *hash, ucl_sha384_ctx_t *context)
SHA384 Finish. More...

Detailed Description

Secure Hash Algorithm 384, from FIPS 180-2.

Header:
ucl_sha384.h

SHA-384 is a data-digest algorithm and a component of the Standard FIPS 180-2. The algorithm takes as input a data of arbitrary length and produces as output a 384-bit "fingerprint" or "data digest" of the input.

Given a data of any length, a single "1" bit is appended at the end of the data. This bit must always be added. Then, a set of "0" bits are also appended so that the data length is 448 modulo 512. Finally, the length of the data is appended.

SHA384 Descriptor:

  • Block length : 512 bits
  • Hash length : 384 bits

Macro Definition Documentation

◆ UCL_SHA384

#define UCL_SHA384 3

Hash size.

32-bits word size of the output of SHA384.

◆ UCL_SHA384_BLOCKSIZE

#define UCL_SHA384_BLOCKSIZE 128

Core block size.

Byte size of a SHA384 core block.

◆ UCL_SHA384_HASHSIZE

#define UCL_SHA384_HASHSIZE 48

Hash size.

Byte size of the output of SHA384.

Typedef Documentation

◆ ucl_sha384_ctx_t

typedef struct ucl_sha512_ctx ucl_sha384_ctx_t

The SHA384 context.

This structure is associated to the 'step by step' process. The SHA384 context.

Function Documentation

◆ ucl_sha384()

int ucl_sha384 | ( | u8 * | hash,
 |  | u8 * | data,
 |  | u32 | data_byteLen
 | ) |  |

SHA384.

The complete process of SHA384.

Precondition
Hash byte length is equal to 32
Parameters
[out] | hash | Pointer to the digest
[in] | data | Pointer to the data
[in] | data_byteLen | Data byte length
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if hash is NULL

◆ ucl_sha384_core()

int ucl_sha384_core | ( | ucl_sha384_ctx_t * | context,
 |  | u8 * | data,
 |  | u32 | data_byteLen
 | ) |  |

SHA384 Core.

The core of SHA384.

Parameters
[in,out] | context | Pointer to the context
[in] | data | Pointer to the data
[in] | data_byteLen | Data byte length
Warning
ucl_sha384_init must be processed before, and ucl_sha384_finish should be processed to get the final hash.
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_NOP | if data_byteLen = 0 or if data is the pointer NULL

◆ ucl_sha384_finish()

int ucl_sha384_finish | ( | u8 * | hash,
 |  | ucl_sha384_ctx_t * | context
 | ) |  |

SHA384 Finish.

Finish the process of SHA384.

Precondition
Hash byte length is equal to 32
Parameters
[out] | hash | Pointer to the digest
[in,out] | context | Pointer to the context
Warning
ucl_sha384_init and ucl_sha384_core must be processed before.
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if hash is the pointer NULL
UCL_INVALID_INPUT | if context is the pointer NULL

◆ ucl_sha384_init()

int ucl_sha384_init ( ucl_sha384_ctx_t * context )

SHA384 Init.

The initialisation of SHA384.

Parameters
[in,out] context Pointer to the context
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if context is NULL


Universal Crypto Library: SIA256

Data Structures | Macros | Functions
SIA256
Secure Hash Function

Variant of the Secure Hash Algorithm 256, from FIPS 180-2. More...

+ Collaboration diagram for SIA256:

Data Structures

struct ucl_sia256_ctx_t
The SIA256 context. More...

Macros

#define | UCL_SIA256_BLOCKSIZE 64
Core block size. More...
#define | UCL_SIA256 6
Hash size. More...
#define | UCL_SIA256_HASHW32SIZE 8
Hash size. More...

Functions

int __API__ | ucl_sia256 (u8 *hash, u8 *data, u32 data_byteLen)
SIA256. More...
int __API__ | ucl_sia256_init (ucl_sia256_ctx_t *context)
SIA256 Init. More...
int __API__ | ucl_sia256_core (ucl_sia256_ctx_t *context, u8 *data, u32 data_byteLen)
SIA256 Core. More...
int __API__ | ucl_sia256_finish (u8 *hash, ucl_sia256_ctx_t *context)
SIA256 Finish. More...

Detailed Description

Variant of the Secure Hash Algorithm 256, from FIPS 180-2.

Header:
ucl_sia256.h

SIA-256 is a data-digest algorithm and a variant of the SHA-256, component of the Standard FIPS 180-2. The algorithm takes as input a data of arbitrary length and produces as output a 256-bit "fingerprint" or "data digest" of the input.

Given a data of any length, a single "1" bit is appended at the end of the data. This bit must always be added. Then, a set of "0" bits are also appended so that the data length is 448 modulo 512. Finally, the length of the data is appended.

SIA256 Descriptor:

  • Block length : 512 bits
  • Hash length : 256 bits

Macro Definition Documentation

◆ UCL_SIA256

#define UCL_SIA256 6

Hash size.

Byte size of the output of SIA256.

◆ UCL_SIA256_BLOCKSIZE

#define UCL_SIA256_BLOCKSIZE 64

Core block size.

Byte size of a SIA256 core block.

◆ UCL_SIA256_HASHW32SIZE

#define UCL_SIA256_HASHW32SIZE 8

Hash size.

32-bits word size of the output of SIA256.

Function Documentation

◆ ucl_sia256()

int __API__ ucl_sia256 | ( | u8 * | hash,
 |  | u8 * | data,
 |  | u32 | data_byteLen
 | ) |  |

SIA256.

The complete process of SIA256.

Precondition
Hash byte length is equal to 32
Parameters
[out] | hash | Pointer to the digest
[in] | data | Pointer to the data
[in] | data_byteLen | Data byte length
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if hash is NULL

◆ ucl_sia256_core()

int __API__ ucl_sia256_core | ( | ucl_sia256_ctx_t * | context,
 |  | u8 * | data,
 |  | u32 | data_byteLen
 | ) |  |

SIA256 Core.

The core of SIA256.

Parameters
[in,out] | context | Pointer to the context
[in] | data | Pointer to the data
[in] | data_byteLen | Data byte length
Warning
ucl_sia256_init must be processed before, and ucl_sia256_finish should be processed to get the final hash.
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_NOP | if data_byteLen = 0 or if data is the pointer NULL

◆ ucl_sia256_finish()

int __API__ ucl_sia256_finish | ( | u8 * | hash,
 |  | ucl_sia256_ctx_t * | context
 | ) |  |

SIA256 Finish.

Finish the process of SIA256.

Precondition
Hash byte length is equal to 32
Parameters
[out] | hash | Pointer to the digest
[in,out] | context | Pointer to the context
Warning
ucl_sia256_init and ucl_sia256_core must be processed before.
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if hash is the pointer NULL
UCL_INVALID_INPUT | if context is the pointer NULL

◆ ucl_sia256_init()

int __API__ ucl_sia256_init ( ucl_sia256_ctx_t * context )

SIA256 Init.

The initialisation of SIA256.

Parameters
[in,out] context Pointer to the context
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if context is NULL


Universal Crypto Library: ucl_sia256_ctx_t Struct Reference

Data Fields
ucl_sia256_ctx_t Struct Reference
Secure Hash Function » SIA256

The SIA256 context. More...

Data Fields

u32 | state [8]
Intermediate and then final hash. More...
u32 | count [2]
Counter in bits. More...
u8 | buffer [64]
Buffer. More...

Detailed Description

The SIA256 context.

This structure is associated to the 'step by step' process.

Field Documentation

◆ buffer

u8 ucl_sia256_ctx_t::buffer[64]

Buffer.

◆ count

u32 ucl_sia256_ctx_t::count[2]

Counter in bits.

◆ state

u32 ucl_sia256_ctx_t::state[8]

Intermediate and then final hash.


Universal Crypto Library: SM3

Macros | Functions
SM3
Secure Hash Function

Secure Hash Algorithm 256, from FIPS 180-2. More...

+ Collaboration diagram for SM3:

Macros

#define UCL_SM3 7
Hash size. More...

Functions

void | ucl_sm3_init (ucl_sm3_ctx_t *ctx)
SM3 Init. More...
void | ucl_sm3_update (ucl_sm3_ctx_t *ctx, u8 *input, int ilen)
SM3 update. More...
void | ucl_sm3_finish (u8 *output, ucl_sm3_ctx_t *ctx)
SM3 Finish. More...
void | ucl_sm3 (u8 *output, u8 *input, int ilen)
SM3. More...
int | kdf_sm2_sm3 (u8 *secret_key, u8 *z, int zlen, int klen)
SM3 KDF. More...

Detailed Description

Secure Hash Algorithm 256, from FIPS 180-2.

Header:
ucl_sm3.h

SM3 is a data-digest algorithm and a component of the chinese cryptographic algorithms standard (see http://www.oscca.gov.cn/UpFile /20101222141857786.pdf. and draft-shen-sm3-hash-00 The algorithm takes as input a data of arbitrary length and produces as output a 256-bit "fingerprint" or "data digest" of the input.

SM3 Descriptor:

  • Block length : 512 bits
  • Hash length : 256 bits

Macro Definition Documentation

◆ UCL_SM3

#define UCL_SM3 7

Hash size.

Byte size of the output of SM3.

Function Documentation

◆ kdf_sm2_sm3()

int kdf_sm2_sm3 | ( | u8 * | secret_key,
 |  | u8 * | z,
 |  | int | zlen,
 |  | int | klen
 | ) |  |

SM3 KDF.

the KDF based on SM3 as defined in the draft-shen-ecdsa-01 sections 6 and 7.

Parameters
[out] | *secret_key | Pointer to the KDF result
[in] | *z | Pointer to the data
[in] | zlen | Data byte length
[in] | klen | KDF result len, in bits

limitation: klen shall be a multiple of 8

Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if hash is NULL

◆ ucl_sm3()

void ucl_sm3 | ( | u8 * | output,
 |  | u8 * | input,
 |  | int | ilen
 | ) |  |

SM3.

The complete process of SM3.

Precondition
Hash byte length is equal to 32
Parameters
[out] | hash | Pointer to the digest
[in] | data | Pointer to the data
[in] | data_byteLen | Data byte length
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if hash is NULL

◆ ucl_sm3_finish()

void ucl_sm3_finish | ( | u8 * | output,
 |  | ucl_sm3_ctx_t * | ctx
 | ) |  |

SM3 Finish.

Finish the process of SM3.

Precondition
Hash byte length is equal to 32
Parameters
[out] | hash | Pointer to the digest
[in,out] | context | Pointer to the context
Warning
ucl_sm3_init and #ucl_sm3_core must be processed before.
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if hash is the pointer NULL
UCL_INVALID_INPUT | if context is the pointer NULL

◆ ucl_sm3_init()

void ucl_sm3_init ( ucl_sm3_ctx_t * ctx )

SM3 Init.

The initialisation of SM3.

Parameters
[in,out] context Pointer to the context
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if context is NULL

◆ ucl_sm3_update()

void ucl_sm3_update | ( | ucl_sm3_ctx_t * | ctx,
 |  | u8 * | input,
 |  | int | ilen
 | ) |  |

SM3 update.

The core of SM3.

Parameters
[in,out] | context | Pointer to the context
[in] | input | Pointer to the data
[in] | ilen | Data byte length
Warning
ucl_sm3_init must be processed before, and ucl_sm3_finish should be processed to get the final hash.
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_NOP | if data_byteLen = 0 or if data is the pointer NULL


Universal Crypto Library: Message Authentication Code

Modules
Message Authentication Code

Message Authentication Code. More...

+ Collaboration diagram for Message Authentication Code:

Modules

CBC MAC
MAC with Cipher Block Chaining.
HMAC
Keying Hash Functions for Message Authentication: HMAC.

Detailed Description

Message Authentication Code.

A keyed hash functions is an hash function with two parameters, a message input and a secret (In several case this secret is a key of an underlying cipher). Keyed hash functions whose specific purpose is message authentication are called message authentication code (MAC) algorithms.
They provides data origin authentication with respect to the original message source.
The most commonly used MAC algorithm based on a block cipher makes use of cipherblock-chaining (CBC).

See also
Operation Modes
Note
Module Version 1.0


Universal Crypto Library: CBC MAC

Modules
CBC MAC
Message Authentication Code

MAC with Cipher Block Chaining. More...

+ Collaboration diagram for CBC MAC:

Modules

AES CBC_MAC
Encrypt / Decrypt with AES in CBC_MAC (Cipher Block Chaining) mode.
DES CBC MAC
ISO/IEC 9797-1:1999 MAC Algorithm 1 with DES.
TDES CBC MAC
ISO/IEC 9797 Part I MAC Algorithm 3 with DES.

Detailed Description

MAC with Cipher Block Chaining.


Universal Crypto Library: AES CBC_MAC

Functions
AES CBC_MAC
Message Authentication Code » CBC MAC

Encrypt / Decrypt with AES in CBC_MAC (Cipher Block Chaining) mode. More...

+ Collaboration diagram for AES CBC_MAC:

Functions

int | ucl_aes_cbc_mac (u8 *tmac, u8 tmac_byteLen, u8 *src, u32 len, u8 *key, u32 keylen, int mode)
AES-CBC_MAC. More...
int | ucl_aes_cbc_mac_init (ucl_aes_ctx_t *ctx, u8 *key, u32 keylen, int mode)
AES-CBC_MAC Init. More...
int | ucl_aes_cbc_mac_core (u8 *dst, ucl_aes_ctx_t *ctx, u8 *src, u32 len)
AES-CBC_MAC Core. More...
int | ucl_aes_cbc_mac_finish (ucl_aes_ctx_t *ctx)
AES-CBC_MAC Finish. More...

Detailed Description

Encrypt / Decrypt with AES in CBC_MAC (Cipher Block Chaining) mode.

Header:
ucl_aes_cbc_mac.h

Function Documentation

◆ ucl_aes_cbc_mac()

int ucl_aes_cbc_mac | ( | u8 * | tmac,
 |  | u8 | tmac_byteLen,
 |  | u8 * | src,
 |  | u32 | len,
 |  | u8 * | key,
 |  | u32 | keylen,
 |  | int | mode
 | ) |  |

AES-CBC_MAC.

Encrypt / Decrypt with AES in CBC_MAC (Cipher Block Chaining) mode.

Parameters
[out] | dst | Pointer to the output data
[in] | src | Pointer to the input data
[in] | len | Data byte length
[in] | key | Pointer to the AES Key
[in] keylen Key byte length:
  • UCL_AES_KEYLEN_128
  • UCL_AES_KEYLEN_192
  • UCL_AES_KEYLEN_256
[in] mode The mode (Encryption/Decryption):
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | no error occurred
UCL_INVALID_INPUT | one of the input is the pointer NULL
UCL_INVALID_OUTPUT | one of the output is the pointer NULL
UCL_INVALID_ARG | len is not a multiple of UCL_AES_BLOCKSIZE or keylen is invalid

◆ ucl_aes_cbc_mac_core()

int ucl_aes_cbc_mac_core | ( | u8 * | dst,
 |  | ucl_aes_ctx_t * | ctx,
 |  | u8 * | src,
 |  | u32 | len
 | ) |  |

AES-CBC_MAC Core.

Process the Data.

Parameters
[out] | dst | Pointer to the processed data
[in,out] | ctx | Pointer to the context
[in] | src | Pointer to the data
[in] | len | Data byte length
Precondition
The byte length must be a multiple of UCL_AES_BLOCKSIZE.
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | The output is the pointer NULL
UCL_INVALID_ARG | The data byte length is not a multiple of UCL_AES_BLOCKSIZE

◆ ucl_aes_cbc_mac_finish()

int ucl_aes_cbc_mac_finish ( ucl_aes_ctx_t * ctx )

AES-CBC_MAC Finish.

Zeroize the context.

Parameters
[in,out] ctx Pointer to the context
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_OUTPUT | The output is the pointer NULL

◆ ucl_aes_cbc_mac_init()

int ucl_aes_cbc_mac_init | ( | ucl_aes_ctx_t * | ctx,
 |  | u8 * | key,
 |  | u32 | keylen,
 |  | int | mode
 | ) |  |

AES-CBC_MAC Init.

Initialise AES CBC_MAC Context.

Parameters
[out] | ctx | Pointer to the context
[in] | key | Pointer to the AES Key
[in] keylen Key byte length:
  • UCL_AES_KEYLEN_128
  • UCL_AES_KEYLEN_192
  • UCL_AES_KEYLEN_256
[in] mode The mode (Encryption/Decryption) :
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | The input is the pointer NULL
UCL_INVALID_OUTPUT | The output is the pointer NULL
UCL_INVALID_ARG | keylen is invalid
UCL_INVALID_MODE | The mode is not one of those described


Universal Crypto Library: DES CBC MAC

Functions
DES CBC MAC
Message Authentication Code » CBC MAC

ISO/IEC 9797-1:1999 MAC Algorithm 1 with DES. More...

+ Collaboration diagram for DES CBC MAC:

Functions

int | ucl_des_cbc_mac (u8 *mac, u32 mac_byteLen, u8 *key, u8 *data, u32 data_byteLen)
DES-CBC-MAC. More...
int | ucl_des_cbc_mac_init (ucl_des_ctx_t *ctx, u8 *key)
DES-CBC-MAC Init. More...
int | ucl_des_cbc_mac_core (ucl_des_ctx_t *ctx, u8 *data, u32 data_byteLen)
DES-CBC-MAC Core. More...
int | ucl_des_cbc_mac_finish (u8 *mac, u32 mac_byteLen, ucl_des_ctx_t *ctx)
DES-CBC-MAC Finish. More...

Detailed Description

ISO/IEC 9797-1:1999 MAC Algorithm 1 with DES.

Header:
ucl_des_cbc_mac.h
Note
The message must be padded before process. Use a padding method described in ISO/IEC 9797.

Function Documentation

◆ ucl_des_cbc_mac()

int ucl_des_cbc_mac | ( | u8 * | mac,
 |  | u32 | mac_byteLen,
 |  | u8 * | key,
 |  | u8 * | data,
 |  | u32 | data_byteLen
 | ) |  |

DES-CBC-MAC.

Complete process.

Precondition
  • The data byte length must be a multiple of 8.
  • The mac byte length must be less or equal than 8 bytes.
  • The key length is 8 bytes.
Parameters
[out] | mac | Pointer to the mac
[in] | mac_byteLen | MAC byte length
[in] | key | Pointer to the DES Key
[in] | data | Pointer to the input data
[in] | data_byteLen | Data byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output is the pointer NULL
UCL_INVALID_ARG | If data_byteLen is not a multiple of 8 or If mac_byteLen is greater than 8

◆ ucl_des_cbc_mac_core()

int ucl_des_cbc_mac_core | ( | ucl_des_ctx_t * | ctx,
 |  | u8 * | data,
 |  | u32 | data_byteLen
 | ) |  |

DES-CBC-MAC Core.

Process the Data.

Precondition
The data byte length must be a multiple of 8.
Parameters
[in,out] | ctx | Pointer to the context
[in] | data | Pointer to the data
[in] | data_byteLen | Data byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL
UCL_INVALID_ARG | If the data byte length is not a multiple of 8

◆ ucl_des_cbc_mac_finish()

int ucl_des_cbc_mac_finish | ( | u8 * | mac,
 |  | u32 | mac_byteLen,
 |  | ucl_des_ctx_t * | ctx
 | ) |  |

DES-CBC-MAC Finish.

Zeroize the context and return result.

Precondition
The mac byte length must be less or equal than 8 bytes.
Parameters
[out] | mac | Pointer to the mac
[in] | mac_byteLen | MAC byte length
[in,out] | ctx | Pointer to the context
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_OUTPUT | If one of the outputs is the pointer NULL
UCL_INVALID_ARG | If MAC byte length is greater than 8 bytes

◆ ucl_des_cbc_mac_init()

int ucl_des_cbc_mac_init | ( | ucl_des_ctx_t * | ctx,
 |  | u8 * | key
 | ) |  |

DES-CBC-MAC Init.

Initialize DES CBC MAC Context.

Precondition
The key length is 8 bytes.
Parameters
[out] | ctx | Pointer to the context
[in] | key | Pointer to the DES Key
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If the input is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL


Universal Crypto Library: TDES CBC MAC

Data Structures | Macros | Functions
TDES CBC MAC
Message Authentication Code » CBC MAC

ISO/IEC 9797 Part I MAC Algorithm 3 with DES. More...

+ Collaboration diagram for TDES CBC MAC:

Data Structures

struct ucl_tdes_ctx_t
TDES-CBC-MAC Context. More...

Macros

#define ucl_tdes_ctx_t ucl_tdes_ctx_t
TDES-CBC-MAC Context.

Functions

int | ucl_tdes_cbc_mac (u8 *mac, u32 mac_byteLen, u8 *key, u8 *data, u32 data_byteLen)
TDES-CBC-MAC. More...
int | ucl_tdes_cbc_mac_init (ucl_tdes_ctx_t *ctx, u8 *key)
TDES-CBC-MAC Init. More...
int | ucl_tdes_cbc_mac_core (ucl_tdes_ctx_t *ctx, u8 *data, u32 data_length)
TDES-CBC-MAC Core. More...
int | ucl_tdes_cbc_mac_finish (u8 *mac, u32 mac_byteLen, ucl_tdes_ctx_t *ctx)
TDES-CBC-MAC Finish. More...

Detailed Description

ISO/IEC 9797 Part I MAC Algorithm 3 with DES.

Header:
ucl_tdes_cbc_mac.h
Note
The message must be padded before process. Use a padding method described in ISO/IEC 9797.

Function Documentation

◆ ucl_tdes_cbc_mac()

int ucl_tdes_cbc_mac | ( | u8 * | mac,
 |  | u32 | mac_byteLen,
 |  | u8 * | key,
 |  | u8 * | data,
 |  | u32 | data_byteLen
 | ) |  |

TDES-CBC-MAC.

Complete process.

Precondition
  • The data byte length must be a multiple of 8.
  • The mac byte length is 8 bytes.
  • The key length is 16 bytes.
Parameters
[out] | mac | Pointer to the mac
[in] | mac_byteLen | MAC byte Length
[in] | key | Pointer to the 3DES 128-bit key
[in] | data | Pointer to the input data
[in] | data_byteLen | Data byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output is the pointer NULL
UCL_INVALID_ARG | If mac_byteLen is greater than 8 or If data_byteLen is not a multiple of 8

◆ ucl_tdes_cbc_mac_core()

int ucl_tdes_cbc_mac_core | ( | ucl_tdes_ctx_t * | ctx,
 |  | u8 * | data,
 |  | u32 | data_length
 | ) |  |

TDES-CBC-MAC Core.

Process the Data.

Precondition
The data byte length must be a multiple of 8.
Parameters
[in,out] | ctx | Pointer to the context
[in] | data | Pointer to the data
[in] | data_length | Data byte length
Precondition
The byte length must be a multiple of 8.
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL
UCL_INVALID_ARG | If the byte length is not a multiple of 8

◆ ucl_tdes_cbc_mac_finish()

int ucl_tdes_cbc_mac_finish | ( | u8 * | mac,
 |  | u32 | mac_byteLen,
 |  | ucl_tdes_ctx_t * | ctx
 | ) |  |

TDES-CBC-MAC Finish.

Zeroize the context and return result.

Precondition
The mac byte length must be less or equal than 8 bytes.
Parameters
[out] | mac | Pointer to the mac
[in] | mac_byteLen | MAC byte Length
[in,out] | ctx | Pointer to the context
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_OUTPUT | If one of the outputs is the pointer NULL

◆ ucl_tdes_cbc_mac_init()

int ucl_tdes_cbc_mac_init | ( | ucl_tdes_ctx_t * | ctx,
 |  | u8 * | key
 | ) |  |

TDES-CBC-MAC Init.

Initialize TDES CBC MAC Context.

Precondition
The key length is 16 bytes.
Parameters
[out] | ctx | Pointer to the context
[in] | key | Pointer to the 3DES 128-bit key
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If the input is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL


Universal Crypto Library: ucl_tdes_ctx_t Struct Reference

Data Fields
ucl_tdes_ctx_t Struct Reference
Message Authentication Code » CBC MAC » TDES CBC MAC

TDES-CBC-MAC Context. More...

Data Fields

ucl_des_ctx_t des_ctx
DES Context. More...
u32 key2 [2]
Second Key. More...

Detailed Description

TDES-CBC-MAC Context.

Field Documentation

◆ des_ctx

ucl_des_ctx_t ucl_tdes_ctx_t::des_ctx

DES Context.

◆ key2

u32 ucl_tdes_ctx_t::key2[2]

Second Key.


Universal Crypto Library: HMAC

Modules
HMAC
Message Authentication Code

Keying Hash Functions for Message Authentication: HMAC. More...

+ Collaboration diagram for HMAC:

Modules

HMAC MD5
.
HMAC RIPEMD160
.
HMAC SHA1
.
HMAC SHA224
.
HMAC SHA256
.
HMAC SHA384
.
HMAC SHA512
.

Detailed Description

Keying Hash Functions for Message Authentication: HMAC.

If F is a secure hash function:

Where k' is the completion by adding 0's of k to a full b-bit block-size of the iterated hash function, opad and ipad are two fixed b-bit constants (the "i" and "o" are mnemonics for inner and outer), is the bitwise Exclusive Or operator, and the commas represent concatenation of the information. opad is formed by repeating the byte x'36' as many times as needed to get a b-bit block, and ipad is defined similarly using the byte x'5c'. (For example, in the case of MD5 and SHA-1 these bytes are repeated 64 times).


Universal Crypto Library: HMAC MD5

Functions
HMAC MD5
Message Authentication Code » HMAC

. More...

+ Collaboration diagram for HMAC MD5:

Functions

int | ucl_hmac_md5 (u8 *mac, u32 mac_byteLen, u8 *message, u32 message_byteLen, u8 *key, u32 key_byteLen)
The complete process of HMAC-MD5. More...
int | ucl_hmac_md5_init (ucl_md5_ctx_t *context, u8 *key, u32 key_byteLen)
The initialisation of HMAC-MD5. More...
int | ucl_hmac_md5_core (ucl_md5_ctx_t *context, u8 *data, u32 byteLen)
The core of MD5 . More...
int | ucl_hmac_md5_finish (u8 *mac, u32 mac_byteLen, ucl_md5_ctx_t *context, u8 *key, u32 key_byteLen)
Finish the process of MD5. More...

Detailed Description

.

Header:
ucl_hmac_md5.h

Function Documentation

◆ ucl_hmac_md5()

int ucl_hmac_md5 | ( | u8 * | mac,
 |  | u32 | mac_byteLen,
 |  | u8 * | message,
 |  | u32 | message_byteLen,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

The complete process of HMAC-MD5.

Parameters
[out] | mac | The 128-bit hmac of the message
[out] | mac_byteLen | MAC byte length
[in] | message | The message
[in] | message_byteLen | The byte length of the message
[in] | key | The key
[in] | key_byteLen | The key byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL

◆ ucl_hmac_md5_core()

int ucl_hmac_md5_core | ( | ucl_md5_ctx_t * | context,
 |  | u8 * | data,
 |  | u32 | byteLen
 | ) |  |

The core of MD5 .

Parameters
[in,out] | context | The MD5 context
[in] | data | Data
[in] | byteLen | Data byte length
Warning
ucl_hmac_md5_init must be processed before.
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the inputs are the pointer NULL
UCL_NOP | If dataLen = 0

◆ ucl_hmac_md5_finish()

int ucl_hmac_md5_finish | ( | u8 * | mac,
 |  | u32 | mac_byteLen,
 |  | ucl_md5_ctx_t * | context,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

Finish the process of MD5.

Parameters
[out] | mac | The hmac of the message
[out] | mac_byteLen | MAC byte length
[in] | context | The MD5 context
[in] | key | The key
[in] | key_byteLen | The key byte length
Warning
ucl_hmac_md5_init and ucl_hmac_md5_core must be processed before.
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_OUTPUT | If @ hmac is the pointer NULL
UCL_INVALID_INPUT | If context or key is the pointer NULL

◆ ucl_hmac_md5_init()

int ucl_hmac_md5_init | ( | ucl_md5_ctx_t * | context,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

The initialisation of HMAC-MD5.

Parameters
[in,out] | context | The MD5 context
[in] | key | The key
[in] | key_byteLen | The key byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If context or key is NULL


Universal Crypto Library: HMAC RIPEMD160

Functions
HMAC RIPEMD160
Message Authentication Code » HMAC

. More...

+ Collaboration diagram for HMAC RIPEMD160:

Functions

int | ucl_hmac_ripemd160 (u8 *mac, u32 mac_byteLen, u8 *message, u32 message_byteLen, u8 *key, u32 key_byteLen)
The complete process of HMAC-RIPEMD160. More...
int | ucl_hmac_ripemd160_init (ucl_ripemd160_ctx_t *context, u8 *key, u32 key_byteLen)
The initialisation of HMAC-RIPEMD160. More...
int | ucl_hmac_ripemd160_core (ucl_ripemd160_ctx_t *context, u8 *data, u32 byteLen)
The core of RIPEMD160 . More...
int | ucl_hmac_ripemd160_finish (u8 *mac, u32 mac_byteLen, ucl_ripemd160_ctx_t *context, u8 *key, u32 key_byteLen)
Finish the process of RIPEMD160. More...

Detailed Description

.

Header:
ucl_hmac_ripemd160.h

Function Documentation

◆ ucl_hmac_ripemd160()

int ucl_hmac_ripemd160 | ( | u8 * | mac,
 |  | u32 | mac_byteLen,
 |  | u8 * | message,
 |  | u32 | message_byteLen,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

The complete process of HMAC-RIPEMD160.

Parameters
[out] | mac | The 128-bit hmac of the message
[out] | mac_byteLen | MAC byte length
[in] | message | The message
[in] | message_byteLen | The byte length of the message
[in] | key | The key
[in] | key_byteLen | The key byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL

◆ ucl_hmac_ripemd160_core()

int ucl_hmac_ripemd160_core | ( | ucl_ripemd160_ctx_t * | context,
 |  | u8 * | data,
 |  | u32 | byteLen
 | ) |  |

The core of RIPEMD160 .

Parameters
[in,out] | context | The RIPEMD160 context
[in] | data | Data
[in] | byteLen | Data byte length
Warning
ucl_hmac_ripemd160_init must be processed before.
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the inputs are the pointer NULL
UCL_NOP | If dataLen = 0

◆ ucl_hmac_ripemd160_finish()

int ucl_hmac_ripemd160_finish | ( | u8 * | mac,
 |  | u32 | mac_byteLen,
 |  | ucl_ripemd160_ctx_t * | context,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

Finish the process of RIPEMD160.

Parameters
[out] | mac | The hmac of the message
[out] | mac_byteLen | MAC byte length
[in] | context | The RIPEMD160 context
[in] | key | The key
[in] | key_byteLen | The key byte length
Warning
ucl_hmac_ripemd160_init and ucl_hmac_ripemd160_core must be processed before.
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_OUTPUT | If @ hmac is the pointer NULL
UCL_INVALID_INPUT | If context or key is the pointer NULL

◆ ucl_hmac_ripemd160_init()

int ucl_hmac_ripemd160_init | ( | ucl_ripemd160_ctx_t * | context,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

The initialisation of HMAC-RIPEMD160.

Parameters
[in,out] | context | The RIPEMD160 context
[in] | key | The key
[in] | key_byteLen | The key byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If context or key is NULL


Universal Crypto Library: HMAC SHA1

Functions
HMAC SHA1
Message Authentication Code » HMAC

. More...

+ Collaboration diagram for HMAC SHA1:

Functions

int | ucl_hmac_sha1 (u8 *mac, u32 mac_byteLen, u8 *message, u32 message_byteLen, u8 *key, u32 key_byteLen)
The complete process of HMAC-SHA1. More...
int | ucl_hmac_sha1_init (ucl_sha1_ctx_t *context, u8 *key, u32 key_byteLen)
The initialisation of HMAC-SHA1. More...
int | ucl_hmac_sha1_core (ucl_sha1_ctx_t *context, u8 *data, u32 byteLen)
The core of SHA1 . More...
int | ucl_hmac_sha1_finish (u8 *mac, u32 mac_byteLen, ucl_sha1_ctx_t *context, u8 *key, u32 key_byteLen)
Finish the process of SHA1. More...

Detailed Description

.

Header:
ucl_hmac_sha1.h

Function Documentation

◆ ucl_hmac_sha1()

int ucl_hmac_sha1 | ( | u8 * | mac,
 |  | u32 | mac_byteLen,
 |  | u8 * | message,
 |  | u32 | message_byteLen,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

The complete process of HMAC-SHA1.

Parameters
[out] | mac | The 128-bit hmac of the message
[out] | mac_byteLen | MAC byte length
[in] | message | The message
[in] | message_byteLen | The byte length of the message
[in] | key | The key
[in] | key_byteLen | The key byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL

◆ ucl_hmac_sha1_core()

int ucl_hmac_sha1_core | ( | ucl_sha1_ctx_t * | context,
 |  | u8 * | data,
 |  | u32 | byteLen
 | ) |  |

The core of SHA1 .

Parameters
[in,out] | context | The SHA1 context
[in] | data | Data
[in] | byteLen | Data byte length
Warning
ucl_hmac_sha1_init must be processed before.
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the inputs are the pointer NULL
UCL_NOP | If dataLen = 0

◆ ucl_hmac_sha1_finish()

int ucl_hmac_sha1_finish | ( | u8 * | mac,
 |  | u32 | mac_byteLen,
 |  | ucl_sha1_ctx_t * | context,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

Finish the process of SHA1.

Parameters
[out] | mac | The hmac of the message
[out] | mac_byteLen | MAC byte length
[in] | context | The SHA1 context
[in] | key | The key
[in] | key_byteLen | The key byte length
Warning
ucl_hmac_sha1_init and ucl_hmac_sha1_core must be processed before.
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_OUTPUT | If @ hmac is the pointer NULL
UCL_INVALID_INPUT | If context or key is the pointer NULL

◆ ucl_hmac_sha1_init()

int ucl_hmac_sha1_init | ( | ucl_sha1_ctx_t * | context,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

The initialisation of HMAC-SHA1.

Parameters
[in,out] | context | The SHA1 context
[in] | key | The key
[in] | key_byteLen | The key byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If context or key is NULL


Universal Crypto Library: HMAC SHA224

Functions
HMAC SHA224
Message Authentication Code » HMAC

. More...

+ Collaboration diagram for HMAC SHA224:

Functions

int | ucl_hmac_sha224 (u8 *mac, u32 mac_byteLen, u8 *message, u32 message_byteLen, u8 *key, u32 key_byteLen)
The complete process of HMAC-SHA224. More...
int | ucl_hmac_sha224_init (ucl_sha224_ctx_t *context, u8 *key, u32 key_byteLen)
The initialisation of HMAC-SHA224. More...
int | ucl_hmac_sha224_core (ucl_sha224_ctx_t *context, u8 *data, u32 byteLen)
The core of SHA224 . More...
int | ucl_hmac_sha224_finish (u8 *mac, u32 mac_byteLen, ucl_sha224_ctx_t *context, u8 *key, u32 key_byteLen)
Finish the process of SHA224. More...

Detailed Description

.

Header:
ucl_hmac_sha224.h

Function Documentation

◆ ucl_hmac_sha224()

int ucl_hmac_sha224 | ( | u8 * | mac,
 |  | u32 | mac_byteLen,
 |  | u8 * | message,
 |  | u32 | message_byteLen,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

The complete process of HMAC-SHA224.

Parameters
[out] | mac | The 128-bit hmac of the message
[out] | mac_byteLen | MAC byte length
[in] | message | The message
[in] | message_byteLen | The byte length of the message
[in] | key | The key
[in] | key_byteLen | The key byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL

◆ ucl_hmac_sha224_core()

int ucl_hmac_sha224_core | ( | ucl_sha224_ctx_t * | context,
 |  | u8 * | data,
 |  | u32 | byteLen
 | ) |  |

The core of SHA224 .

Parameters
[in,out] | context | The SHA224 context
[in] | data | Data
[in] | byteLen | Data byte length
Warning
ucl_hmac_sha224_init must be processed before.
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the inputs are the pointer NULL
UCL_NOP | If dataLen = 0

◆ ucl_hmac_sha224_finish()

int ucl_hmac_sha224_finish | ( | u8 * | mac,
 |  | u32 | mac_byteLen,
 |  | ucl_sha224_ctx_t * | context,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

Finish the process of SHA224.

Parameters
[out] | mac | The hmac of the message
[out] | mac_byteLen | MAC byte length
[in] | context | The SHA224 context
[in] | key | The key
[in] | key_byteLen | The key byte length
Warning
ucl_hmac_sha224_init and ucl_hmac_sha224_core must be processed before.
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_OUTPUT | If @ hmac is the pointer NULL
UCL_INVALID_INPUT | If context or key is the pointer NULL

◆ ucl_hmac_sha224_init()

int ucl_hmac_sha224_init | ( | ucl_sha224_ctx_t * | context,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

The initialisation of HMAC-SHA224.

Parameters
[in,out] | context | The SHA224 context
[in] | key | The key
[in] | key_byteLen | The key byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If context or key is NULL


Universal Crypto Library: HMAC SHA256

Functions
HMAC SHA256
Message Authentication Code » HMAC

. More...

+ Collaboration diagram for HMAC SHA256:

Functions

int | ucl_hmac_sha256 (u8 *mac, u32 mac_byteLen, u8 *message, u32 message_byteLen, u8 *key, u32 key_byteLen)
The complete process of HMAC-SHA256. More...
int | ucl_hmac_sha256_init (ucl_sha256_ctx_t *context, u8 *key, u32 key_byteLen)
The initialisation of HMAC-SHA256. More...
int | ucl_hmac_sha256_core (ucl_sha256_ctx_t *context, u8 *data, u32 byteLen)
The core of SHA256 . More...
int | ucl_hmac_sha256_finish (u8 *mac, u32 mac_byteLen, ucl_sha256_ctx_t *context, u8 *key, u32 key_byteLen)
Finish the process of SHA256. More...

Detailed Description

.

Header:
ucl_hmac_sha256.h

Function Documentation

◆ ucl_hmac_sha256()

int ucl_hmac_sha256 | ( | u8 * | mac,
 |  | u32 | mac_byteLen,
 |  | u8 * | message,
 |  | u32 | message_byteLen,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

The complete process of HMAC-SHA256.

Parameters
[out] | mac | The 128-bit hmac of the message
[out] | mac_byteLen | MAC byte length
[in] | message | The message
[in] | message_byteLen | The byte length of the message
[in] | key | The key
[in] | key_byteLen | The key byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL

◆ ucl_hmac_sha256_core()

int ucl_hmac_sha256_core | ( | ucl_sha256_ctx_t * | context,
 |  | u8 * | data,
 |  | u32 | byteLen
 | ) |  |

The core of SHA256 .

Parameters
[in,out] | context | The SHA256 context
[in] | data | Data
[in] | byteLen | Data byte length
Warning
ucl_hmac_sha256_init must be processed before.
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the inputs are the pointer NULL
UCL_NOP | If dataLen = 0

◆ ucl_hmac_sha256_finish()

int ucl_hmac_sha256_finish | ( | u8 * | mac,
 |  | u32 | mac_byteLen,
 |  | ucl_sha256_ctx_t * | context,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

Finish the process of SHA256.

Parameters
[out] | mac | The hmac of the message
[out] | mac_byteLen | MAC byte length
[in] | context | The SHA256 context
[in] | key | The key
[in] | key_byteLen | The key byte length
Warning
ucl_hmac_sha256_init and ucl_hmac_sha256_core must be processed before.
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_OUTPUT | If @ hmac is the pointer NULL
UCL_INVALID_INPUT | If context or key is the pointer NULL

◆ ucl_hmac_sha256_init()

int ucl_hmac_sha256_init | ( | ucl_sha256_ctx_t * | context,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

The initialisation of HMAC-SHA256.

Parameters
[in,out] | context | The SHA256 context
[in] | key | The key
[in] | key_byteLen | The key byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If context or key is NULL


Universal Crypto Library: HMAC SHA384

Functions
HMAC SHA384
Message Authentication Code » HMAC

. More...

+ Collaboration diagram for HMAC SHA384:

Functions

int | ucl_hmac_sha384 (u8 *mac, u32 mac_byteLen, u8 *message, u32 message_byteLen, u8 *key, u32 key_byteLen)
The complete process of HMAC-SHA384. More...
int | ucl_hmac_sha384_init (ucl_sha384_ctx_t *context, u8 *key, u32 key_byteLen)
The initialisation of HMAC-SHA384. More...
int | ucl_hmac_sha384_core (ucl_sha384_ctx_t *context, u8 *data, u32 byteLen)
The core of SHA384 . More...
int | ucl_hmac_sha384_finish (u8 *mac, u32 mac_byteLen, ucl_sha384_ctx_t *context, u8 *key, u32 key_byteLen)
Finish the process of SHA384. More...

Detailed Description

.

Header:
ucl_hmac_sha384.h

Function Documentation

◆ ucl_hmac_sha384()

int ucl_hmac_sha384 | ( | u8 * | mac,
 |  | u32 | mac_byteLen,
 |  | u8 * | message,
 |  | u32 | message_byteLen,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

The complete process of HMAC-SHA384.

Parameters
[out] | mac | The 128-bit hmac of the message
[out] | mac_byteLen | MAC byte length
[in] | message | The message
[in] | message_byteLen | The byte length of the message
[in] | key | The key
[in] | key_byteLen | The key byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL

◆ ucl_hmac_sha384_core()

int ucl_hmac_sha384_core | ( | ucl_sha384_ctx_t * | context,
 |  | u8 * | data,
 |  | u32 | byteLen
 | ) |  |

The core of SHA384 .

Parameters
[in,out] | context | The SHA384 context
[in] | data | Data
[in] | byteLen | Data byte length
Warning
ucl_hmac_sha384_init must be processed before.
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the inputs are the pointer NULL
UCL_NOP | If dataLen = 0

◆ ucl_hmac_sha384_finish()

int ucl_hmac_sha384_finish | ( | u8 * | mac,
 |  | u32 | mac_byteLen,
 |  | ucl_sha384_ctx_t * | context,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

Finish the process of SHA384.

Parameters
[out] | mac | The hmac of the message
[out] | mac_byteLen | MAC byte length
[in] | context | The SHA384 context
[in] | key | The key
[in] | key_byteLen | The key byte length
Warning
ucl_hmac_sha384_init and ucl_hmac_sha384_core must be processed before.
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_OUTPUT | If @ hmac is the pointer NULL
UCL_INVALID_INPUT | If context or key is the pointer NULL

◆ ucl_hmac_sha384_init()

int ucl_hmac_sha384_init | ( | ucl_sha384_ctx_t * | context,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

The initialisation of HMAC-SHA384.

Parameters
[in,out] | context | The SHA384 context
[in] | key | The key
[in] | key_byteLen | The key byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If context or key is NULL


Universal Crypto Library: HMAC SHA512

Functions
HMAC SHA512
Message Authentication Code » HMAC

. More...

+ Collaboration diagram for HMAC SHA512:

Functions

int | ucl_hmac_sha512 (u8 *mac, u32 mac_byteLen, u8 *message, u32 message_byteLen, u8 *key, u32 key_byteLen)
The complete process of HMAC-SHA512. More...
int | ucl_hmac_sha512_init (ucl_sha512_ctx_t *context, u8 *key, u32 key_byteLen)
The initialisation of HMAC-SHA512. More...
int | ucl_hmac_sha512_core (ucl_sha512_ctx_t *context, u8 *data, u32 byteLen)
The core of SHA512 . More...
int | ucl_hmac_sha512_finish (u8 *mac, u32 mac_byteLen, ucl_sha512_ctx_t *context, u8 *key, u32 key_byteLen)
Finish the process of SHA512. More...

Detailed Description

.

Header:
ucl_hmac_sha512.h

Function Documentation

◆ ucl_hmac_sha512()

int ucl_hmac_sha512 | ( | u8 * | mac,
 |  | u32 | mac_byteLen,
 |  | u8 * | message,
 |  | u32 | message_byteLen,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

The complete process of HMAC-SHA512.

Parameters
[out] | mac | The 128-bit hmac of the message
[out] | mac_byteLen | MAC byte length
[in] | message | The message
[in] | message_byteLen | The byte length of the message
[in] | key | The key
[in] | key_byteLen | The key byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL

◆ ucl_hmac_sha512_core()

int ucl_hmac_sha512_core | ( | ucl_sha512_ctx_t * | context,
 |  | u8 * | data,
 |  | u32 | byteLen
 | ) |  |

The core of SHA512 .

Parameters
[in,out] | context | The SHA512 context
[in] | data | Data
[in] | byteLen | Data byte length
Warning
ucl_hmac_sha512_init must be processed before.
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the inputs are the pointer NULL
UCL_NOP | If dataLen = 0

◆ ucl_hmac_sha512_finish()

int ucl_hmac_sha512_finish | ( | u8 * | mac,
 |  | u32 | mac_byteLen,
 |  | ucl_sha512_ctx_t * | context,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

Finish the process of SHA512.

Parameters
[out] | mac | The hmac of the message
[out] | mac_byteLen | MAC byte length
[in] | context | The SHA512 context
[in] | key | The key
[in] | key_byteLen | The key byte length
Warning
ucl_hmac_sha512_init and ucl_hmac_sha512_core must be processed before.
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_OUTPUT | If @ hmac is the pointer NULL
UCL_INVALID_INPUT | If context or key is the pointer NULL

◆ ucl_hmac_sha512_init()

int ucl_hmac_sha512_init | ( | ucl_sha512_ctx_t * | context,
 |  | u8 * | key,
 |  | u32 | key_byteLen
 | ) |  |

The initialisation of HMAC-SHA512.

Parameters
[in,out] | context | The SHA512 context
[in] | key | The key
[in] | key_byteLen | The key byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If context or key is NULL


Universal Crypto Library: Miscellaneous functions

Modules
Miscellaneous functions

Functions of UCL which don't belong to another module. More...

+ Collaboration diagram for Miscellaneous functions:

Modules

Mathematical functions
Mathematical miscellaneous functions.
Self Tests
Integrity Tests.

Detailed Description

Functions of UCL which don't belong to another module.

Note
Module Version 1.0


Universal Crypto Library: Mathematical functions

Functions
Mathematical functions
Miscellaneous functions

Mathematical miscellaneous functions. More...

+ Collaboration diagram for Mathematical functions:

Functions

int | ucl_misc_div64by32 (u32 *ptQ1, u32 *ptQ0, u32 *ptR, u32 a1, u32 a0, u32 b)
Euclidian Division of a 64bits word by a 32bits word . More...
int | ucl_misc_incW64byW32 (u32 *b, u32 a)
Increment a 64-bit word by a 32-bit word . More...

Detailed Description

Mathematical miscellaneous functions.

Header:
ucl_misc_math.h

Those particular functions use special MIPS� 4KSd instruction.

Function Documentation

◆ ucl_misc_div64by32()

int ucl_misc_div64by32 | ( | u32 * | ptQ1,
 |  | u32 * | ptQ0,
 |  | u32 * | ptR,
 |  | u32 | a1,
 |  | u32 | a0,
 |  | u32 | b
 | ) |  |

Euclidian Division of a 64bits word by a 32bits word .

Let a and q two 64bits unsigned words such that

Let b and r two 32-bit unsigned words

If preconditions are satisfied then

Parameters
[out] | ptQ1 | Pointer to the higher word of the quotient q
[out] | ptQ0 | Pointer to the lower word of the quotient q
[out] | ptR | Pointer to the reminder r
[in] | a1 | The higher word of a
[in] | a0 | The lower word of a
[in] | b | The divisor
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_OUTPUT | If an output is the pointer NULL
UCL_INVALID_INPUT | If an intput is the pointer NULL
UCL_INVALID_PRECISION | If invalid precision

◆ ucl_misc_incW64byW32()

int ucl_misc_incW64byW32 | ( | u32 * | b,
 |  | u32 | a
 | ) |  |

Increment a 64-bit word by a 32-bit word .

Parameters
[in] | b | A 64-bit word
[in] | a | A 32-bit word
Returns
The carry.
Return values
UCL_INVALID_INPUT if an intput is the pointer NULL


Universal Crypto Library: Self Tests

Functions
Self Tests
Miscellaneous functions

Integrity Tests. More...

+ Collaboration diagram for Self Tests:

Functions

int | ucl_cipher_des_stest (void)
DES Primitive self test. More...
int | ucl_cipher_3des_stest (void)
3DES Primitive self test. More...
int | ucl_cipher_aes_stest (void)
AES Primitive self test. More...
int | ucl_pkc_rsa_stest (void)
RSA Primitive self test. More...
int | ucl_pkc_public_rsa_stest (void)
RSA public key Primitive self test. More...
int | ucl_pkc_dsa_stest (void)
DSA Primitive self test. More...
int | ucl_ecdsa_p224r1_sha1_stest (void)
ECDSA secp224r1 SHA-1 self test. More...
int | ucl_ecdsa_p224r1_sha224_stest (void)
ECDSA secp224r1 SHA-1 self test. More...
int | ucl_ecdsa_p521r1_sha512_stest (void)
ECDSA secp521r1 SHA-512 self test. More...
int | ucl_ecdsa_p384r1_sha384_stest (void)
ECDSA secp384r1 SHA-384 self test. More...
int | ucl_ecdsa_p160r1_sha256_stest (void)
ECDSA secp160r1 SHA-256 self test. More...
int | ucl_ecdsa_p160r1_sha1_stest (void)
ECDSA secp160r1 SHA-1 self test. More...
int | ucl_ecdsa_p192r1_sha1_stest (void)
ECDSA secp192r1 SHA-1 self test. More...
int | ucl_ecdsa_p192r1_sha256_stest (void)
ECDSA secp192r1 SHA-256 self test. More...
int | ucl_ecdsa_p256r1_sha256_stest (void)
ECDSA secp256r1 SHA-256 self test. More...
int | ucl_ecdsa_p256r1_sha1_stest (void)
ECDSA secp256r1 SHA-1 self test. More...
int | ucl_ecdsa_p224r1_sha1_selftest (void)
ECDSA secp224r1 SHA-1 self test. More...
int | ucl_ecdsa_p224r1_sha224_selftest (void)
ECDSA secp224r1 SHA-224 self test. More...
int | ucl_ecdsa_p521r1_sha512_selftest (void)
ECDSA secp521r1 SHA-512 self test. More...
int | ucl_ecdsa_p384r1_sha384_selftest (void)
ECDSA secp384r1 SHA-384 self test. More...
int | ucl_ecdsa_p160r1_sha256_selftest (void)
ECDSA secp160r1 SHA-256 self test. More...
int | ucl_ecdsa_p160r1_sha1_selftest (void)
ECDSA secp160r1 SHA-1 self test. More...
int | ucl_ecdsa_p192r1_sha1_selftest (void)
ECDSA secp192r1 SHA-1 self test. More...
int | ucl_ecdsa_p192r1_sha256_selftest (void)
ECDSA secp192r1 SHA-256 self test. More...
int | ucl_ecdsa_p256r1_sha256_selftest (void)
ECDSA secp256r1 SHA-256 self test. More...
int | ucl_ecdsa_p256r1_sha1_selftest (void)
ECDSA secp256r1 SHA-1 self test. More...
int | ucl_hash_hdes_stest (void)
HDES self test. More...
int | ucl_hash_sha256_stest (void)
SHA256 self test. More...
int | ucl_hash_sha384_stest (void)
SHA384 self test. More...
int | ucl_hash_sha224_stest (void)
SHA224 self test. More...
int | ucl_hash_sha512_stest (void)
SHA512 self test. More...
int | ucl_hash_sha1_stest (void)
SHA1 self test. More...
int | ucl_hash_ripemd160_stest (void)
RIPEMD160 self test. More...

Detailed Description

Integrity Tests.

Header:
ucl_stest.h

This module provides functions to test UCL primitives. Those functions must be used in the case of self tests are necessary.

Function Documentation

◆ ucl_cipher_3des_stest()

int ucl_cipher_3des_stest ( void )

3DES Primitive self test.

Test 3DES.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_cipher_aes_stest()

int ucl_cipher_aes_stest ( void )

AES Primitive self test.

Test AES 128/192/256 bits key length.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_cipher_des_stest()

int ucl_cipher_des_stest ( void )

DES Primitive self test.

Test DES.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_ecdsa_p160r1_sha1_selftest()

int ucl_ecdsa_p160r1_sha1_selftest ( void )

ECDSA secp160r1 SHA-1 self test.

Test ECDSA function with the new API (verify/sign) for the secp160r1 curve and the SHA-1 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_ecdsa_p160r1_sha1_stest()

int ucl_ecdsa_p160r1_sha1_stest ( void )

ECDSA secp160r1 SHA-1 self test.

Test ECDSA function (verify/sign) for the secp160r1 curve and the SHA-1 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_ecdsa_p160r1_sha256_selftest()

int ucl_ecdsa_p160r1_sha256_selftest ( void )

ECDSA secp160r1 SHA-256 self test.

Test ECDSA function with the new API (verify/sign) for the secp160r1 curve and the SHA-256 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_ecdsa_p160r1_sha256_stest()

int ucl_ecdsa_p160r1_sha256_stest ( void )

ECDSA secp160r1 SHA-256 self test.

Test ECDSA function (verify/sign) for the secp160r1 curve and the SHA-256 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_ecdsa_p192r1_sha1_selftest()

int ucl_ecdsa_p192r1_sha1_selftest ( void )

ECDSA secp192r1 SHA-1 self test.

Test ECDSA function with the new API (verify/sign) for the secp192r1 curve and the SHA-1 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_ecdsa_p192r1_sha1_stest()

int ucl_ecdsa_p192r1_sha1_stest ( void )

ECDSA secp192r1 SHA-1 self test.

Test ECDSA function (verify/sign) for the secp192r1 curve and the SHA-1 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_ecdsa_p192r1_sha256_selftest()

int ucl_ecdsa_p192r1_sha256_selftest ( void )

ECDSA secp192r1 SHA-256 self test.

Test ECDSA function with the new API (verify/sign) for the secp192r1 curve and the SHA-256 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_ecdsa_p192r1_sha256_stest()

int ucl_ecdsa_p192r1_sha256_stest ( void )

ECDSA secp192r1 SHA-256 self test.

Test ECDSA function (verify/sign) for the secp192r1 curve and the SHA-256 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_ecdsa_p224r1_sha1_selftest()

int ucl_ecdsa_p224r1_sha1_selftest ( void )

ECDSA secp224r1 SHA-1 self test.

Test ECDSA function with the new API (verify/sign) for the secp224r1 curve and the SHA-1 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_ecdsa_p224r1_sha1_stest()

int ucl_ecdsa_p224r1_sha1_stest ( void )

ECDSA secp224r1 SHA-1 self test.

Test ECDSA function (verify/sign) for the secp224r1 curve and the SHA-1 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_ecdsa_p224r1_sha224_selftest()

int ucl_ecdsa_p224r1_sha224_selftest ( void )

ECDSA secp224r1 SHA-224 self test.

Test ECDSA function with the new API (verify/sign) for the secp224r1 curve and the SHA-224 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_ecdsa_p224r1_sha224_stest()

int ucl_ecdsa_p224r1_sha224_stest ( void )

ECDSA secp224r1 SHA-1 self test.

Test ECDSA function (verify/sign) for the secp224r1 curve and the SHA-1 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_ecdsa_p256r1_sha1_selftest()

int ucl_ecdsa_p256r1_sha1_selftest ( void )

ECDSA secp256r1 SHA-1 self test.

Test ECDSA function with the new API (verify) for the secp256r1 curve and the SHA-1 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_ecdsa_p256r1_sha1_stest()

int ucl_ecdsa_p256r1_sha1_stest ( void )

ECDSA secp256r1 SHA-1 self test.

Test ECDSA function with the new API (verify) for the secp256r1 curve and the SHA-1 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_ecdsa_p256r1_sha256_selftest()

int ucl_ecdsa_p256r1_sha256_selftest ( void )

ECDSA secp256r1 SHA-256 self test.

Test ECDSA function with the new API (verify/sign) for the secp256r1 curve and the SHA-256 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_ecdsa_p256r1_sha256_stest()

int ucl_ecdsa_p256r1_sha256_stest ( void )

ECDSA secp256r1 SHA-256 self test.

Test ECDSA function (verify/sign) for the secp256r1 curve and the SHA-256 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_ecdsa_p384r1_sha384_selftest()

int ucl_ecdsa_p384r1_sha384_selftest ( void )

ECDSA secp384r1 SHA-384 self test.

Test ECDSA function with the new API (verify/sign) for the secp384r1 curve and the SHA-384 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_ecdsa_p384r1_sha384_stest()

int ucl_ecdsa_p384r1_sha384_stest ( void )

ECDSA secp384r1 SHA-384 self test.

Test ECDSA function (verify/sign) for the secp384r1 curve and the SHA-384 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_ecdsa_p521r1_sha512_selftest()

int ucl_ecdsa_p521r1_sha512_selftest ( void )

ECDSA secp521r1 SHA-512 self test.

Test ECDSA function with the new API (verify/sign) for the secp521r1 curve and the SHA-512 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_ecdsa_p521r1_sha512_stest()

int ucl_ecdsa_p521r1_sha512_stest ( void )

ECDSA secp521r1 SHA-512 self test.

Test ECDSA function (verify/sign) for the secp521r1 curve and the SHA-512 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_hash_hdes_stest()

int ucl_hash_hdes_stest ( void )

HDES self test.

Test HDES hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_hash_ripemd160_stest()

int ucl_hash_ripemd160_stest ( void )

RIPEMD160 self test.

Test RIPEMD160 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_hash_sha1_stest()

int ucl_hash_sha1_stest ( void )

SHA1 self test.

Test SHA1 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_hash_sha224_stest()

int ucl_hash_sha224_stest ( void )

SHA224 self test.

Test SHA224 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_hash_sha256_stest()

int ucl_hash_sha256_stest ( void )

SHA256 self test.

Test SHA256 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_hash_sha384_stest()

int ucl_hash_sha384_stest ( void )

SHA384 self test.

Test SHA384 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_hash_sha512_stest()

int ucl_hash_sha512_stest ( void )

SHA512 self test.

Test SHA512 hash function.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_pkc_dsa_stest()

int ucl_pkc_dsa_stest ( void )

DSA Primitive self test.

Test DSA encryption, decryption.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_pkc_public_rsa_stest()

int ucl_pkc_public_rsa_stest ( void )

RSA public key Primitive self test.

Test RSA encryption.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed

◆ ucl_pkc_rsa_stest()

int ucl_pkc_rsa_stest ( void )

RSA Primitive self test.

Test RSA encryption, decryption and CRT decryption.

Returns
Error code
Return values
UCL_OK | Test passed
UCL_ERROR | Test failed


Universal Crypto Library: Operation Modes

Modules
Operation Modes

Operation Modes. More...

+ Collaboration diagram for Operation Modes:

Modules

CBC
Cipher Block Chaining.
CCM
Counter with CBC-MAC.
CFB
Cipher Feedback mode.
ECB
Electronic Codebook.
OFB
Output Feedback.

Detailed Description

Operation Modes.

This section defines four modes of operation for the ciphers which may be used in a wide variety of applications. The modes specify how data will be encrypted (cryptographically protected) and decrypted (returned to original form).

The modes included in this standard are:

  • The Electronic Codebook (ECB) mode
  • The Cipher Block Chaining (CBC) mode
  • The Cipher Feedback (CFB) mode
  • The CBC-MAC with CRT (CCM) mode
  • The Galois Counter Mode (GCM and GMAC) mode
  • The RFC 3394 Keywrap mode
Note
Module Version 1.1


Universal Crypto Library: CBC

Modules | Functions
CBC
Operation Modes

Cipher Block Chaining. More...

+ Collaboration diagram for CBC:

Modules

3DES CBC
Encrypt / Decrypt with 3DES in CBC (Cipher Block Chaining) mode.
AES CBC
Encrypt / Decrypt with AES in CBC (Cipher Block Chaining) mode.
DES CBC
Encrypt / Decrypt with DES in CBC (Cipher Block Chaining) mode.
USIP AES CBC
Encrypt / Decrypt with USIP® AES in CBC (Cipher Block Chaining) mode.

Functions

int ucl_3des_eee_cbc (u8 *dataOut, u8 *dataIn, u8 *key, u8 *IV, u32 byteLen, int mode)
3DES-EEE-CBC. More...

Detailed Description

Cipher Block Chaining.

CBC is an operation mode in which the first plain text data block is exclusive-ORed with a block of pseudo-random data prior to being processed through the underlying cipher. The resulting cipher text block is then exclusive-ORed with the next plain text data block to form the next input block to the cipher, thus chaining together blocks of cipher text. The chaining of cipher text blocks provides an error extension characteristic which is valuable in protecting against fraudulent data alteration.

Note
This mode requires an initialization vector IV to combine with the first plaintext block. The IV need not be secret, but it must be unpredictable. We recommend to generate it with the USIP® TRNG.

Function Documentation

◆ ucl_3des_eee_cbc()

int ucl_3des_eee_cbc | ( | u8 * | dataOut,
 |  | u8 * | dataIn,
 |  | u8 * | key,
 |  | u8 * | IV,
 |  | u32 | byteLen,
 |  | int | mode
 | ) |  |

3DES-EEE-CBC.

Encrypt / Decrypt with 3DES-EEE in CBC (Cipher Block Chaining) mode.

According to mode, dataOut is the encrypted or decrypted of dataIn.

Parameters
[out] | dataOut | Pointer to the output data
[in] | dataIn | Pointer to the input data
[in] | key | Pointer to the DES Key
[in] | IV | Pointer to the initialization vector
[in] | byteLen | Data byte length
[in] mode The mode (Encryption/Decryption):
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if one of the input is the pointer NULL
UCL_INVALID_OUTPUT | if one of the output is the pointer NULL
UCL_INVALID_ARG | if byteLen is not a multiple of 8
Note
This mode requires an initialization vector IV to combine with the first plaintext block. The IV need not be secret, but it must be unpredictable.
We recommand to generate it with the USIP TRNG.


Universal Crypto Library: 3DES CBC

Functions
3DES CBC
Operation Modes » CBC

Encrypt / Decrypt with 3DES in CBC (Cipher Block Chaining) mode. More...

+ Collaboration diagram for 3DES CBC:

Functions

int | ucl_3des_cbc (u8 *dataOut, u8 *dataIn, u8 *key, u8 *IV, u32 data_byteLen, int mode)
3DES-CBC. More...
int | ucl_3des_cbc_init (ucl_3des_ctx_t *ctx, u8 *key, u8 *IV, int mode)
3DES-CBC Init. More...
int | ucl_3des_cbc_core (u8 *dataOut, ucl_3des_ctx_t *ctx, u8 *dataIn, u32 data_byteLen)
3DES-CBC Core. More...
int | ucl_3des_cbc_finish (ucl_3des_ctx_t *ctx)
3DES-CBC Finish. More...
void | ucl_do_xor (u8 *buffOut, u8 *buffIn1, u8 *buffIn2, int length)
3DES-CBC Xor. More...

Detailed Description

Encrypt / Decrypt with 3DES in CBC (Cipher Block Chaining) mode.

Header:
ucl_3des_cbc.h

Function Documentation

◆ ucl_3des_cbc()

int ucl_3des_cbc | ( | u8 * | dataOut,
 |  | u8 * | dataIn,
 |  | u8 * | key,
 |  | u8 * | IV,
 |  | u32 | data_byteLen,
 |  | int | mode
 | ) |  |

3DES-CBC.

3DES-CBC Complete process.

Precondition
  • The data byte length must be a multiple of 8.
  • Input and Output Data have the same length.
  • The key length is 16 or 24 bytes (See 3DES ).
Parameters
[out] | dataOut | Pointer to the output data
[in] | dataIn | Pointer to the input data
[in] | key | Pointer to the 3DES Key
[in] | IV | Pointer to the initialization vector
[in] | data_byteLen | Data byte length
[in] mode The mode (Encryption/Decryption):
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if one of the input is the pointer NULL
UCL_INVALID_OUTPUT | if one of the output is the pointer NULL
UCL_INVALID_ARG | if data_byteLen is not a multiple of 8
See also
3DES

◆ ucl_3des_cbc_core()

int ucl_3des_cbc_core | ( | u8 * | dataOut,
 |  | ucl_3des_ctx_t * | ctx,
 |  | u8 * | dataIn,
 |  | u32 | data_byteLen
 | ) |  |

3DES-CBC Core.

Process the Data.

Precondition
  • The data byte length must be a multiple of 8.
  • Input and output data have the same length.
Parameters
[out] | dataOut | Pointer to the output data
[in,out] | ctx | Pointer to the context
[in] | dataIn | Pointer to the data
[in] | data_byteLen | Data byte length
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if one of the input is the pointer NULL
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_ARG | if the byte length is not a multiple of 8

◆ ucl_3des_cbc_finish()

int ucl_3des_cbc_finish ( ucl_3des_ctx_t * ctx )

3DES-CBC Finish.

Zeroize the context.

Parameters
[in,out] ctx Pointer to the context
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if the output is the pointer NULL

◆ ucl_3des_cbc_init()

int ucl_3des_cbc_init | ( | ucl_3des_ctx_t * | ctx,
 |  | u8 * | key,
 |  | u8 * | IV,
 |  | int | mode
 | ) |  |

3DES-CBC Init.

Initialize 3DES CBC Context.

Precondition
The key length is 16 or 24 bytes (See UCL_3DES).
Parameters
[out] | ctx | Pointer to the context
[in] | key | Pointer to the 3DES Key
[in] | IV | Pointer to the initialization vector
[in] mode The mode (Encryption/Decryption) :
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if the input is the pointer NULL
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_MODE | if the mode is not one of those 3described

◆ ucl_do_xor()

void ucl_do_xor | ( | u8 * | buffOut,
 |  | u8 * | buffIn1,
 |  | u8 * | buffIn2,
 |  | int | length
 | ) |  |

3DES-CBC Xor.

Xor 2 buffers and store the result in a third.

Parameters
[out] | buffOut | Pointer to the output buffer (result)
[in] | buffIn1 | Pointer to the 1st buffer
[in] | buffIn2 | Pointer to the 2nd buffer
[in] | length | number of bytes to process


Universal Crypto Library: AES CBC

Functions
AES CBC
Operation Modes » CBC

Encrypt / Decrypt with AES in CBC (Cipher Block Chaining) mode. More...

+ Collaboration diagram for AES CBC:

Functions

int | ucl_aes_cbc (u8 *dst, u8 *src, u32 len, u8 *key, u32 keylen, u8 *IV, int mode)
AES-CBC. More...
int | ucl_aes_cbc_init (ucl_aes_ctx_t *ctx, u8 *key, u32 keylen, u8 *IV, int mode)
AES-CBC Init. More...
int | ucl_aes_cbc_core (u8 *dst, ucl_aes_ctx_t *ctx, u8 *src, u32 len)
AES-CBC Core. More...
int | ucl_aes_cbc_finish (ucl_aes_ctx_t *ctx)
AES-CBC Finish. More...
int | ucl_aes_cbc_core_context (u8 *dst, ucl_aes_ctx_t *ctx, u8 *src, u32 len)
AES-CBC Core. More...
int | ucl_aes_cbc_init_rw20 (ucl_aes_ctx_t *ctx, int key_id, u8 *IV, int mode)
RW20 AES-CBC Init. More...
int | ucl_aes_cbc_core_rw20 (u8 *dst, ucl_aes_ctx_t *ctx, u8 *src, u32 len)
RW20 AES-CBC Core. More...
int | ucl_aes_cbc_finish_rw20 (ucl_aes_ctx_t *ctx)
RW20 AES-CBC Finish. More...
int | ucl_aes_cbc_rw20 (u8 *dst, u8 *src, u32 len, int key_id, u8 *iv, int mode)
RW20 AES-CBC. More...

Detailed Description

Encrypt / Decrypt with AES in CBC (Cipher Block Chaining) mode.

Header:
ucl_aes_cbc.h

Function Documentation

◆ ucl_aes_cbc()

int ucl_aes_cbc | ( | u8 * | dst,
 |  | u8 * | src,
 |  | u32 | len,
 |  | u8 * | key,
 |  | u32 | keylen,
 |  | u8 * | IV,
 |  | int | mode
 | ) |  |

AES-CBC.

Encrypt / Decrypt with AES in CBC (Cipher Block Chaining) mode.

Parameters
[out] | dst | Pointer to the output data
[in] | src | Pointer to the input data
[in] | len | Data byte length
[in] | key | Pointer to the AES Key
[in] keylen Key byte length:
  • UCL_AES_KEYLEN_128
  • UCL_AES_KEYLEN_192
  • UCL_AES_KEYLEN_256
[in] | IV | Pointer to the initialization vector
[in] mode The mode (Encryption/Decryption):
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | no error occurred
UCL_INVALID_INPUT | one of the input is the pointer NULL
UCL_INVALID_OUTPUT | one of the output is the pointer NULL
UCL_INVALID_ARG | len is not a multiple of UCL_AES_BLOCKSIZE or keylen is invalid

◆ ucl_aes_cbc_core()

int ucl_aes_cbc_core | ( | u8 * | dst,
 |  | ucl_aes_ctx_t * | ctx,
 |  | u8 * | src,
 |  | u32 | len
 | ) |  |

AES-CBC Core.

Process the Data.

Parameters
[out] | dst | Pointer to the processed data
[in,out] | ctx | Pointer to the context
[in] | src | Pointer to the data
[in] | len | Data byte length
Precondition
The byte length must be a multiple of UCL_AES_BLOCKSIZE.
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | The output is the pointer NULL
UCL_INVALID_ARG | The data byte length is not a multiple of UCL_AES_BLOCKSIZE

◆ ucl_aes_cbc_core_context()

int ucl_aes_cbc_core_context | ( | u8 * | dst,
 |  | ucl_aes_ctx_t * | ctx,
 |  | u8 * | src,
 |  | u32 | len
 | ) |  |

AES-CBC Core.

Process the Data.

Parameters
[out] | dst | Pointer to the output data
[in,out] | ctx | AES context
[in] | src | Pointer to the input data
[in] | len | Data byte length
Precondition
The byte length must be a multiple of UCL_AES_BLOCKSIZE.
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | The output is the pointer NULL
UCL_INVALID_ARG | The byte length is not a multiple of UCL_AES_BLOCKSIZE

◆ ucl_aes_cbc_core_rw20()

int ucl_aes_cbc_core_rw20 | ( | u8 * | dst,
 |  | ucl_aes_ctx_t * | ctx,
 |  | u8 * | src,
 |  | u32 | len
 | ) |  |

RW20 AES-CBC Core.

Process the Data.

Parameters
[out] | dst | Pointer to the processed data
[in,out] | ctx | Pointer to the context
[in] | src | Pointer to the data
[in] | len | Data byte length
Precondition
The byte length must be a multiple of UCL_AES_BLOCKSIZE.
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | The output is the pointer NULL
UCL_INVALID_ARG | The data byte length is not a multiple of UCL_AES_BLOCKSIZE

◆ ucl_aes_cbc_finish()

int ucl_aes_cbc_finish ( ucl_aes_ctx_t * ctx )

AES-CBC Finish.

Zeroize the context.

Parameters
[in,out] ctx Pointer to the context
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_OUTPUT | The output is the pointer NULL

◆ ucl_aes_cbc_finish_rw20()

int ucl_aes_cbc_finish_rw20 ( ucl_aes_ctx_t * ctx )

RW20 AES-CBC Finish.

Zeroize the context.

Parameters
[in,out] ctx Pointer to the context
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_OUTPUT | The output is the pointer NULL

◆ ucl_aes_cbc_init()

int ucl_aes_cbc_init | ( | ucl_aes_ctx_t * | ctx,
 |  | u8 * | key,
 |  | u32 | keylen,
 |  | u8 * | IV,
 |  | int | mode
 | ) |  |

AES-CBC Init.

Initialize AES CBC Context.

Warning
on platforms using a AES hardware block, this function is required to change the key the use of another context in the ucl_aes_core function will not mean using the other context key
Parameters
[out] | ctx | Pointer to the context
[in] | key | Pointer to the AES Key
[in] keylen Key byte length:
  • UCL_AES_KEYLEN_128
  • UCL_AES_KEYLEN_192
  • UCL_AES_KEYLEN_256
[in] | IV | Pointer to the initialization vector
[in] mode The mode (Encryption/Decryption) :
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | The input is the pointer NULL
UCL_INVALID_OUTPUT | The output is the pointer NULL
UCL_INVALID_ARG | keylen is invalid
UCL_INVALID_MODE | The mode is not one of those described

◆ ucl_aes_cbc_init_rw20()

int ucl_aes_cbc_init_rw20 | ( | ucl_aes_ctx_t * | ctx,
 |  | int | key_id,
 |  | u8 * | IV,
 |  | int | mode
 | ) |  |

RW20 AES-CBC Init.

Initialise AES CBC Context.

Parameters
[out] | ctx | Pointer to the context
[in] | key_id | AES Key index: MK_KEY for MK, K_KEY for K
[in] | IV | Pointer to the initialization vector
[in] mode The mode (Encryption/Decryption) :
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | The input is the pointer NULL
UCL_INVALID_OUTPUT | The output is the pointer NULL
UCL_INVALID_MODE | The mode is not one of those described

◆ ucl_aes_cbc_rw20()

int ucl_aes_cbc_rw20 | ( | u8 * | dst,
 |  | u8 * | src,
 |  | u32 | len,
 |  | int | key_id,
 |  | u8 * | iv,
 |  | int | mode
 | ) |  |

RW20 AES-CBC.

Encrypt / Decrypt with AES in CBC (Cipher Block Chaining) mode.

Parameters
[out] | dst | Pointer to the output data
[in] | src | Pointer to the input data
[in] | len | Data byte length
[in] | key_id | AES Key index: MK_KEY for MK, K_KEY for K
[in] | IV | Pointer to the initialization vector
[in] mode The mode (Encryption/Decryption):
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | no error occurred
UCL_INVALID_INPUT | one of the input is the pointer NULL
UCL_INVALID_OUTPUT | one of the output is the pointer NULL
UCL_INVALID_ARG | len is not a multiple of UCL_AES_BLOCKSIZE or keylen is invalid


Universal Crypto Library: DES CBC

Functions
DES CBC
Operation Modes » CBC

Encrypt / Decrypt with DES in CBC (Cipher Block Chaining) mode. More...

+ Collaboration diagram for DES CBC:

Functions

int | ucl_des_cbc (u8 *dataOut, u8 *dataIn, u8 *key, u8 *IV, u32 data_byteLen, int mode)
DES-CBC. More...
int | ucl_des_cbc_init (ucl_des_ctx_t *ctx, u8 *key, u8 *IV, int mode)
DES-CBC Init. More...
int | ucl_des_cbc_core (u8 *dataOut, ucl_des_ctx_t *ctx, u8 *dataIn, u32 data_byteLen)
DES-CBC Core. More...
int | ucl_des_cbc_finish (ucl_des_ctx_t *ctx)
DES-CBC Finish. More...

Detailed Description

Encrypt / Decrypt with DES in CBC (Cipher Block Chaining) mode.

Header:
ucl_des_cbc.h

Function Documentation

◆ ucl_des_cbc()

int ucl_des_cbc | ( | u8 * | dataOut,
 |  | u8 * | dataIn,
 |  | u8 * | key,
 |  | u8 * | IV,
 |  | u32 | data_byteLen,
 |  | int | mode
 | ) |  |

DES-CBC.

Complete process.

Precondition
  • The byte length must be a multiple of 8.
  • Input and Output Data have the same length.
  • The key length is 8 bytes.
Parameters
[out] | dataOut | Pointer to the output data
[in] | dataIn | Pointer to the input data
[in] | key | Pointer to the DES Key
[in] | IV | Pointer to the initialization vector
[in] | data_byteLen | Data byte length
[in] mode The mode (Encryption/Decryption):
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output is the pointer NULL
UCL_INVALID_ARG | If data_byteLen is not a multiple of 8
See also
DES

◆ ucl_des_cbc_core()

int ucl_des_cbc_core | ( | u8 * | dataOut,
 |  | ucl_des_ctx_t * | ctx,
 |  | u8 * | dataIn,
 |  | u32 | data_byteLen
 | ) |  |

DES-CBC Core.

Process the Data.

Parameters
[out] | dataOut | Pointer to the output data
[in,out] | ctx | Pointer to the context
[in] | dataIn | Pointer to the data
[in] | data_byteLen | Data byte length
Precondition
  • The data byte length must be a multiple of 8.
  • Input and output data have the same length.
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL
UCL_INVALID_ARG | If the byte length is not a multiple of 8

◆ ucl_des_cbc_finish()

int ucl_des_cbc_finish ( ucl_des_ctx_t * ctx )

DES-CBC Finish.

Zeroize the context.

Parameters
[in,out] ctx Pointer to the context
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_OUTPUT | If the output is the pointer NULL

◆ ucl_des_cbc_init()

int ucl_des_cbc_init | ( | ucl_des_ctx_t * | ctx,
 |  | u8 * | key,
 |  | u8 * | IV,
 |  | int | mode
 | ) |  |

DES-CBC Init.

Initialize DES CBC Context.

Precondition
The key length is 8 bytes.
Parameters
[out] | ctx | Pointer to the context
[in] | key | Pointer to the DES Key
[in] | IV | Pointer to the initialization vector
[in] mode The mode (Encryption/Decryption) :
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If the input is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL
UCL_INVALID_MODE | If the mode is not one of those described


Universal Crypto Library: USIP AES CBC

Functions
USIP AES CBC
Operation Modes » CBC

Encrypt / Decrypt with USIP® AES in CBC (Cipher Block Chaining) mode. More...

+ Collaboration diagram for USIP AES CBC:

Functions

int | ucl_uaes_cbc (u8 *dst, u8 *src, u8 *key, u8 *IV, u32 len, int mode)
USIP® AES-CBC. More...
int | ucl_uaes_cbc_init (ucl_uaes_ctx_t *ctx, u8 *key, u8 *IV, int mode)
USIP® AES-CBC Init. More...
int | ucl_uaes_cbc_core (u8 *dst, ucl_uaes_ctx_t *ctx, u8 *src, u32 len)
USIP® AES-CBC Core. More...
int | ucl_uaes_cbc_finish (ucl_uaes_ctx_t *ctx)
USIP® AES-CBC Finish. More...

Detailed Description

Encrypt / Decrypt with USIP® AES in CBC (Cipher Block Chaining) mode.

Header:
ucl_uaes_cbc.h
Warning
If you use those functions you erase the USIP® AES context.
Note
A USIP® AES interface must be defined.

Function Documentation

◆ ucl_uaes_cbc()

int ucl_uaes_cbc | ( | u8 * | dst,
 |  | u8 * | src,
 |  | u8 * | key,
 |  | u8 * | IV,
 |  | u32 | len,
 |  | int | mode
 | ) |  |

USIP® AES-CBC.

Complete process.

Precondition
  • The data byte length must be a multiple of 16.
  • The key length is 16 bytes.
Parameters
[out] | dst | Pointer to the output data
[in] | key | Pointer to the USIP® AES Key
[in] | IV | Pointer to the initialization vector
[in] | src | Pointer to the input data
[in] | len | Data byte length
[in] mode The mode (Encryption/Decryption):
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | One of the output is the pointer NULL
UCL_INVALID_ARG | len is not a multiple of 16

◆ ucl_uaes_cbc_core()

int ucl_uaes_cbc_core | ( | u8 * | dst,
 |  | ucl_uaes_ctx_t * | ctx,
 |  | u8 * | src,
 |  | u32 | len
 | ) |  |

USIP® AES-CBC Core.

Process the Data.

Precondition
The data byte length must be a multiple of 16.
Parameters
[out] | dst | Pointer to the output data
[in,out] | ctx | Pointer to the context
[in] | src | Pointer to the data
[in] | len | Data byte length
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | The output is the pointer NULL
UCL_INVALID_ARG | The byte length is not a multiple of 16

◆ ucl_uaes_cbc_finish()

int ucl_uaes_cbc_finish ( ucl_uaes_ctx_t * ctx )

USIP® AES-CBC Finish.

Zeroize the context.

Parameters
[in,out] ctx Pointer to the context
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_OUTPUT | The output is the pointer NULL

◆ ucl_uaes_cbc_init()

int ucl_uaes_cbc_init | ( | ucl_uaes_ctx_t * | ctx,
 |  | u8 * | key,
 |  | u8 * | IV,
 |  | int | mode
 | ) |  |

USIP® AES-CBC Init.

Initialize USIP® AES CBC Context.

Precondition
The key length is 16 bytes.
Parameters
[out] | ctx | Pointer to the context
[in] | key | Pointer to the USIP® AES Key
[in] | IV | Pointer to the initialization vector
[in] mode The mode (Encryption/Decryption) :
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | The input is the pointer NULL
UCL_INVALID_OUTPUT | The output is the pointer NULL
UCL_INVALID_MODE | The mode is not one of those described


Universal Crypto Library: CCM

Modules
CCM
Operation Modes

Counter with CBC-MAC. More...

+ Collaboration diagram for CCM:

Modules

AES CCM
Encrypt / Decrypt with AES in CCM (Counter with CBC-MAC) mode.

Detailed Description

Counter with CBC-MAC.

CCM mode combines the well known CBC-MAC with the well known counter mode of encryption. These two primitives are applied in an "authenticate-then-encrypt" manner, that is, CBC-MAC is first computed on the message to obtain a tag t; the message and the tag are then encrypted using counter mode. One key insight is that the same encryption key can be used for both, provided that the counter values used in the encryption do not collide with the (pre-)initialization vector used in the authentication ((from Wikipedia)

Note
This mode requires a nonce vector which does not need to be secret, but it must be unpredictable. We recommend to generate it with the TRNG.


Universal Crypto Library: AES CCM

Functions
AES CCM
Operation Modes » CCM

Encrypt / Decrypt with AES in CCM (Counter with CBC-MAC) mode. More...

+ Collaboration diagram for AES CCM:

Functions

int | ucl_aes_ccm_encrypt (u8 *c, u8 *U, int M, int L, u8 *msg, int msg_len, u8 *aad, int aad_len, u8 *nonce, u8 *key, int keylen)
AES-CCM. More...
int | ucl_aes_ccm_encrypt_init (aes_ccm_t *ctxt, int M, int L, int msg_len, u8 *aad, int aad_len, u8 *nonce, u8 *key, int keylen)
AES-CCM. More...
int | ucl_aes_ccm_encrypt_core (u8 *c, aes_ccm_t *ctxt, u8 *msg, int msg_len)
AES-CCM. More...
int | ucl_aes_ccm_encrypt_finish (u8 *U, aes_ccm_t *ctxt)
AES-CCM. More...
int | ucl_aes_ccm_decrypt (u8 *msg, int M, int L, u8 *c, int c_len, u8 *U, u8 *aad, int aad_len, u8 *nonce, u8 *key, int keylen)
AES-CCM. More...
int | ucl_aes_ccm_decrypt_init (aes_ccm_t *ctxt, int M, int L, int c_len, u8 *U, u8 *aad, int aad_len, u8 *nonce, u8 *key, int keylen)
AES-CCM. More...
int | ucl_aes_ccm_decrypt_core (u8 *msg, aes_ccm_t *ctxt, u8 *c, int c_len)
AES-CCM. More...
int | ucl_aes_ccm_decrypt_finish (aes_ccm_t *ctxt)
AES-CCM. More...

Detailed Description

Encrypt / Decrypt with AES in CCM (Counter with CBC-MAC) mode.

Header:
ucl_aes_ccm.h

Function Documentation

◆ ucl_aes_ccm_decrypt()

int ucl_aes_ccm_decrypt | ( | u8 * | msg,
 |  | int | M,
 |  | int | L,
 |  | u8 * | c,
 |  | int | c_len,
 |  | u8 * | U,
 |  | u8 * | aad,
 |  | int | aad_len,
 |  | u8 * | nonce,
 |  | u8 * | key,
 |  | int | keylen
 | ) |  |

AES-CCM.

Decrypt with AES in CCM (Counter with CBC-MAC) mode.

Parameters
[out] | msg | Pointer to the plaintext
[in] | M | authentication field bytes length
[in] | L | length field bytes length
[in] | c | Pointer to the cryptotext
[in] | c_len | cryptotext byte length
[in] | U | Pointer to the authentication field
[in] | aad | additional authenticated data; can be NULL if the length is zero
[in] | aad_len | additional authenticated data byte length; if zero, no AAD
[in] | nonce | Pointer to the nonce (its length is 15-L bytes)
[in] | key | Pointer to the AES Key
[in] keylen Key byte length:
  • UCL_AES_KEYLEN_128
  • UCL_AES_KEYLEN_192
  • UCL_AES_KEYLEN_256
Returns
Error code
Return values
UCL_OK | no error occurred
UCL_INVALID_INPUT | one of the input is the pointer NULL
UCL_INVALID_OUTPUT | one of the output is the pointer NULL
UCL_ERROR | if the authentication field verification fails

◆ ucl_aes_ccm_decrypt_core()

int ucl_aes_ccm_decrypt_core | ( | u8 * | msg,
 |  | aes_ccm_t * | ctxt,
 |  | u8 * | c,
 |  | int | c_len
 | ) |  |

AES-CCM.

AES CCM decryption core computation. Requirements: the encrypted data length shall be known a multiple of 16 bytes, except for the last call

Parameters
[out] | msg | Pointer to the plain data
[out] | ctxt | Pointer to a AES CCM context
[in] | c | Pointer to the encrypted data
[in] | c_len | encrypted data byte length
Returns
Error code
Return values
UCL_OK | no error occurred
UCL_INVALID_INPUT | one of the input is the pointer NULL
UCL_INVALID_OUTPUT | one of the output is the pointer NULL

◆ ucl_aes_ccm_decrypt_finish()

int ucl_aes_ccm_decrypt_finish ( aes_ccm_t * ctxt )

AES-CCM.

AES CCM decryption final step

Parameters
[in] ctxt Pointer to a AES CCM context
Returns
Error code
Return values
UCL_OK | no error occurred and authentication field verification succeeds in
UCL_INVALID_INPUT | one of the input is the pointer NULL
UCL_INVALID_OUTPUT | one of the output is the pointer NULL
UCL_ERROR | if the authentication field verification fails

◆ ucl_aes_ccm_decrypt_init()

int ucl_aes_ccm_decrypt_init | ( | aes_ccm_t * | ctxt,
 |  | int | M,
 |  | int | L,
 |  | int | c_len,
 |  | u8 * | U,
 |  | u8 * | aad,
 |  | int | aad_len,
 |  | u8 * | nonce,
 |  | u8 * | key,
 |  | int | keylen
 | ) |  |

AES-CCM.

Initialize AES CCM decryption. Requirements: the AAD, Additional Authenticated Data, shall be known the encrypted data length, shall be known the nonce shall be known the authentication field, U, shall be known

Parameters
[out] | ctxt | Pointer to a AES CCM context
[in] | M | authentication field bytes length
[in] | L | length field bytes length
[in] | c_len | plaintext byte length
[in] | U | authentication field
[in] | aad | additional authenticated data; can be NULL if the length is zero
[in] | aad_len | additional authenticated data byte length; if zero, no AAD
[in] | nonce | Pointer to the nonce (its length is 15-L bytes)
[in] | key | Pointer to the AES Key
[in] keylen Key byte length:
  • UCL_AES_KEYLEN_128
  • UCL_AES_KEYLEN_192
  • UCL_AES_KEYLEN_256
Returns
Error code
Return values
UCL_OK | no error occurred
UCL_INVALID_INPUT | one of the input is the pointer NULL
UCL_INVALID_OUTPUT | one of the output is the pointer NULL

◆ ucl_aes_ccm_encrypt()

int ucl_aes_ccm_encrypt | ( | u8 * | c,
 |  | u8 * | U,
 |  | int | M,
 |  | int | L,
 |  | u8 * | msg,
 |  | int | msg_len,
 |  | u8 * | aad,
 |  | int | aad_len,
 |  | u8 * | nonce,
 |  | u8 * | key,
 |  | int | keylen
 | ) |  |

AES-CCM.

Encrypt with AES in CCM (Counter with CBC-MAC) mode.

Parameters
[out] | c | Pointer to the cryptotext
[out] | U | Pointer to the authentication field
[in] | M | authentication field bytes length
[in] | L | length field bytes length
[in] | msg | Pointer to the plaintext
[in] | msg_len | plaintext byte length
[in] | aad | additional authenticated data; can be NULL if the length is zero
[in] | aad_len | additional authenticated data byte length; if zero, no AAD
[in] | nonce | Pointer to the nonce (its length is 15-L bytes)
[in] | key | Pointer to the AES Key
[in] keylen Key byte length:
  • UCL_AES_KEYLEN_128
  • UCL_AES_KEYLEN_192
  • UCL_AES_KEYLEN_256
Returns
Error code
Return values
UCL_OK | no error occurred
UCL_INVALID_INPUT | one of the input is the pointer NULL
UCL_INVALID_OUTPUT | one of the output is the pointer NULL

◆ ucl_aes_ccm_encrypt_core()

int ucl_aes_ccm_encrypt_core | ( | u8 * | c,
 |  | aes_ccm_t * | ctxt,
 |  | u8 * | msg,
 |  | int | msg_len
 | ) |  |

AES-CCM.

AES CCM encryption core computation. Requirements: the plain data length shall be known a multiple of 16 bytes, except for the last call

Parameters
[out] | c | Pointer to the encrypted data
[out] | ctxt | Pointer to a AES CCM context
[in] | msg | Pointer to the plaintext
[in] | msg_len | plaintext byte length
Returns
Error code
Return values
UCL_OK | no error occurred
UCL_INVALID_INPUT | one of the input is the pointer NULL
UCL_INVALID_OUTPUT | one of the output is the pointer NULL

◆ ucl_aes_ccm_encrypt_finish()

int ucl_aes_ccm_encrypt_finish | ( | u8 * | U,
 |  | aes_ccm_t * | ctxt
 | ) |  |

AES-CCM.

AES CCM encryption final step

Parameters
[out] | U | Pointer to the authentication field
[in] | ctxt | Pointer to a AES CCM context
Returns
Error code
Return values
UCL_OK | no error occurred
UCL_INVALID_INPUT | one of the input is the pointer NULL
UCL_INVALID_OUTPUT | one of the output is the pointer NULL

◆ ucl_aes_ccm_encrypt_init()

int ucl_aes_ccm_encrypt_init | ( | aes_ccm_t * | ctxt,
 |  | int | M,
 |  | int | L,
 |  | int | msg_len,
 |  | u8 * | aad,
 |  | int | aad_len,
 |  | u8 * | nonce,
 |  | u8 * | key,
 |  | int | keylen
 | ) |  |

AES-CCM.

Initialize AES CCM encryption. Requirements: the AAD, Additional Authenticated Data, shall be known the plain data length, shall be known the nonce shall be known

Parameters
[out] | ctxt | Pointer to a AES CCM context
[in] | M | authentication field bytes length
[in] | L | length field bytes length
[in] | msg_len | plaintext byte length
[in] | aad | additional authenticated data; can be NULL if the length is zero
[in] | aad_len | additional authenticated data byte length; if zero, no AAD
[in] | nonce | Pointer to the nonce (its length is 15-L bytes)
[in] | key | Pointer to the AES Key
[in] keylen Key byte length:
  • UCL_AES_KEYLEN_128
  • UCL_AES_KEYLEN_192
  • UCL_AES_KEYLEN_256
Returns
Error code
Return values
UCL_OK | no error occurred
UCL_INVALID_INPUT | one of the input is the pointer NULL
UCL_INVALID_OUTPUT | one of the output is the pointer NULL


Universal Crypto Library: CFB

Modules
CFB
Operation Modes

Cipher Feedback mode. More...

+ Collaboration diagram for CFB:

Modules

3DES CFB
Encrypt/Decrypt with 3DES in 64bits CFB (Cipher Feedback) mode.
DES CFB
Encrypt/Decrypt with DES in 64bits CFB (Cipher Feedback) mode.

Detailed Description

Cipher Feedback mode.

The CFB mode is a stream method of encryption in which the cipher is used to generate pseudorandom bits which are exclusive-ORed with binary plain text to form cipher text. The cipher text is fed back to form the next cipher input block. Identical messages that are encrypted using the CFB mode and different IVs will have different cipher texts. IVs that are shorter than the length of the input block should be put in the least significant bits of the first cipher input block and the unused, most significant, bits initialized to "0's."

Note
This mode requires an initialization vector IV to combine with the first plaintext block. The IV need not be secret, but it must be unpredictable.
We recommand to generate it with the USIP® TRNG.


Universal Crypto Library: 3DES CFB

Functions
3DES CFB
Operation Modes » CFB

Encrypt/Decrypt with 3DES in 64bits CFB (Cipher Feedback) mode. More...

+ Collaboration diagram for 3DES CFB:

Functions

int | ucl_3des_cfb (u8 *dataOut, u8 *dataIn, u8 *key, u8 *IV, u32 data_byteLen, int mode)
3DES-CFB. More...
int | ucl_3des_cfb_init (ucl_3des_ctx_t *ctx, u8 *key, u8 *IV, int mode)
3DES-CFB Init. More...
int | ucl_3des_cfb_core (u8 *dataOut, ucl_3des_ctx_t *ctx, u8 *dataIn, u32 data_byteLen)
3DES-CFB Core. More...
int | ucl_3des_cfb_finish (ucl_3des_ctx_t *ctx)
3DES-CFB Finish. More...

Detailed Description

Encrypt/Decrypt with 3DES in 64bits CFB (Cipher Feedback) mode.

Header:
ucl_3des_cfb.h

Function Documentation

◆ ucl_3des_cfb()

int ucl_3des_cfb | ( | u8 * | dataOut,
 |  | u8 * | dataIn,
 |  | u8 * | key,
 |  | u8 * | IV,
 |  | u32 | data_byteLen,
 |  | int | mode
 | ) |  |

3DES-CFB.

Complete process.

Precondition
  • The byte length must be a multiple of 8.
  • Input and Output Data have the same length.
  • The key length is 16 or 24 bytes (See 3DES ).
Parameters
[out] | dataOut | Pointer to the output data
[in] | dataIn | Pointer to the input data
[in] | key | Pointer to the 3DES Key
[in] | IV | Pointer to the initialization vector
[in] | data_byteLen | Data byte length
[in] mode The mode (Encryption/Decryption):
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if one of the input is the pointer NULL
UCL_INVALID_OUTPUT | if one of the output is the pointer NULL
UCL_INVALID_ARG | if data_byteLen is not a multiple of 8
See also
3DES

◆ ucl_3des_cfb_core()

int ucl_3des_cfb_core | ( | u8 * | dataOut,
 |  | ucl_3des_ctx_t * | ctx,
 |  | u8 * | dataIn,
 |  | u32 | data_byteLen
 | ) |  |

3DES-CFB Core.

Process the Data.

Precondition
  • The byte length must be a multiple of 8.
  • Input and Output Data have the same length.
Parameters
[out] | dataOut | Pointer to the procesed data
[in,out] | ctx | Pointer to the context
[in] | dataIn | Pointer to the data
[in] | data_byteLen | Data byte length
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if one of the input is the pointer NULL
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_ARG | if the byte length is not a multiple of 8

◆ ucl_3des_cfb_finish()

int ucl_3des_cfb_finish ( ucl_3des_ctx_t * ctx )

3DES-CFB Finish.

Zeroize the context.

Parameters
[in,out] ctx Pointer to the context
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if the output is the pointer NULL

◆ ucl_3des_cfb_init()

int ucl_3des_cfb_init | ( | ucl_3des_ctx_t * | ctx,
 |  | u8 * | key,
 |  | u8 * | IV,
 |  | int | mode
 | ) |  |

3DES-CFB Init.

Initialize 3DES CFB Context.

Precondition
The key length is 16 or 24 bytes (See 3DES ).
Parameters
[out] | ctx | Pointer to the context
[in] | key | Pointer to the 3DES Key
[in] | IV | Pointer to the initialization vector
[in] mode The mode (Encryption/Decryption) :
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if the input is the pointer NULL
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_MODE | if the mode is not one of those 3described


Universal Crypto Library: DES CFB

Functions
DES CFB
Operation Modes » CFB

Encrypt/Decrypt with DES in 64bits CFB (Cipher Feedback) mode. More...

+ Collaboration diagram for DES CFB:

Functions

int | ucl_des_cfb (u8 *dataOut, u8 *dataIn, u8 *key, u8 *IV, u32 data_byteLen, int mode)
DES-CFB. More...
int | ucl_des_cfb_init (ucl_des_ctx_t *ctx, u8 *key, u8 *IV, int mode)
DES-CFB Init. More...
int | ucl_des_cfb_core (u8 *dataOut, ucl_des_ctx_t *ctx, u8 *dataIn, u32 data_byteLen)
DES-CFB Core. More...
int | ucl_des_cfb_finish (ucl_des_ctx_t *ctx)
DES-CFB Finish. More...

Detailed Description

Encrypt/Decrypt with DES in 64bits CFB (Cipher Feedback) mode.

Header:
ucl_des_cfb.h

Function Documentation

◆ ucl_des_cfb()

int ucl_des_cfb | ( | u8 * | dataOut,
 |  | u8 * | dataIn,
 |  | u8 * | key,
 |  | u8 * | IV,
 |  | u32 | data_byteLen,
 |  | int | mode
 | ) |  |

DES-CFB.

Complete process.

Precondition
  • The byte length must be a multiple of 8.
  • Input and Output Data have the same length.
  • The key length is 8 bytes.
Parameters
[out] | dataOut | Pointer to the output data
[in] | dataIn | Pointer to the input data
[in] | key | Pointer to the DES Key
[in] | IV | Pointer to the initialization vector
[in] | data_byteLen | Data byte length
[in] mode The mode (Encryption/Decryption):
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output is the pointer NULL
UCL_INVALID_ARG | If data_byteLen is not a multiple of 8
See also
DES

◆ ucl_des_cfb_core()

int ucl_des_cfb_core | ( | u8 * | dataOut,
 |  | ucl_des_ctx_t * | ctx,
 |  | u8 * | dataIn,
 |  | u32 | data_byteLen
 | ) |  |

DES-CFB Core.

Process the Data.

Precondition
  • The byte length must be a multiple of 8.
  • Input and output data have the same length.
Parameters
[out] | dataOut | Pointer to the procesed data
[in,out] | ctx | Pointer to the context
[in] | dataIn | Pointer to the data
[in] | data_byteLen | Data byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL
UCL_INVALID_ARG | If the byte length is not a multiple of 8

◆ ucl_des_cfb_finish()

int ucl_des_cfb_finish ( ucl_des_ctx_t * ctx )

DES-CFB Finish.

Zeroize the context.

Parameters
[in,out] ctx Pointer to the context
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_OUTPUT | If the output is the pointer NULL

◆ ucl_des_cfb_init()

int ucl_des_cfb_init | ( | ucl_des_ctx_t * | ctx,
 |  | u8 * | key,
 |  | u8 * | IV,
 |  | int | mode
 | ) |  |

DES-CFB Init.

Initialize DES CFB Context.

Precondition
The key length is 8 bytes.
Parameters
[out] | ctx | Pointer to the context
[in] | key | Pointer to the DES Key
[in] | IV | Pointer to the initialization vector
[in] mode The mode (Encryption/Decryption) :
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If the input is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL
UCL_INVALID_MODE | If the mode is not one of those described


Universal Crypto Library: ECB

Modules
ECB
Operation Modes

Electronic Codebook. More...

+ Collaboration diagram for ECB:

Modules

3DES ECB
Encrypt/Decrypt with 3DES in ECB (Electronic Codebook) mode.
AES ECB
Encrypt / Decrypt with AES in ECB (Electronic Codebook) mode.
DES ECB
Encrypt/Decrypt with DES in ECB (Electronic Codebook) mode.
USIP AES ECB
Encrypt/Decrypt with USIP® AES in ECB (Electronic Codebook) mode.

Detailed Description

Electronic Codebook.

This mode is a basic, block, cryptographic method where every block are processed independently .


Universal Crypto Library: 3DES ECB

Functions
3DES ECB
Operation Modes » ECB

Encrypt/Decrypt with 3DES in ECB (Electronic Codebook) mode. More...

+ Collaboration diagram for 3DES ECB:

Functions

int | ucl_3des_ecb (u8 *dataOut, u8 *dataIn, u8 *key, u32 data_byteLen, int mode)
3DES-ECB. More...
int | ucl_3des_ecb_init (ucl_3des_ctx_t *ctx, u8 *key, int mode)
3DES-ECB Init. More...
int | ucl_3des_ecb_core (u8 *dataOut, ucl_3des_ctx_t *ctx, u8 *dataIn, u32 data_byteLen)
3DES-ECB Core. More...
int | ucl_3des_ecb_finish (ucl_3des_ctx_t *ctx)
3DES-ECB Finish. More...

Detailed Description

Encrypt/Decrypt with 3DES in ECB (Electronic Codebook) mode.

Header:
ucl_3des_ecb.h

Function Documentation

◆ ucl_3des_ecb()

int ucl_3des_ecb | ( | u8 * | dataOut,
 |  | u8 * | dataIn,
 |  | u8 * | key,
 |  | u32 | data_byteLen,
 |  | int | mode
 | ) |  |

3DES-ECB.

Complete process.

Precondition
  • The byte length must be a multiple of 8.
  • Input and Output Data have the same length.
  • The key length is 16 or 24 bytes (See 3DES ).
Parameters
[out] | dataOut | Pointer to decrypted/encryted message
[in] | dataIn | Pointer to encrypted/decrypted message
[in] | key | Pointer to the 3DES Key
[in] | data_byteLen | Data byte length
[in] mode The mode (Encryption/Decryption) :
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if one of the input is the pointer NULL
UCL_INVALID_OUTPUT | if one of the output is the pointer NULL
UCL_INVALID_MODE | if the mode is invalid
UCL_INVALID_ARG | if the data byte length is not a multiple of 8
See also
3DES

◆ ucl_3des_ecb_core()

int ucl_3des_ecb_core | ( | u8 * | dataOut,
 |  | ucl_3des_ctx_t * | ctx,
 |  | u8 * | dataIn,
 |  | u32 | data_byteLen
 | ) |  |

3DES-ECB Core.

Process the Data.

Precondition
  • The byte length must be a multiple of 8.
  • Input and Output Data have the same length.
Parameters
[out] | dataOut | Pointer to the output data
[in,out] | ctx | Pointer to the context
[in] | dataIn | Pointer to the data
[in] | data_byteLen | Data byte length
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if one of the input is the pointer NULL
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_ARG | if the data byte length is not a multiple of 8

◆ ucl_3des_ecb_finish()

int ucl_3des_ecb_finish ( ucl_3des_ctx_t * ctx )

3DES-ECB Finish.

Zeroize the context.

Parameters
[in,out] ctx Pointer to the context
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if the output is the pointer NULL

◆ ucl_3des_ecb_init()

int ucl_3des_ecb_init | ( | ucl_3des_ctx_t * | ctx,
 |  | u8 * | key,
 |  | int | mode
 | ) |  |

3DES-ECB Init.

Initialize 3DES ECB Context.

Precondition
The key length is 16 or 24 bytes (See 3DES ).
Parameters
[out] | ctx | Pointer to the context
[in] | key | Pointer to the 3DES Key
[in] mode The mode (Encryption/Decryption) :
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | if the input is the pointer NULL
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_MODE | if the mode is not one of those 3described


Universal Crypto Library: AES ECB

Functions
AES ECB
Operation Modes » ECB

Encrypt / Decrypt with AES in ECB (Electronic Codebook) mode. More...

+ Collaboration diagram for AES ECB:

Functions

int | ucl_aes_ecb (u8 *dst, u8 *src, u32 len, u8 *key, u32 keylen, int mode)
AES-ECB. More...
int | ucl_aes_ecb_init (ucl_aes_ctx_t *ctx, u8 *key, u32 keylen, int mode)
AES-ECB Init. More...
int | ucl_aes_ecb_core (u8 *dst, ucl_aes_ctx_t *ctx, u8 *src, u32 len)
AES-ECB Core. More...
int | ucl_aes_ecb_finish (ucl_aes_ctx_t *ctx)
AES-ECB Finish. More...
int | ucl_aes_ecb_core_context (u8 *dst, ucl_aes_ctx_t *ctx, u8 *src, u32 len)
AES-ECB Core. More...

Detailed Description

Encrypt / Decrypt with AES in ECB (Electronic Codebook) mode.

Header:
ucl_aes_ecb.h

Function Documentation

◆ ucl_aes_ecb()

int ucl_aes_ecb | ( | u8 * | dst,
 |  | u8 * | src,
 |  | u32 | len,
 |  | u8 * | key,
 |  | u32 | keylen,
 |  | int | mode
 | ) |  |

AES-ECB.

Complete process.

Parameters
[out] | dst | Pointer to the output data
[in] | src | Pointer to the input data
[in] | len | Data byte length
[in] | key | Pointer to the AES Key
[in] keylen Key byte length:
  • UCL_AES_KEYLEN_128
  • UCL_AES_KEYLEN_192
  • UCL_AES_KEYLEN_256
[in] mode The mode (Encryption/Decryption):
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | One of the output is the pointer NULL
UCL_INVALID_ARG | len is not a multiple of UCL_AES_BLOCKSIZE or keylen is invalid

◆ ucl_aes_ecb_core()

int ucl_aes_ecb_core | ( | u8 * | dst,
 |  | ucl_aes_ctx_t * | ctx,
 |  | u8 * | src,
 |  | u32 | len
 | ) |  |

AES-ECB Core.

Process the Data.

Parameters
[out] | dst | Pointer to the output data
[in,out] | ctx | AES context
[in] | src | Pointer to the input data
[in] | len | Data byte length
Precondition
The byte length must be a multiple of UCL_AES_BLOCKSIZE.
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | The output is the pointer NULL
UCL_INVALID_ARG | The byte length is not a multiple of UCL_AES_BLOCKSIZE

◆ ucl_aes_ecb_core_context()

int ucl_aes_ecb_core_context | ( | u8 * | dst,
 |  | ucl_aes_ctx_t * | ctx,
 |  | u8 * | src,
 |  | u32 | len
 | ) |  |

AES-ECB Core.

Process the Data.

Parameters
[out] | dst | Pointer to the output data
[in,out] | ctx | AES context
[in] | src | Pointer to the input data
[in] | len | Data byte length
Precondition
The byte length must be a multiple of UCL_AES_BLOCKSIZE.
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | The output is the pointer NULL
UCL_INVALID_ARG | The byte length is not a multiple of UCL_AES_BLOCKSIZE

◆ ucl_aes_ecb_finish()

int ucl_aes_ecb_finish ( ucl_aes_ctx_t * ctx )

AES-ECB Finish.

Zeroize the context.

Parameters
[in,out] ctx Pointer to the context
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_OUTPUT | The output is the pointer NULL

◆ ucl_aes_ecb_init()

int ucl_aes_ecb_init | ( | ucl_aes_ctx_t * | ctx,
 |  | u8 * | key,
 |  | u32 | keylen,
 |  | int | mode
 | ) |  |

AES-ECB Init.

Initialise AES ECB Context.

Warning
on platforms using a AES hardware block, this function is required to change the key the use of another context in the ucl_aes_core function will not mean using the other context key
Parameters
[out] | ctx | Pointer to the context
[in] | key | Pointer to the AES Key
[in] keylen Key byte length:
  • UCL_AES_KEYLEN_128
  • UCL_AES_KEYLEN_192
  • UCL_AES_KEYLEN_256
[in] mode The mode (Encryption/Decryption):
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | The input is the pointer NULL
UCL_INVALID_OUTPUT | The output is the pointer NULL
UCL_INVALID_ARG | keylen is invalid
UCL_INVALID_MODE | The mode is not one of those uaescribed


Universal Crypto Library: DES ECB

Functions
DES ECB
Operation Modes » ECB

Encrypt/Decrypt with DES in ECB (Electronic Codebook) mode. More...

+ Collaboration diagram for DES ECB:

Functions

int | ucl_des_ecb (u8 *dataOut, u8 *dataIn, u8 *key, u32 data_byteLen, int mode)
DES-ECB. More...
int | ucl_des_ecb_init (ucl_des_ctx_t *ctx, u8 *key, int mode)
DES-ECB Init. More...
int | ucl_des_ecb_core (u8 *dataOut, ucl_des_ctx_t *ctx, u8 *dataIn, u32 data_byteLen)
DES-ECB Core. More...
int | ucl_des_ecb_finish (ucl_des_ctx_t *ctx)
DES-ECB Finish. More...

Detailed Description

Encrypt/Decrypt with DES in ECB (Electronic Codebook) mode.

Header:
ucl_des_ecb.h

Function Documentation

◆ ucl_des_ecb()

int ucl_des_ecb | ( | u8 * | dataOut,
 |  | u8 * | dataIn,
 |  | u8 * | key,
 |  | u32 | data_byteLen,
 |  | int | mode
 | ) |  |

DES-ECB.

Complete process.

Precondition
  • The byte length must be a multiple of 8.
  • Input and Output Data have the same length.
  • The key length is 8 bytes.
Parameters
[out] | dataOut | Pointer to decrypted/encryted message
[in] | dataIn | Pointer to encrypted/decrypted message
[in] | key | Pointer to the DES Key
[in] | data_byteLen | Data byte length
[in] mode The mode (Encryption/Decryption):
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output is the pointer NULL
UCL_INVALID_MODE | If the mode is invalid
UCL_INVALID_ARG | If the data byte length is not a multiple of 8
See also
DES

◆ ucl_des_ecb_core()

int ucl_des_ecb_core | ( | u8 * | dataOut,
 |  | ucl_des_ctx_t * | ctx,
 |  | u8 * | dataIn,
 |  | u32 | data_byteLen
 | ) |  |

DES-ECB Core.

Process the Data.

Precondition
  • The data byte length must be a multiple of 8.
  • Input and output data have the same length.
Parameters
[out] | dataOut | Pointer to the output data
[in,out] | ctx | Pointer to the context
[in] | dataIn | Pointer to the data
[in] | data_byteLen | Data byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL
UCL_INVALID_ARG | If the byte length is not a multiple of 8

◆ ucl_des_ecb_finish()

int ucl_des_ecb_finish ( ucl_des_ctx_t * ctx )

DES-ECB Finish.

Zeroize the context.

Parameters
[in,out] ctx Pointer to the context
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_OUTPUT | If the output is the pointer NULL

◆ ucl_des_ecb_init()

int ucl_des_ecb_init | ( | ucl_des_ctx_t * | ctx,
 |  | u8 * | key,
 |  | int | mode
 | ) |  |

DES-ECB Init.

Initialize DES ECB Context.

Precondition
The key length is 8 bytes.
Parameters
[out] | ctx | Pointer to the context
[in] | key | Pointer to the DES Key
[in] mode The mode (Encryption/Decryption) :
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If the input is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL
UCL_INVALID_MODE | If the mode is not one of those described


Universal Crypto Library: USIP AES ECB

Functions
USIP AES ECB
Operation Modes » ECB

Encrypt/Decrypt with USIP® AES in ECB (Electronic Codebook) mode. More...

+ Collaboration diagram for USIP AES ECB:

Functions

int | ucl_uaes_ecb (u8 *dst, u8 *src, u8 *key, u32 len, int mode)
USIP® AES-ECB. More...
int | ucl_uaes_ecb_init (ucl_uaes_ctx_t *ctx, u8 *key, int mode)
USIP® AES-ECB Init. More...
int | ucl_uaes_ecb_core (u8 *dst, ucl_uaes_ctx_t *ctx, u8 *src, u32 len)
USIP® AES-ECB Core. More...
int | ucl_uaes_ecb_finish (ucl_uaes_ctx_t *ctx)
USIP® AES-ECB Finish. More...

Detailed Description

Encrypt/Decrypt with USIP® AES in ECB (Electronic Codebook) mode.

Header:
ucl_uaes_ecb.h
Warning
If you use those functions you erase the USIP® AES context.
Note
A USIP® AES interface must be defined.

Function Documentation

◆ ucl_uaes_ecb()

int ucl_uaes_ecb | ( | u8 * | dst,
 |  | u8 * | src,
 |  | u8 * | key,
 |  | u32 | len,
 |  | int | mode
 | ) |  |

USIP® AES-ECB.

Complete process.

Precondition
  • The data byte length must be a multiple of 16.
  • The key length is 16 bytes.
Parameters
[out] | dst | Pointer to the output data
[in] | key | Pointer to the USIP® AES Key
[in] | src | Pointer to the input data
[in] | len | Data byte length
[in] mode The mode (Encryption/Decryption):
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | One of the output is the pointer NULL
UCL_INVALID_ARG | len is not a multiple of 16

◆ ucl_uaes_ecb_core()

int ucl_uaes_ecb_core | ( | u8 * | dst,
 |  | ucl_uaes_ctx_t * | ctx,
 |  | u8 * | src,
 |  | u32 | len
 | ) |  |

USIP® AES-ECB Core.

Process the Data.

Precondition
The data byte length must be a multiple of 16.
Parameters
[out] | dst | Pointer to the output data
[in,out] | ctx | Pointer to the context
[in] | src | Pointer to the data
[in] | len | Data byte length
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | One of the input is the pointer NULL
UCL_INVALID_OUTPUT | The output is the pointer NULL
UCL_INVALID_ARG | The byte length is not a multiple of 16

◆ ucl_uaes_ecb_finish()

int ucl_uaes_ecb_finish ( ucl_uaes_ctx_t * ctx )

USIP® AES-ECB Finish.

Zeroize the context.

Parameters
[in,out] ctx Pointer to the context
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_OUTPUT | The output is the pointer NULL

◆ ucl_uaes_ecb_init()

int ucl_uaes_ecb_init | ( | ucl_uaes_ctx_t * | ctx,
 |  | u8 * | key,
 |  | int | mode
 | ) |  |

USIP® AES-ECB Init.

Initialize USIP® AES ECB Context.

Precondition
The key length is 16 bytes.
Parameters
[out] | ctx | Pointer to the context
[in] | key | Pointer to the USIP® AES Key
[in] mode The mode (Encryption/Decryption):
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | The input is the pointer NULL
UCL_INVALID_OUTPUT | The output is the pointer NULL
UCL_INVALID_MODE | The mode is not one of those described


Universal Crypto Library: OFB

Modules
OFB
Operation Modes

Output Feedback. More...

+ Collaboration diagram for OFB:

Modules

3DES OFB
Encrypt/Decrypt with 3DES in 64-bit OFB (Output Feedback) mode.
DES OFB
Encrypt/Decrypt with DES in 64-bit OFB (Output Feedback) mode.

Detailed Description

Output Feedback.

This mode is an additive stream cipher in which errors in the cipher text are not extended to cause additional errors in the decrypted plain text. One bit in error in the cipher text causes only one bit to be in error in the decrypted plain text. Therefore, this mode cannot be used for data authentication but is useful in applications where a few errors in the decrypted plain text are acceptable.

Note
This mode requires an initialization vector IV to combine with the first plaintext block. The IV need not be secret, but it must be unpredictable.
We recommand to generate it with the USIP® TRNG.


Universal Crypto Library: 3DES OFB

Functions
3DES OFB
Operation Modes » OFB

Encrypt/Decrypt with 3DES in 64-bit OFB (Output Feedback) mode. More...

+ Collaboration diagram for 3DES OFB:

Functions

int | ucl_3des_ofb (u8 *dataOut, u8 *dataIn, u8 *key, u8 *IV, u32 data_byteLen, int mode)
3DES-OFB. More...
int | ucl_3des_ofb_init (ucl_3des_ctx_t *ctx, u8 *key, u8 *IV, int mode)
3DES-OFB Init. More...
int | ucl_3des_ofb_core (u8 *dataOut, ucl_3des_ctx_t *ctx, u8 *dataIn, u32 data_byteLen)
3DES-OFB Core. More...
int | ucl_3des_ofb_finish (ucl_3des_ctx_t *ctx)
3DES-OFB Finish. More...

Detailed Description

Encrypt/Decrypt with 3DES in 64-bit OFB (Output Feedback) mode.

Header:
ucl_3des_ofb.h

Function Documentation

◆ ucl_3des_ofb()

int ucl_3des_ofb | ( | u8 * | dataOut,
 |  | u8 * | dataIn,
 |  | u8 * | key,
 |  | u8 * | IV,
 |  | u32 | data_byteLen,
 |  | int | mode
 | ) |  |

3DES-OFB.

Complete process.

Precondition
  • The byte length must be a multiple of 8.
  • Input and Output Data have the same length.
  • The key length is 16 or 24 bytes (See 3DES ).
Parameters
[out] | dataOut | Pointer to decrypted/encryted message
[in] | dataIn | Pointer to encrypted/decrypted message
[in] | key | Pointer to the 3DES Key
[in] | IV | Pointer to the initialization vector
[in] | data_byteLen | Data byte length
[in] mode The mode (Encryption/Decryption) :
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output is the pointer NULL
UCL_INVALID_ARG | If data_byteLen is not a multiple of 8
Note
This mode requires an initialization vector IV to combine with the first plaintext block. The IV need not be secret, but it must be unpredictable.
We recommand to generate it with the USIP® TRNG.
See also
3DES

◆ ucl_3des_ofb_core()

int ucl_3des_ofb_core | ( | u8 * | dataOut,
 |  | ucl_3des_ctx_t * | ctx,
 |  | u8 * | dataIn,
 |  | u32 | data_byteLen
 | ) |  |

3DES-OFB Core.

Process the Data.

Precondition
  • The byte length must be a multiple of 8.
  • Input and Output Data have the same length.
Parameters
[out] | dataOut | Pointer to the output data
[in,out] | ctx | Pointer to the context
[in] | dataIn | Pointer to the data
[in] | data_byteLen | Data byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL
UCL_INVALID_ARG | If the byte length is not a multiple of 8

◆ ucl_3des_ofb_finish()

int ucl_3des_ofb_finish ( ucl_3des_ctx_t * ctx )

3DES-OFB Finish.

Zeroize the context.

Parameters
[in,out] ctx Pointer to the context
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_OUTPUT | If the output is the pointer NULL

◆ ucl_3des_ofb_init()

int ucl_3des_ofb_init | ( | ucl_3des_ctx_t * | ctx,
 |  | u8 * | key,
 |  | u8 * | IV,
 |  | int | mode
 | ) |  |

3DES-OFB Init.

Initialize 3DES OFB Context.

Precondition
The key length is 16 or 24 bytes (See 3DES ).
Parameters
[out] | ctx | Pointer to the context
[in] | key | Pointer to the 3DES Key
[in] | IV | Pointer to the initialization vector
[in] mode The mode (Encryption/Decryption) :
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If the input is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL
UCL_INVALID_MODE | If the mode is not one of those 3 described


Universal Crypto Library: DES OFB

Functions
DES OFB
Operation Modes » OFB

Encrypt/Decrypt with DES in 64-bit OFB (Output Feedback) mode. More...

+ Collaboration diagram for DES OFB:

Functions

int | ucl_des_ofb (u8 *dataOut, u8 *dataIn, u8 *key, u8 *IV, u32 data_byteLen, int mode)
DES-OFB. More...
int | ucl_des_ofb_init (ucl_des_ctx_t *ctx, u8 *key, u8 *IV, int mode)
DES-OFB Init. More...
int | ucl_des_ofb_core (u8 *dataOut, ucl_des_ctx_t *ctx, u8 *dataIn, u32 data_byteLen)
DES-OFB Core. More...
int | ucl_des_ofb_finish (ucl_des_ctx_t *ctx)
DES-OFB Finish. More...

Detailed Description

Encrypt/Decrypt with DES in 64-bit OFB (Output Feedback) mode.

Header:
ucl_des_ofb.h

Function Documentation

◆ ucl_des_ofb()

int ucl_des_ofb | ( | u8 * | dataOut,
 |  | u8 * | dataIn,
 |  | u8 * | key,
 |  | u8 * | IV,
 |  | u32 | data_byteLen,
 |  | int | mode
 | ) |  |

DES-OFB.

Complete Process.

Precondition
  • The byte length must be a multiple of 8.
  • Input and Output Data have the same length.
  • The key length is 8 bytes.
Parameters
[out] | dataOut | Pointer to the output data
[in] | dataIn | Pointer to the input data
[in] | key | Pointer to the DES Key
[in] | IV | Pointer to the initialization vector
[in] | data_byteLen | Data byte length
[in] mode The mode (Encryption/Decryption):
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output is the pointer NULL
UCL_INVALID_ARG | If data_byteLen is not a multiple of 8
See also
DES

◆ ucl_des_ofb_core()

int ucl_des_ofb_core | ( | u8 * | dataOut,
 |  | ucl_des_ctx_t * | ctx,
 |  | u8 * | dataIn,
 |  | u32 | data_byteLen
 | ) |  |

DES-OFB Core.

Process the Data.

Precondition
  • The byte length must be a multiple of 8.
  • Input and output data have the same length.
Parameters
[out] | dataOut | Pointer to the procesed data
[in,out] | ctx | Pointer to the context
[in] | dataIn | Pointer to the data
[in] | data_byteLen | Data byte length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL
UCL_INVALID_ARG | If the byte length is not a multiple of 8

◆ ucl_des_ofb_finish()

int ucl_des_ofb_finish ( ucl_des_ctx_t * ctx )

DES-OFB Finish.

Zeroize the context.

Parameters
[in,out] ctx Pointer to the context
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_OUTPUT | If the output is the pointer NULL

◆ ucl_des_ofb_init()

int ucl_des_ofb_init | ( | ucl_des_ctx_t * | ctx,
 |  | u8 * | key,
 |  | u8 * | IV,
 |  | int | mode
 | ) |  |

DES-OFB Init.

Initialize DES OFB Context.

Precondition
The key length is 8 bytes.
Parameters
[out] | ctx | Pointer to the context
[in] | key | Pointer to the DES Key
[in] | IV | Pointer to the initialization vector
[in] mode The mode (Encryption/Decryption) :
  • UCL_CIPHER_ENCRYPT
  • UCL_CIPHER_DECRYPT
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If the input is the pointer NULL
UCL_INVALID_OUTPUT | If the output is the pointer NULL
UCL_INVALID_MODE | If the mode is not one of those described


Universal Crypto Library: Public Key Algorithm

Modules
Public Key Algorithm

Public Key Algorithm of the Libcrypto. More...

+ Collaboration diagram for Public Key Algorithm:

Modules

Diffie-Hellman
Diffie-Hellman Key Exchange Protocol.
Elliptic Curves.
ECC Elliptic Curves.
RSA
The RSA cryptosystem.

Detailed Description

Public Key Algorithm of the Libcrypto.

Asymmetric key algorithm uses a pair of different, though related, cryptographic keys to encrypt and decrypt. The two keys are related mathematically; a message encrypted by the algorithm using one key can be decrypted by the same algorithm using the other.
One drawback of asymmetric key algorithms is that they are much slower than comparably secure symmetric key algorithms. In many quality crypto systems, both algorithm types are used. The receiver's public key encrypts a symmetric algorithm key which is used to encrypt the main message. This combines the virtues of both algorithm types when properly done.

Another important point is that Public-key cryptography facilitates efficient signatures (particularly non-repudiation) and key mangement.

Note
Module Version 1.0


Universal Crypto Library: Diffie-Hellman

Data Structures | Macros | Functions
Diffie-Hellman
Public Key Algorithm

Diffie-Hellman Key Exchange Protocol. More...

+ Collaboration diagram for Diffie-Hellman:

Data Structures

struct ucl_dh_ctx_t
DH Context. More...

Macros

#define | UCL_MOD_EXP_METHOD_MONTY 1
Modular exponentiation use Montgomery method.
#define | UCL_MOD_EXP_METHOD_FBEM 2
Modular exponentiation use FBEM method.
#define | UCL_BUFFER_TOO_SMALL -101
Specific error.
#define | UCL_DATA_TOO_SMALL -102
Specific error.

Functions

int | ucl_dh_save_ctx (u8 *data, u32 datalen, ucl_dh_ctx_t dh_ctx)
Save the Diffie-Hellman Context. More...
int | ucl_dh_restore_ctx (ucl_dh_ctx_t *dh_ctx, u8 *data, u32 datalen, u32 *buffer, u32 size)
Restore the Diffie-Hellman Context. More...
int | ucl_dh_init (ucl_dh_ctx_t *dh_ctx, u32 *buffer, u32 size, int option)
Diffie-Hellman Initialization. More...
int | ucl_dh_gen_secret (ucl_dh_ctx_t *dh_ctx)
Diffie-Hellman Secret Generation. More...
int | ucl_dh_gen_mess (u8 *m, ucl_dh_ctx_t *dh_ctx)
Diffie-Hellman Message Generation. More...
int | ucl_dh_gen_key (u8 *key, u32 keylen, u8 *m, ucl_dh_ctx_t *dh_ctx)
Diffie-Hellman Shared-Key Generation. More...

Detailed Description

Diffie-Hellman Key Exchange Protocol.

Header:
ucl_dh.h

Diffie-Hellman key agreement provided the first practical solution to the key distribution problem, allowing two parties, never having met in advance or shared keying material, to establish a shared secret by exchanging messages over an open channel. The security rests on the intractability of the Diffie-Hellman problem and the related problem of computing discrete logarithms.

The basic version provides protection in the form of secrecy of the resulting key from passive adversaries, but not from active adversaries capable of intercepting, modifying, or injecting messages. Neither party has assurances of the source identity of the incoming message or the identity of the party which may know the resulting key, i.e., entity authentication or key authentication.

The Diffie-Hellman protocol, and those based on it, can be carried out in any group in which both the discrete logarithm problem is hard and exponentiation is efficient. The most common examples of such groups used in practice are the multiplicative group [image] of $ Z_p $, the analogous multiplicative group of $ F_{2^m} $, and the group of points defined by an elliptic curve over a finite field.
In our case, we choose the group $ Z_p $ where p is a large prime.

Protocol:
The goal: A and B want to share a secret key K.
A and B use the public elements p and g where p (the modulus) is a large prime and g (the base) is an element of $ Z_p $.

  • A and B generate each a secret element [image].
  • A calculate and send [image] to B
  • B calculate and send [image] to A
  • then

Function Documentation

◆ ucl_dh_gen_key()

int ucl_dh_gen_key | ( | u8 * | key,
 |  | u32 | keylen,
 |  | u8 * | m,
 |  | ucl_dh_ctx_t * | dh_ctx
 | ) |  |

Diffie-Hellman Shared-Key Generation.

Generate the key from the second parts message and the secret.

$ key = m^y $

Parameters
[out] | key | The shared key
[in] | keylen | The key length
[in] | m | The second part message
[in] | dh_ctx | Pointer to a Diffie-Hellman context
Returns
Error code

◆ ucl_dh_gen_mess()

int ucl_dh_gen_mess | ( | u8 * | m,
 |  | ucl_dh_ctx_t * | dh_ctx
 | ) |  |

Diffie-Hellman Message Generation.

Generate the message from the secret.

$ m = g^x $

Parameters
[out] | m | The message
[in] | dh_ctx | Pointer to a Diffie-Hellman context
Returns
Error code

◆ ucl_dh_gen_secret()

int ucl_dh_gen_secret ( ucl_dh_ctx_t * dh_ctx )

Diffie-Hellman Secret Generation.

Generate a secret.

Parameters
[out] dh_ctx Pointer to a Diffie-Hellman context
Returns
Error code

◆ ucl_dh_init()

int ucl_dh_init | ( | ucl_dh_ctx_t * | dh_ctx,
 |  | u32 * | buffer,
 |  | u32 | size,
 |  | int | option
 | ) |  |

Diffie-Hellman Initialization.

Init the context. The Diffie-Hellman protocol needs some pre-computations.

Parameters
[out] | dh_ctx | Pointer to a Diffie-Hellman context
[in] | buffer | Pointer to a buffer
[in] | size | Buffer 32-bit words length (See the note)
[in] option Define the exponentiation method:
  • UCL_MOD_EXP_METHOD_MONTY Montgomery method
  • UCL_MOD_EXP_METHOD_FBEM Fixed-base Euclidian Method
Note
The size of the buffer depends on the computation methods:
  • UCL_MOD_EXP_METHOD_FBEM (((2 + 2*s) * s) + MFPA_CTX_SIZE)
  • UCL_MOD_EXP_METHOD_MONTY ((2*s) + +MFPA_CTX_SIZE)
Returns
Error code

◆ ucl_dh_restore_ctx()

int ucl_dh_restore_ctx | ( | ucl_dh_ctx_t * | dh_ctx,
 |  | u8 * | data,
 |  | u32 | datalen,
 |  | u32 * | buffer,
 |  | u32 | size
 | ) |  |

Restore the Diffie-Hellman Context.

Parameters
[out] | dh_ctx | The Diffie-Hellman context
[in] | data | A saved context
[in] | datalen | Data byte length
[in] | buffer | Buffer
[in] | size | Buffer 32-bits words length (See the note)
Note
Data length is (s * (4 + s)) + 8
Buffer size is (((2 + 2*s) * s) + 6)
Warning
Only for FBEM method
Returns
Error code

◆ ucl_dh_save_ctx()

int ucl_dh_save_ctx | ( | u8 * | data,
 |  | u32 | datalen,
 |  | ucl_dh_ctx_t | dh_ctx
 | ) |  |

Save the Diffie-Hellman Context.

Parameters
[out] | data | The saved context
[in] | datalen | Data byte length (See the note)
[in] | dh_ctx | Pointer to a Diffie-Hellman context
Note
Data length is (s * (4 + s)) + 8
Warning
Only for FBEM method
Returns
Error code


Universal Crypto Library: ucl_dh_ctx_t Struct Reference

Data Fields
ucl_dh_ctx_t Struct Reference
Public Key Algorithm » Diffie-Hellman

DH Context. More...

Data Fields

u8 * module
The module.
u8 * base
The base.
u8 * secret
The secret.
u32 len
Module (base and secret) byte length.
void * ctx
The precalculation context.

Detailed Description

DH Context.

DH Context typedef.


Universal Crypto Library: Elliptic Curves.

Modules | Functions
Elliptic Curves.
Public Key Algorithm

ECC Elliptic Curves. More...

+ Collaboration diagram for Elliptic Curves.:

Modules

ECDSA
Elliptic Curve Digital signature Algorithm.
ECC keys generation.
ECC keys generation.
ECC public keys generation.
ECC public keys generation.
ECIES computation.
ECIES computation.
SP800-56 ECDH computation

Functions

void | msbit_and_size (int *np, int *digits_tmp, ucl_type_curve *curve_params)
compute bits size and word size of a curve domain parameter p. More...
void | set_msbit_curve (DIGIT *KEXT, DIGIT *digits_ext, int np, int digits_tmp, ucl_type_curve *curve_params)
extend the msbit of a sclar for a curve domain parameter. More...

Detailed Description

ECC Elliptic Curves.

Function Documentation

◆ msbit_and_size()

void msbit_and_size | ( | int * | np,
 |  | int * | digits_tmp,
 |  | ucl_type_curve * | curve_params
 | ) |  |

compute bits size and word size of a curve domain parameter p.

Parameters
[out] | np | pointer to the real number of bits of p, i.e. the largest position with a bit set to 1
[out] | digits_tmp | pointer to the real number of words (DIGIT) of p, i.e. the largest position with a word non null
[in] | *curve_params | the pointer to a ucl_type_curve structure, containing the curve domain parameters (already existing ones are described in the documentation)

◆ set_msbit_curve()

void set_msbit_curve | ( | DIGIT * | KEXT,
 |  | DIGIT * | digits_ext,
 |  | int | np,
 |  | int | digits_tmp,
 |  | ucl_type_curve * | curve_params
 | ) |  |

extend the msbit of a sclar for a curve domain parameter.

Parameters
[in,out] | KEXT | the pointer to the extended scalar array, with a bit equal to 1 appended after the msb equal to 1
[out] | digits_ext | the pointer to the new size of the new scalar
[in] | np | the real number of bits of p, i.e. the largest position with a bit set to 1


Universal Crypto Library: ECDSA

Data Structures | Macros | Functions | Variables
ECDSA
Public Key Algorithm » Elliptic Curves.

Elliptic Curve Digital signature Algorithm. More...

+ Collaboration diagram for ECDSA:

Data Structures

struct | ucl_type_ecc_jacobian_point
ECC word Jacobian point coordinates. More...
struct | ucl_type_ecc_u8_affine_point
ECC byte affine point coordinates. More...
struct | ucl_type_ecc_digit_affine_point
ECC word affine point coordinates. More...
struct | ucl_type_ecdsa_signature
ECC byte signature structure. More...

Macros

#define SIGNATURE_COMPUTATION 0xFF
ECC Curve Structure.

Functions

int | ucl_ecdsa_signature (ucl_type_ecdsa_signature signature, u8 *d, int(*ucl_hash)(u8 *, u8 *, u32), u8 *input, u32 inputlength, ucl_type_curve *curve_params, u32 configuration)
ECDSA signature. More...
int | ucl_ecdsa_verification (ucl_type_ecc_u8_affine_point Q, ucl_type_ecdsa_signature signature, int(*ucl_hash)(u8 *, u8 *, u32), u8 *input, u32 inputlength, ucl_type_curve *curve_params, u32 configuration)
ECDSA signature. More...
int | ucl_sm2dsa_signature (ucl_type_ecdsa_signature signature, u8 *d, ucl_type_ecc_u8_affine_point A, u8 *input, u32 inputlength, u8 *ida, u8 *entla, u32 configuration)
SM2 DSA signature. More...
int | ucl_sm2dsa_signature_curve (ucl_type_ecdsa_signature signature, u8 *d, ucl_type_ecc_u8_affine_point A, u8 *input, u32 inputlength, u8 *ida, u8 *entla, ucl_type_curve *curve_params, u32 configuration)
SM2 DSA signature. More...
int | ucl_sm2dsa_verification (ucl_type_ecdsa_signature signature, ucl_type_ecc_u8_affine_point A, u8 *input, u32 inputlength, u8 *ida, u8 *entla, u32 configuration)
ECC SM2 DSA signature. More...
int | ucl_sm2dsa_verification_curve (ucl_type_ecdsa_signature signature, ucl_type_ecc_u8_affine_point A, u8 *input, u32 inputlength, u8 *ida, u8 *entla, ucl_type_curve *curve_params, u32 configuration)
ECC SM2 DSA signature. More...
int | ucl_sm2_encryption_curve (u8 *c, ucl_type_ecc_u8_affine_point A, u8 *m, u32 klen, ucl_type_curve *curve_params)
SM2 public key encryption. More...
int | ucl_sm2_decryption_curve (u8 *m, u8 *d, ucl_type_ecc_u8_affine_point A, u8 *c, u32 klen, ucl_type_curve *curve_params)
SM2 public key encryption. More...
int | ucl_ecdsa_sign (u8 *r_and_others, u8 *s, u8 *d, u8 *input, u32 inputlength, u32 configuration)
ECDSA signature. More...
int | ucl_ecdsa_verify_p160r1 (u32 keylength, u8 *xG, u8 *yG, u8 *xQ, u8 *yQ, u8 *r, u8 *s, u8 *a, u8 *n, u8 *p, u8 *hash, u32 hashlength)
ECDSA signature. More...
int | ucl_ecdsa_verify_p192r1 (u32 keylength, u8 *xG, u8 *yG, u8 *xQ, u8 *yQ, u8 *r, u8 *s, u8 *a, u8 *n, u8 *p, u8 *hash, u32 hashlength)
ECDSA signature. More...
int | ucl_ecdsa_verify_p224r1 (u32 keylength, u8 *xG, u8 *yG, u8 *xQ, u8 *yQ, u8 *r, u8 *s, u8 *a, u8 *n, u8 *p, u8 *hash, u32 hashlength)
ECDSA signature. More...
int | ucl_ecdsa_verify_p256r1 (u32 keylength, u8 *xG, u8 *yG, u8 *xQ, u8 *yQ, u8 *r, u8 *s, u8 *a, u8 *n, u8 *p, u8 *hash, u32 hashlength)
ECDSA signature. More...
int | ucl_ecdsa_verify_bp256r1 (u32 keylength, u8 *xG, u8 *yG, u8 *xQ, u8 *yQ, u8 *r, u8 *s, u8 *a, u8 *n, u8 *p, u8 *hash, u32 hashlength)
ECDSA signature. More...
int | ucl_ecdsa_verify_p384r1 (u32 keylength, u8 *xG, u8 *yG, u8 *xQ, u8 *yQ, u8 *r, u8 *s, u8 *a, u8 *n, u8 *p, u8 *hash, u32 hashlength)
ECDSA signature. More...
int | ucl_ecdsa_verify_bp384r1 (u32 keylength, u8 *xG, u8 *yG, u8 *xQ, u8 *yQ, u8 *r, u8 *s, u8 *a, u8 *n, u8 *p, u8 *hash, u32 hashlength)
ECDSA signature. More...
int | ucl_ecdsa_verify_p521r1 (u32 keylength, u8 *xG, u8 *yG, u8 *xQ, u8 *yQ, u8 *r, u8 *s, u8 *a, u8 *n, u8 *p, u8 *hash, u32 hashlength)
ECDSA signature. More...
int | ucl_ecdsa_verify_bp512r1 (u32 keylength, u8 *xG, u8 *yG, u8 *xQ, u8 *yQ, u8 *r, u8 *s, u8 *a, u8 *n, u8 *p, u8 *hash, u32 hashlength)
ECDSA signature. More...
int | ucl_ecdsa_verify (u8 *xQ, u8 *yQ, u8 *r, u8 *s, u8 *input, u32 inputlength, u32 configuration)
ECDSA signature. More...
int | ucl_sm2dsa_sign_curve (u8 *r, u8 *s, u8 *d, u8 *xA, u8 *yA, u8 *input, u32 inputlength, u8 *ida, u8 *entla, u32 configuration, u8 *a, u8 *b, u8 *p, u8 *xG, u8 *yG, u8 *n)
SM2 DSA signature. More...
int | ucl_sm2dsa_sign (u8 *r, u8 *s, u8 *d, u8 *xA, u8 *yA, u8 *input, u32 inputlength, u8 *ida, u8 *entla, u32 configuration)
SM2 DSA signature. More...
int | ucl_sm2dsa_verify_curve (u8 *r, u8 *s, u8 *xA, u8 *yA, u8 *input, u32 inputlength, u8 *ida, u8 *entla, u32 configuration, u8 *a, u8 *b, u8 *p, u8 *xG, u8 *yG, u8 *n)
ECDSA signature. More...
int | ucl_sm2dsa_verify (u8 *r, u8 *s, u8 *xA, u8 *yA, u8 *input, u32 inputlength, u8 *ida, u8 *entla, u32 configuration)
ECDSA signature. More...

Variables

ucl_type_curve | secp160r1
ECC Curve structure variable for SEC-P160r1.
ucl_type_curve | secp192r1
ECC Curve structure variable for SEC-P192r1.
ucl_type_curve | secp224r1
ECC Curve structure variable for SEC-P224r1.
ucl_type_curve | secp256r1
ECC Curve structure variable for SEC-P256r1.
ucl_type_curve | secp256k1
ECC Curve structure variable for SEC-P256k1.
ucl_type_curve | sm2fp256
ECC Curve structure variable for SM2-FP256.
ucl_type_curve | bp256r1
ECC Curve structure variable for Brainpool P256r1.
ucl_type_curve | bp384r1
ECC Curve structure variable for Brainpool P384r1.
ucl_type_curve | secp384r1
ECC Curve structure variable for SEC-P384r1.
ucl_type_curve | secp521r1
ECC Curve structure variable for SEC-P521r1.
ucl_type_curve | bp512r1
ECC Curve structure variable for Brainpool P512r1.

Detailed Description

Elliptic Curve Digital signature Algorithm.

ECDSA is the implementation of DSA using the ECC.

Header:
ecdsa_generic_api.h

Function Documentation

◆ ucl_ecdsa_sign()

int ucl_ecdsa_sign | ( | u8 * | r_and_others,
 |  | u8 * | s,
 |  | u8 * | d,
 |  | u8 * | input,
 |  | u32 | inputlength,
 |  | u32 | configuration
 | ) |  |

ECDSA signature.

Compute a ECDSA signature

Parameters
[out] | *r_and_others | input/output, the r value for the computed signature (may have been pre-computed, with UCL_R_PRECOMP configuration) if UCL_R_PRECOMP or UCL_PRECOMP_R are used, the array is a double curve array as containing the r and the k-1.
[out] | *s | output, the s value for the computed signature
[in] | *d | input, the secret key
[in] | *input | input, the message or the hash digest to be signed,
[in] | inputlength | input, the input length, in bytes
[in] configuration (combination of any of these lines)
  • UCL_R_PRECOMP or UCL_PRECOMP_R:
  • UCL_R_PRECOMP: using precomputed r to finish the signature computation,
  • UCL_PRECOMP_R: to only pre-compute the r value,
  • SECP160R1 or SECP192R1 or SECP224R1 or SECP256R1 or SECP384R1 or SECP521R1 or BP256R1 or BP384R1 or BP512R1
  • UCL_MSG_INPUT or UCL_HASH_INPUT or UCL_NO_INPUT
  • UCL_MSG_INPUT: the message will be hashed first,
  • UCL_HASH_INPUT: the message is already the hash digest,
  • UCL_NO_INPUT: for r precomputation (UCL_PRECOMP_R)
  • UCL_SHA256 or UCL_SHA224 or UCL_SHA384 or UCL_SHA512 or UCL_SHA1: hash function, if UCL_MSG_INPUT is used.
  • Examples are:
    • SECP192R1<<UCL_CURVE_SHIFT+UCL_HASH_INPUT<<UCL_INPUT_SHIFT: signing a hash digest on P192 curve, r not precomputed
    • SECP256R1<<UCL_CURVE_SHIFT+UCL_HASH_INPUT<<UCL_INPUT_SHIFT: signing a hash digest on P256 curve, r not precomputed
    • SECP256R1<<UCL_CURVE_SHIFT+UCL_PRECOMP_R<<UCL_PRECOMP_SHIFT+UCL_NO_INPUT<<UCL_INPUT_SHIFT: pre-compute r on P-256.
    • UCL_R_PRECOMP<<UCL_PRECOMP_SHIFT+SECP192R1<<UCL_CURVE_SHIFT+ UCL_MSG_INPUT<<UCL_INPUT_SHIFT+ UCL_SHA256<<UCL_HASH_SHIFT:signing a message, to be hashed with SHA-256, using pre-computed r
Returns
Error code
Return values
UCL_OK | in case of correct computation
UCL_INVALID_INPUT | in case of wrong parameters configuration

◆ ucl_ecdsa_signature()

int ucl_ecdsa_signature | ( | ucl_type_ecdsa_signature | signature,
 |  | u8 * | d,
 |  | int(*)(u8 *, u8 *, u32) | ucl_hash,
 |  | u8 * | input,
 |  | u32 | inputlength,
 |  | ucl_type_curve * | curve_params,
 |  | u32 | configuration
 | ) |  |

ECDSA signature.

Compute a ECDSA signature, using curve domain parameters, introduced in 2.4.9

Parameters
[out] | signature | pointer to a ucl_type_ecdsa_signature structure, containing the signature (r,s) values
[in] | *d | input, the secret key
[in] | *ucl_hash | input, the pointer to the hash function (see hash functions documentation for already available ones)
[in] | *input | input, the message or the hash digest to be signed,
[in] | inputlength | input, the input length, in bytes
[in] | *curve_params | the pointer to a ucl_type_curve structure, containing the curve domain parameters (already existing ones are described in the documentation)
[in] configuration (combination of any of these lines)
  • UCL_R_PRECOMP or UCL_PRECOMP_R:
  • UCL_R_PRECOMP: using precomputed r to finish the signature computation,
  • UCL_PRECOMP_R: to only pre-compute the r value,
  • UCL_MSG_INPUT or UCL_HASH_INPUT or UCL_NO_INPUT
  • UCL_MSG_INPUT: the message will be hashed first,
  • UCL_HASH_INPUT: the message is already the hash digest,
  • UCL_NO_INPUT: for r precomputation (UCL_PRECOMP_R)
  • Examples are:
    • UCL_HASH_INPUT<<UCL_INPUT_SHIFT: signing a hash digest, r not precomputed
    • UCL_HASH_INPUT<<UCL_INPUT_SHIFT: signing a hash digest, r not precomputed
    • UCL_PRECOMP_R<<UCL_PRECOMP_SHIFT+UCL_NO_INPUT<<UCL_INPUT_SHIFT: pre-compute r
    • UCL_R_PRECOMP<<UCL_PRECOMP_SHIFT+ UCL_MSG_INPUT<<UCL_INPUT_SHIFT:signing a message, using pre-computed r
Returns
Error code
Return values
UCL_OK | in case of correct computation
UCL_INVALID_INPUT | or #UCL_INVALID OUTPUT in case of wrong parameters configuration (e.g. NULL pointers, secret key greater than curve order)

◆ ucl_ecdsa_verification()

int ucl_ecdsa_verification | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | ucl_type_ecdsa_signature | signature,
 |  | int(*)(u8 *, u8 *, u32) | ucl_hash,
 |  | u8 * | input,
 |  | u32 | inputlength,
 |  | ucl_type_curve * | curve_params,
 |  | u32 | configuration
 | ) |  |

ECDSA signature.

Verify a ECDSA signature, using curve domain structure, introduced in 2.4.9

Parameters
[in] | public | key: pointer to a ucl_type_ecc_u8_affine_point structure, containing the ECC public key, used for signature verification
[in] | signature | pointer to a ucl_type_ecdsa_signature structure, containing the signature (r,s) values
[in] | *ucl_hash | input, the pointer to the hash function (see hash functions documentation for already available ones)
[in] | *input | input, the message or the hash digest to be signed,
[in] | inputlength | input, the input length, in bytes
[in] | *curve_params | the pointer to a ucl_type_curve structure, containing the curve domain parameters (already existing ones are described in the documentation)
[in] | configuration | (combination of any of these lines)
[in]

◆ ucl_ecdsa_verify()

int ucl_ecdsa_verify | ( | u8 * | xQ,
 |  | u8 * | yQ,
 |  | u8 * | r,
 |  | u8 * | s,
 |  | u8 * | input,
 |  | u32 | inputlength,
 |  | u32 | configuration
 | ) |  |

ECDSA signature.

Verify a ECDSA signature

Parameters
[in] | *xQ | input, the x affine coordinate of the public key
[in] | *yQ | input, the y affine coordinate of the public key
[in] | *r | input, the r value for the computed signature,
[in] | *s | input, the s value for the computed signature
[in] | *input | input, the signed message or signed hashed digest of the message,
[in] | inputlength | input, the input length, in bytes
[in] configuration (combination of any of these lines) SECP160R1 or SECP192R1 or SECP224R1 or SECP256R1 or SECP384R1 or SECP521R1 or BP256R1 or BP384R1 or BP512R1
  • UCL_MSG_INPUT or UCL_HASH_INPUT
  • UCL_MSG_INPUT: the message will be hashed first,
  • UCL_HASH_INPUT: the message is already the hash digest,
  • UCL_SHA256 or UCL_SHA224 or UCL_SHA384 or UCL_SHA512 or UCL_SHA1: hash function, if UCL_MSG_INPUT is used.
  • UCL_PRECOMP_TRICK: informs about use of precomputed values, to speed up the verification
  • Examples are:
    • SECP192R1<<UCL_CURVE_SHIFT+ UCL_MSG_INPUT<<UCL_INPUT_SHIFT+ UCL_SHA256<<UCL_HASH_INPUT:verifying a signed message, hashed with SHA-256,
    • SECP256R1<<UCL_CURVE_SHIFT+ UCL_MSG_INPUT<<UCL_INPUT_SHIFT+ UCL_SHA256<<UCL_HASH_INPUT:verifying a signed message, hashed with SHA-256,
    • UCL_PRECOMP_TRICK<<UCL_PRECOMP_TRICK_SHIFT:uses the precompx and precompy global variables as pointing to the customer tables containing the precomputed values
    • SECP192R1<<UCL_CURVE_SHIFT+UCL_HASH_INPUT<<UCL_INPUT_SHIFT: verifying a signed hash digest on P192 curve,
Returns
Error code
Return values
UCL_OK | if the signature is verified
UCL_ERROR | if the signature is not verified
UCL_INVALID_INPUT | in case of wrong parameters configuration

◆ ucl_ecdsa_verify_bp256r1()

int ucl_ecdsa_verify_bp256r1 | ( | u32 | keylength,
 |  | u8 * | xG,
 |  | u8 * | yG,
 |  | u8 * | xQ,
 |  | u8 * | yQ,
 |  | u8 * | r,
 |  | u8 * | s,
 |  | u8 * | a,
 |  | u8 * | n,
 |  | u8 * | p,
 |  | u8 * | hash,
 |  | u32 | hashlength
 | ) |  |

ECDSA signature.

Verify a bp256r1 ECDSA signature, directly from the message hash

Parameters
[in] | keylength | input, the bytes size of the curve, i.e. #BP256R1_BYTESIZE
[in] | *xG | input, the x affine coordinate of the bp256r1 base point
[in] | *yG | input, the y affine coordinate of the bp256r1 base point
[in] | *xQ | input, the x affine coordinate of the public key
[in] | *yQ | input, the y affine coordinate of the public key
[in] | *r | input, the r value of the signature to be verified
[in] | *s | input, the s value of the signature to be verified
[in] | *a | input, the a parameter of the bp256r1 curve
[in] | *n | input, the n parameter of the bp256r1 curve
[in] | *p | input, the p parameter of the bp256r1 curve
[in] | *hash | input, the already hashed digest of the message,
[in] | hashlength | input, the hash length, in bytes
Returns
Error code
Return values
UCL_OK | if the signature is verified
UCL_ERROR | if the signature is not verified
UCL_INVALID_INPUT | in case of wrong parameters

◆ ucl_ecdsa_verify_bp384r1()

int ucl_ecdsa_verify_bp384r1 | ( | u32 | keylength,
 |  | u8 * | xG,
 |  | u8 * | yG,
 |  | u8 * | xQ,
 |  | u8 * | yQ,
 |  | u8 * | r,
 |  | u8 * | s,
 |  | u8 * | a,
 |  | u8 * | n,
 |  | u8 * | p,
 |  | u8 * | hash,
 |  | u32 | hashlength
 | ) |  |

ECDSA signature.

Verify a bp384r1 ECDSA signature, directly from the message hash

Parameters
[in] | keylength | input, the bytes size of the curve, i.e. #BP384R1_BYTESIZE
[in] | *xG | input, the x affine coordinate of the bp384r1 base point
[in] | *yG | input, the y affine coordinate of the bp384r1 base point
[in] | *xQ | input, the x affine coordinate of the public key
[in] | *yQ | input, the y affine coordinate of the public key
[in] | *r | input, the r value of the signature to be verified
[in] | *s | input, the s value of the signature to be verified
[in] | *a | input, the a parameter of the bp384r1 curve
[in] | *n | input, the n parameter of the bp384r1 curve
[in] | *p | input, the p parameter of the bp384r1 curve
[in] | *hash | input, the already hashed digest of the message,
[in] | hashlength | input, the hash length, in bytes
Returns
Error code
Return values
UCL_OK | if the signature is verified
UCL_ERROR | if the signature is not verified
UCL_INVALID_INPUT | in case of wrong parameters

◆ ucl_ecdsa_verify_bp512r1()

int ucl_ecdsa_verify_bp512r1 | ( | u32 | keylength,
 |  | u8 * | xG,
 |  | u8 * | yG,
 |  | u8 * | xQ,
 |  | u8 * | yQ,
 |  | u8 * | r,
 |  | u8 * | s,
 |  | u8 * | a,
 |  | u8 * | n,
 |  | u8 * | p,
 |  | u8 * | hash,
 |  | u32 | hashlength
 | ) |  |

ECDSA signature.

Verify a bp512r1 ECDSA signature, directly from the message hash

Parameters
[in] | keylength | input, the bytes size of the curve, i.e. #BP512R1_BYTESIZE
[in] | *xG | input, the x affine coordinate of the bp512r1 base point
[in] | *yG | input, the y affine coordinate of the bp512r1 base point
[in] | *xQ | input, the x affine coordinate of the public key
[in] | *yQ | input, the y affine coordinate of the public key
[in] | *r | input, the r value of the signature to be verified
[in] | *s | input, the s value of the signature to be verified
[in] | *a | input, the a parameter of the bp512r1 curve
[in] | *n | input, the n parameter of the bp512r1 curve
[in] | *p | input, the p parameter of the bp512r1 curve
[in] | *hash | input, the already hashed digest of the message,
[in] | hashlength | input, the hash length, in bytes
Returns
Error code
Return values
UCL_OK | if the signature is verified
UCL_ERROR | if the signature is not verified
UCL_INVALID_INPUT | in case of wrong parameters

◆ ucl_ecdsa_verify_p160r1()

int ucl_ecdsa_verify_p160r1 | ( | u32 | keylength,
 |  | u8 * | xG,
 |  | u8 * | yG,
 |  | u8 * | xQ,
 |  | u8 * | yQ,
 |  | u8 * | r,
 |  | u8 * | s,
 |  | u8 * | a,
 |  | u8 * | n,
 |  | u8 * | p,
 |  | u8 * | hash,
 |  | u32 | hashlength
 | ) |  |

ECDSA signature.

Verify a secp160r1 ECDSA signature, directly from the message hash

Parameters
[in] | keylength | input, the bytes size of the curve, i.e. #SECP160R1_BYTESIZE
[in] | *xG | input, the x affine coordinate of the secp160r1 base point
[in] | *yG | input, the y affine coordinate of the secp160r1 base point
[in] | *xQ | input, the x affine coordinate of the public key
[in] | *yQ | input, the y affine coordinate of the public key
[in] | *r | input, the r value of the signature to be verified
[in] | *s | input, the s value of the signature to be verified
[in] | *a | input, the a parameter of the secp160r1 curve
[in] | *n | input, the n parameter of the secp160r1 curve
[in] | *p | input, the p parameter of the secp160r1 curve
[in] | *hash | input, the already hashed digest of the message,
[in] | hashlength | input, the hash length, in bytes
Returns
Error code
Return values
UCL_OK | if the signature is verified
UCL_ERROR | if the signature is not verified
UCL_INVALID_INPUT | in case of wrong parameters

◆ ucl_ecdsa_verify_p192r1()

int ucl_ecdsa_verify_p192r1 | ( | u32 | keylength,
 |  | u8 * | xG,
 |  | u8 * | yG,
 |  | u8 * | xQ,
 |  | u8 * | yQ,
 |  | u8 * | r,
 |  | u8 * | s,
 |  | u8 * | a,
 |  | u8 * | n,
 |  | u8 * | p,
 |  | u8 * | hash,
 |  | u32 | hashlength
 | ) |  |

ECDSA signature.

Verify a secp192r1 ECDSA signature, directly from the message hash

Parameters
[in] | keylength | input, the bytes size of the curve, i.e. #SECP192R1_BYTESIZE
[in] | *xG | input, the x affine coordinate of the secp192r1 base point
[in] | *yG | input, the y affine coordinate of the secp192r1 base point
[in] | *xQ | input, the x affine coordinate of the public key
[in] | *yQ | input, the y affine coordinate of the public key
[in] | *r | input, the r value of the signature to be verified
[in] | *s | input, the s value of the signature to be verified
[in] | *a | input, the a parameter of the secp192r1 curve
[in] | *n | input, the n parameter of the secp192r1 curve
[in] | *p | input, the p parameter of the secp192r1 curve
[in] | *hash | input, the already hashed digest of the message,
[in] | hashlength | input, the hash length, in bytes
Returns
Error code
Return values
UCL_OK | if the signature is verified
UCL_ERROR | if the signature is not verified
UCL_INVALID_INPUT | in case of wrong parameters

◆ ucl_ecdsa_verify_p224r1()

int ucl_ecdsa_verify_p224r1 | ( | u32 | keylength,
 |  | u8 * | xG,
 |  | u8 * | yG,
 |  | u8 * | xQ,
 |  | u8 * | yQ,
 |  | u8 * | r,
 |  | u8 * | s,
 |  | u8 * | a,
 |  | u8 * | n,
 |  | u8 * | p,
 |  | u8 * | hash,
 |  | u32 | hashlength
 | ) |  |

ECDSA signature.

Verify a secp224r1 ECDSA signature, directly from the message hash

Parameters
[in] | keylength | input, the bytes size of the curve, i.e. #SECP224R1_BYTESIZE
[in] | *xG | input, the x affine coordinate of the secp224r1 base point
[in] | *yG | input, the y affine coordinate of the secp224r1 base point
[in] | *xQ | input, the x affine coordinate of the public key
[in] | *yQ | input, the y affine coordinate of the public key
[in] | *r | input, the r value of the signature to be verified
[in] | *s | input, the s value of the signature to be verified
[in] | *a | input, the a parameter of the secp224r1 curve
[in] | *n | input, the n parameter of the secp224r1 curve
[in] | *p | input, the p parameter of the secp224r1 curve
[in] | *hash | input, the already hashed digest of the message,
[in] | hashlength | input, the hash length, in bytes
Returns
Error code
Return values
UCL_OK | if the signature is verified
UCL_ERROR | if the signature is not verified
UCL_INVALID_INPUT | in case of wrong parameters

◆ ucl_ecdsa_verify_p256r1()

int ucl_ecdsa_verify_p256r1 | ( | u32 | keylength,
 |  | u8 * | xG,
 |  | u8 * | yG,
 |  | u8 * | xQ,
 |  | u8 * | yQ,
 |  | u8 * | r,
 |  | u8 * | s,
 |  | u8 * | a,
 |  | u8 * | n,
 |  | u8 * | p,
 |  | u8 * | hash,
 |  | u32 | hashlength
 | ) |  |

ECDSA signature.

Verify a secp256r1 ECDSA signature, directly from the message hash

Parameters
[in] | keylength | input, the bytes size of the curve, i.e. #SECP256R1_BYTESIZE
[in] | *xG | input, the x affine coordinate of the secp256r1 base point
[in] | *yG | input, the y affine coordinate of the secp256r1 base point
[in] | *xQ | input, the x affine coordinate of the public key
[in] | *yQ | input, the y affine coordinate of the public key
[in] | *r | input, the r value of the signature to be verified
[in] | *s | input, the s value of the signature to be verified
[in] | *a | input, the a parameter of the secp256r1 curve
[in] | *n | input, the n parameter of the secp256r1 curve
[in] | *p | input, the p parameter of the secp256r1 curve
[in] | *hash | input, the already hashed digest of the message,
[in] | hashlength | input, the hash length, in bytes
Returns
Error code
Return values
UCL_OK | if the signature is verified
UCL_ERROR | if the signature is not verified
UCL_INVALID_INPUT | in case of wrong parameters

◆ ucl_ecdsa_verify_p384r1()

int ucl_ecdsa_verify_p384r1 | ( | u32 | keylength,
 |  | u8 * | xG,
 |  | u8 * | yG,
 |  | u8 * | xQ,
 |  | u8 * | yQ,
 |  | u8 * | r,
 |  | u8 * | s,
 |  | u8 * | a,
 |  | u8 * | n,
 |  | u8 * | p,
 |  | u8 * | hash,
 |  | u32 | hashlength
 | ) |  |

ECDSA signature.

Verify a secp384r1 ECDSA signature, directly from the message hash

Parameters
[in] | keylength | input, the bytes size of the curve, i.e. #SECP384R1_BYTESIZE
[in] | *xG | input, the x affine coordinate of the secp384r1 base point
[in] | *yG | input, the y affine coordinate of the secp384r1 base point
[in] | *xQ | input, the x affine coordinate of the public key
[in] | *yQ | input, the y affine coordinate of the public key
[in] | *r | input, the r value of the signature to be verified
[in] | *s | input, the s value of the signature to be verified
[in] | *a | input, the a parameter of the secp384r1 curve
[in] | *n | input, the n parameter of the secp384r1 curve
[in] | *p | input, the p parameter of the secp384r1 curve
[in] | *hash | input, the already hashed digest of the message,
[in] | hashlength | input, the hash length, in bytes
Returns
Error code
Return values
UCL_OK | if the signature is verified
UCL_ERROR | if the signature is not verified
UCL_INVALID_INPUT | in case of wrong parameters

◆ ucl_ecdsa_verify_p521r1()

int ucl_ecdsa_verify_p521r1 | ( | u32 | keylength,
 |  | u8 * | xG,
 |  | u8 * | yG,
 |  | u8 * | xQ,
 |  | u8 * | yQ,
 |  | u8 * | r,
 |  | u8 * | s,
 |  | u8 * | a,
 |  | u8 * | n,
 |  | u8 * | p,
 |  | u8 * | hash,
 |  | u32 | hashlength
 | ) |  |

ECDSA signature.

Verify a secp521r1 ECDSA signature, directly from the message hash

Parameters
[in] | keylength | input, the bytes size of the curve, i.e. #SECP521R1_BYTESIZE
[in] | *xG | input, the x affine coordinate of the secp521r1 base point
[in] | *yG | input, the y affine coordinate of the secp521r1 base point
[in] | *xQ | input, the x affine coordinate of the public key
[in] | *yQ | input, the y affine coordinate of the public key
[in] | *r | input, the r value of the signature to be verified
[in] | *s | input, the s value of the signature to be verified
[in] | *a | input, the a parameter of the secp521r1 curve
[in] | *n | input, the n parameter of the secp521r1 curve
[in] | *p | input, the p parameter of the secp521r1 curve
[in] | *hash | input, the already hashed digest of the message,
[in] | hashlength | input, the hash length, in bytes
Returns
Error code
Return values
UCL_OK | if the signature is verified
UCL_ERROR | if the signature is not verified
UCL_INVALID_INPUT | in case of wrong parameters

◆ ucl_sm2_decryption_curve()

int ucl_sm2_decryption_curve | ( | u8 * | m,
 |  | u8 * | d,
 |  | ucl_type_ecc_u8_affine_point | A,
 |  | u8 * | c,
 |  | u32 | klen,
 |  | ucl_type_curve * | curve_params
 | ) |  |

SM2 public key encryption.

decrypt data, using the SM2 public key encryption scheme, as defined in the draf-shen-ecdsa-01 section 7, using a KDF based on SM3 hash function as defined in draft-shen-sm3-hash-00

Parameters
[out] | *m | output, pointer to a u8 array containing the produced plaintext
[in] | *d | input, the ECC SM2 private key, to be used for decryption
[in] | *A | input, the ECC SM2 public key, to be used for decryption
[in] | *c | input, the ciphertext to be decrypted
[in] | klen | input, the len of the ciphertext, in bits
[in] | *curve_params | the pointer to a ucl_type_curve structure, containing the curve domain parameters (already existing one, sm2fp256, is described in the documentation)

limitation: the cryptotext length is limited to 500 bytes

Returns
Error code
Return values
UCL_OK | if the decryption process is OK
UCL_ERROR | if the decryption process is not OK
#UCL_INVALID_OUPUT | if the output pointer parameters are NULL
UCL_INVALID_INPUT | in case of NULL input parameters pointers or if the cryptotext length is too long
UCL_STACK_ERROR | in case of too small available stack space

◆ ucl_sm2_encryption_curve()

int ucl_sm2_encryption_curve | ( | u8 * | c,
 |  | ucl_type_ecc_u8_affine_point | A,
 |  | u8 * | m,
 |  | u32 | klen,
 |  | ucl_type_curve * | curve_params
 | ) |  |

SM2 public key encryption.

encrypt data, using the SM2 public key encryption scheme, as defined in the draf-shen-ecdsa-01 section 7, using a KDF based on SM3 hash function as defined in draft-shen-sm3-hash-00

Parameters
[out] | *c | output, pointer to a u8 array containing the produced ciphertext
[in] | *A | input, the ECC SM2 public key, to be used for encryption
[in] | *m | input, the message to be encrypted,
[in] | klen | input, the len of the ciphertext, in bits
[in] | *curve_params | the pointer to a ucl_type_curve structure, containing the curve domain parameters (already existing one, sm2fp256, is described in the documentation)

limitation: the cryptotext length is limited to 500 bytes

Returns
Error code
Return values
UCL_OK | if the encryption process is OK
UCL_ERROR | if the encryption process is not OK
#UCL_INVALID_OUPUT | if the output pointer parameters are NULL or if the cryptotext length is too long
UCL_INVALID_INPUT | in case of NULL input parameters pointers
UCL_STACK_ERROR | in case of too small available stack space

◆ ucl_sm2dsa_sign()

int ucl_sm2dsa_sign | ( | u8 * | r,
 |  | u8 * | s,
 |  | u8 * | d,
 |  | u8 * | xA,
 |  | u8 * | yA,
 |  | u8 * | input,
 |  | u32 | inputlength,
 |  | u8 * | ida,
 |  | u8 * | entla,
 |  | u32 | configuration
 | ) |  |

SM2 DSA signature.

compute a SM2 P256 DSA signature, for SM2 P256 only (as defined in SM2 Digital Signature Algorithm draft-shen-sm2-ecdsa-00)

Parameters
[out] | *r | output, the r value of the computed signature
[out] | *s | output, the s value of the computed signature
[in] | *d | input, the private key value
[in] | *xA | input, the x affine coordinate of the public key
[in] | *yA | input, the y affine coordinate of the public key
[in] | *input | input, the message or the hash digest to be signed
[in] | inputlength | input, the input length, in bytes
[in] configuration (combination of any of these lines)
  • UCL_R_PRECOMP or UCL_PRECOMP_R:
  • UCL_R_PRECOMP: using precomputed r to finish the signature computation,
  • UCL_PRECOMP_R: to only pre-compute the r value,
  • SM2FP256, as defined in SM2 Digital Signature Algorithm draft-shen-sm2-ecdsa-00
  • UCL_MSG_INPUT or UCL_HASH_INPUT or UCL_NO_INPUT
  • UCL_MSG_INPUT: the message will be hashed first,
  • UCL_HASH_INPUT: the message is already the hash digest,
  • UCL_NO_INPUT: for r precomputation (UCL_PRECOMP_R)
  • UCL_SM3: hash function, if UCL_MSG_INPUT is used.
  • Examples are:
    • SM2FP256<<UCL_CURVE_SHIFT+UCL_HASH_INPUT<<UCL_INPUT_SHIFT: signing a hash digest on SM2 P256 curve, r not precomputed
    • SM2FP256<<UCL_CURVE_SHIFT+UCL_PRECOMP_R<<UCL_PRECOMP_SHIFT+UCL_NO_INPUT<<UCL_INPUT_SHIFT: pre-compute r on SM2 P256.
    • UCL_R_PRECOMP<<UCL_PRECOMP_SHIFT+SM2FP256<<UCL_CURVE_SHIFT+ UCL_MSG_INPUT<<UCL_INPUT_SHIFT+ UCL_SM3<<UCL_HASH_SHIFT:signing a message, to be hashed with SM3, using pre-computed r
Returns
Error code
computed signature
Return values
UCL_OK | if the computation is ok
UCL_ERROR | if the computation is not ok
UCL_INVALID_INPUT | in case of wrong parameters

◆ ucl_sm2dsa_sign_curve()

int ucl_sm2dsa_sign_curve | ( | u8 * | r,
 |  | u8 * | s,
 |  | u8 * | d,
 |  | u8 * | xA,
 |  | u8 * | yA,
 |  | u8 * | input,
 |  | u32 | inputlength,
 |  | u8 * | ida,
 |  | u8 * | entla,
 |  | u32 | configuration,
 |  | u8 * | a,
 |  | u8 * | b,
 |  | u8 * | p,
 |  | u8 * | xG,
 |  | u8 * | yG,
 |  | u8 * | n
 | ) |  |

SM2 DSA signature.

compute a SM2 P256 DSA signature, with curves parameters in input

Parameters
[out] | *r | output, the r value of the computed signature
[out] | *s | output, the s value of the computed signature
[in] | *d | input, the private key value
[in] | *xA | input, the x affine coordinate of the public key
[in] | *yA | input, the y affine coordinate of the public key
[in] | *input | input, the message or the hash digest to be signed
[in] | inputlength | input, the input length, in bytes
[in] configuration (combination of any of these lines)
  • UCL_R_PRECOMP or UCL_PRECOMP_R:
  • UCL_R_PRECOMP: using precomputed r to finish the signature computation,
  • UCL_PRECOMP_R: to only pre-compute the r value,
  • SM2FP256 (as defined in SM2 Digital Signature Algorithm draft-shen-sm2-ecdsa-00) or SM2VP256
  • UCL_MSG_INPUT or UCL_HASH_INPUT or UCL_NO_INPUT
  • UCL_MSG_INPUT: the message will be hashed first,
  • UCL_HASH_INPUT: the message is already the hash digest,
  • UCL_NO_INPUT: for r precomputation (UCL_PRECOMP_R)
  • UCL_SM3: hash function, if UCL_MSG_INPUT is used.
  • Examples are:
    • SM2FP256<<UCL_CURVE_SHIFT+UCL_HASH_INPUT<<UCL_INPUT_SHIFT: signing a hash digest on SM2 P256 curve, r not precomputed
    • SM2FP256<<UCL_CURVE_SHIFT+UCL_PRECOMP_R<<UCL_PRECOMP_SHIFT+UCL_NO_INPUT<<UCL_INPUT_SHIFT: pre-compute r on SM2 P256.
    • UCL_R_PRECOMP<<UCL_PRECOMP_SHIFT+SM2FP256<<UCL_CURVE_SHIFT+ UCL_MSG_INPUT<<UCL_INPUT_SHIFT+ UCL_SM3<<UCL_HASH_SHIFT:signing a message, to be hashed with SM3, using pre-computed r
[in] | *a | input, the a parameter of the curve
[in] | *b | input, the b parameter of the curve
[in] | *p | input, the p parameter of the curve
[in] | *xG | input, the x affine coordinate of the base point
[in] | *yG | input, the y affine coordinate of the base point
[in] | *n | input, the n parameter of the curve
Returns
Error code
computed signature
Return values
UCL_OK | if the signature is verified
UCL_ERROR | if the signature is not correctly computed
UCL_INVALID_INPUT | in case of wrong parameters

◆ ucl_sm2dsa_signature()

int ucl_sm2dsa_signature | ( | ucl_type_ecdsa_signature | signature,
 |  | u8 * | d,
 |  | ucl_type_ecc_u8_affine_point | A,
 |  | u8 * | input,
 |  | u32 | inputlength,
 |  | u8 * | ida,
 |  | u8 * | entla,
 |  | u32 | configuration
 | ) |  |

SM2 DSA signature.

compute a SM2 P256 DSA signature, using the SM2 curve as defined in SM2 Digital Signature Algorithm draft-shen-sm2-ecdsa-00, with SM3 hash function defined in draft-shen-sm3-hash-00

Parameters
[out] | signature | pointer to a ucl_type_ecdsa_signature structure, containing the signature (r,s) values
[in] | *d | input, the secret key
[in] | *A | input, a pointer to a ucl_type_ecc_u8_affine_point structure, representing the public key
[in] | *input | input, the input message or hash which signature to be checked
[in] | inputlength | input, the input length, in bytes
[in] | *ida | input, the IDA identifier
[in] | *entla | input, the ENTLA (entlenA bits) parameter
[in] configuration (combination of any of these lines)
  • UCL_R_PRECOMP or UCL_PRECOMP_R:
  • UCL_R_PRECOMP: using precomputed r to finish the signature computation,
  • UCL_PRECOMP_R: to only pre-compute the r value,
  • UCL_MSG_INPUT or UCL_HASH_INPUT or UCL_NO_INPUT
  • UCL_MSG_INPUT: the message will be hashed first,
  • UCL_HASH_INPUT: the message is already the hash digest,
  • UCL_NO_INPUT: for r precomputation (UCL_PRECOMP_R)
Returns
Error code
Return values
UCL_OK | in case of correct computation
UCL_INVALID_INPUT | or #UCL_INVALID OUTPUT in case of wrong parameters configuration (e.g. NULL pointers)

◆ ucl_sm2dsa_signature_curve()

int ucl_sm2dsa_signature_curve | ( | ucl_type_ecdsa_signature | signature,
 |  | u8 * | d,
 |  | ucl_type_ecc_u8_affine_point | A,
 |  | u8 * | input,
 |  | u32 | inputlength,
 |  | u8 * | ida,
 |  | u8 * | entla,
 |  | ucl_type_curve * | curve_params,
 |  | u32 | configuration
 | ) |  |

SM2 DSA signature.

compute a SM2 DSA signature, using the curve domain parameters provided in the curve domain structure, with SM3 hash function it is equivalent to the ucl_sm2dsa_signature function, if the sm2fp256 variable is used

Parameters
[out] | signature | pointer to a ucl_type_ecdsa_signature structure, containing the signature (r,s) values
[in] | *d | input, the secret key
[in] | *A | input, a pointer to a ucl_type_ecc_u8_affine_point structure, representing the public key
[in] | *input | input, the input message or hash which signature to be checked
[in] | inputlength | input, the input length, in bytes
[in] | *ida | input, the IDA identifier
[in] | *entla | input, the ENTLA (entlenA bits) parameter
[in] | *curve_params | the pointer to a ucl_type_curve structure, containing the curve domain parameters (already existing one is sm2fp256, described in the documentation)
[in] configuration (combination of any of these lines)
  • UCL_R_PRECOMP or UCL_PRECOMP_R:
  • UCL_R_PRECOMP: using precomputed r to finish the signature computation,
  • UCL_PRECOMP_R: to only pre-compute the r value,
  • UCL_MSG_INPUT or UCL_HASH_INPUT or UCL_NO_INPUT
  • UCL_MSG_INPUT: the message will be hashed first,
  • UCL_HASH_INPUT: the message is already the hash digest,
  • UCL_NO_INPUT: for r precomputation (UCL_PRECOMP_R)
Returns
Error code
Return values
UCL_OK | in case of correct computation
UCL_INVALID_INPUT | or #UCL_INVALID OUTPUT in case of wrong parameters configuration (e.g. NULL pointers)

◆ ucl_sm2dsa_verification()

int ucl_sm2dsa_verification | ( | ucl_type_ecdsa_signature | signature,
 |  | ucl_type_ecc_u8_affine_point | A,
 |  | u8 * | input,
 |  | u32 | inputlength,
 |  | u8 * | ida,
 |  | u8 * | entla,
 |  | u32 | configuration
 | ) |  |

ECC SM2 DSA signature.

Verify a SM2 P256 DSA signature, using the SM2 curve as defined in SM2 Digital Signature Algorithm draft-shen-sm2-ecdsa-00, with SM3 hash function defined in draft-shen-sm3-hash-00

Parameters
[in] | signature | pointer to a ucl_type_ecdsa_signature structure, containing the signature (r,s) values
[in] | public | key: pointer to a ucl_type_ecc_u8_affine_point structure, containing the ECC public key, used for signature verification
[in] | *input | input, the message or the hash digest to be signed,
[in] | inputlength | input, the input length, in bytes
[in] | *ida | input, the IDA identifier
[in] | *entla | input, the ENTLA (entlenA bits) parameter
[in] configuration (combination of any of these lines)
  • UCL_R_PRECOMP or UCL_PRECOMP_R:
  • UCL_R_PRECOMP: using precomputed r to finish the signature computation,
  • UCL_PRECOMP_R: to only pre-compute the r value,
  • UCL_MSG_INPUT or UCL_HASH_INPUT or UCL_NO_INPUT
  • UCL_MSG_INPUT: the message will be hashed first,
  • UCL_HASH_INPUT: the message is already the hash digest,
  • UCL_NO_INPUT: for r precomputation (UCL_PRECOMP_R)
Returns
Error code
Return values
UCL_OK | if the signature is verified
UCL_ERROR | if the signature is not verified
UCL_INVALID_INPUT | in case of wrong parameters

◆ ucl_sm2dsa_verification_curve()

int ucl_sm2dsa_verification_curve | ( | ucl_type_ecdsa_signature | signature,
 |  | ucl_type_ecc_u8_affine_point | A,
 |  | u8 * | input,
 |  | u32 | inputlength,
 |  | u8 * | ida,
 |  | u8 * | entla,
 |  | ucl_type_curve * | curve_params,
 |  | u32 | configuration
 | ) |  |

ECC SM2 DSA signature.

Verify a SM2 DSA signature, using the SM2 curve given as a parameter, with the SM3 hash function defined in draft-shen-sm3-hash-00

Parameters
[in] | signature | pointer to a ucl_type_ecdsa_signature structure, containing the signature (r,s) values
[in] | public | key: pointer to a ucl_type_ecc_u8_affine_point structure, containing the ECC public key, used for signature verification
[in] | *input | input, the message or the hash digest to be signed,
[in] | inputlength | input, the input length, in bytes
[in] | *ida | input, the IDA identifier
[in] | *entla | input, the ENTLA (entlenA bits) parameter
[in] | *curve_params | the pointer to a ucl_type_curve structure, containing the curve domain parameters (already existing one, sm2fp256, is described in the documentation)
[in] configuration (combination of any of these lines)
  • UCL_R_PRECOMP or UCL_PRECOMP_R:
  • UCL_R_PRECOMP: using precomputed r to finish the signature computation,
  • UCL_PRECOMP_R: to only pre-compute the r value,
  • UCL_MSG_INPUT or UCL_HASH_INPUT or UCL_NO_INPUT
  • UCL_MSG_INPUT: the message will be hashed first,
  • UCL_HASH_INPUT: the message is already the hash digest,
  • UCL_NO_INPUT: for r precomputation (UCL_PRECOMP_R)
Returns
Error code
Return values
UCL_OK | if the signature is verified
UCL_ERROR | if the signature is not verified
UCL_INVALID_INPUT | in case of wrong parameters

◆ ucl_sm2dsa_verify()

int ucl_sm2dsa_verify | ( | u8 * | r,
 |  | u8 * | s,
 |  | u8 * | xA,
 |  | u8 * | yA,
 |  | u8 * | input,
 |  | u32 | inputlength,
 |  | u8 * | ida,
 |  | u8 * | entla,
 |  | u32 | configuration
 | ) |  |

ECDSA signature.

Verify a SM2 P256 DSA signature, directly from the message hash, using the SM2 curve as defined in SM2 Digital Signature Algorithm draft-shen-sm2-ecdsa-00

Parameters
[in] | *r | input, the r value of the signature to be verified
[in] | *s | input, the s value of the signature to be verified
[in] | *xA | input, the x affine coordinate of the public key
[in] | *yA | input, the y affine coordinate of the public key
[in] | *input | input, the input message or hash which signature to be checked
[in] | inputlength | input, the input length, in bytes
[in] | *ida | input, the IDA identifier
[in] | *entla | input, the ENTLA (entlenA bits) parameter
Returns
Error code
Return values
UCL_OK | if the signature is verified
UCL_ERROR | if the signature is not verified
UCL_INVALID_INPUT | in case of wrong parameters

◆ ucl_sm2dsa_verify_curve()

int ucl_sm2dsa_verify_curve | ( | u8 * | r,
 |  | u8 * | s,
 |  | u8 * | xA,
 |  | u8 * | yA,
 |  | u8 * | input,
 |  | u32 | inputlength,
 |  | u8 * | ida,
 |  | u8 * | entla,
 |  | u32 | configuration,
 |  | u8 * | a,
 |  | u8 * | b,
 |  | u8 * | p,
 |  | u8 * | xG,
 |  | u8 * | yG,
 |  | u8 * | n
 | ) |  |

ECDSA signature.

verify a SM2 P256 DSA signature, with curve parameters in input

Parameters
[in] | *r | input, the r value of the signature to be verified
[in] | *s | input, the s value of the signature to be verified
[in] | *xA | input, the x affine coordinate of the public key
[in] | *yA | input, the y affine coordinate of the public key
[in] | *input | input, the input message or hash which signature to be checked
[in] | inputlength | input, the input length, in bytes
[in] | *ida | input, the IDA identifier
[in] | *entla | input, the ENTLA (entlenA bits) parameter
[in] configuration (combination of any of these lines)
  • UCL_R_PRECOMP or UCL_PRECOMP_R:
  • UCL_R_PRECOMP: using precomputed r to finish the signature computation,
  • UCL_PRECOMP_R: to only pre-compute the r value,
  • SM2FP256 (as defined in SM2 Digital Signature Algorithm draft-shen-sm2-ecdsa-00) or SM2VP256
  • UCL_MSG_INPUT or UCL_HASH_INPUT or UCL_NO_INPUT
  • UCL_MSG_INPUT: the message will be hashed first,
  • UCL_HASH_INPUT: the message is already the hash digest,
  • UCL_NO_INPUT: for r precomputation (UCL_PRECOMP_R)
  • UCL_SM3: hash function, if UCL_MSG_INPUT is used.
  • Examples are:
    • SM2FP256<<UCL_CURVE_SHIFT+UCL_HASH_INPUT<<UCL_INPUT_SHIFT: signing a hash digest on a SM2 P256 curve, using the given curve parameters
    • SM2VP256<<UCL_CURVE_SHIFT)^(UCL_MSG_INPUT<<UCL_INPUT_SHIFT)^(UCL_SM3<<UCL_HASH_SHIFT)^(UCL_NO_PRECOMP_TRICK<<UCL_PRECOMP_TRICK_SHIFT): signing a message on a SM2 P256 curve, using the given curve parameters
[in] | *a | input, the a parameter of the curve
[in] | *b | input, the b parameter of the curve
[in] | *p | input, the p parameter of the curve
[in] | *xG | input, the x affine coordinate of the base point
[in] | *yG | input, the y affine coordinate of the base point
[in] | *n | input, the n parameter of the curve
Returns
Error code
Return values
UCL_OK | if the signature is verified
UCL_ERROR | if the signature is not verified
UCL_INVALID_INPUT | in case of wrong parameters


Universal Crypto Library: ucl_type_ecc_jacobian_point Struct Reference

Data Fields
ucl_type_ecc_jacobian_point Struct Reference
Public Key Algorithm » Elliptic Curves. » ECDSA

ECC word Jacobian point coordinates. More...

Data Fields

DIGIT * | x
jacobian x coordinate. More...
DIGIT * | y
jacobian y coordinate. More...
DIGIT * | z
jacobian z coordinate. More...

Detailed Description

ECC word Jacobian point coordinates.

this structure is used within ECC routines

Field Documentation

◆ x

DIGIT* ucl_type_ecc_jacobian_point::x

jacobian x coordinate.

◆ y

DIGIT* ucl_type_ecc_jacobian_point::y

jacobian y coordinate.

◆ z

DIGIT* ucl_type_ecc_jacobian_point::z

jacobian z coordinate.


Universal Crypto Library: ucl_type_ecc_u8_affine_point Struct Reference

Data Fields
ucl_type_ecc_u8_affine_point Struct Reference
Public Key Algorithm » Elliptic Curves. » ECDSA

ECC byte affine point coordinates. More...

Data Fields

u8 * x
affine x coordinate. More...
u8 * y
affine y coordinate. More...

Detailed Description

ECC byte affine point coordinates.

this structure is used at application level

Field Documentation

◆ x

u8* ucl_type_ecc_u8_affine_point::x

affine x coordinate.

◆ y

u8* ucl_type_ecc_u8_affine_point::y

affine y coordinate.


Universal Crypto Library: ucl_type_ecc_digit_affine_point Struct Reference

Data Fields
ucl_type_ecc_digit_affine_point Struct Reference
Public Key Algorithm » Elliptic Curves. » ECDSA

ECC word affine point coordinates. More...

Data Fields

DIGIT * | x
affine x coordinate. More...
DIGIT * | y
affine y coordinate. More...

Detailed Description

ECC word affine point coordinates.

this structure is used within ECC routines

Field Documentation

◆ x

DIGIT* ucl_type_ecc_digit_affine_point::x

affine x coordinate.

◆ y

DIGIT* ucl_type_ecc_digit_affine_point::y

affine y coordinate.


Universal Crypto Library: ucl_type_ecdsa_signature Struct Reference

Data Fields
ucl_type_ecdsa_signature Struct Reference
Public Key Algorithm » Elliptic Curves. » ECDSA

ECC byte signature structure. More...

Data Fields

u8 * r
signature r value
u8 * s
signature s value

Detailed Description

ECC byte signature structure.

this structure is used at application level


Universal Crypto Library: ECC keys generation.

Functions
ECC keys generation.
Public Key Algorithm » Elliptic Curves.

ECC keys generation. More...

+ Collaboration diagram for ECC keys generation.:

Functions

int | ucl_ecc_keygeneration_generic (ucl_type_ecc_u8_affine_point Q, u8 *d, ucl_type_curve *curve_params)
ECC key Generation. More...
int | ucl_ecc_keygeneration_p160r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC key Generation. More...
int | ucl_ecc_keygeneration_p192r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC key Generation. More...
int | ucl_ecc_keygeneration_p224r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC key Generation. More...
int | ucl_ecc_keygeneration_p256r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC key Generation. More...
int | ucl_ecc_keygeneration_p384r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC key Generation. More...
int | ucl_ecc_keygeneration_p521r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC key Generation. More...
int | ucl_ecc_keygeneration_bp256r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC key Generation. More...
int | ucl_ecc_keygeneration_bp384r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC key Generation. More...
int | ucl_ecc_keygeneration_bp512r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC key Generation. More...
int | ucl_ecc_keygeneration_sm2fp256 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC SM2 DSA key Generation. More...
int | ucl_ecc_checkkey_generic (ucl_type_ecc_u8_affine_point Q, u8 *d, ucl_type_curve *curve_params)
ECC keys consistency verification. More...
int | ucl_ecc_checkkey_p256r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC keys consistency verification. More...
int | ucl_ecc_checkkey_p160r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC keys consistency verification. More...
int | ucl_ecc_checkkey_p192r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC keys consistency verification. More...
int | ucl_ecc_checkkey_p224r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC keys consistency verification. More...
int | ucl_ecc_checkkey_p384r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC keys consistency verification. More...
int | ucl_ecc_checkkey_p521r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC keys consistency verification. More...
int | ucl_ecc_checkkey_bp256r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC keys consistency verification. More...
int | ucl_ecc_checkkey_bp384r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC keys consistency verification. More...
int | ucl_ecc_checkkey_bp512r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC keys consistency verification. More...
int | ucl_ecc_point_on_curve_p192r1 (ucl_type_ecc_u8_affine_point Q)
ECDSA point verification. More...
int | ucl_ecc_point_on_curve_p224r1 (ucl_type_ecc_u8_affine_point Q)
ECDSA point verification. More...
int | ucl_ecc_point_on_curve_p256r1 (ucl_type_ecc_u8_affine_point Q)
ECDSA point verification. More...
int | ucl_ecc_point_on_curve_p384r1 (ucl_type_ecc_u8_affine_point Q)
ECDSA point verification. More...
int | ucl_ecc_point_on_curve_p521r1 (ucl_type_ecc_u8_affine_point Q)
ECDSA point verification. More...
int | ucl_ecc_point_on_curve_bp256r1 (ucl_type_ecc_u8_affine_point Q)
ECDSA point verification. More...
int | ucl_ecc_point_on_curve_bp384r1 (ucl_type_ecc_u8_affine_point Q)
ECDSA point verification. More...
int | ucl_ecc_point_on_curve_bp512r1 (ucl_type_ecc_u8_affine_point Q)
ECDSA point verification. More...
int | ucl_ecc_point_on_curve_sm2fp256 (ucl_type_ecc_u8_affine_point Q)
ECDSA point verification. More...
int | ucl_ecc_keygen_p160r1 (u8 *xr, u8 *yr, u8 *d)
ECC key Generation. More...
int | ucl_ecc_keygen_p192r1 (u8 *xr, u8 *yr, u8 *d)
ECC key Generation. More...
int | ucl_ecc_keygen_p224r1 (u8 *xr, u8 *yr, u8 *d)
ECC key Generation. More...
int | ucl_ecc_keygen_p256r1 (u8 *xr, u8 *yr, u8 *d)
ECC key Generation. More...
int | ucl_ecc_keygen_p384r1 (u8 *xr, u8 *yr, u8 *d)
ECC key Generation. More...
int | ucl_ecc_keygen_bp256r1 (u8 *xr, u8 *yr, u8 *d)
ECC key Generation. More...
int | ucl_ecc_keygen_bp384r1 (u8 *xr, u8 *yr, u8 *d)
ECC key Generation. More...
int | ucl_ecc_keygen_bp512r1 (u8 *xr, u8 *yr, u8 *d)
ECC key Generation. More...
int | ucl_ecc_keygen_p521r1 (u8 *xr, u8 *yr, u8 *d)
ECC key Generation. More...
int | ucl_ecc_on_curve_p160r1 (u8 *x, u8 *y, u8 *a, u8 *b, u8 *p)
ECDSA point verification. More...
int | ucl_ecc_on_curve_p192r1 (u8 *x, u8 *y, u8 *a, u8 *b, u8 *p)
ECDSA point verification. More...
int | ucl_ecc_on_curve_p224r1 (u8 *x, u8 *y, u8 *a, u8 *b, u8 *p)
ECDSA point verification. More...
int | ucl_ecc_on_curve_p256r1 (u8 *x, u8 *y, u8 *a, u8 *b, u8 *p)
ECDSA point verification. More...
int | ucl_ecc_on_curve_bp256r1 (u8 *x, u8 *y, u8 *a, u8 *b, u8 *p)
ECDSA point verification. More...
int | ucl_ecc_on_curve_p384r1 (u8 *x, u8 *y, u8 *a, u8 *b, u8 *p)
ECDSA point verification. More...
int | ucl_ecc_on_curve_bp384r1 (u8 *x, u8 *y, u8 *a, u8 *b, u8 *p)
ECDSA point verification. More...
int | ucl_ecc_on_curve_bp512r1 (u8 *x, u8 *y, u8 *a, u8 *b, u8 *p)
ECDSA point verification. More...
int | ucl_ecc_on_curve_p521r1 (u8 *x, u8 *y, u8 *a, u8 *b, u8 *p)
ECDSA point verification. More...

Detailed Description

ECC keys generation.

Function Documentation

◆ ucl_ecc_checkkey_bp256r1()

int ucl_ecc_checkkey_bp256r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC keys consistency verification.

this function verifies the keypair consistency on the curve BP-256 which means that the public key matches the private key and that the point is on the curve

Parameters

◆ ucl_ecc_checkkey_bp384r1()

int ucl_ecc_checkkey_bp384r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC keys consistency verification.

this function verifies the keypair consistency on the curve BP-384 which means that the public key matches the private key and that the point is on the curve

Parameters

◆ ucl_ecc_checkkey_bp512r1()

int ucl_ecc_checkkey_bp512r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC keys consistency verification.

this function verifies the keypair consistency on the curve BP-512 which means that the public key matches the private key and that the point is on the curve

Parameters

◆ ucl_ecc_checkkey_generic()

int ucl_ecc_checkkey_generic | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d,
 |  | ucl_type_curve * | curve_params
 | ) |  |

ECC keys consistency verification.

this function verifies the keypair consistency on the provided curve which means that the public key matches the private key and that the point is on the curve

Parameters

◆ ucl_ecc_checkkey_p160r1()

int ucl_ecc_checkkey_p160r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC keys consistency verification.

this function verifies the keypair consistency on the curve P-160 which means that the public key matches the private key and that the point is on the curve

Parameters

◆ ucl_ecc_checkkey_p192r1()

int ucl_ecc_checkkey_p192r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC keys consistency verification.

this function verifies the keypair consistency on the curve P-192 which means that the public key matches the private key and that the point is on the curve

Parameters

◆ ucl_ecc_checkkey_p224r1()

int ucl_ecc_checkkey_p224r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC keys consistency verification.

this function verifies the keypair consistency on the curve P-224 which means that the public key matches the private key and that the point is on the curve

Parameters

◆ ucl_ecc_checkkey_p256r1()

int ucl_ecc_checkkey_p256r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC keys consistency verification.

this function verifies the keypair consistency on the curve P-256 which means that the public key matches the private key and that the point is on the curve

Parameters

◆ ucl_ecc_checkkey_p384r1()

int ucl_ecc_checkkey_p384r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC keys consistency verification.

this function verifies the keypair consistency on the curve P-384 which means that the public key matches the private key and that the point is on the curve

Parameters

◆ ucl_ecc_checkkey_p521r1()

int ucl_ecc_checkkey_p521r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC keys consistency verification.

this function verifies the keypair consistency on the curve P-521 which means that the public key matches the private key and that the point is on the curve

Parameters

◆ ucl_ecc_keygen_bp256r1()

int ucl_ecc_keygen_bp256r1 | ( | u8 * | xr,
 |  | u8 * | yr,
 |  | u8 * | d
 | ) |  |

ECC key Generation.

this function generates a public/private keypair on the curve BP-256

Parameters
[out] | xr,yr | output, the public key: R=d.G, xr and yr pointers to a 32-byte array
[out] | d | output, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_ecc_keygen_bp384r1()

int ucl_ecc_keygen_bp384r1 | ( | u8 * | xr,
 |  | u8 * | yr,
 |  | u8 * | d
 | ) |  |

ECC key Generation.

this function generates a public/private keypair on the curve BP-384

Parameters
[out] | xr,yr | output, the public key: R=d.G, xr and yr pointers to a 48-byte array
[out] | d | output, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_ecc_keygen_bp512r1()

int ucl_ecc_keygen_bp512r1 | ( | u8 * | xr,
 |  | u8 * | yr,
 |  | u8 * | d
 | ) |  |

ECC key Generation.

this function generates a public/private keypair on the curve BP-512

Parameters
[out] | xr,yr | output, the public key: R=d.G, xr and yr pointers to a 64-byte array
[out] | d | output, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_ecc_keygen_p160r1()

int ucl_ecc_keygen_p160r1 | ( | u8 * | xr,
 |  | u8 * | yr,
 |  | u8 * | d
 | ) |  |

ECC key Generation.

this function generates a public/private keypair on the curve P-160

Parameters
[out] | xr,yr | output, the public key: R=d.G, xr and yr pointers to a 20-byte array
[out] | d | output, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_ecc_keygen_p192r1()

int ucl_ecc_keygen_p192r1 | ( | u8 * | xr,
 |  | u8 * | yr,
 |  | u8 * | d
 | ) |  |

ECC key Generation.

this function generates a public/private keypair on the curve P-192

Parameters
[out] | xr,yr | output, the public key: R=d.G, xr and yr pointers to a 24-byte array
[out] | d | output, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_ecc_keygen_p224r1()

int ucl_ecc_keygen_p224r1 | ( | u8 * | xr,
 |  | u8 * | yr,
 |  | u8 * | d
 | ) |  |

ECC key Generation.

this function generates a public/private keypair on the curve P-224

Parameters
[out] | xr,yr | output, the public key: R=d.G, xr and yr pointers to a 28-byte array
[out] | d | output, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_ecc_keygen_p256r1()

int ucl_ecc_keygen_p256r1 | ( | u8 * | xr,
 |  | u8 * | yr,
 |  | u8 * | d
 | ) |  |

ECC key Generation.

this function generates a public/private keypair on the curve P-256

Parameters
[out] | xr,yr | output, the public key: R=d.G, xr and yr pointers to a 32-byte array
[out] | d | output, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_ecc_keygen_p384r1()

int ucl_ecc_keygen_p384r1 | ( | u8 * | xr,
 |  | u8 * | yr,
 |  | u8 * | d
 | ) |  |

ECC key Generation.

this function generates a public/private keypair on the curve P-384

Parameters
[out] | xr,yr | output, the public key: R=d.G, xr and yr pointers to a 48-byte array
[out] | d | output, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_ecc_keygen_p521r1()

int ucl_ecc_keygen_p521r1 | ( | u8 * | xr,
 |  | u8 * | yr,
 |  | u8 * | d
 | ) |  |

ECC key Generation.

this function generates a public/private keypair on the curve P-521

Parameters
[out] | xr,yr | output, the public key: R=d.G, xr and yr pointers to an array
[out] | d | output, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_ecc_keygeneration_bp256r1()

int ucl_ecc_keygeneration_bp256r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC key Generation.

this function generates a public/private keypair on the curve Brainpool P-256 using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to a 32-byte array
[out] | d | output, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_ecc_keygeneration_bp384r1()

int ucl_ecc_keygeneration_bp384r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC key Generation.

this function generates a public/private keypair on the curve Brainpool P-384 using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to a 48-byte array
[out] | d | output, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_ecc_keygeneration_bp512r1()

int ucl_ecc_keygeneration_bp512r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC key Generation.

this function generates a public/private keypair on the curve Brainpool P-512 using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to a 64-byte array
[out] | d | output, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_ecc_keygeneration_generic()

int ucl_ecc_keygeneration_generic | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d,
 |  | ucl_type_curve * | curve_params
 | ) |  |

ECC key Generation.

this function generates a public/private keypair on the provided curve using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to the array
[out] | d | output, the secret key, generated by the function
[in] | curve_params | input, the pointer to the curve domain parameters structure
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL
UCL_STACK_ERROR | if the UCL stack has a problem

◆ ucl_ecc_keygeneration_p160r1()

int ucl_ecc_keygeneration_p160r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC key Generation.

this function generates a public/private keypair on the curve P-160 using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to a 20-byte array
[out] | d | output, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_ecc_keygeneration_p192r1()

int ucl_ecc_keygeneration_p192r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC key Generation.

this function generates a public/private keypair on the curve P-192 using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to a 24-byte array
[out] | d | output, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_ecc_keygeneration_p224r1()

int ucl_ecc_keygeneration_p224r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC key Generation.

this function generates a public/private keypair on the curve P-224 using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to a 28-byte array
[out] | d | output, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_ecc_keygeneration_p256r1()

int ucl_ecc_keygeneration_p256r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC key Generation.

this function generates a public/private keypair on the curve P-256 using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to a 32-byte array
[out] | d | output, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_ecc_keygeneration_p384r1()

int ucl_ecc_keygeneration_p384r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC key Generation.

this function generates a public/private keypair on the curve P-384 using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to a 48-byte array
[out] | d | output, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_ecc_keygeneration_p521r1()

int ucl_ecc_keygeneration_p521r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC key Generation.

ECDSA point verification.

this function generates a public/private keypair on the curve P-521 using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to a 66-byte array
[out] | d | output, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

this function checks whether or not a point is on the curve P-160 using the new ECC API introduced in the UCL 2.4.9

Parameters
[in] Q input, the point structure to be checked
Returns
Error code
Return values
UCL_OK | if the point is on the curve
UCL_ERROR | if the point is not on the curve
UCL_INVALID_INPUT | in case of erroneous input parameters,

◆ ucl_ecc_keygeneration_sm2fp256()

int ucl_ecc_keygeneration_sm2fp256 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC SM2 DSA key Generation.

this function generates a public/private keypair on the chinese standard curve SM2 FP256 using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to a 32-byte array
[out] | d | output, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_ecc_on_curve_bp256r1()

int ucl_ecc_on_curve_bp256r1 | ( | u8 * | x,
 |  | u8 * | y,
 |  | u8 * | a,
 |  | u8 * | b,
 |  | u8 * | p
 | ) |  |

ECDSA point verification.

this function checks whether or not a point is on the curve BP-256

Parameters
[in] | u8 | *x: input, the x affine coordinate of the point to be checked
[in] | u8 | *y: input, the y affine coordinate of the point to be checked
[in] | u8 | *a, u8 *n, u8 *p: curve parameters
Returns
Error code
Return values
UCL_OK | if the point is on the curve
UCL_ERROR | if the point is not on the curve
UCL_INVALID_INPUT | in case of erroneous input parameters,

◆ ucl_ecc_on_curve_bp384r1()

int ucl_ecc_on_curve_bp384r1 | ( | u8 * | x,
 |  | u8 * | y,
 |  | u8 * | a,
 |  | u8 * | b,
 |  | u8 * | p
 | ) |  |

ECDSA point verification.

this function checks whether or not a point is on the curve BP-384

Parameters
[in] | u8 | *x: input, the x affine coordinate of the point to be checked
[in] | u8 | *y: input, the y affine coordinate of the point to be checked
[in] | u8 | *a, u8 *n, u8 *p: curve parameters
Returns
Error code
Return values
UCL_OK | if the point is on the curve
UCL_ERROR | if the point is not on the curve
UCL_INVALID_INPUT | in case of erroneous input parameters,

◆ ucl_ecc_on_curve_bp512r1()

int ucl_ecc_on_curve_bp512r1 | ( | u8 * | x,
 |  | u8 * | y,
 |  | u8 * | a,
 |  | u8 * | b,
 |  | u8 * | p
 | ) |  |

ECDSA point verification.

this function checks whether or not a point is on the curve BP-512

Parameters
[in] | u8 | *x: input, the x affine coordinate of the point to be checked
[in] | u8 | *y: input, the y affine coordinate of the point to be checked
[in] | u8 | *a, u8 *n, u8 *p: curve parameters
Returns
Error code
Return values
UCL_OK | if the point is on the curve
UCL_ERROR | if the point is not on the curve
UCL_INVALID_INPUT | in case of erroneous input parameters,

◆ ucl_ecc_on_curve_p160r1()

int ucl_ecc_on_curve_p160r1 | ( | u8 * | x,
 |  | u8 * | y,
 |  | u8 * | a,
 |  | u8 * | b,
 |  | u8 * | p
 | ) |  |

ECDSA point verification.

this function checks whether or not a point is on the curve P-160

Parameters
[in] | u8 | *x: input, the x affine coordinate of the point to be checked
[in] | u8 | *y: input, the y affine coordinate of the point to be checked
[in] | u8 | *a, u8 *n, u8 *p: curve parameters
Returns
Error code
Return values
UCL_OK | if the point is on the curve
UCL_ERROR | if the point is not on the curve
UCL_INVALID_INPUT | in case of erroneous input parameters,

◆ ucl_ecc_on_curve_p192r1()

int ucl_ecc_on_curve_p192r1 | ( | u8 * | x,
 |  | u8 * | y,
 |  | u8 * | a,
 |  | u8 * | b,
 |  | u8 * | p
 | ) |  |

ECDSA point verification.

this function checks whether or not a point is on the curve P-192

Parameters
[in] | u8 | *x: input, the x affine coordinate of the point to be checked
[in] | u8 | *y: input, the y affine coordinate of the point to be checked
[in] | u8 | *a, u8 *n, u8 *p: curve parameters
Returns
Error code
Return values
UCL_OK | if the point is on the curve
UCL_ERROR | if the point is not on the curve
UCL_INVALID_INPUT | in case of erroneous input parameters,

◆ ucl_ecc_on_curve_p224r1()

int ucl_ecc_on_curve_p224r1 | ( | u8 * | x,
 |  | u8 * | y,
 |  | u8 * | a,
 |  | u8 * | b,
 |  | u8 * | p
 | ) |  |

ECDSA point verification.

this function checks whether or not a point is on the curve P-224

Parameters
[in] | u8 | *x: input, the x affine coordinate of the point to be checked
[in] | u8 | *y: input, the y affine coordinate of the point to be checked
[in] | u8 | *a, u8 *n, u8 *p: curve parameters
Returns
Error code
Return values
UCL_OK | if the point is on the curve
UCL_ERROR | if the point is not on the curve
UCL_INVALID_INPUT | in case of erroneous input parameters,

◆ ucl_ecc_on_curve_p256r1()

int ucl_ecc_on_curve_p256r1 | ( | u8 * | x,
 |  | u8 * | y,
 |  | u8 * | a,
 |  | u8 * | b,
 |  | u8 * | p
 | ) |  |

ECDSA point verification.

this function checks whether or not a point is on the curve P-256

Parameters
[in] | u8 | *x: input, the x affine coordinate of the point to be checked
[in] | u8 | *y: input, the y affine coordinate of the point to be checked
[in] | u8 | *a, u8 *n, u8 *p: curve parameters
Returns
Error code
Return values
UCL_OK | if the point is on the curve
UCL_ERROR | if the point is not on the curve
UCL_INVALID_INPUT | in case of erroneous input parameters,

◆ ucl_ecc_on_curve_p384r1()

int ucl_ecc_on_curve_p384r1 | ( | u8 * | x,
 |  | u8 * | y,
 |  | u8 * | a,
 |  | u8 * | b,
 |  | u8 * | p
 | ) |  |

ECDSA point verification.

this function checks whether or not a point is on the curve P-384

Parameters
[in] | u8 | *x: input, the x affine coordinate of the point to be checked
[in] | u8 | *y: input, the y affine coordinate of the point to be checked
[in] | u8 | *a, u8 *n, u8 *p: curve parameters
Returns
Error code
Return values
UCL_OK | if the point is on the curve
UCL_ERROR | if the point is not on the curve
UCL_INVALID_INPUT | in case of erroneous input parameters,

◆ ucl_ecc_on_curve_p521r1()

int ucl_ecc_on_curve_p521r1 | ( | u8 * | x,
 |  | u8 * | y,
 |  | u8 * | a,
 |  | u8 * | b,
 |  | u8 * | p
 | ) |  |

ECDSA point verification.

this function checks whether or not a point is on the curve P-521

Parameters
[in] | u8 | *x: input, the x affine coordinate of the point to be checked
[in] | u8 | *y: input, the y affine coordinate of the point to be checked
[in] | u8 | *a, u8 *n, u8 *p: curve parameters
Returns
Error code
Return values
UCL_OK | if the point is on the curve
UCL_ERROR | if the point is not on the curve
UCL_INVALID_INPUT | in case of erroneous input parameters,

◆ ucl_ecc_point_on_curve_bp256r1()

int ucl_ecc_point_on_curve_bp256r1 ( ucl_type_ecc_u8_affine_point Q )

ECDSA point verification.

this function checks whether or not a point is on the curve Brainpool P-256 using the new ECC API introduced in the UCL 2.4.9

Parameters
[in] Q input, the point structure to be checked
Returns
Error code
Return values
UCL_OK | if the point is on the curve
UCL_ERROR | if the point is not on the curve
UCL_INVALID_INPUT | in case of erroneous input parameters,

◆ ucl_ecc_point_on_curve_bp384r1()

int ucl_ecc_point_on_curve_bp384r1 ( ucl_type_ecc_u8_affine_point Q )

ECDSA point verification.

this function checks whether or not a point is on the curve Brainpool P-384 using the new ECC API introduced in the UCL 2.4.9

Parameters
[in] Q input, the point structure to be checked
Returns
Error code
Return values
UCL_OK | if the point is on the curve
UCL_ERROR | if the point is not on the curve
UCL_INVALID_INPUT | in case of erroneous input parameters,

◆ ucl_ecc_point_on_curve_bp512r1()

int ucl_ecc_point_on_curve_bp512r1 ( ucl_type_ecc_u8_affine_point Q )

ECDSA point verification.

this function checks whether or not a point is on the curve Brainpool P-512 using the new ECC API introduced in the UCL 2.4.9

Parameters
[in] Q input, the point structure to be checked
Returns
Error code
Return values
UCL_OK | if the point is on the curve
UCL_ERROR | if the point is not on the curve
UCL_INVALID_INPUT | in case of erroneous input parameters,

◆ ucl_ecc_point_on_curve_p192r1()

int ucl_ecc_point_on_curve_p192r1 ( ucl_type_ecc_u8_affine_point Q )

ECDSA point verification.

this function checks whether or not a point is on the curve P-192 using the new ECC API introduced in the UCL 2.4.9

Parameters
[in] Q input, the point structure to be checked
Returns
Error code
Return values
UCL_OK | if the point is on the curve
UCL_ERROR | if the point is not on the curve
UCL_INVALID_INPUT | in case of erroneous input parameters,

◆ ucl_ecc_point_on_curve_p224r1()

int ucl_ecc_point_on_curve_p224r1 ( ucl_type_ecc_u8_affine_point Q )

ECDSA point verification.

this function checks whether or not a point is on the curve P-224 using the new ECC API introduced in the UCL 2.4.9

Parameters
[in] Q input, the point structure to be checked
Returns
Error code
Return values
UCL_OK | if the point is on the curve
UCL_ERROR | if the point is not on the curve
UCL_INVALID_INPUT | in case of erroneous input parameters,

◆ ucl_ecc_point_on_curve_p256r1()

int ucl_ecc_point_on_curve_p256r1 ( ucl_type_ecc_u8_affine_point Q )

ECDSA point verification.

this function checks whether or not a point is on the curve P-256 using the new ECC API introduced in the UCL 2.4.9

Parameters
[in] Q input, the point structure to be checked
Returns
Error code
Return values
UCL_OK | if the point is on the curve
UCL_ERROR | if the point is not on the curve
UCL_INVALID_INPUT | in case of erroneous input parameters,

◆ ucl_ecc_point_on_curve_p384r1()

int ucl_ecc_point_on_curve_p384r1 ( ucl_type_ecc_u8_affine_point Q )

ECDSA point verification.

this function checks whether or not a point is on the curve P-384 using the new ECC API introduced in the UCL 2.4.9

Parameters
[in] Q input, the point structure to be checked
Returns
Error code
Return values
UCL_OK | if the point is on the curve
UCL_ERROR | if the point is not on the curve
UCL_INVALID_INPUT | in case of erroneous input parameters,

◆ ucl_ecc_point_on_curve_p521r1()

int ucl_ecc_point_on_curve_p521r1 ( ucl_type_ecc_u8_affine_point Q )

ECDSA point verification.

this function checks whether or not a point is on the curve P-521 using the new ECC API introduced in the UCL 2.4.9

Parameters
[in] Q input, the point structure to be checked
Returns
Error code
Return values
UCL_OK | if the point is on the curve
UCL_ERROR | if the point is not on the curve
UCL_INVALID_INPUT | in case of erroneous input parameters,

◆ ucl_ecc_point_on_curve_sm2fp256()

int ucl_ecc_point_on_curve_sm2fp256 ( ucl_type_ecc_u8_affine_point Q )

ECDSA point verification.

this function checks whether or not a point is on the chinese SM2 FP 256 curve using the new ECC API introduced in the UCL 2.4.9

Parameters
[in] Q input, the point structure to be checked
Returns
Error code
Return values
UCL_OK | if the point is on the curve
UCL_ERROR | if the point is not on the curve
UCL_INVALID_INPUT | in case of erroneous input parameters,


Universal Crypto Library: ECC public keys generation.

Functions
ECC public keys generation.
Public Key Algorithm » Elliptic Curves.

ECC public keys generation. More...

+ Collaboration diagram for ECC public keys generation.:

Functions

int | ucl_ecc_publickeygeneration_generic (ucl_type_ecc_u8_affine_point Q, u8 *d, ucl_type_curve *curve_params)
ECC public key Generation. More...
int | ucl_ecc_publickeygeneration_p160r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC public key Generation. More...
int | ucl_ecc_publickeygeneration_p192r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC public key Generation. More...
int | ucl_ecc_publickeygeneration_p224r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC public key Generation. More...
int | ucl_ecc_publickeygeneration_p256r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC public key Generation. More...
int | ucl_ecc_publickeygeneration_p384r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC public key Generation. More...
int | ucl_ecc_publickeygeneration_p521r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC public key Generation. More...
int | ucl_ecc_publickeygeneration_bp256r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC public key Generation. More...
int | ucl_ecc_publickeygeneration_bp384r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC public key Generation. More...
int | ucl_ecc_publickeygeneration_bp512r1 (ucl_type_ecc_u8_affine_point Q, u8 *d)
ECC public key Generation. More...

Detailed Description

ECC public keys generation.

Function Documentation

◆ ucl_ecc_publickeygeneration_bp256r1()

int ucl_ecc_publickeygeneration_bp256r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC public key Generation.

this function generates a public key from a private keypair on the curve BP-256 using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to a 32-byte array
[in] | d | input, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL

◆ ucl_ecc_publickeygeneration_bp384r1()

int ucl_ecc_publickeygeneration_bp384r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC public key Generation.

this function generates a public key from a private keypair on the curve BP-384 using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to a 48-byte array
[in] | d | input, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL

◆ ucl_ecc_publickeygeneration_bp512r1()

int ucl_ecc_publickeygeneration_bp512r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC public key Generation.

this function generates a public key from a private keypair on the curve BP-512 using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to a 64-byte array
[in] | d | input, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL

◆ ucl_ecc_publickeygeneration_generic()

int ucl_ecc_publickeygeneration_generic | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d,
 |  | ucl_type_curve * | curve_params
 | ) |  |

ECC public key Generation.

this function generates a public key from a private keypair on the provided curve using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to the array
[in] | d | input, the secret key, generated by the function
[in] | curve_params | input, the pointer to the curve domain parameters structure
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_STACK_ERROR | if the UCL stack has a problem

◆ ucl_ecc_publickeygeneration_p160r1()

int ucl_ecc_publickeygeneration_p160r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC public key Generation.

this function generates a public key from a private keypair on the curve P-160 using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to a 20-byte array
[in] | d | input, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL

◆ ucl_ecc_publickeygeneration_p192r1()

int ucl_ecc_publickeygeneration_p192r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC public key Generation.

this function generates a public key from a private keypair on the curve P-192 using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to a 24-byte array
[in] | d | input, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL

◆ ucl_ecc_publickeygeneration_p224r1()

int ucl_ecc_publickeygeneration_p224r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC public key Generation.

this function generates a public key from a private keypair on the curve P-224 using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to a 28-byte array
[in] | d | input, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL

◆ ucl_ecc_publickeygeneration_p256r1()

int ucl_ecc_publickeygeneration_p256r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC public key Generation.

this function generates a public key from a private keypair on the curve P-256 using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to a 32-byte array
[in] | d | input, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL

◆ ucl_ecc_publickeygeneration_p384r1()

int ucl_ecc_publickeygeneration_p384r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC public key Generation.

this function generates a public key from a private keypair on the curve P-384 using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to a 48-byte array
[in] | d | input, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL

◆ ucl_ecc_publickeygeneration_p521r1()

int ucl_ecc_publickeygeneration_p521r1 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | d
 | ) |  |

ECC public key Generation.

this function generates a public key from a private keypair on the curve P-521 using the API introduced in the UCL 2.4.9

Parameters
[out] | Q | output, the public key structure: R=d.G, pointing to a 66-byte array
[in] | d | input, the secret key, generated by the function
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL


Universal Crypto Library: ECIES computation.

Functions
ECIES computation.
Public Key Algorithm » Elliptic Curves.

ECIES computation. More...

+ Collaboration diagram for ECIES computation.:

Functions

int | ucl_ecies_encrypt_p192r1_aes_hmac_sha256 (unsigned char *rx, unsigned char *ry, unsigned char *crypto, unsigned char *t, unsigned int keylength, unsigned char *xG, unsigned char *yG, unsigned char *xQ, unsigned char *yQ, unsigned char *a, unsigned char *n, unsigned char *p, unsigned char *m, unsigned MsgLng)
ECIES encryption. More...
int | ucl_ecies_decrypt_p192r1_aes_hmac_sha256 (unsigned char *m, unsigned int keylength, unsigned char *xG, unsigned char *yG, unsigned char *a, unsigned char *n, unsigned char *p, unsigned char *d, unsigned char *rx, unsigned char *ry, unsigned char *crypto, int crypto_len, unsigned char *t)
ECIES decryption. More...
int | ucl_ecies_encrypt_p256r1_aes_hmac_sha256 (u8 *rx, u8 *ry, u8 *crypto, u8 *t, u32 keylength, u8 *xG, u8 *yG, u8 *xQ, u8 *yQ, u8 *a, u8 *n, u8 *p, u8 *m, u32 MsgLng)
ECIES encryption. More...
int | ucl_ecies_decrypt_p256r1_aes_hmac_sha256 (u8 *m, u32 keylength, u8 *xG, u8 *yG, u8 *a, u8 *n, u8 *p, u8 *d, u8 *rx, u8 *ry, u8 *crypto, int crypto_len, u8 *t)
ECIES decryption. More...
int | ucl_ecies_encrypt_aes_hmac_sha256 (ucl_type_ecc_u8_affine_point Q, u8 *crypto, u8 *t, ucl_type_ecc_u8_affine_point pubkey, u8 *input, u32 inputlength, ucl_type_curve *curve_params)
ECIES encryption. More...
int | ucl_ecies_decrypt_aes_hmac_sha256 (u8 *message, u8 *d, ucl_type_ecc_u8_affine_point pubkey, u8 *crypto, int cryptolength, u8 *t, ucl_type_curve *curve_params)
ECIES decryption. More...

Detailed Description

ECIES computation.

Elliptic Curve Integrated Encryption Scheme, or ECIES, is a hybrid encryption system. ECIES has been standardized in ANSI X9.63, IEEE 1363a, ISO/IEC 18033-2, and SECG SEC-1. ECIES combines a Key Encapsulation Mechanism (KEM) with a Data Encapsulation Mechanism (DEM). The system independently derives a bulk encryption key and a MAC key from a common secret. Data is first encrypted under a symmetric cipher, and then the cipher text is MAC'd under an authentication scheme. Finally, the common secret is encrypted under the public part of a public/private key pair. The output of the encryption function is the tuple {K,C,T}, where K is the encrypted common secret, C is the ciphertext, and T is the authentication tag. There is some hand waiving around the "common secret" since its actually the result of applying a Key Agreement function, and it uses the static public key and an ephemeral key pair (Wikipedia)

Function Documentation

◆ ucl_ecies_decrypt_aes_hmac_sha256()

int ucl_ecies_decrypt_aes_hmac_sha256 | ( | u8 * | message,
 |  | u8 * | d,
 |  | ucl_type_ecc_u8_affine_point | pubkey,
 |  | u8 * | crypto,
 |  | int | cryptolength,
 |  | u8 * | t,
 |  | ucl_type_curve * | curve_params
 | ) |  |

ECIES decryption.

this generic function performs a ECIES AES HMAC SHA256 decryption on the proposed curve using the ECC API introduced in the UCL 2.4.9

Parameters
[out] u8 *message: the decrypted message

◆ ucl_ecies_decrypt_p192r1_aes_hmac_sha256()

int ucl_ecies_decrypt_p192r1_aes_hmac_sha256 | ( | unsigned char * | m,
 |  | unsigned int | keylength,
 |  | unsigned char * | xG,
 |  | unsigned char * | yG,
 |  | unsigned char * | a,
 |  | unsigned char * | n,
 |  | unsigned char * | p,
 |  | unsigned char * | d,
 |  | unsigned char * | rx,
 |  | unsigned char * | ry,
 |  | unsigned char * | crypto,
 |  | int | crypto_len,
 |  | unsigned char * | t
 | ) |  |

ECIES decryption.

this function performs a ECIES AES HMAC SHA256 decryption on the P-192 curve

Parameters
[out] | u8 | *rx,u8 *ry: the resulting point for encryption
[out] | u8 | *crypto: the encrypted message
[out] | u8 | *t: the resulting HMAC
[in] | u32 | keylength: the curve length, in bytes, i.e. SECP192R1_BYTESIZE for P-192
[in] | u8 | * xG,u8 *yG: the curve base point
[in] | u8 | *xQ,u8 * yQ: the public key
[in] | u8 | *a,u8 *n,u8 *p: the curve parameters,
[in] | u8 | *m: the message to be encrypted
[in] | u32 | MsgLng: the message length, in bytes
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_ERROR | otherwise

◆ ucl_ecies_decrypt_p256r1_aes_hmac_sha256()

int ucl_ecies_decrypt_p256r1_aes_hmac_sha256 | ( | u8 * | m,
 |  | u32 | keylength,
 |  | u8 * | xG,
 |  | u8 * | yG,
 |  | u8 * | a,
 |  | u8 * | n,
 |  | u8 * | p,
 |  | u8 * | d,
 |  | u8 * | rx,
 |  | u8 * | ry,
 |  | u8 * | crypto,
 |  | int | crypto_len,
 |  | u8 * | t
 | ) |  |

ECIES decryption.

this function performs a ECIES AES HMAC SHA256 decryption on the P-256 curve

Parameters
[out] | u8 | *rx,u8 *ry: the resulting point for encryption
[out] | u8 | *crypto: the encrypted message
[out] | u8 | *t: the resulting HMAC
[in] | u32 | keylength: the curve length, in bytes, i.e. SECP192R1_BYTESIZE for P-192
[in] | u8 | * xG,u8 *yG: the curve base point
[in] | u8 | *xQ,u8 * yQ: the public key
[in] | u8 | *a,u8 *n,u8 *p: the curve parameters,
[in] | u8 | *m: the message to be encrypted
[in] | u32 | MsgLng: the message length, in bytes
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_ERROR | otherwise

◆ ucl_ecies_encrypt_aes_hmac_sha256()

int ucl_ecies_encrypt_aes_hmac_sha256 | ( | ucl_type_ecc_u8_affine_point | Q,
 |  | u8 * | crypto,
 |  | u8 * | t,
 |  | ucl_type_ecc_u8_affine_point | pubkey,
 |  | u8 * | input,
 |  | u32 | inputlength,
 |  | ucl_type_curve * | curve_params
 | ) |  |

ECIES encryption.

this generic function performs a ECIES AES HMAC SHA256 encryption on the proposed curve using the ECC API introduced in the UCL 2.4.9

Parameters
[out] | ucl_type_ecc_u8_affine_point | Q: the resulting point for encryption
[out] | u8 | *crypto: the encrypted message
[out] | u8 | *t: the resulting HMAC
[in] | ucl_type_ecc_u8_affine_point | pubkey: the public key
[in] | u8 | *input: the message to be encrypted
[in] | u32 | inputlength: the message length, in bytes
[in] | ucl_type_curve | *curve_params: a pointer to the curve domain parameters structure
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_STACK_ERROR | if not enough UCL buffer memory available
UCL_ERROR | otherwise

◆ ucl_ecies_encrypt_p192r1_aes_hmac_sha256()

int ucl_ecies_encrypt_p192r1_aes_hmac_sha256 | ( | unsigned char * | rx,
 |  | unsigned char * | ry,
 |  | unsigned char * | crypto,
 |  | unsigned char * | t,
 |  | unsigned int | keylength,
 |  | unsigned char * | xG,
 |  | unsigned char * | yG,
 |  | unsigned char * | xQ,
 |  | unsigned char * | yQ,
 |  | unsigned char * | a,
 |  | unsigned char * | n,
 |  | unsigned char * | p,
 |  | unsigned char * | m,
 |  | unsigned | MsgLng
 | ) |  |

ECIES encryption.

this function performs a ECIES AES HMAC SHA256 encryption on the P-192 curve

Parameters
[out] | u8 | *rx,u8 *ry: the resulting point for encryption
[out] | u8 | *crypto: the encrypted message
[out] | u8 | *t: the resulting HMAC
[in] | u32 | keylength: the curve length, in bytes, i.e. SECP192R1_BYTESIZE for P-192
[in] | u8 | * xG,u8 *yG: the curve base point
[in] | u8 | *xQ,u8 * yQ: the public key
[in] | u8 | *a,u8 *n,u8 *p: the curve parameters,
[in] | u8 | *m: the message to be encrypted
[in] | u32 | MsgLng: the message length, in bytes
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_ERROR | otherwise

◆ ucl_ecies_encrypt_p256r1_aes_hmac_sha256()

int ucl_ecies_encrypt_p256r1_aes_hmac_sha256 | ( | u8 * | rx,
 |  | u8 * | ry,
 |  | u8 * | crypto,
 |  | u8 * | t,
 |  | u32 | keylength,
 |  | u8 * | xG,
 |  | u8 * | yG,
 |  | u8 * | xQ,
 |  | u8 * | yQ,
 |  | u8 * | a,
 |  | u8 * | n,
 |  | u8 * | p,
 |  | u8 * | m,
 |  | u32 | MsgLng
 | ) |  |

ECIES encryption.

this function performs a ECIES AES HMAC SHA256 encryption on the P-256 curve

Parameters
[out] | u8 | *rx,u8 *ry: the resulting point for encryption
[out] | u8 | *crypto: the encrypted message
[out] | u8 | *t: the resulting HMAC
[in] | u32 | keylength: the curve length, in bytes, i.e. SECP192R1_BYTESIZE for P-192
[in] | u8 | * xG,u8 *yG: the curve base point
[in] | u8 | *xQ,u8 * yQ: the public key
[in] | u8 | *a,u8 *n,u8 *p: the curve parameters,
[in] | u8 | *m: the message to be encrypted
[in] | u32 | MsgLng: the message length, in bytes
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_ERROR | otherwise


Universal Crypto Library: SP800-56 ECDH computation

Functions
SP800-56 ECDH computation
Public Key Algorithm » Elliptic Curves.
+ Collaboration diagram for SP800-56 ECDH computation:

Functions

int | ucl_sp800_56_ecc_cdh (u8 *z, u8 *dU, u8 *xV, u8 *yV, u32 configuration)
shared secret computation. More...
int | ucl_sp800_56_concat_kdf (u8 *derivedkeyingmaterial, u32 keydatalen, u8 *z, u32 zbytelength, u8 *otherinfo, u32 otherinfobitlength, u32 configuration)
secret key derivation. More...
int | ucl_sp800_56_eum_ecc_cdh (u8 *derivedkeyingmaterial, u32 keydatalen, u8 *dU, u8 *xU, u8 *yU, u8 *xV, u8 *yV, u8 *otherinfo, u32 otherinfobitlength, u32 configuration)
derived key material computation and ephemeral key generation. More...
int | ucl_ecc_sp800_56_ecc_cdh (u8 *z, u8 *dU, ucl_type_ecc_u8_affine_point V, ucl_type_curve *curve_params)
shared secret computation. More...
int | ucl_ecc_sp800_56_eum_ecc_cdh (u8 *derivedkeyingmaterial, u32 keydatalen, u8 *dU, ucl_type_ecc_u8_affine_point U, ucl_type_ecc_u8_affine_point V, u8 *otherinfo, u32 otherinfobitlength, ucl_type_curve *curve_params, u32 configuration)
derived key material computation and ephemeral key generation. More...

Detailed Description

Header:
ucl_sp800_56.h
SP800-56A NIST document specifies how to establish a secure link between two entities U and V thanks to the ECDH, Elliptic Curve Diffie-Hellman. These routines implement the Ephemeral Unified Model (section 6.1.2.2) Note only the routines to be used by U are provided here as the protocol and so, the routines can be used symmetrically by replacing U data by V data and reciprocally

Function Documentation

◆ ucl_ecc_sp800_56_ecc_cdh()

int ucl_ecc_sp800_56_ecc_cdh | ( | u8 * | z,
 |  | u8 * | dU,
 |  | ucl_type_ecc_u8_affine_point | V,
 |  | ucl_type_curve * | curve_params
 | ) |  |

shared secret computation.

this function computes the shared secret Z, using the secret key from U and the public key from V as described in the SP800-56A section 5.7.1.2 using the ECC API introduced in UCL 2.4.9

Parameters
[out] | *z | the shared secret Z
[in] | *dU | the secret key for the entity U
[in] | V | the V ephemeral public key using the ucl_type_ecc_u8_affine_point structure
[in] | curve_params | a pointer to the curve domain parameters
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_ecc_sp800_56_eum_ecc_cdh()

int ucl_ecc_sp800_56_eum_ecc_cdh | ( | u8 * | derivedkeyingmaterial,
 |  | u32 | keydatalen,
 |  | u8 * | dU,
 |  | ucl_type_ecc_u8_affine_point | U,
 |  | ucl_type_ecc_u8_affine_point | V,
 |  | u8 * | otherinfo,
 |  | u32 | otherinfobitlength,
 |  | ucl_type_curve * | curve_params,
 |  | u32 | configuration
 | ) |  |

derived key material computation and ephemeral key generation.

this function computes the derived key material and generates the U ephemeral key using the ECC API introduced in UCL 2.4.9 the derived key material is used to establish the secure link

Parameters
[out] | *z | the shared secret Z
[out] | *d | the newly generated secret key for the entity U
[out] | U | the newly generated U ephemeral key using the ucl_type_ecc_u8_affine_point structure
[in] | V | the V ephemeral public key using the ucl_type_ecc_u8_affine_point structure
[in] | *otherinfo | the OtherInfo field as defined in section 5.8.1.2
[in] | otherinfolength | the OtherInfo field bit length; this number is a multiple of 8
[in] | curve_params | a pointer to the curve domain parameters
[in] | configuration | the configuration variable for transmitting the hash function identifier
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL
UCL_ERROR | if any problem in key generation or Z shared secret computation

limitation: the OtherInfo length is expressed in bits but is a multiple of 8 (so bytes).

◆ ucl_sp800_56_concat_kdf()

int ucl_sp800_56_concat_kdf | ( | u8 * | derivedkeyingmaterial,
 |  | u32 | keydatalen,
 |  | u8 * | z,
 |  | u32 | zbytelength,
 |  | u8 * | otherinfo,
 |  | u32 | otherinfobitlength,
 |  | u32 | configuration
 | ) |  |

secret key derivation.

this function represents the concatenation KDF, Key Derivation Function, as described in the as described in the SP800-56A in the section 5.8.1

Parameters
[out] | *derivingkeymaterial | the derived key
[in] | keydatalen | the bits length of the derived key material
[in] | *z | the shared secret
[in] | zbytelength | the shared secret length in bytes
[in] | *otherinfo | the OtherInfo field as defined in section 5.8.1.2
[in] | otherinfolength | the OtherInfo field bit length; this number is a multiple of 8
[in] | configuration | the configuration variable for transmitting the hash function identifier
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

limitation: the OtherInfo length is expressed in bits but is a multiple of 8 (so bytes).

◆ ucl_sp800_56_ecc_cdh()

int ucl_sp800_56_ecc_cdh | ( | u8 * | z,
 |  | u8 * | dU,
 |  | u8 * | xV,
 |  | u8 * | yV,
 |  | u32 | configuration
 | ) |  |

shared secret computation.

this function computes the shared secret Z, using the secret key from U and the public key from V as described in the SP800-56A in the section 5.7.1.2

Parameters
[out] | *z | the shared secret Z
[in] | *d | the secret key for the entity U
[in] | *xV | the V ephemeral public key X coordinate
[in] | *yV | the V ephemeral public key Y coordinate
[in] | configuration | the configuration variable for transmitting the curve identifier
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL

◆ ucl_sp800_56_eum_ecc_cdh()

int ucl_sp800_56_eum_ecc_cdh | ( | u8 * | derivedkeyingmaterial,
 |  | u32 | keydatalen,
 |  | u8 * | dU,
 |  | u8 * | xU,
 |  | u8 * | yU,
 |  | u8 * | xV,
 |  | u8 * | yV,
 |  | u8 * | otherinfo,
 |  | u32 | otherinfobitlength,
 |  | u32 | configuration
 | ) |  |

derived key material computation and ephemeral key generation.

this function computes the derived key material and generates the U ephemeral key the derived key material is used to establish the secure link

Parameters
[out] | *derivedkeyingmaterial | the shared secret Z
[out] | keydatalen | the length of the shared secret
[out] | *dU | the newly generated secret key for the entity U
[out] | *xU | the newly generated U ephemeral key X coordinate using the ucl_type_ecc_u8_affine_point structure
[out] | *yU | the newly generated U ephemeral key Y coordinate using the ucl_type_ecc_u8_affine_point structure
[in] | *xV | the V ephemeral public key X coordinate using the ucl_type_ecc_u8_affine_point structure
[in] | *yV | the V ephemeral public key Y coordinate using the ucl_type_ecc_u8_affine_point structure
[in] | *otherinfo | the OtherInfo field as defined in section 5.8.1.2
[in] | otherinfolength | the OtherInfo field bit length; this number is a multiple of 8
[in] | configuration | the configuration variable for transmitting the curve and hash function identifiers
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_OUTPUT | if one of the outputs is the pointer NULL
UCL_ERROR | if any problem in key generation or Z shared secret computation

limitation: the OtherInfo length is expressed in bits but is a multiple of 8 (so bytes).


Universal Crypto Library: RSA

Modules | Data Structures | Macros | Functions
RSA
Public Key Algorithm

The RSA cryptosystem. More...

+ Collaboration diagram for RSA:

Modules

DSA
the DSA cryptosystem.
RSA2VS
The RSA2VS validation program.
RSA Deprecated Prototypes
Old RSA prototypes.

Data Structures

struct | ucl_rsa_public_key_t
RSA Public Key Structure. More...
struct | ucl_rsa_private_key_t
RSA Private Key Structure. More...
struct | ucl_rsa_crt_private_key_t
RSA CRT Private Key Structure. More...

Macros

#define | ucl_rsa_public_key_t ucl_rsa_public_key_t
RSA Public Key.
#define | ucl_rsa_private_key_t ucl_rsa_private_key_t
RSA Private Key.
#define | ucl_rsa_crt_private_key_t ucl_rsa_crt_private_key_t
RSA CRT Private Key.

Functions

int | ucl_rsa_param_gen_fips186_4 (u32 *n, u32 *p, u32 *q, u32 *d, u32 *e, u32 t, u32 s)
RSA Parameters Generation. More...
int | ucl_rsa_param_gen (u32 *n, u32 *p, u32 *q, u32 *d, u32 *e, u32 t, u32 s)
RSA Parameters Generation. More...
int | ucl_rsa_crt_param_gen_legacy (u32 *n, u32 *p, u32 *q, u32 *dp, u32 *dq, u32 *qInv, u32 *e, u32 t, u32 s)
RSA CRT Parameters Generation. More...
int | ucl_rsa_crt_param_gen_fips186_4 (u32 *n, u32 *d, u32 *p, u32 *q, u32 *dp, u32 *dq, u32 *qInv, u32 *e, u32 t, u32 s)
RSA CRT Parameters Generation. More...
int | ucl_rsa_crt_param_gen (u32 *n, u32 *d, u32 *p, u32 *q, u32 *dp, u32 *dq, u32 *qInv, u32 *e, u32 t, u32 s)
RSA CRT Parameters Generation. More...
int | ucl_rsa_param_generation_fips186_4 (u8 *n, u8 *p, u8 *q, u8 *d, u8 *e, int t, int modulus_bytes_size)
RSA Parameters Generation. More...
int | ucl_rsa_param_generation (u8 *n, u8 *p, u8 *q, u8 *d, u8 *e, int t, int modulus_bytes_size)
RSA Parameters Generation. More...
int | ucl_rsa_crt_param_generation_fips186_4 (u8 *n, u8 *d, u8 *p, u8 *q, u8 *dp, u8 *dq, u8 *qInv, u8 *e, u32 t, u32 modulus_bytes_size)
RSA CRT Parameters Generation. More...
int | ucl_rsa_crt_param_generation (u8 *n, u8 *d, u8 *p, u8 *q, u8 *dp, u8 *dq, u8 *qInv, u8 *e, u32 t, u32 modulusbytes_size)
RSA CRT Parameters Generation Generate two primes p & and calculate
. More...
int | fpa_is_prime (u32 *n, u32 s, u32 t)
Miller-Rabin Test. More...
int | fpa_gen_prime (u32 *p, u32 *e, u32 *pMin, u32 *pMax, u32 s)
prime number generation. More...
int | fpa_gen_prime_fips186_4 (u32 *p, u32 *e, u32 t)
FIPS 186-4 prime number generation. More...
int | ucl_rsa_decryptBlock (u32 *dst, u32 *src, u32 *d, u32 *n, u32 s)
RSA Primitive - Decryption. More...
int | ucl_rsa_crt_decryptBlock (u32 *dst, u32 *src, u32 *dp, u32 *dq, u32 *p, u32 *q, u32 *qInv, u32 *e, u32 sE, u32 *n, u32 s)
RSA Primitive - Decryption with CRT. More...
int | ucl_rsa_crt_decryptBlock_without_protection (u32 *dst, u32 *src, u32 *dp, u32 *dq, u32 *p, u32 *q, u32 *qInv, u32 *e, u32 sE, u32 *n, u32 s)
RSA Primitive - Decryption with CRT. More...
int | ucl_rsa_encryptBlock (u32 *dst, u32 *src, u32 *e, u32 sE, u32 *n, u32 s)
RSA Primitive - Encryption. More...
int | ucl_rsa_crt_parameters_legacy (u32 *n, u32 *dp, u32 *dq, u32 *qInv, u32 *p, u32 *q, u32 *e, u32 elength, u32 nlength)
RSA CRT Parameters re-generation Generate CRT parameters dp, dq, and
from two primes p & . More...
int | ucl_rsa_crt_non_fips186_4_compliant_parameters (u32 *n, u32 *d, u32 *dp, u32 *dq, u32 *qInv, u32 *p, u32 *q, u32 *e, u32 elength, u32 nlength)
RSA CRT Parameters non FIPS-186-4-compliant re-generation Generate CRT parameters n,d,dp, dq, and
from two primes p & . More...
int | ucl_rsa_recover_primes_from_secret_exponent (u8 *p, u8 *q, u8 *n, u8 *d, u8 *e, int modulus_bytes_size)
RSA prime numbers computation Generate the two primes p & from d and
. More...

Detailed Description

The RSA cryptosystem.

Header:
ucl_rsa.h

It named after its inventors R. Rivest, A. Shamir, and L. Adleman, is the most widely used public-key cryptosystem. It may be used to provide both secrecy and digital signatures and its security is based on the dificulty of the integer factorization problem.

Principle:

Let e a small integer (in general 3 or $ 2^{16}+1 $), the public exponent.
Let [image], the modulus, such as p and q are two large primes, and [image] where [image].
Let [image], the private exponent.

(n, e) is named the public key and (n, d) the private key.

Encryption/Decryption primitives:
If $ 0 < m < n $ is a message, then the ciphetext is [image] and [image].

Signature/Verification primitives:
If $ 0 < m < n $ is a message, then the signature is
To check a S' signature, calculate [image] and compare with m.

CRT: In order to speed up the RSA calculation, the CRT can be applied.

Note
This section contains the RSA primitives compliants with PKCS #1 V2.1.

Function Documentation

◆ fpa_gen_prime()

int fpa_gen_prime | ( | u32 * | p,
 |  | u32 * | e,
 |  | u32 * | pMin,
 |  | u32 * | pMax,
 |  | u32 | s
 | ) |  |

prime number generation.

prime number generation following IEEE1363 Annex A.16.11 Generate a prime number p between pMax and pMin for which p-1 is relatively prime to e

Parameters
[out] | p | the generated prime number
[in] | e | the public exponent
[in] | s | the precision, i.e. the number size in words
Returns
Error code or Test value
Return values
UCL_STACK_OVERFLOW | if the buffer memory is too small
UCL_STACK_ERROR | if there is an error with the buffer memory
UCL_INVALID_INPUT | if e is the pointer NULL
UCL_INVALID_OUTPUT | if p is the pointer NULL
UCL_OK | if everything went ok

◆ fpa_gen_prime_fips186_4()

int fpa_gen_prime_fips186_4 | ( | u32 * | p,
 |  | u32 * | e,
 |  | u32 | t
 | ) |  |

FIPS 186-4 prime number generation.

prime number generation compliant with FIPS 186-4 appendix B3.3

Generate a prime number p for which p-1 is relatively prime to e

Parameters
[out] | p | the generated prime number
[in] | e | the public exponent
[in] | s | the precision, i.e. the number size in words
Returns
Error code or Test value
Return values
UCL_STACK_OVERFLOW | if the buffer memory is too small
UCL_STACK_ERROR | if there is an error with the buffer memory
UCL_INVALID_INPUT | if e is the pointer NULL
UCL_INVALID_OUTPUT | if p is the pointer NULL
UCL_OK | if everything went ok

◆ fpa_is_prime()

int fpa_is_prime | ( | u32 * | n,
 |  | u32 | s,
 |  | u32 | t
 | ) |  |

Miller-Rabin Test.

If n is a large positive integer, the following probabilistic algorithm will determine whether n is prime or composite, with arbitrarily small probability of error. [Knu81]

Parameters
[in] | n | the number to be tested
[in] | s | the precision, i.e. the number size in words
[in] | t | the number of Miller-Rabin tests to perform
Returns
Error code or Test value
Return values
#UCL_IS_PRIME | if the number n is prime
#UCL_ISNOT_PRIME | if the number n is not prime
UCL_STACK_OVERFLOW | if the buffer memory is too small
UCL_STACK_ERROR | if there is an error with the buffer memory
UCL_INVALID_INPUT | if n is the pointer NULL

◆ ucl_rsa_crt_decryptBlock()

int ucl_rsa_crt_decryptBlock | ( | u32 * | dst,
 |  | u32 * | src,
 |  | u32 * | dp,
 |  | u32 * | dq,
 |  | u32 * | p,
 |  | u32 * | q,
 |  | u32 * | qInv,
 |  | u32 * | e,
 |  | u32 | sE,
 |  | u32 * | n,
 |  | u32 | s
 | ) |  |

RSA Primitive - Decryption with CRT.

It's equivalent to generate a signature.

Parameters
[out] | dst | The result of decryption
[in] | src | The ciphertext
[in] | dp | Private exponent 1
[in] | dq | Private exponent 2
[in] | p | Private factor 1
[in] | q | Private factor 2
[in] | qInv | Inverse of q mod p
[in] | e | Public exponent
[in] | sE | Precision of the public exponent
[in] | n | The modulus
[in] | s | The precision
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_INPUT | if one of the input is the pointer NULL
UCL_INVALID_PRECISION | if s is out of range
UCL_RSA_INVALID_INPUT | if $ input > n $
Note
This primitive is compliant with RSADP and RSAVP1 from PKCS #1 V2.1

◆ ucl_rsa_crt_decryptBlock_without_protection()

int ucl_rsa_crt_decryptBlock_without_protection | ( | u32 * | dst,
 |  | u32 * | src,
 |  | u32 * | dp,
 |  | u32 * | dq,
 |  | u32 * | p,
 |  | u32 * | q,
 |  | u32 * | qInv,
 |  | u32 * | e,
 |  | u32 | sE,
 |  | u32 * | n,
 |  | u32 | s
 | ) |  |

RSA Primitive - Decryption with CRT.

It's equivalent to generate a signature. this function does not have any protection, so it SHALL NOT be used when protections are required

Parameters
[out] | dst | The result of decryption
[in] | src | The ciphertext
[in] | dp | Private exponent 1
[in] | dq | Private exponent 2
[in] | p | Private factor 1
[in] | q | Private factor 2
[in] | qInv | Inverse of q mod p
[in] | e | Public exponent
[in] | sE | Precision of the public exponent
[in] | n | The modulus
[in] | s | The precision
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_INPUT | if one of the input is the pointer NULL
UCL_INVALID_PRECISION | if s is out of range
UCL_RSA_INVALID_INPUT | if $ input > n $
Note
This primitive is compliant with RSADP and RSAVP1 from PKCS #1 V2.1

◆ ucl_rsa_crt_non_fips186_4_compliant_parameters()

int ucl_rsa_crt_non_fips186_4_compliant_parameters | ( | u32 * | n,
 |  | u32 * | d,
 |  | u32 * | dp,
 |  | u32 * | dq,
 |  | u32 * | qInv,
 |  | u32 * | p,
 |  | u32 * | q,
 |  | u32 * | e,
 |  | u32 | elength,
 |  | u32 | nlength
 | ) |  |

RSA CRT Parameters non FIPS-186-4-compliant re-generation Generate CRT parameters n,d,dp, dq, and
from two primes p & .

Parameters
[out] | n | The pointer to n
[out] | d | The pointer to d
[out] | dp | The pointer to dp
[out] | dp | The pointer to dp
[out] | qInv | The pointer to qInv
[in] | p | The pointer to p
[in] | q | The pointer to q
[in] | e | The pointer to e
[in] | elength | The length of e
[in] | nlength | The length of n
Returns
Error code
Return values
UCL_OK

◆ ucl_rsa_crt_param_gen()

int ucl_rsa_crt_param_gen | ( | u32 * | n,
 |  | u32 * | d,
 |  | u32 * | p,
 |  | u32 * | q,
 |  | u32 * | dp,
 |  | u32 * | dq,
 |  | u32 * | qInv,
 |  | u32 * | e,
 |  | u32 | t,
 |  | u32 | s
 | ) |  |

RSA CRT Parameters Generation.

it applies the method described in IEEE-1363. Generate p, q, n , dp, dq and qInv such as:

Parameters
[out] | n | The pointer to n
[out] | p | The pointer to p
[out] | q | The pointer to q
[out] | dp | The pointer to dp
[out] | dq | The pointer to dp
[out] | qInv | The pointer to qInv
[in] | e | The pointer to e
[in] | t | The length of e
[in] | s | The precision
Returns
Error code
Return values
UCL_OK
UCL_STACK_ERROR | if the stack is too small for allocating temp variables
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_INPUT | if one of the input is the pointer NULL

◆ ucl_rsa_crt_param_gen_fips186_4()

int ucl_rsa_crt_param_gen_fips186_4 | ( | u32 * | n,
 |  | u32 * | d,
 |  | u32 * | p,
 |  | u32 * | q,
 |  | u32 * | dp,
 |  | u32 * | dq,
 |  | u32 * | qInv,
 |  | u32 * | e,
 |  | u32 | t,
 |  | u32 | s
 | ) |  |

RSA CRT Parameters Generation.

generate RSA keys pairs with FIPS 186-4 compliance. for keys length=1024, it applies section B3.6, otherwise it applies section B.3.3. Generate p, q, n , dp, dq and qInv such as:

Parameters
[out] | n | The pointer to n
[out] | p | The pointer to p
[out] | q | The pointer to q
[out] | dp | The pointer to dp
[out] | dq | The pointer to dp
[out] | qInv | The pointer to qInv
[in] | e | The pointer to e
[in] | t | The length of e
[in] | s | The precision
Returns
Error code
Return values
UCL_OK
UCL_ERROR | if the key length is not authorized or if the public exponent is not authorized
UCL_STACK_ERROR | if the stack is too small for allocating temp variables
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_INPUT | if one of the input is the pointer NULL

◆ ucl_rsa_crt_param_gen_legacy()

int ucl_rsa_crt_param_gen_legacy | ( | u32 * | n,
 |  | u32 * | p,
 |  | u32 * | q,
 |  | u32 * | dp,
 |  | u32 * | dq,
 |  | u32 * | qInv,
 |  | u32 * | e,
 |  | u32 | t,
 |  | u32 | s
 | ) |  |

RSA CRT Parameters Generation.

Generate p, q, n , dp, dq and qInv such as:

Parameters
[out] | n | The pointer to n
[out] | p | The pointer to p
[out] | q | The pointer to q
[out] | dp | The pointer to dp
[out] | dq | The pointer to dp
[out] | qInv | The pointer to qInv
[in] | e | The pointer to e
[in] | t | The length of e
[in] | s | The precision
Returns
Error code
Return values
UCL_OK
UCL_STACK_ERROR | if the stack is too small for allocating temp variables
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_INPUT | if one of the input is the pointer NULL

◆ ucl_rsa_crt_param_generation()

int ucl_rsa_crt_param_generation | ( | u8 * | n,
 |  | u8 * | d,
 |  | u8 * | p,
 |  | u8 * | q,
 |  | u8 * | dp,
 |  | u8 * | dq,
 |  | u8 * | qInv,
 |  | u8 * | e,
 |  | u32 | t,
 |  | u32 | modulusbytes_size
 | ) |  |

RSA CRT Parameters Generation Generate two primes p & and calculate
.

the parameters are in bytes (u8)

Parameters
[out] | n | The pointer to n
[out] | d | The pointer to d
[out] | p | The pointer to p
[out] | q | The pointer to q
[out] | dp | The pointer to dp
[out] | dp | The pointer to dp
[out] | qInv | The pointer to qInv
[in] | e | The pointer to e
[in] | t | The length of e
[in] | modulus_bytes_size | The precision
Returns
Error code
Return values
UCL_OK
UCL_STACK_ERROR | if the stack is too small for allocating temp variables
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_INPUT | if one of the input is the pointer NULL

◆ ucl_rsa_crt_param_generation_fips186_4()

int ucl_rsa_crt_param_generation_fips186_4 | ( | u8 * | n,
 |  | u8 * | d,
 |  | u8 * | p,
 |  | u8 * | q,
 |  | u8 * | dp,
 |  | u8 * | dq,
 |  | u8 * | qInv,
 |  | u8 * | e,
 |  | u32 | t,
 |  | u32 | modulus_bytes_size
 | ) |  |

RSA CRT Parameters Generation.

generate RSA keys pairs with FIPS 186-4 compliance. for keys length=1024, it applies section B3.6, otherwise it applies section B.3.3. Generate p, q, n , dp, dq and qInv such as:

the parameters are in bytes (u8)

Parameters
[out] | n | The pointer to n
[out] | p | The pointer to p
[out] | q | The pointer to q
[out] | dp | The pointer to dp
[out] | dq | The pointer to dp
[out] | qInv | The pointer to qInv
[in] | e | The pointer to e
[in] | t | The length of e
[in] | s | The precision
Returns
Error code
Return values
UCL_OK
UCL_ERROR | if the key length is not authorized or if the public exponent is not authorized
UCL_STACK_ERROR | if the stack is too small for allocating temp variables
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_INPUT | if one of the input is the pointer NULL

◆ ucl_rsa_crt_parameters_legacy()

int ucl_rsa_crt_parameters_legacy | ( | u32 * | n,
 |  | u32 * | dp,
 |  | u32 * | dq,
 |  | u32 * | qInv,
 |  | u32 * | p,
 |  | u32 * | q,
 |  | u32 * | e,
 |  | u32 | elength,
 |  | u32 | nlength
 | ) |  |

RSA CRT Parameters re-generation Generate CRT parameters dp, dq, and
from two primes p & .

Parameters
[out] | n | The pointer to n
[out] | dp | The pointer to dp
[out] | dp | The pointer to dp
[out] | qInv | The pointer to qInv
[in] | p | The pointer to p
[in] | q | The pointer to q
[in] | e | The pointer to e
[in] | elength | The length of e
[in] | nlength | The length of n
Returns
Error code
Return values
UCL_OK

◆ ucl_rsa_decryptBlock()

int ucl_rsa_decryptBlock | ( | u32 * | dst,
 |  | u32 * | src,
 |  | u32 * | d,
 |  | u32 * | n,
 |  | u32 | s
 | ) |  |

RSA Primitive - Decryption.

It's equivalent to generate a signature.

Parameters
[out] | dst | The result of decryption
[in] | src | The ciphertext
[in] | d | Private exponent
[in] | n | The modulus
[in] | s | The precision
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_INPUT | if one of the input is the pointer NULL or if the src is greater than the modulus
UCL_INVALID_PRECISION | if s is out of range
UCL_RSA_INVALID_INPUT | if $ src > n $
Note
This primitive is compliant with RSADP and RSAVP1 from PKCS #1 V2.1

◆ ucl_rsa_encryptBlock()

int ucl_rsa_encryptBlock | ( | u32 * | dst,
 |  | u32 * | src,
 |  | u32 * | e,
 |  | u32 | sE,
 |  | u32 * | n,
 |  | u32 | s
 | ) |  |

RSA Primitive - Encryption.

It's equivalent to check a signature.

Parameters
[out] | dst | The result of encryption
[in] | src | The plaintext
[in] | e | Public exponent
[in] | sE | Precision of the public exponent
[in] | n | The modulus
[in] | s | The precision
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_INPUT | if one of the input is the pointer NULL, or if the public exponent size is too large or if the src is greater than the modulus
UCL_INVALID_PRECISION | if s or sE is out of range
UCL_RSA_INVALID_INPUT | if $ input > n $
Note
This primitive is compliant with RSAEP and RSASP1 from PKCS #1 V2.1

◆ ucl_rsa_param_gen()

int ucl_rsa_param_gen | ( | u32 * | n,
 |  | u32 * | p,
 |  | u32 * | q,
 |  | u32 * | d,
 |  | u32 * | e,
 |  | u32 | t,
 |  | u32 | s
 | ) |  |

RSA Parameters Generation.

it applies the method described in IEEE-1363. Generate p, q, n and d such as:

the parameters are in words (u32)

Parameters
[out] | n | The pointer to n
[out] | p | The pointer to p
[out] | q | The pointer to q
[out] | d | The pointer to d
[in] | e | The pointer to e
[in] | t | The length of e
[in] | s | The precision
Returns
Error code
Return values
UCL_OK
UCL_STACK_ERROR | if the stack is too small for allocating temp variables
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_INPUT | if one of the input is the pointer NULL

◆ ucl_rsa_param_gen_fips186_4()

int ucl_rsa_param_gen_fips186_4 | ( | u32 * | n,
 |  | u32 * | p,
 |  | u32 * | q,
 |  | u32 * | d,
 |  | u32 * | e,
 |  | u32 | t,
 |  | u32 | s
 | ) |  |

RSA Parameters Generation.

generate RSA keys pairs with FIPS 186-4 compliance. for keys length=1024, it applies section B3.6, for keys length=2048, 3072 or 4096 (as a FIPS 186-4 extension), it applies section B3.3 Generate p, q, n and d such as:

Parameters
[out] | n | The pointer to n
[out] | p | The pointer to p
[out] | q | The pointer to q
[out] | d | The pointer to d
[in] | e | The pointer to e
[in] | t | The length of e
[in] | s | The precision
Returns
Error code
Return values
UCL_OK
UCL_ERROR | if the key length is not authorized or if the public exponent is not authorized
UCL_STACK_ERROR | if the stack is too small for allocating temp variables
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_INPUT | if one of the input is the pointer NULL

◆ ucl_rsa_param_generation()

int ucl_rsa_param_generation | ( | u8 * | n,
 |  | u8 * | p,
 |  | u8 * | q,
 |  | u8 * | d,
 |  | u8 * | e,
 |  | int | t,
 |  | int | modulus_bytes_size
 | ) |  |

RSA Parameters Generation.

it applies the method described in IEEE-1363. Generate p, q, n and d such as:

the parameters are in bytes (u8)

Parameters
[out] | n | The pointer to n
[out] | p | The pointer to p
[out] | q | The pointer to q
[out] | d | The pointer to d
[in] | e | The pointer to e
[in] | t | The length of e
[in] | modulus_bytes_size | The modulus size in bytes
Returns
Error code
Return values
UCL_OK
UCL_STACK_ERROR | if the stack is too small for allocating temp variables
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_INPUT | if one of the input is the pointer NULL

◆ ucl_rsa_param_generation_fips186_4()

int ucl_rsa_param_generation_fips186_4 | ( | u8 * | n,
 |  | u8 * | p,
 |  | u8 * | q,
 |  | u8 * | d,
 |  | u8 * | e,
 |  | int | t,
 |  | int | modulus_bytes_size
 | ) |  |

RSA Parameters Generation.

generate RSA keys pairs with FIPS 186-4 compliance. for keys length=1024, it applies section B3.6, otherwise it applies section B.3.3. Generate p, q, n and d such as:

the parameters are in bytes (u8)

Parameters
[out] | n | The pointer to n
[out] | p | The pointer to p
[out] | q | The pointer to q
[out] | d | The pointer to d
[in] | e | The pointer to e
[in] | t | The length of e
[in] | s | The precision
Returns
Error code
Return values
UCL_OK
UCL_ERROR | if the key length is not authorized or if the public exponent is not authorized
UCL_STACK_ERROR | if the stack is too small for allocating temp variables

◆ ucl_rsa_recover_primes_from_secret_exponent()

int ucl_rsa_recover_primes_from_secret_exponent | ( | u8 * | p,
 |  | u8 * | q,
 |  | u8 * | n,
 |  | u8 * | d,
 |  | u8 * | e,
 |  | int | modulus_bytes_size
 | ) |  |

RSA prime numbers computation Generate the two primes p & from d and
.

Parameters
[out] | p | The pointer to p
[out] | q | The pointer to q
[in] | n | The pointer to n, the modulus
[in] | d | The pointer to d, the private exponent
[in] | modulus_bytes_size | The length of n, in bytes
Returns
Error code
Return values
UCL_OK
UCL_INVALID_INPUT | if the input parametes are incorrect
UCL_INVALID_INPUT | if the input parametes are incorrect
UCL_STACK_ERROR | if the buffer size is too small (e.g. for the key size)
UCL_OK
Warning
the only supported public exponent values are 3 and 65537


Universal Crypto Library: DSA

Functions
DSA
Public Key Algorithm » RSA

the DSA cryptosystem. More...

+ Collaboration diagram for DSA:

Functions

int | ucl_dsa_keygen (u8 *y, u8 *x, u8 *p, u32 plength, u8 *q, u8 *g)
DSA signature . More...
int | ucl_dsa_sign (u8 *r_and_others, u8 *s, u8 *p, u32 plength, u8 *q, u8 *g, u8 *x, u8 *input, u32 inputlength, u32 configuration)
DSA signature . More...
int | ucl_dsa_verify (u8 *r, u8 *s, u8 *p, u32 plength, u8 *q, u8 *g, u8 *y, u8 *input, u32 inputlength, u32 configuration)
DSA signature verification . More...

Detailed Description

the DSA cryptosystem.

Function Documentation

◆ ucl_dsa_keygen()

int ucl_dsa_keygen | ( | u8 * | y,
 |  | u8 * | x,
 |  | u8 * | p,
 |  | u32 | plength,
 |  | u8 * | q,
 |  | u8 * | g
 | ) |  |

DSA signature .

DSA key generation

Parameters
[out] | u8 | *y: output, the public key
[out] | u8 | *x: output, the secret key
[in] | u8 | *p: input, the prime modulus,
[in] | u32 | *plength: input, the prime modulus length,
[in] | u8 | *q: input, the prime divisor of p-1
[in] | u8 | *g: input, the generator
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | in case of NULL pointers for input parameters
UCL_INVALID_OUTPUT | in case of NULL pointers for output parameters
UCL_ERROR | for wrong parameters
UCL_STACK_ERROR | if the UCL stack has a problem
See also
DSA

◆ ucl_dsa_sign()

int ucl_dsa_sign | ( | u8 * | r_and_others,
 |  | u8 * | s,
 |  | u8 * | p,
 |  | u32 | plength,
 |  | u8 * | q,
 |  | u8 * | g,
 |  | u8 * | x,
 |  | u8 * | input,
 |  | u32 | inputlength,
 |  | u32 | configuration
 | ) |  |

DSA signature .

DSA Signature computation using supplied hash function.

Parameters
[out] | u8 | *r_and_others: input/output, the r value for the computed signature (input if pre-computed with R_PRECOMP configuration) if R_PRECOMP or PRECOMP_R are used, the array is a double curve array as containing the r and the k-1.
[out] | u8 | *s: output, the s value for the computed signature
[in] | u8 | *p: input, the prime modulus,
[in] | u32 | *plength: input, the prime modulus length,
[in] | u8 | *q: input, the prime divisor of p-1
[in] | u8 | *g: input, the generator
[in] | u8 | *x: input, the secret key
[in] | u8 | *input: input, the message or the hash digest to be signed,
[in] | u32 | inputlength: input, the input length, in bytes
[in] | u32 | configuration (combination of any of these lines) UCL_MSG_INPUT or UCL_HASH_INPUT UCL_MSG_INPUT: the message will be hashed first, UCL_SHA256 or UCL_SHA1 UCL_HASH_INPUT: the input is already the hash digest, UCL_SHA256 or UCL_SHA1: hash function, if UCL_MSG_INPUT is used.
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_INPUT | in case of wrong parameters configuration
UCL_STACK_ERROR | if the UCL stack has a problem
UCL_ERROR | if a decryption error occurred
See also
DSA
UCL_SHA1
UCL_SHA256

◆ ucl_dsa_verify()

int ucl_dsa_verify | ( | u8 * | r,
 |  | u8 * | s,
 |  | u8 * | p,
 |  | u32 | plength,
 |  | u8 * | q,
 |  | u8 * | g,
 |  | u8 * | y,
 |  | u8 * | input,
 |  | u32 | inputlength,
 |  | u32 | configuration
 | ) |  |

DSA signature verification .

DSA Signature verification using supplied hash function.

Parameters


Universal Crypto Library: RSA2VS

Functions
RSA2VS
Public Key Algorithm » RSA

The RSA2VS validation program. More...

+ Collaboration diagram for RSA2VS:

Functions

int | ucl_rsa_param_gen_fips186_4_B36_RSA2VS (u32 *n, u32 *p, u32 *q, u32 *d, u32 *xp1, u32 *xp2, u32 *p1, u32 *p2, u32 *xp, u32 *xq1, u32 *xq2, u32 *q1, u32 *q2, u32 *xq, u32 *bitlen1, u32 *bitlen2, u32 *e, u32 t, u32 s)
RSA Parameters Generation. More...
int | ucl_rsa_param_generation_fips186_4_B36_RSA2VS (u8 *n, u8 *p, u8 *q, u8 *d, u8 *xp1, u8 *xp2, u8 *p1, u8 *p2, u8 *xp, u8 *xq1, u8 *xq2, u8 *q1, u8 *q2, u8 *xq, int *bitlen1, int *bitlen2, u8 *e, int t, int modulus_bytes_size)
RSA Parameters Generation. More...
int | ucl_fips186_4_kat_B33 (u32 *p, u32 *q, u32 *e, u32 s)
FIPS 186-4 prime number generation. More...

Detailed Description

The RSA2VS validation program.

Function Documentation

◆ ucl_fips186_4_kat_B33()

int ucl_fips186_4_kat_B33 | ( | u32 * | p,
 |  | u32 * | q,
 |  | u32 * | e,
 |  | u32 | s
 | ) |  |

FIPS 186-4 prime number generation.

prime number generation compliant with FIPS 186-4 appendix B3.3

Generate a prime number p for which p-1 is relatively prime to e

Parameters
[in] | p | the random number to test
[in] | q | the (optional) random number to test (q shall be NULL to not be tested)
[in] | e | the public exponent
[in] | s | the precision, i.e. the number size in words
Returns
Error code or Test value
Return values
UCL_STACK_OVERFLOW | if the buffer memory is too small
UCL_STACK_ERROR | if there is an error with the buffer memory
UCL_INVALID_INPUT | if e is the pointer NULL or p is the pointer NULL
#UCL_ERROR_B43 | if p is not odd
#UCL_ERROR_B44 | if step 4.4 is not satisfied
#UCL_ERROR_B452 | if p is probably not prime
#UCL_ERROR_B45 | if step 4.5 is not satisfied
#UCL_ERROR_B53 | if (p is prime and) q is not odd
#UCL_ERROR_B55 | if (p is prime and) step 5.5 is not satisfied
#UCL_ERROR_B562 | if (p is prime and) q is probably not prime
#UCL_ERROR_B56 | if (p is prime and) step 5.6 is not satisfied
UCL_OK | if everything went ok (p and q probably primes numbers)

◆ ucl_rsa_param_gen_fips186_4_B36_RSA2VS()

int ucl_rsa_param_gen_fips186_4_B36_RSA2VS | ( | u32 * | n,
 |  | u32 * | p,
 |  | u32 * | q,
 |  | u32 * | d,
 |  | u32 * | xp1,
 |  | u32 * | xp2,
 |  | u32 * | p1,
 |  | u32 * | p2,
 |  | u32 * | xp,
 |  | u32 * | xq1,
 |  | u32 * | xq2,
 |  | u32 * | q1,
 |  | u32 * | q2,
 |  | u32 * | xq,
 |  | u32 * | bitlen1,
 |  | u32 * | bitlen2,
 |  | u32 * | e,
 |  | u32 | t,
 |  | u32 | s
 | ) |  |

RSA Parameters Generation.

generate RSA keys pairs with FIPS 186-4 compliance. for keys length=1024, it applies section B.3.6. this function returns parameters required by the RSA2VS testing, section 6.2.1, item iv more especially, it returns the values xp, xq, xp1,xp2,xq1,xq2,p1,p2,q1,q2,bitlen1 and bitlen2 Generate p, q, n and d such as:

Parameters
[out] | n | The pointer to n
[out] | p | The pointer to p
[out] | q | The pointer to q
[out] | d | The pointer to d
[out] | xp | The pointer to xp
[out] | xq | The pointer to xq
[out] | xp1 | The pointer to xp1
[out] | xp2 | The pointer to xp2
[out] | xq1 | The pointer to xq1
[out] | xq2 | The pointer to xq2
[out] | p1 | The pointer to p1
[out] | p2 | The pointer to p2
[out] | q1 | The pointer to q1
[out] | q2 | The pointer to q2
[out] | bitlen1 | The pointer to bitlen1
[out] | bitlen2 | The pointer to bitlen2
[in] | e | The pointer to e
[in] | t | The length of e
[in] | s | The precision
Returns
Error code
Return values
UCL_OK

◆ ucl_rsa_param_generation_fips186_4_B36_RSA2VS()

int ucl_rsa_param_generation_fips186_4_B36_RSA2VS | ( | u8 * | n,
 |  | u8 * | p,
 |  | u8 * | q,
 |  | u8 * | d,
 |  | u8 * | xp1,
 |  | u8 * | xp2,
 |  | u8 * | p1,
 |  | u8 * | p2,
 |  | u8 * | xp,
 |  | u8 * | xq1,
 |  | u8 * | xq2,
 |  | u8 * | q1,
 |  | u8 * | q2,
 |  | u8 * | xq,
 |  | int * | bitlen1,
 |  | int * | bitlen2,
 |  | u8 * | e,
 |  | int | t,
 |  | int | modulus_bytes_size
 | ) |  |

RSA Parameters Generation.

generate RSA keys pairs with FIPS 186-4 compliance. for keys length=1024, it applies section B.3.6. this function returns parameters required by the RSA2VS testing, section 6.2.1, item iv more especially, it returns the values xp, xq, xp1,xp2,xq1,xq2,p1,p2,q1,q2,bitlen1 and bitlen2 Generate p, q, n and d such as:

the parameters are in bytes (u8)

Parameters
[out] | n | The pointer to n
[out] | p | The pointer to p
[out] | q | The pointer to q
[out] | d | The pointer to d
[out] | xp | The pointer to xp
[out] | xq | The pointer to xq
[out] | xp1 | The pointer to xp1
[out] | xp2 | The pointer to xp2
[out] | xq1 | The pointer to xq1
[out] | xq2 | The pointer to xq2
[out] | p1 | The pointer to p1
[out] | p2 | The pointer to p2
[out] | q1 | The pointer to q1
[out] | q2 | The pointer to q2
[out] | bitlen1 | The pointer to bitlen1
[out] | bitlen2 | The pointer to bitlen2
[in] | e | The pointer to e
[in] | t | The length of e
[in] | s | The precision
Returns
Error code
Return values
UCL_OK


Universal Crypto Library: RSA Deprecated Prototypes

Data Structures | Functions
RSA Deprecated Prototypes
Public Key Algorithm » RSA

Old RSA prototypes. More...

+ Collaboration diagram for RSA Deprecated Prototypes:

Data Structures

struct | RSA_PuKEY
RSA General Public Key. More...
struct | RSA_PrKEY
RSA General Private Key. More...
struct | RSACRT_KEY
General RSA Private Key for CRT. More...

Functions

int | ucl_rsa_encryptBlock (u32 *cipherBlock, u32 *plainBlock, RSA_PuKEY key)
RSA Encryption. More...
int | ucl_rsa_crt_decryptBlock (u32 *decryptedBlock, u32 *cipherBlock, RSACRT_KEY key, RSA_PuKEY keyPu)
RSA Decryption with CRT. More...
int | ucl_rsa_decryptBlock (u32 *decryptedBlock, u32 *cipherBlock, RSA_PrKEY key)
RSA Decryption. More...

Detailed Description

Old RSA prototypes.

Those prototypes are not any more available. We recommend to use the PKCS #1 V2.1 API.

Function Documentation

◆ ucl_rsa_crt_decryptBlock()

int ucl_rsa_crt_decryptBlock | ( | u32 * | decryptedBlock,
 |  | u32 * | cipherBlock,
 |  | RSACRT_KEY | key,
 |  | RSA_PuKEY | keyPu
 | ) |  |

RSA Decryption with CRT.

It's equivalent to generate a signature.

Parameters
[out] | decryptedBlock | The result of decryption
[in] | cipherBlock | The ciphertext
[in] | key | A RSA CRT private key
[in] | keyPu | A RSA public key
Deprecated:
Prototype changed

◆ ucl_rsa_decryptBlock()

int ucl_rsa_decryptBlock | ( | u32 * | decryptedBlock,
 |  | u32 * | cipherBlock,
 |  | RSA_PrKEY | key
 | ) |  |

RSA Decryption.

It's equivalent to generate a signature.

Parameters
[out] | decryptedBlock | The result of decryption
[in] | cipherBlock | The ciphertext
[in] | key | A RSA private key
Deprecated:
Prototype changed

◆ ucl_rsa_encryptBlock()

int ucl_rsa_encryptBlock | ( | u32 * | cipherBlock,
 |  | u32 * | plainBlock,
 |  | RSA_PuKEY | key
 | ) |  |

RSA Encryption.

It's equivalent to check a signature.

Parameters
[out] | cipherBlock | The result of encryption
[in] | plainBlock | The plaintext
[in] | key | A RSA public key
Deprecated:
Prototype changed


Universal Crypto Library: RSA_PuKEY Struct Reference

Data Fields
RSA_PuKEY Struct Reference
Public Key Algorithm » RSA » RSA Deprecated Prototypes

RSA General Public Key. More...

Data Fields

u32 | e [1]
The public exponant. More...
u32 | n [UCL_FPA_UPRECISION]
The module. More...
u32 len
The length of the module. More...

Detailed Description

RSA General Public Key.

Deprecated:
This structure is not any more used

Field Documentation

◆ e

u32 RSA_PuKEY::e[1]

The public exponant.

◆ len

u32 RSA_PuKEY::len

The length of the module.

◆ n

u32 RSA_PuKEY::n[UCL_FPA_UPRECISION]

The module.


Universal Crypto Library: RSA_PrKEY Struct Reference

Data Fields
RSA_PrKEY Struct Reference
Public Key Algorithm » RSA » RSA Deprecated Prototypes

RSA General Private Key. More...

Data Fields

u32 | d [UCL_FPA_UPRECISION]
The private exponant. More...
u32 | n [UCL_FPA_UPRECISION]
The module. More...
u32 len
The length of the module (also the length of the exponant). More...

Detailed Description

RSA General Private Key.

Deprecated:
This structure is not any more used

Field Documentation

◆ d

u32 RSA_PrKEY::d[UCL_FPA_UPRECISION]

The private exponant.

Such as

◆ len

u32 RSA_PrKEY::len

The length of the module (also the length of the exponant).

◆ n

u32 RSA_PrKEY::n[UCL_FPA_UPRECISION]

The module.


Universal Crypto Library: RSACRT_KEY Struct Reference

Data Fields
RSACRT_KEY Struct Reference
Public Key Algorithm » RSA » RSA Deprecated Prototypes

General RSA Private Key for CRT. More...

Data Fields

u32 | dp [UCL_FPA_UPRECISION/2]
The private exponant associated to p. More...
u32 | dq [UCL_FPA_UPRECISION/2]
The private exponant associated to p. More...
u32 | p [UCL_FPA_UPRECISION/2]
The private prime p. More...
u32 | q [UCL_FPA_UPRECISION/2]
The private prime q. More...
u32 len
The length of n. More...
u32 | qInv [UCL_FPA_UPRECISION/2]
. More...

Detailed Description

General RSA Private Key for CRT.

Deprecated:
This structure is not any more used

Field Documentation

◆ dp

u32 RSACRT_KEY::dp[UCL_FPA_UPRECISION/2]

The private exponant associated to p.

◆ dq

u32 RSACRT_KEY::dq[UCL_FPA_UPRECISION/2]

The private exponant associated to p.

◆ len

u32 RSACRT_KEY::len

The length of n.

◆ p

u32 RSACRT_KEY::p[UCL_FPA_UPRECISION/2]

The private prime p.

◆ q

u32 RSACRT_KEY::q[UCL_FPA_UPRECISION/2]

The private prime q.

◆ qInv

u32 RSACRT_KEY::qInv[UCL_FPA_UPRECISION/2]

.


Universal Crypto Library: ucl_rsa_public_key_t Struct Reference

Data Fields
ucl_rsa_public_key_t Struct Reference
Public Key Algorithm » RSA

RSA Public Key Structure. More...

Data Fields

u8 | public_exponent [UCL_RSA_PUBLIC_EXPONENT_MAXSIZE]
The public exponent e. More...
u8 | modulus [UCL_RSA_KEY_MAXSIZE]
The modulus n. More...
u32 modulus_length
The modulus byte length. More...
u32 public_exponent_length
The public exponent byte length. More...

Detailed Description

RSA Public Key Structure.

RSA Public Key.

Let [image] and e the public exponent.

Field Documentation

◆ modulus

u8 ucl_rsa_public_key_t::modulus[UCL_RSA_KEY_MAXSIZE]

The modulus n.

◆ modulus_length

u32 ucl_rsa_public_key_t::modulus_length

The modulus byte length.

◆ public_exponent

u8 ucl_rsa_public_key_t::public_exponent[UCL_RSA_PUBLIC_EXPONENT_MAXSIZE]

The public exponent e.

◆ public_exponent_length

u32 ucl_rsa_public_key_t::public_exponent_length

The public exponent byte length.


Universal Crypto Library: ucl_rsa_private_key_t Struct Reference

Data Fields
ucl_rsa_private_key_t Struct Reference
Public Key Algorithm » RSA

RSA Private Key Structure. More...

Data Fields

u8 * private_exponent
The private exponent d. More...
u8 * modulus
The modulus n. More...
u32 modulus_length
The modulus byte length. More...

Detailed Description

RSA Private Key Structure.

RSA Private Key.

Let [image] and d the private exponent.

Field Documentation

◆ modulus

u8* ucl_rsa_private_key_t::modulus

The modulus n.

◆ modulus_length

u32 ucl_rsa_private_key_t::modulus_length

The modulus byte length.

◆ private_exponent

u8* ucl_rsa_private_key_t::private_exponent

The private exponent d.


Universal Crypto Library: ucl_rsa_crt_private_key_t Struct Reference

Data Fields
ucl_rsa_crt_private_key_t Struct Reference
Public Key Algorithm » RSA

RSA CRT Private Key Structure. More...

Data Fields

u8 | exponent1 [UCL_RSA_KEY_MAXSIZE/2]
. More...
u8 | exponent2 [UCL_RSA_KEY_MAXSIZE/2]
. More...
u8 | prime1 [UCL_RSA_KEY_MAXSIZE/2]
p. More...
u8 | prime2 [UCL_RSA_KEY_MAXSIZE/2]
q. More...
u8 | coefficient [UCL_RSA_KEY_MAXSIZE/2]

u8 | public_exponent [UCL_RSA_PUBLIC_EXPONENT_MAXSIZE]
The public exponent e. More...
u32 public_exponent_length
The public exponent byte length. More...
u32 modulus_length
The modulus byte length. More...

Detailed Description

RSA CRT Private Key Structure.

RSA CRT Private Key.

Let [image] and d the private exponent.

Field Documentation

◆ exponent1

u8 ucl_rsa_crt_private_key_t::exponent1[UCL_RSA_KEY_MAXSIZE/2]

.

◆ exponent2

u8 ucl_rsa_crt_private_key_t::exponent2[UCL_RSA_KEY_MAXSIZE/2]

.

◆ modulus_length

u32 ucl_rsa_crt_private_key_t::modulus_length

The modulus byte length.

◆ prime1

u8 ucl_rsa_crt_private_key_t::prime1[UCL_RSA_KEY_MAXSIZE/2]

p.

◆ prime2

u8 ucl_rsa_crt_private_key_t::prime2[UCL_RSA_KEY_MAXSIZE/2]

q.

◆ public_exponent

u8 ucl_rsa_crt_private_key_t::public_exponent[UCL_RSA_PUBLIC_EXPONENT_MAXSIZE]

The public exponent e.

◆ public_exponent_length

u32 ucl_rsa_crt_private_key_t::public_exponent_length

The public exponent byte length.


Universal Crypto Library: PKCS #1 V2.1

Modules
PKCS #1 V2.1

RSA Cryptography Standard. More...

+ Collaboration diagram for PKCS #1 V2.1:

Modules

RSAES-PKCS1-v1.5
PKCS #1 V2.1 Section 7.2: RSAES-PKCS1-v1_5.
PKCS1v21-MGF1
MGF1 hash functions management.
RSAES-OAEP
PKCS #1 V2.1 Section 7.1: RSAES-OAEP.
RSASSA-PKCS1-v1.5
PKCS #1 V2.1 Section 8.2: RSASSA-PKCS1-v1.5.
RSASSA-PSS
RSAPSS with pre-hashed data.

Detailed Description

RSA Cryptography Standard.

This section describes functions following the recommendations of PKCS #1 V2.1 : RSA CRYPTOGRAPHY STANDARD:
These recommendations for the implementation of public-key cryptography based on the RSA algorithm, covering the following aspects:

  • Cryptographic primitives
  • Encryption schemes
  • Signature schemes with appendix
  • ASN.1 syntax for representing keys and for identifying the schemes

Two encryption schemes are specified by PKCS #1 V2.1: RSAES-OAEP and RSAES-PKCS1-v1.5. RSAES-OAEP is recommended for new applications; RSAES-PKCS1-v1.5 is included only for compatibility with existing applications, and is not recommended for new applications.

Two signature schemes with appendix are specified in PKCS #1 V2.1: RSASSA-PSS and RSASSA-PKCS1-v1.5. Although no attacks are known against RSASSA-PKCS1-v1.5, in the interest of increased robustness, RSASSA-PSS is recommended for eventual adoption in new applications. RSASSA-PKCS1-v1.5 is included for compatibility with existing applications, and while still appropriate for new applications, a gradual transition to RSASSA-PSS is encouraged.

Note
Module Version 1.0


Universal Crypto Library: RSAES-PKCS1-v1.5

Functions
RSAES-PKCS1-v1.5
PKCS #1 V2.1

PKCS #1 V2.1 Section 7.2: RSAES-PKCS1-v1_5. More...

+ Collaboration diagram for RSAES-PKCS1-v1.5:

Functions

int | ucl_pkcs1_es_pkcs1v15_encrypt (u8 *output, u8 *input, u32 input_length, ucl_rsa_public_key_t *keyPu)
RSAES-PKCS1V15 encryption. More...
int | ucl_pkcs1_es_pkcs1v15_decrypt (u8 *output, u32 *output_length, u8 *input, ucl_rsa_private_key_t *keyPr)
RSAES-PKCS1V15 decryption. More...
int | ucl_pkcs1_es_pkcs1v15_crt_decrypt (u8 *output, u32 *output_length, u8 *input, ucl_rsa_crt_private_key_t *keyPr)
RSAES-PKCS1V15 decryption with CRT. More...

Detailed Description

PKCS #1 V2.1 Section 7.2: RSAES-PKCS1-v1_5.

Header:
ucl_pkcs1_es_pkcs1v15.h

RSAES-PKCS1-v1_5 combines the RSAEP and RSADP primitives with the EME-PKCS1-v1_5 encoding method. It is mathematically equivalent to the encryption scheme in PKCS #1 v1.5. RSAES-PKCS1-v1_5 can operate on messages of length up to $ k - 11 $ octets (k is the byte length of the RSA modulus), although care should be taken to avoid certain attacks on low-exponent RSA due to Coppersmith, Franklin, Patarin, and Reiter when long messages are encrypted. As a general rule, the use of this scheme for encrypting an arbitrary message, as opposed to a randomly generated key, is not recommended.

Function Documentation

◆ ucl_pkcs1_es_pkcs1v15_crt_decrypt()

int ucl_pkcs1_es_pkcs1v15_crt_decrypt | ( | u8 * | output,
 |  | u32 * | output_length,
 |  | u8 * | input,
 |  | ucl_rsa_crt_private_key_t * | keyPr
 | ) |  |

RSAES-PKCS1V15 decryption with CRT.

Decryption with CRT complete process.

Parameters
[out] | output | Pointer to decrypted message
[out] | output_length | Pointer to the final length of the message
[in] | input | Pointer to the encrypted input
[in] | keyPr | RSA private key
Note
the output_length shall be initialized with the supposed output length it will be used for checking the decrypted output length and then avoid buffer overflow in case the lengths do not match
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output pointer is the pointer NULL
UCL_INVALID_LENGTH | If the given, supposed output length is smaller than the result output length
UCL_ERROR | If a decryption error occurred (PKCS1 Error)
See also
RSA

◆ ucl_pkcs1_es_pkcs1v15_decrypt()

int ucl_pkcs1_es_pkcs1v15_decrypt | ( | u8 * | output,
 |  | u32 * | output_length,
 |  | u8 * | input,
 |  | ucl_rsa_private_key_t * | keyPr
 | ) |  |

RSAES-PKCS1V15 decryption.

Decryption complete process.

Parameters
[out] | output | Pointer to decrypted message
[out] | output_length | Pointer to the final length of the message
[in] | input | Pointer to the encrypted input
[in] | keyPr | RSA private key
Note
the output_length shall be initialized with the supposed output length it will be used for checking the decrypted output length and then avoid buffer overflow in case the lengths do not match
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output pointer is the pointer NULL
UCL_INVALID_LENGTH | If the given, supposed output length is smaller than the result output length
UCL_ERROR | If a decryption error occurred (PKCS1 Error)
See also
RSA

◆ ucl_pkcs1_es_pkcs1v15_encrypt()

int ucl_pkcs1_es_pkcs1v15_encrypt | ( | u8 * | output,
 |  | u8 * | input,
 |  | u32 | input_length,
 |  | ucl_rsa_public_key_t * | keyPu
 | ) |  |

RSAES-PKCS1V15 encryption.

Encryption complete process.

Parameters
[out] | output | Pointer to encrypted output
[in] | input | Pointer to the message which must be processed
[in] | input_length | Input byte length
[in] | keyPu | RSA public key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If the output pointer is the pointer NULL
UCL_INVALID_ARG | If the message to encrypt is too long (PKCS1 Error)
See also
RSA


Universal Crypto Library: PKCS1v21-MGF1

Functions
PKCS1v21-MGF1
PKCS #1 V2.1

MGF1 hash functions management. More...

+ Collaboration diagram for PKCS1v21-MGF1:

Functions

int | ucl_set_mgf1_hash_function (int hash_identifier)
PKCS#1 MGF1 hash function selection. More...
void | ucl_clear_mgf1_hash_function (void)
PKCS#1 MGF1 hash function selection clearance. More...
int | ucl_get_mgf1_hash_function (void)
PKCS#1 MGF1 hash function retrieval . More...

Detailed Description

MGF1 hash functions management.

Mask Generation Function based on a hash function.

Header:
ucl_pkcs1_mgf1.h

Function Documentation

◆ ucl_clear_mgf1_hash_function()

void ucl_clear_mgf1_hash_function ( void )

PKCS#1 MGF1 hash function selection clearance.

this function allows to unselect the PKCS#1 MGF1 hash function, i.e. once done, the hash function used in the MGF1 will be the same than in the PKCS#1 scheme This is the GOOD PRACTICE !! It impacts RSA PKCS#1 ES-OAEP and SSA-PSS

See also
RSA

◆ ucl_get_mgf1_hash_function()

int ucl_get_mgf1_hash_function ( void )

PKCS#1 MGF1 hash function retrieval .

this function returns the PKCS#1 MGF1 hash function, whatever the hash function used in the PKCS#1 scheme if the MGF1 hash function has been set using the ucl_set_mgf1_hash_function it returns the value of this hash function otherwise This so selected hash function will be then be used for RSA PKCS#1 ES-OAEP and SSA-PSS until either another one is selected, or the selection is cleared

Parameters
[in] hsh_identifier the hsh function identifier, as defined in hash function include files
Returns
Error code
Return values
hash | function identifier if the selection with ucl_set_mgf1_hash_function has been performed
#UCL_UNDEFINED_HASH | if not (either no selection or selection clearance performed)
See also
RSA

◆ ucl_set_mgf1_hash_function()

int ucl_set_mgf1_hash_function ( int hash_identifier )

PKCS#1 MGF1 hash function selection.

this function allows to select the PKCS#1 MGF1 hash function, whatever the hash function used in the PKCS#1 scheme This is not a GOOD PRACTICE !! but Android test suite allows that This so selected hash function will be then be used for RSA PKCS#1 ES-OAEP and SSA-PSS until either another one is selected, or the selection is cleared

Parameters
[in] hsh_identifier the hsh function identifier, as defined in hash function include files
Returns
Error code
Return values
UCL_OK | if the selection is ok
UCL_INVALID_INPUT | if the selection is not valide
See also
RSA


Universal Crypto Library: RSAES-OAEP

Modules
RSAES-OAEP
PKCS #1 V2.1

PKCS #1 V2.1 Section 7.1: RSAES-OAEP. More...

+ Collaboration diagram for RSAES-OAEP:

Modules

RSA OAEP MD5
Encrypt/Decrypt with RSA OAEP using the hash function MD5.
RSA OAEP RIPEMD160
Encrypt/Decrypt with RSA OAEP using the hash function RIPEMD160.
RSA OAEP SHA1
Encrypt/Decrypt with RSA OAEP using the hash function SHA1.
RSA OAEP SHA224
Encrypt/Decrypt with RSA OAEP using the hash function SHA224.
RSA OAEP SHA256
Encrypt/Decrypt with RSA OAEP using the hash function SHA256.
RSA OAEP SHA384
Encrypt/Decrypt with RSA OAEP using the hash function SHA384.
RSA OAEP SHA512
Encrypt/Decrypt with RSA OAEP using the hash function SHA512.

Detailed Description

PKCS #1 V2.1 Section 7.1: RSAES-OAEP.

RSAES-OAEP combines the RSAEP and RSADP primitives with the EME-OAEP encoding method. EME-OAEP is based on Bellare and Rogaway Optimal Asymmetric Encryption scheme (OAEP stands for Optimal Asymmetric Encryption Padding.). It is compatible with the IFES scheme defined in IEEE Std 1363-2000, where the encryption and decryption primitives are IFEP-RSA and IFDP-RSA and the message encoding method is EME-OAEP. RSAES-OAEP can operate on messages of length up to $ k - 2hLen - 2 $ octets, where hLen is the length of the output from the underlying hash function and k is the length in octets of the recipient RSA modulus.


Universal Crypto Library: RSA OAEP MD5

Functions
RSA OAEP MD5
PKCS #1 V2.1 » RSAES-OAEP

Encrypt/Decrypt with RSA OAEP using the hash function MD5. More...

+ Collaboration diagram for RSA OAEP MD5:

Functions

int | ucl_pkcs1_es_oaep_md5_encrypt (u8 *output, u8 *input, u32 input_length, ucl_rsa_public_key_t *keyPu, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-MD5 encryption. More...
int | ucl_pkcs1_es_oaep_md5_decrypt (u8 *output, u32 *output_length, u8 *input, ucl_rsa_private_key_t *keyPr, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-MD5 decryption. More...
int | ucl_pkcs1_es_oaep_md5_crt_decrypt (u8 *output, u32 *output_length, u8 *input, ucl_rsa_crt_private_key_t *key, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-MD5 decryption with CRT. More...

Detailed Description

Encrypt/Decrypt with RSA OAEP using the hash function MD5.

Header:
ucl_pkcs1_es_oaep_md5.h

Function Documentation

◆ ucl_pkcs1_es_oaep_md5_crt_decrypt()

int ucl_pkcs1_es_oaep_md5_crt_decrypt | ( | u8 * | output,
 |  | u32 * | output_length,
 |  | u8 * | input,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-MD5 decryption with CRT.

Decryption with CRT complete process using the hash function MD5.

Parameters
[out] | output | Pointer to decrypted message
[out] | output_length | Pointer to length of the decrypted message
[in] | input | Pointer to the input
[in] | key | Pointer to the RSA CRT key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output pointer is the pointer NULL
UCL_ERROR | If a decryption error occurred (PKCS1 Error)
See also
RSA

◆ ucl_pkcs1_es_oaep_md5_decrypt()

int ucl_pkcs1_es_oaep_md5_decrypt | ( | u8 * | output,
 |  | u32 * | output_length,
 |  | u8 * | input,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-MD5 decryption.

Decryption complete process using the hash function MD5.

Parameters
[out] | output | Pointer to decrypted message
[out] | output_length | Pointer to the final length of the message
[in] | input | Pointer to the encrypted input
[in] | keyPr | RSA private key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output pointer is the pointer NULL
UCL_ERROR | If a decryption error occurred (PKCS1 Error)
See also
RSA
UCL_MD5

◆ ucl_pkcs1_es_oaep_md5_encrypt()

int ucl_pkcs1_es_oaep_md5_encrypt | ( | u8 * | output,
 |  | u8 * | input,
 |  | u32 | input_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-MD5 encryption.

Encryption complete process using the hash function MD5.

Precondition
The message byte length must be lesser than $ k - 34 $ where k is the modulus length.
Parameters
[out] | output | Pointer to encrypted output
[in] | input | Pointer to the message which must be processed
[in] | input_length | Input byte length
[in] | keyPu | RSA public key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If the output pointer is the pointer NULL
UCL_INVALID_ARG | If the message to encrypt is too long (PKCS1 Error)
See also
RSA
UCL_MD5


Universal Crypto Library: RSA OAEP RIPEMD160

Functions
RSA OAEP RIPEMD160
PKCS #1 V2.1 » RSAES-OAEP

Encrypt/Decrypt with RSA OAEP using the hash function RIPEMD160. More...

+ Collaboration diagram for RSA OAEP RIPEMD160:

Functions

int | ucl_pkcs1_es_oaep_ripemd160_encrypt (u8 *output, u8 *input, u32 input_length, ucl_rsa_public_key_t *keyPu, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-RIPEMD160 encryption. More...
int | ucl_pkcs1_es_oaep_ripemd160_decrypt (u8 *output, u32 *output_length, u8 *input, ucl_rsa_private_key_t *keyPr, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-RIPEMD160 decryption. More...
int | ucl_pkcs1_es_oaep_ripemd160_crt_decrypt (u8 *output, u32 *output_length, u8 *input, ucl_rsa_crt_private_key_t *key, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-RIPEMD160 decryption with CRT. More...

Detailed Description

Encrypt/Decrypt with RSA OAEP using the hash function RIPEMD160.

Header:
ucl_pkcs1_es_oaep_ripemd160.h

Function Documentation

◆ ucl_pkcs1_es_oaep_ripemd160_crt_decrypt()

int ucl_pkcs1_es_oaep_ripemd160_crt_decrypt | ( | u8 * | output,
 |  | u32 * | output_length,
 |  | u8 * | input,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-RIPEMD160 decryption with CRT.

Decryption with CRT complete process using the hash function RIPEMD160.

Parameters
[out] | output | Pointer to decrypted message
[out] | output_length | Pointer to length of the decrypted message
[in] | input | Pointer to the input
[in] | key | Pointer to the RSA CRT key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output pointer is the pointer NULL
UCL_ERROR | If a decryption error occurred (PKCS1 Error)
See also
RSA

◆ ucl_pkcs1_es_oaep_ripemd160_decrypt()

int ucl_pkcs1_es_oaep_ripemd160_decrypt | ( | u8 * | output,
 |  | u32 * | output_length,
 |  | u8 * | input,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-RIPEMD160 decryption.

Decryption complete process using the hash function RIPEMD160.

Parameters
[out] | output | Pointer to decrypted message
[out] | output_length | Pointer to the final length of the message
[in] | input | Pointer to the encrypted input
[in] | keyPr | RSA private key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output pointer is the pointer NULL
UCL_ERROR | If a decryption error occurred (PKCS1 Error)
See also
RSA
UCL_RIPEMD160

◆ ucl_pkcs1_es_oaep_ripemd160_encrypt()

int ucl_pkcs1_es_oaep_ripemd160_encrypt | ( | u8 * | output,
 |  | u8 * | input,
 |  | u32 | input_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-RIPEMD160 encryption.

Encryption complete process using the hash function RIPEMD160.

Precondition
The message byte length must be lesser than $ k - 42 $ where k is the modulus length
Parameters
[out] | output | Pointer to encrypted output
[in] | input | Pointer to the message which must be processed
[in] | input_length | Input byte length
[in] | keyPu | RSA public key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If the output pointer is the pointer NULL
UCL_INVALID_ARG | If the message to encrypt is too long (PKCS1 Error)
See also
RSA
UCL_RIPEMD160


Universal Crypto Library: RSA OAEP SHA1

Functions
RSA OAEP SHA1
PKCS #1 V2.1 » RSAES-OAEP

Encrypt/Decrypt with RSA OAEP using the hash function SHA1. More...

+ Collaboration diagram for RSA OAEP SHA1:

Functions

int | ucl_pkcs1_es_oaep_sha1_encrypt (u8 *output, u8 *input, u32 input_length, ucl_rsa_public_key_t *keyPu, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-SHA1 encryption. More...
int | ucl_pkcs1_es_oaep_sha1_decrypt (u8 *output, u32 *output_length, u8 *input, ucl_rsa_private_key_t *keyPr, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-SHA1 decryption. More...
int | ucl_pkcs1_es_oaep_sha1_crt_decrypt (u8 *output, u32 *output_length, u8 *input, ucl_rsa_crt_private_key_t *key, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-SHA1 decryption with CRT. More...

Detailed Description

Encrypt/Decrypt with RSA OAEP using the hash function SHA1.

Header:
ucl_pkcs1_es_oaep_sha1.h

Function Documentation

◆ ucl_pkcs1_es_oaep_sha1_crt_decrypt()

int ucl_pkcs1_es_oaep_sha1_crt_decrypt | ( | u8 * | output,
 |  | u32 * | output_length,
 |  | u8 * | input,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-SHA1 decryption with CRT.

Decryption with CRT complete process using the hash function SHA1.

Parameters
[out] | output | Pointer to decrypted message
[out] | output_length | Pointer to length of the decrypted message
[in] | input | Pointer to the input
[in] | key | Pointer to the RSA CRT key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output pointer is the pointer NULL
UCL_ERROR | If a decryption error occurred (PKCS1 Error)
See also
RSA

◆ ucl_pkcs1_es_oaep_sha1_decrypt()

int ucl_pkcs1_es_oaep_sha1_decrypt | ( | u8 * | output,
 |  | u32 * | output_length,
 |  | u8 * | input,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-SHA1 decryption.

Decryption complete process using the hash function SHA1.

Parameters
[out] | output | Pointer to decrypted message
[out] | output_length | Pointer to the final length of the message
[in] | input | Pointer to the encrypted input
[in] | keyPr | RSA private key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output pointer is the pointer NULL
UCL_ERROR | If a decryption error occurred (PKCS1 Error)
See also
RSA
UCL_SHA1

◆ ucl_pkcs1_es_oaep_sha1_encrypt()

int ucl_pkcs1_es_oaep_sha1_encrypt | ( | u8 * | output,
 |  | u8 * | input,
 |  | u32 | input_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-SHA1 encryption.

Encryption complete process using the hash function SHA1.

Precondition
The message byte length must be lesser than $ k - 42 $ where k is the modulus byte length
Parameters
[out] | output | Pointer to encrypted output
[in] | input | Pointer to the message which must be processed
[in] | input_length | Input byte length
[in] | keyPu | RSA public key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If the output pointer is the pointer NULL
UCL_INVALID_ARG | If the message to encrypt is too long (PKCS1 Error)
See also
RSA
UCL_SHA1


Universal Crypto Library: RSA OAEP SHA224

Functions
RSA OAEP SHA224
PKCS #1 V2.1 » RSAES-OAEP

Encrypt/Decrypt with RSA OAEP using the hash function SHA224. More...

+ Collaboration diagram for RSA OAEP SHA224:

Functions

int | ucl_pkcs1_es_oaep_sha224_encrypt (u8 *output, u8 *input, u32 input_length, ucl_rsa_public_key_t *keyPu, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-SHA224 encryption. More...
int | ucl_pkcs1_es_oaep_sha224_decrypt (u8 *output, u32 *output_length, u8 *input, ucl_rsa_private_key_t *keyPr, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-SHA224 decryption. More...
int | ucl_pkcs1_es_oaep_sha224_crt_decrypt (u8 *output, u32 *output_length, u8 *input, ucl_rsa_crt_private_key_t *key, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-SHA224 decryption with CRT. More...

Detailed Description

Encrypt/Decrypt with RSA OAEP using the hash function SHA224.

Header:
ucl_pkcs1_es_oaep_sha224.h

Function Documentation

◆ ucl_pkcs1_es_oaep_sha224_crt_decrypt()

int ucl_pkcs1_es_oaep_sha224_crt_decrypt | ( | u8 * | output,
 |  | u32 * | output_length,
 |  | u8 * | input,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-SHA224 decryption with CRT.

Decryption with CRT complete process using the hash function SHA224.

Parameters
[out] | output | Pointer to decrypted message
[out] | output_length | Pointer to length of the decrypted message
[in] | input | Pointer to the input
[in] | key | Pointer to the RSA CRT key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output pointer is the pointer NULL
UCL_ERROR | If a decryption error occurred (PKCS1 Error)
See also
RSA

◆ ucl_pkcs1_es_oaep_sha224_decrypt()

int ucl_pkcs1_es_oaep_sha224_decrypt | ( | u8 * | output,
 |  | u32 * | output_length,
 |  | u8 * | input,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-SHA224 decryption.

Decryption complete process using the hash function SHA224.

Parameters
[out] | output | Pointer to decrypted message
[out] | output_length | Pointer to the final length of the message
[in] | input | Pointer to the encrypted input
[in] | keyPr | RSA private key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output pointer is the pointer NULL
UCL_ERROR | If a decryption error occurred (PKCS1 Error)
See also
RSA
UCL_SHA224

◆ ucl_pkcs1_es_oaep_sha224_encrypt()

int ucl_pkcs1_es_oaep_sha224_encrypt | ( | u8 * | output,
 |  | u8 * | input,
 |  | u32 | input_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-SHA224 encryption.

Encryption complete process using the hash function SHA224.

Precondition
The message byte length must be lesser than $ k - 66 $ where k is the modulus byte length
Parameters
[out] | output | Pointer to encrypted output
[in] | input | Pointer to the message which must be processed
[in] | input_length | Input byte length
[in] | keyPu | RSA public key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If the output pointer is the pointer NULL
UCL_INVALID_ARG | If the message to encrypt is too long (PKCS1 Error)
See also
RSA
UCL_SHA224


Universal Crypto Library: RSA OAEP SHA256

Functions
RSA OAEP SHA256
PKCS #1 V2.1 » RSAES-OAEP

Encrypt/Decrypt with RSA OAEP using the hash function SHA256. More...

+ Collaboration diagram for RSA OAEP SHA256:

Functions

int | ucl_pkcs1_es_oaep_sha256_encrypt (u8 *output, u8 *input, u32 input_length, ucl_rsa_public_key_t *keyPu, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-SHA256 encryption. More...
int | ucl_pkcs1_es_oaep_sha256_decrypt (u8 *output, u32 *output_length, u8 *input, ucl_rsa_private_key_t *keyPr, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-SHA256 decryption. More...
int | ucl_pkcs1_es_oaep_sha256_crt_decrypt (u8 *output, u32 *output_length, u8 *input, ucl_rsa_crt_private_key_t *key, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-SHA256 decryption with CRT. More...

Detailed Description

Encrypt/Decrypt with RSA OAEP using the hash function SHA256.

Header:
ucl_pkcs1_es_oaep_sha256.h

Function Documentation

◆ ucl_pkcs1_es_oaep_sha256_crt_decrypt()

int ucl_pkcs1_es_oaep_sha256_crt_decrypt | ( | u8 * | output,
 |  | u32 * | output_length,
 |  | u8 * | input,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-SHA256 decryption with CRT.

Decryption with CRT complete process using the hash function SHA256.

Parameters
[out] | output | Pointer to decrypted message
[out] | output_length | Pointer to length of the decrypted message
[in] | input | Pointer to the input
[in] | key | Pointer to the RSA CRT key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output pointer is the pointer NULL
UCL_ERROR | If a decryption error occurred (PKCS1 Error)
See also
RSA

◆ ucl_pkcs1_es_oaep_sha256_decrypt()

int ucl_pkcs1_es_oaep_sha256_decrypt | ( | u8 * | output,
 |  | u32 * | output_length,
 |  | u8 * | input,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-SHA256 decryption.

Decryption complete process using the hash function SHA256.

Parameters
[out] | output | Pointer to decrypted message
[out] | output_length | Pointer to the final length of the message
[in] | input | Pointer to the encrypted input
[in] | keyPr | RSA private key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output pointer is the pointer NULL
UCL_ERROR | If a decryption error occurred (PKCS1 Error)
See also
RSA
UCL_SHA256

◆ ucl_pkcs1_es_oaep_sha256_encrypt()

int ucl_pkcs1_es_oaep_sha256_encrypt | ( | u8 * | output,
 |  | u8 * | input,
 |  | u32 | input_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-SHA256 encryption.

Encryption complete process using the hash function SHA256.

Precondition
The message byte length must be lesser than $ k - 66 $ where k is the modulus byte length
Parameters
[out] | output | Pointer to encrypted output
[in] | input | Pointer to the message which must be processed
[in] | input_length | Input byte length
[in] | keyPu | RSA public key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If the output pointer is the pointer NULL
UCL_INVALID_ARG | If the message to encrypt is too long (PKCS1 Error)
See also
RSA
UCL_SHA256


Universal Crypto Library: RSA OAEP SHA384

Functions
RSA OAEP SHA384
PKCS #1 V2.1 » RSAES-OAEP

Encrypt/Decrypt with RSA OAEP using the hash function SHA384. More...

+ Collaboration diagram for RSA OAEP SHA384:

Functions

int | ucl_pkcs1_es_oaep_sha384_encrypt (u8 *output, u8 *input, u32 input_length, ucl_rsa_public_key_t *keyPu, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-SHA384 encryption. More...
int | ucl_pkcs1_es_oaep_sha384_decrypt (u8 *output, u32 *output_length, u8 *input, ucl_rsa_private_key_t *keyPr, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-SHA384 decryption. More...
int | ucl_pkcs1_es_oaep_sha384_crt_decrypt (u8 *output, u32 *output_length, u8 *input, ucl_rsa_crt_private_key_t *key, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-SHA384 decryption with CRT. More...

Detailed Description

Encrypt/Decrypt with RSA OAEP using the hash function SHA384.

Header:
ucl_pkcs1_es_oaep_sha384.h

Function Documentation

◆ ucl_pkcs1_es_oaep_sha384_crt_decrypt()

int ucl_pkcs1_es_oaep_sha384_crt_decrypt | ( | u8 * | output,
 |  | u32 * | output_length,
 |  | u8 * | input,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-SHA384 decryption with CRT.

Decryption with CRT complete process using the hash function SHA384.

Parameters
[out] | output | Pointer to decrypted message
[out] | output_length | Pointer to length of the decrypted message
[in] | input | Pointer to the input
[in] | key | Pointer to the RSA CRT key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output pointer is the pointer NULL
UCL_ERROR | If a decryption error occurred (PKCS1 Error)
See also
RSA

◆ ucl_pkcs1_es_oaep_sha384_decrypt()

int ucl_pkcs1_es_oaep_sha384_decrypt | ( | u8 * | output,
 |  | u32 * | output_length,
 |  | u8 * | input,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-SHA384 decryption.

Decryption complete process using the hash function SHA384.

Parameters
[out] | output | Pointer to decrypted message
[out] | output_length | Pointer to the final length of the message
[in] | input | Pointer to the encrypted input
[in] | keyPr | RSA private key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output pointer is the pointer NULL
UCL_ERROR | If a decryption error occurred (PKCS1 Error)
See also
RSA
UCL_SHA384

◆ ucl_pkcs1_es_oaep_sha384_encrypt()

int ucl_pkcs1_es_oaep_sha384_encrypt | ( | u8 * | output,
 |  | u8 * | input,
 |  | u32 | input_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-SHA384 encryption.

Encryption complete process using the hash function SHA384.

Precondition
The message byte length must be lesser than $ k - 66 $ where k is the modulus byte length
Parameters
[out] | output | Pointer to encrypted output
[in] | input | Pointer to the message which must be processed
[in] | input_length | Input byte length
[in] | keyPu | RSA public key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If the output pointer is the pointer NULL
UCL_INVALID_ARG | If the message to encrypt is too long (PKCS1 Error)
See also
RSA
UCL_SHA384


Universal Crypto Library: RSA OAEP SHA512

Functions
RSA OAEP SHA512
PKCS #1 V2.1 » RSAES-OAEP

Encrypt/Decrypt with RSA OAEP using the hash function SHA512. More...

+ Collaboration diagram for RSA OAEP SHA512:

Functions

int | ucl_pkcs1_es_oaep_sha512_encrypt (u8 *output, u8 *input, u32 input_length, ucl_rsa_public_key_t *keyPu, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-SHA512 encryption. More...
int | ucl_pkcs1_es_oaep_sha512_decrypt (u8 *output, u32 *output_length, u8 *input, ucl_rsa_private_key_t *keyPr, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-SHA512 decryption. More...
int | ucl_pkcs1_es_oaep_sha512_crt_decrypt (u8 *output, u32 *output_length, u8 *input, ucl_rsa_crt_private_key_t *key, u8 *optional_label, u32 optional_label_length)
RSA-OAEP-SHA512 decryption with CRT. More...

Detailed Description

Encrypt/Decrypt with RSA OAEP using the hash function SHA512.

Header:
ucl_pkcs1_es_oaep_sha512.h

Function Documentation

◆ ucl_pkcs1_es_oaep_sha512_crt_decrypt()

int ucl_pkcs1_es_oaep_sha512_crt_decrypt | ( | u8 * | output,
 |  | u32 * | output_length,
 |  | u8 * | input,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-SHA512 decryption with CRT.

Decryption with CRT complete process using the hash function SHA512.

Parameters
[out] | output | Pointer to decrypted message
[out] | output_length | Pointer to length of the decrypted message
[in] | input | Pointer to the input
[in] | key | Pointer to the RSA CRT key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output pointer is the pointer NULL
UCL_ERROR | If a decryption error occurred (PKCS1 Error)
See also
RSA

◆ ucl_pkcs1_es_oaep_sha512_decrypt()

int ucl_pkcs1_es_oaep_sha512_decrypt | ( | u8 * | output,
 |  | u32 * | output_length,
 |  | u8 * | input,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-SHA512 decryption.

Decryption complete process using the hash function SHA512.

Parameters
[out] | output | Pointer to decrypted message
[out] | output_length | Pointer to the final length of the message
[in] | input | Pointer to the encrypted input
[in] | keyPr | RSA private key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If one of the output pointer is the pointer NULL
UCL_ERROR | If a decryption error occurred (PKCS1 Error)
See also
RSA
UCL_SHA512

◆ ucl_pkcs1_es_oaep_sha512_encrypt()

int ucl_pkcs1_es_oaep_sha512_encrypt | ( | u8 * | output,
 |  | u8 * | input,
 |  | u32 | input_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u8 * | optional_label,
 |  | u32 | optional_label_length
 | ) |  |

RSA-OAEP-SHA512 encryption.

Encryption complete process using the hash function SHA512.

Precondition
The message byte length must be lesser than $ k - 66 $ where k is the modulus byte length
Parameters
[out] | output | Pointer to encrypted output
[in] | input | Pointer to the message which must be processed
[in] | input_length | Input byte length
[in] | keyPu | RSA public key
[in] | optional_label | Pointer to optional label
[in] | optional_label_length | Optional label byte length
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK | If no error occurred
UCL_INVALID_INPUT | If one of the input pointers is the pointer NULL
UCL_INVALID_OUTPUT | If the output pointer is the pointer NULL
UCL_INVALID_ARG | If the message to encrypt is too long (PKCS1 Error)
See also
RSA
UCL_SHA512


Universal Crypto Library: RSASSA-PKCS1-v1.5

Modules
RSASSA-PKCS1-v1.5
PKCS #1 V2.1

PKCS #1 V2.1 Section 8.2: RSASSA-PKCS1-v1.5. More...

+ Collaboration diagram for RSASSA-PKCS1-v1.5:

Modules

RSASSA-PKCS1V15
Signature scheme RSA PKCS#1 V1.5 using pre-hashed data (SHA1 and SHA256)
RSASSA-PKCS1V15 MD5
Signature scheme RSA PKCS#1 V1.5 using the hash function MD5.
RSASSA-PKCS1V15 RIPEMD160
Signature scheme RSA PKCS#1 V1.5 using the hash function RIPEMD160.
RSASSA-PKCS1V15 SHA1
Signature scheme RSA PKCS#1 V1.5 using the hash function SHA1.
RSASSA-PKCS1V15 SHA224
Signature scheme RSA PKCS#1 V1.5 using the hash function SHA224.
RSASSA-PKCS1V15 SHA256
Signature scheme RSA PKCS#1 V1.5 using the hash function SHA256.
RSASSA-PKCS1V15 SHA384
Signature scheme RSA PKCS#1 V1.5 using the hash function SHA384.
RSASSA-PKCS1V15 SHA512
Signature scheme RSA PKCS#1 V1.5 using the hash function SHA512.

Detailed Description

PKCS #1 V2.1 Section 8.2: RSASSA-PKCS1-v1.5.

RSASSA-PKCS1-v1_5 combines the RSASP1 and RSAVP1 primitives with the EMSAPKCS1-v1_5 encoding method. It is compatible with the IFSSA scheme defined in IEEE Std 1363-2000, where the signature and verification primitives are IFSP-RSA1 and IFVP-RSA1 and the message encoding method is EMSA-PKCS1-v1_5 (which is not defined in IEEE Std 1363-2000, but is in the IEEE P1363a draft).


Universal Crypto Library: RSASSA-PKCS1V15

Functions
RSASSA-PKCS1V15
PKCS #1 V2.1 » RSASSA-PKCS1-v1.5

Signature scheme RSA PKCS#1 V1.5 using pre-hashed data (SHA1 and SHA256) More...

+ Collaboration diagram for RSASSA-PKCS1V15:

Functions

int | ucl_pkcs1_ssa_pkcs1v15_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA1 Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *keyPr)
RSASSA-PKCS1V15 CRT Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_verify (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu)
RSASSA-PKCS1V15Signature Verification. More...

Detailed Description

Signature scheme RSA PKCS#1 V1.5 using pre-hashed data (SHA1 and SHA256)

Header:
ucl_pkcs1_ssa_pkcs1v15.h

Function Documentation

◆ ucl_pkcs1_ssa_pkcs1v15_crt_sign()

int ucl_pkcs1_ssa_pkcs1v15_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15 CRT Signature Generation.

CRT Signature generation using pre-hashed data (SHA1 and SHA256).

Parameters
[out] | signature | The generated signature
[in] | message | The messageto be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA CRT private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sign()

int ucl_pkcs1_ssa_pkcs1v15_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA1 Signature Generation.

Signature generation using pre-hashed data (SHA1 and SHA256).

Parameters
[out] | signature | The generated signature
[in] | message | The message to be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_verify()

int ucl_pkcs1_ssa_pkcs1v15_verify | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu
 | ) |  |

RSASSA-PKCS1V15Signature Verification.

Signature verification using pre-hashed data (SHA1 and SHA256).

Parameters
[in] | signature | The signature to verify
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPu | The RSA public key
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK if the signature is valid
See also
RSA


Universal Crypto Library: RSASSA-PKCS1V15 MD5

Functions
RSASSA-PKCS1V15 MD5
PKCS #1 V2.1 » RSASSA-PKCS1-v1.5

Signature scheme RSA PKCS#1 V1.5 using the hash function MD5. More...

+ Collaboration diagram for RSASSA-PKCS1V15 MD5:

Functions

int | ucl_pkcs1_ssa_pkcs1v15_md5_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr)
RSASSA-PKCS1V15-MD5 Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_md5_hashed_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr)
RSASSA-PKCS1V15-MD5 Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_md5_hashed_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *keyPr)
RSASSA-PKCS1V15-MD5 CRT Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_md5_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *keyPr)
RSASSA-PKCS1V15-MD5 CRT Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_md5_verify (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu)
RSASSA-PKCS1V15-MD5 Signature Verification. More...
int | ucl_pkcs1_ssa_pkcs1v15_md5_verify_digest (u8 *signature, u8 *hash, u32 hash_length, ucl_rsa_public_key_t *keyPu)
RSASSA-PKCS1V15-MD5 Signature Verification. More...

Detailed Description

Signature scheme RSA PKCS#1 V1.5 using the hash function MD5.

Header:
ucl_pkcs1_ssa_pkcs1v15_md5.h

Function Documentation

◆ ucl_pkcs1_ssa_pkcs1v15_md5_crt_sign()

int ucl_pkcs1_ssa_pkcs1v15_md5_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-MD5 CRT Signature Generation.

CRT Signature generation using hash function MD5.

Parameters
[out] | signature | The generated signature
[in] | message | The messageto be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA CRT private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_md5_hashed_crt_sign()

int ucl_pkcs1_ssa_pkcs1v15_md5_hashed_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-MD5 CRT Signature Generation.

CRT Signature generation using hash function MD5. it uses pre-hashed data, using the MD5 function

Parameters
[out] | signature | The generated signature
[in] | message | The messageto be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA CRT private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_md5_hashed_sign()

int ucl_pkcs1_ssa_pkcs1v15_md5_hashed_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-MD5 Signature Generation.

Signature generation using hash function MD5. it uses pre-hashed data, using the MD5 function

Parameters
[out] | signature | The generated signature
[in] | message | The message to be signed, pre-hashed data
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_md5_sign()

int ucl_pkcs1_ssa_pkcs1v15_md5_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-MD5 Signature Generation.

Signature generation using hash function MD5.

Parameters
[out] | signature | The generated signature
[in] | message | The message to be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_md5_verify()

int ucl_pkcs1_ssa_pkcs1v15_md5_verify | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu
 | ) |  |

RSASSA-PKCS1V15-MD5 Signature Verification.

Signature verification using hash function MD5.

Parameters
[in] | signature | The signature to verify
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPu | The RSA public key
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK if the signature is valid
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_md5_verify_digest()

int ucl_pkcs1_ssa_pkcs1v15_md5_verify_digest | ( | u8 * | signature,
 |  | u8 * | hash,
 |  | u32 | hash_length,
 |  | ucl_rsa_public_key_t * | keyPu
 | ) |  |

RSASSA-PKCS1V15-MD5 Signature Verification.

Signature verification using hash function MD5.

Parameters
[in] | signature | The signature to verify
[in] | hash | The original message digest to be verified
[in] | hash_length | The byte length of the digest
[in] | keyPu | The RSA public key
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK if the signature is valid
See also
RSA


Universal Crypto Library: RSASSA-PKCS1V15 RIPEMD160

Functions
RSASSA-PKCS1V15 RIPEMD160
PKCS #1 V2.1 » RSASSA-PKCS1-v1.5

Signature scheme RSA PKCS#1 V1.5 using the hash function RIPEMD160. More...

+ Collaboration diagram for RSASSA-PKCS1V15 RIPEMD160:

Functions

int | ucl_pkcs1_ssa_pkcs1v15_ripemd160_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr)
RSASSA-PKCS1V15-RIPEMD160 Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_ripemd160_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *keyPr)
RSASSA-PKCS1V15-RIPEMD160 CRT Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_ripemd160_verify (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu)
RSASSA-PKCS1V15-RIPEMD160 Signature Verification. More...

Detailed Description

Signature scheme RSA PKCS#1 V1.5 using the hash function RIPEMD160.

Header:
ucl_pkcs1_ssa_pkcs1v15_ripemd160.h

Function Documentation

◆ ucl_pkcs1_ssa_pkcs1v15_ripemd160_crt_sign()

int ucl_pkcs1_ssa_pkcs1v15_ripemd160_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-RIPEMD160 CRT Signature Generation.

CRT Signature generation using hash function RIPEMD160.

Parameters
[out] | signature | The generated signature
[in] | message | The messageto be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA CRT private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_ripemd160_sign()

int ucl_pkcs1_ssa_pkcs1v15_ripemd160_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-RIPEMD160 Signature Generation.

Signature generation using hash function RIPEMD160.

Parameters
[out] | signature | The generated signature
[in] | message | The message to be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_ripemd160_verify()

int ucl_pkcs1_ssa_pkcs1v15_ripemd160_verify | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu
 | ) |  |

RSASSA-PKCS1V15-RIPEMD160 Signature Verification.

Signature verification using hash function RIPEMD160.

Parameters
[in] | signature | The signature to verify
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPu | The RSA public key
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK if the signature is valid
See also
RSA


Universal Crypto Library: RSASSA-PKCS1V15 SHA1

Functions
RSASSA-PKCS1V15 SHA1
PKCS #1 V2.1 » RSASSA-PKCS1-v1.5

Signature scheme RSA PKCS#1 V1.5 using the hash function SHA1. More...

+ Collaboration diagram for RSASSA-PKCS1V15 SHA1:

Functions

int | ucl_pkcs1_ssa_pkcs1v15_sha1_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA1 Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha1_hashed_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA1 Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha1_hashed_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA1 CRT Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha1_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA1 CRT Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha1_verify (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu)
RSASSA-PKCS1V15-SHA1 Signature Verification. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha1_verify_digest (u8 *signature, u8 *hash, u32 hash_length, ucl_rsa_public_key_t *keyPu)
RSASSA-PKCS1V15-SHA1 Signature Verification. More...

Detailed Description

Signature scheme RSA PKCS#1 V1.5 using the hash function SHA1.

Header:
ucl_pkcs1_ssa_pkcs1v15_sha1.h

Function Documentation

◆ ucl_pkcs1_ssa_pkcs1v15_sha1_crt_sign()

int ucl_pkcs1_ssa_pkcs1v15_sha1_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA1 CRT Signature Generation.

CRT Signature generation using hash function SHA1. the message is hashed using the SHA1 function

Parameters
[out] | signature | The generated signature
[in] | message | The messageto be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA CRT private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha1_hashed_crt_sign()

int ucl_pkcs1_ssa_pkcs1v15_sha1_hashed_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA1 CRT Signature Generation.

CRT Signature generation using hash function SHA1. it uses pre-hashed data, using the SHA1 function

Parameters
[out] | signature | The generated signature
[in] | message | The messageto be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA CRT private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha1_hashed_sign()

int ucl_pkcs1_ssa_pkcs1v15_sha1_hashed_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA1 Signature Generation.

Signature generation using hash function SHA1. it uses pre-hashed data, using the SHA1 function

Parameters
[out] | signature | The generated signature
[in] | message | The message to be signed, pre-hashed data
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha1_sign()

int ucl_pkcs1_ssa_pkcs1v15_sha1_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA1 Signature Generation.

Signature generation using hash function SHA1. the message is hashed using the SHA1 function

Parameters
[out] | signature | The generated signature
[in] | message | The message to be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha1_verify()

int ucl_pkcs1_ssa_pkcs1v15_sha1_verify | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu
 | ) |  |

RSASSA-PKCS1V15-SHA1 Signature Verification.

Signature verification using hash function SHA1.

Parameters
[in] | signature | The signature to verify
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPu | The RSA public key
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK if the signature is valid
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha1_verify_digest()

int ucl_pkcs1_ssa_pkcs1v15_sha1_verify_digest | ( | u8 * | signature,
 |  | u8 * | hash,
 |  | u32 | hash_length,
 |  | ucl_rsa_public_key_t * | keyPu
 | ) |  |

RSASSA-PKCS1V15-SHA1 Signature Verification.

Signature verification using hash function SHA1.

Parameters
[in] | signature | The signature to verify
[in] | hash | The original message digest to be verified
[in] | hash_length | The byte length of the digest
[in] | keyPu | The RSA public key
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK if the signature is valid
See also
RSA


Universal Crypto Library: RSASSA-PKCS1V15 SHA224

Functions
RSASSA-PKCS1V15 SHA224
PKCS #1 V2.1 » RSASSA-PKCS1-v1.5

Signature scheme RSA PKCS#1 V1.5 using the hash function SHA224. More...

+ Collaboration diagram for RSASSA-PKCS1V15 SHA224:

Functions

int | ucl_pkcs1_ssa_pkcs1v15_sha224_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA224 Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha224_hashed_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA224 Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha224_hashed_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA224 CRT Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha224_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA224 CRT Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha224_verify (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu)
RSASSA-PKCS1V15-SHA224 Signature Verification. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha224_verify_digest (u8 *signature, u8 *hash, u32 hash_length, ucl_rsa_public_key_t *keyPu)
RSASSA-PKCS1V15-SHA224 Signature Verification. More...

Detailed Description

Signature scheme RSA PKCS#1 V1.5 using the hash function SHA224.

Header:
ucl_pkcs1_ssa_pkcs1v15_sha224.h

Function Documentation

◆ ucl_pkcs1_ssa_pkcs1v15_sha224_crt_sign()

int ucl_pkcs1_ssa_pkcs1v15_sha224_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA224 CRT Signature Generation.

CRT Signature generation using hash function SHA224.

Parameters
[out] | signature | The generated signature
[in] | message | The messageto be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA CRT private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha224_hashed_crt_sign()

int ucl_pkcs1_ssa_pkcs1v15_sha224_hashed_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA224 CRT Signature Generation.

CRT Signature generation using hash function SHA224. it uses pre-hashed data, using the SHA224 function

Parameters
[out] | signature | The generated signature
[in] | message | The messageto be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA CRT private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha224_hashed_sign()

int ucl_pkcs1_ssa_pkcs1v15_sha224_hashed_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA224 Signature Generation.

Signature generation using hash function SHA224. it uses pre-hashed data, using the SHA224 function

Parameters
[out] | signature | The generated signature
[in] | message | The message to be signed, pre-hashed data
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha224_sign()

int ucl_pkcs1_ssa_pkcs1v15_sha224_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA224 Signature Generation.

Signature generation using hash function SHA224.

Parameters
[out] | signature | The generated signature
[in] | message | The message to be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha224_verify()

int ucl_pkcs1_ssa_pkcs1v15_sha224_verify | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu
 | ) |  |

RSASSA-PKCS1V15-SHA224 Signature Verification.

Signature verification using hash function SHA224.

Parameters
[in] | signature | The signature to verify
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPu | The RSA public key
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK if the signature is valid
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha224_verify_digest()

int ucl_pkcs1_ssa_pkcs1v15_sha224_verify_digest | ( | u8 * | signature,
 |  | u8 * | hash,
 |  | u32 | hash_length,
 |  | ucl_rsa_public_key_t * | keyPu
 | ) |  |

RSASSA-PKCS1V15-SHA224 Signature Verification.

Signature verification using hash function SHA224.

Parameters
[in] | signature | The signature to verify
[in] | hash | The original message digest to be verified
[in] | hash_length | The byte length of the digest
[in] | keyPu | The RSA public key
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK if the signature is valid
See also
RSA


Universal Crypto Library: RSASSA-PKCS1V15 SHA256

Functions
RSASSA-PKCS1V15 SHA256
PKCS #1 V2.1 » RSASSA-PKCS1-v1.5

Signature scheme RSA PKCS#1 V1.5 using the hash function SHA256. More...

+ Collaboration diagram for RSASSA-PKCS1V15 SHA256:

Functions

int | ucl_pkcs1_ssa_pkcs1v15_sha256_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA256 Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha256_hashed_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA256 Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha256_hashed_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA256 CRT Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha256_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA256 CRT Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha256_verify (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu)
RSASSA-PKCS1V15-SHA256 Signature Verification. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha256_verify_digest (u8 *signature, u8 *hash, u32 hash_length, ucl_rsa_public_key_t *keyPu)
RSASSA-PKCS1V15-SHA256 Signature Verification. More...

Detailed Description

Signature scheme RSA PKCS#1 V1.5 using the hash function SHA256.

Header:
ucl_pkcs1_ssa_pkcs1v15_sha256.h

Function Documentation

◆ ucl_pkcs1_ssa_pkcs1v15_sha256_crt_sign()

int ucl_pkcs1_ssa_pkcs1v15_sha256_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA256 CRT Signature Generation.

CRT Signature generation using hash function SHA256.

Parameters
[out] | signature | The generated signature
[in] | message | The messageto be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA CRT private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha256_hashed_crt_sign()

int ucl_pkcs1_ssa_pkcs1v15_sha256_hashed_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA256 CRT Signature Generation.

CRT Signature generation using hash function SHA256. it uses pre-hashed data, using the SHA256 function

Parameters
[out] | signature | The generated signature
[in] | message | The messageto be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA CRT private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha256_hashed_sign()

int ucl_pkcs1_ssa_pkcs1v15_sha256_hashed_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA256 Signature Generation.

Signature generation using hash function SHA256. it uses pre-hashed data, using the SHA256 function

Parameters
[out] | signature | The generated signature
[in] | message | The message to be signed, pre-hashed data
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha256_sign()

int ucl_pkcs1_ssa_pkcs1v15_sha256_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA256 Signature Generation.

Signature generation using hash function SHA256.

Parameters
[out] | signature | The generated signature
[in] | message | The message to be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha256_verify()

int ucl_pkcs1_ssa_pkcs1v15_sha256_verify | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu
 | ) |  |

RSASSA-PKCS1V15-SHA256 Signature Verification.

Signature verification using hash function SHA256.

Parameters
[in] | signature | The signature to verify
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPu | The RSA public key
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK if the signature is valid
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha256_verify_digest()

int ucl_pkcs1_ssa_pkcs1v15_sha256_verify_digest | ( | u8 * | signature,
 |  | u8 * | hash,
 |  | u32 | hash_length,
 |  | ucl_rsa_public_key_t * | keyPu
 | ) |  |

RSASSA-PKCS1V15-SHA256 Signature Verification.

Signature verification using hash function SHA256.

Parameters
[in] | signature | The signature to verify
[in] | hash | The original message digest to be verified
[in] | hash_length | The byte length of the digest
[in] | keyPu | The RSA public key
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK if the signature is valid
See also
RSA


Universal Crypto Library: RSASSA-PKCS1V15 SHA384

Functions
RSASSA-PKCS1V15 SHA384
PKCS #1 V2.1 » RSASSA-PKCS1-v1.5

Signature scheme RSA PKCS#1 V1.5 using the hash function SHA384. More...

+ Collaboration diagram for RSASSA-PKCS1V15 SHA384:

Functions

int | ucl_pkcs1_ssa_pkcs1v15_sha384_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA384 Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha384_hashed_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA384 Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha384_hashed_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA384 CRT Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha384_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA384 CRT Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha384_verify (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu)
RSASSA-PKCS1V15-SHA384 Signature Verification. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha384_verify_digest (u8 *signature, u8 *hash, u32 hash_length, ucl_rsa_public_key_t *keyPu)
RSASSA-PKCS1V15-SHA384 Signature Verification. More...

Detailed Description

Signature scheme RSA PKCS#1 V1.5 using the hash function SHA384.

Header:
ucl_pkcs1_ssa_pkcs1v15_sha384.h

Function Documentation

◆ ucl_pkcs1_ssa_pkcs1v15_sha384_crt_sign()

int ucl_pkcs1_ssa_pkcs1v15_sha384_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA384 CRT Signature Generation.

CRT Signature generation using hash function SHA384.

Parameters
[out] | signature | The generated signature
[in] | message | The messageto be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA CRT private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha384_hashed_crt_sign()

int ucl_pkcs1_ssa_pkcs1v15_sha384_hashed_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA384 CRT Signature Generation.

CRT Signature generation using hash function SHA384. it uses pre-hashed data, using the SHA384 function

Parameters
[out] | signature | The generated signature
[in] | message | The messageto be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA CRT private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha384_hashed_sign()

int ucl_pkcs1_ssa_pkcs1v15_sha384_hashed_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA384 Signature Generation.

Signature generation using hash function SHA384. it uses pre-hashed data, using the SHA384 function

Parameters
[out] | signature | The generated signature
[in] | message | The message to be signed, pre-hashed data
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha384_sign()

int ucl_pkcs1_ssa_pkcs1v15_sha384_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA384 Signature Generation.

Signature generation using hash function SHA384.

Parameters
[out] | signature | The generated signature
[in] | message | The message to be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha384_verify()

int ucl_pkcs1_ssa_pkcs1v15_sha384_verify | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu
 | ) |  |

RSASSA-PKCS1V15-SHA384 Signature Verification.

Signature verification using hash function SHA384.

Parameters
[in] | signature | The signature to verify
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPu | The RSA public key
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK if the signature is valid
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha384_verify_digest()

int ucl_pkcs1_ssa_pkcs1v15_sha384_verify_digest | ( | u8 * | signature,
 |  | u8 * | hash,
 |  | u32 | hash_length,
 |  | ucl_rsa_public_key_t * | keyPu
 | ) |  |

RSASSA-PKCS1V15-SHA384 Signature Verification.

Signature verification using hash function SHA384.

Parameters
[in] | signature | The signature to verify
[in] | hash | The original message digest to be verified
[in] | hash_length | The byte length of the digest
[in] | keyPu | The RSA public key
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK if the signature is valid
See also
RSA


Universal Crypto Library: RSASSA-PKCS1V15 SHA512

Functions
RSASSA-PKCS1V15 SHA512
PKCS #1 V2.1 » RSASSA-PKCS1-v1.5

Signature scheme RSA PKCS#1 V1.5 using the hash function SHA512. More...

+ Collaboration diagram for RSASSA-PKCS1V15 SHA512:

Functions

int | ucl_pkcs1_ssa_pkcs1v15_sha512_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA512 Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha512_hashed_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA512 Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha512_hashed_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA512 CRT Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha512_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *keyPr)
RSASSA-PKCS1V15-SHA512 CRT Signature Generation. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha512_verify (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu)
RSASSA-PKCS1V15-SHA512 Signature Verification. More...
int | ucl_pkcs1_ssa_pkcs1v15_sha512_verify_digest (u8 *signature, u8 *hash, u32 hash_length, ucl_rsa_public_key_t *keyPu)
RSASSA-PKCS1V15-SHA512 Signature Verification. More...

Detailed Description

Signature scheme RSA PKCS#1 V1.5 using the hash function SHA512.

Header:
ucl_pkcs1_ssa_pkcs1v15_sha512.h

Function Documentation

◆ ucl_pkcs1_ssa_pkcs1v15_sha512_crt_sign()

int ucl_pkcs1_ssa_pkcs1v15_sha512_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA512 CRT Signature Generation.

CRT Signature generation using hash function SHA512. the message is hashed using the SHA512 function

Parameters
[out] | signature | The generated signature
[in] | message | The messageto be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA CRT private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha512_hashed_crt_sign()

int ucl_pkcs1_ssa_pkcs1v15_sha512_hashed_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA512 CRT Signature Generation.

CRT Signature generation using hash function SHA512. it uses pre-hashed data, using the SHA512 function

Parameters
[out] | signature | The generated signature
[in] | message | The messageto be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA CRT private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha512_hashed_sign()

int ucl_pkcs1_ssa_pkcs1v15_sha512_hashed_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA512 Signature Generation.

Signature generation using hash function SHA512. it uses pre-hashed data, using the SHA512 function

Parameters
[out] | signature | The generated signature
[in] | message | The message to be signed, pre-hashed data
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha512_sign()

int ucl_pkcs1_ssa_pkcs1v15_sha512_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr
 | ) |  |

RSASSA-PKCS1V15-SHA512 Signature Generation.

Signature generation using hash function SHA512. the message is hashed using the SHA512 function

Parameters
[out] | signature | The generated signature
[in] | message | The message to be signed
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
Note
The output buffer length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha512_verify()

int ucl_pkcs1_ssa_pkcs1v15_sha512_verify | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu
 | ) |  |

RSASSA-PKCS1V15-SHA512 Signature Verification.

Signature verification using hash function SHA512.

Parameters
[in] | signature | The signature to verify
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPu | The RSA public key
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK if the signature is valid
See also
RSA

◆ ucl_pkcs1_ssa_pkcs1v15_sha512_verify_digest()

int ucl_pkcs1_ssa_pkcs1v15_sha512_verify_digest | ( | u8 * | signature,
 |  | u8 * | hash,
 |  | u32 | hash_length,
 |  | ucl_rsa_public_key_t * | keyPu
 | ) |  |

RSASSA-PKCS1V15-SHA512 Signature Verification.

Signature verification using hash function SHA512.

Parameters
[in] | signature | The signature to verify
[in] | hash | The original message digest to be verified
[in] | hash_length | The byte length of the digest
[in] | keyPu | The RSA public key
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK if the signature is valid
See also
RSA


Universal Crypto Library: RSASSA-PSS

Modules | Functions
RSASSA-PSS
PKCS #1 V2.1

RSAPSS with pre-hashed data. More...

+ Collaboration diagram for RSASSA-PSS:

Modules

RSASSA-PSS-MD5
RSAPSS with the hash function MD5.
RSASSA-PSS-RIPEMD160
RSAPSS with the hash function RIPEMD160.
RSASSA-PSS-SHA1
RSAPSS with the hash function SHA1.
RSASSA-PSS-SHA224
RSAPSS with the hash function SHA224.
RSASSA-PSS-SHA256
RSAPSS with the hash function SHA256.
RSASSA-PSS-SHA384
RSAPSS with the hash function SHA384.
RSASSA-PSS-SHA512
RSAPSS with the hash function SHA512.

Functions

int | ucl_pkcs1_ssa_pss_verify_digest (u8 *signature, u8 *hash, u32 hash_length, ucl_rsa_public_key_t *keyPu, u32 salt_length)
RSASSA-PSS digest signature verification. More...
int | ucl_pkcs1_ssa_pss_verify (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu, u32 salt_length)
RSASSA-PSS signature verification. More...
int | ucl_pkcs1_ssa_pss_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr, u32 salt_length)
RSA-SSA-PSS signature generation. More...
int | ucl_pkcs1_ssa_pss_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *key, u32 salt_length)
RSASSA-PSS signature generation with CRT. More...

Detailed Description

RSAPSS with pre-hashed data.

PKCS #1 V2.1 Section 8.1: RSASSA-PSS.

Header:
ucl_pkcs1_ssa_pss.h

RSASSA-PSS combines the RSASP1 and RSAVP1 primitives with the EMSA-PSS encoding method. It is compatible with the IFSSA scheme as amended in the IEEE P1363a draft, where the signature and verification primitives are IFSP-RSA1 and IFVP-RSA1 as defined in IEEE Std 1363-2000 and the message encoding method is EMSA4. EMSA4 is slightly more general than EMSA-PSS as it acts on bit strings rather than on octet strings. EMSA-PSS is equivalent to EMSA4 restricted to the case that the operands as well as the hash and salt values are octet strings.

Function Documentation

◆ ucl_pkcs1_ssa_pss_crt_sign()

int ucl_pkcs1_ssa_pss_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS signature generation with CRT.

Signature generation with CRT pre-hashed data (SHA1 and SHA256).

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | key | RSA CRT private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sign()

int ucl_pkcs1_ssa_pss_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u32 | salt_length
 | ) |  |

RSA-SSA-PSS signature generation.

Signature generation using pre-hashed data (SHA1 and SHA256).

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_verify()

int ucl_pkcs1_ssa_pss_verify | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS signature verification.

Signature verification using pre-hashed data (SHA1 and SHA256).

Parameters
[in] | signature | The signature to be verify
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA

◆ ucl_pkcs1_ssa_pss_verify_digest()

int ucl_pkcs1_ssa_pss_verify_digest | ( | u8 * | signature,
 |  | u8 * | hash,
 |  | u32 | hash_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS digest signature verification.

RSASSA-PSS signature verification.

Signature verification using pre-hashed data (SHA1 and SHA256).

Parameters
[in] | signature | Pointer to the signature to be checked
[in] | hash | The original message digest to be verified
[in] | hash_length | The byte length of the digest
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA

Signature verification using pre-hashed data (SHA1 and SHA256).

Parameters
[in] | signature | The signature to be verify
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA


Universal Crypto Library: RSASSA-PSS-MD5

Functions
RSASSA-PSS-MD5
PKCS #1 V2.1 » RSASSA-PSS

RSAPSS with the hash function MD5. More...

+ Collaboration diagram for RSASSA-PSS-MD5:

Functions

int | ucl_pkcs1_ssa_pss_md5_verify_digest (u8 *signature, u8 *hash, u32 hash_length, ucl_rsa_public_key_t *keyPu, u32 salt_length)
RSASSA-PSS-MD5 digest signature verification. More...
int | ucl_pkcs1_ssa_pss_md5_verify (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu, u32 salt_length)
RSASSA-PSS-MD5 signature verification. More...
int __API__ | ucl_pkcs1_ssa_pss_md5_verify_ (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu, u32 salt_length, int is_digest)
RSASSA-PSS-MD5 signature verification. More...
int | ucl_pkcs1_ssa_pss_md5_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr, u32 salt_length)
RSA-SSA-PSS-MD5 signature generation. More...
int | ucl_pkcs1_ssa_pss_md5_hashed_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr, u32 salt_length)
RSA-SSA-PSS-MD5 signature generation. More...
int | ucl_pkcs1_ssa_pss_md5_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *key, u32 salt_length)
RSASSA-PSS-MD5 signature generation with CRT. More...
int | ucl_pkcs1_ssa_pss_md5_hashed_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *key, u32 salt_length)
RSASSA-PSS-MD5 signature generation with CRT. More...

Detailed Description

RSAPSS with the hash function MD5.

Header:
ucl_pkcs1_ssa_pss_md5.h

Function Documentation

◆ ucl_pkcs1_ssa_pss_md5_crt_sign()

int ucl_pkcs1_ssa_pss_md5_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-MD5 signature generation with CRT.

Signature generation with CRT using the hash function MD5. the message is hashed using the MD5 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | key | RSA CRT private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_md5_hashed_crt_sign()

int ucl_pkcs1_ssa_pss_md5_hashed_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-MD5 signature generation with CRT.

Signature generation with CRT using the hash function MD5. it uses pre-hashed data, using the MD5 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | key | RSA CRT private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_md5_hashed_sign()

int ucl_pkcs1_ssa_pss_md5_hashed_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u32 | salt_length
 | ) |  |

RSA-SSA-PSS-MD5 signature generation.

Signature generation using the hash function MD5. it uses pre-hashed data, using the MD5 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_md5_sign()

int ucl_pkcs1_ssa_pss_md5_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u32 | salt_length
 | ) |  |

RSA-SSA-PSS-MD5 signature generation.

Signature generation using the hash function MD5. the message is hashed using the MD5 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_md5_verify()

int ucl_pkcs1_ssa_pss_md5_verify | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-MD5 signature verification.

Signature verification using the hash function MD5.

Parameters
[in] | signature | The signature to be verify
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA

◆ ucl_pkcs1_ssa_pss_md5_verify_()

int __API__ ucl_pkcs1_ssa_pss_md5_verify_ | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length,
 |  | int | is_digest
 | ) |  |

RSASSA-PSS-MD5 signature verification.

Signature verification using the hash function MD5.

Parameters
[in] | signature | Pointer to the signature to be checked
[in] | message | The original message to be verified
[in] | message_length | The byte length of the message
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
[in] | is_digest | Use a digest instead of the message (use UCL_FALSE if not)
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA

◆ ucl_pkcs1_ssa_pss_md5_verify_digest()

int ucl_pkcs1_ssa_pss_md5_verify_digest | ( | u8 * | signature,
 |  | u8 * | hash,
 |  | u32 | hash_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-MD5 digest signature verification.

Signature verification using the hash function MD5.

Parameters
[in] | signature | Pointer to the signature to be checked
[in] | hash | The original message digest to be verified
[in] | hash_length | The byte length of the digest
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA


Universal Crypto Library: RSASSA-PSS-RIPEMD160

Functions
RSASSA-PSS-RIPEMD160
PKCS #1 V2.1 » RSASSA-PSS

RSAPSS with the hash function RIPEMD160. More...

+ Collaboration diagram for RSASSA-PSS-RIPEMD160:

Functions

int __API__ | ucl_pkcs1_ssa_pss_ripemd160_verify (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu, u32 salt_length)
RSASSA-PSS-RIPEMD160 signature verification. More...
int __API__ | ucl_pkcs1_ssa_pss_ripemd160_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr, u32 salt_length)
RSA-SSA-PSS-RIPEMD160 signature generation. More...
int __API__ | ucl_pkcs1_ssa_pss_ripemd160_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *key, u32 salt_length)
RSASSA-PSS-RIPEMD160 signature generation with CRT. More...

Detailed Description

RSAPSS with the hash function RIPEMD160.

Header:
ucl_pkcs1_ssa_pss_ripemd160.h

Function Documentation

◆ ucl_pkcs1_ssa_pss_ripemd160_crt_sign()

int __API__ ucl_pkcs1_ssa_pss_ripemd160_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-RIPEMD160 signature generation with CRT.

Signature generation with CRT using the hash function RIPEMD160.

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | key | RSA CRT private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_ripemd160_sign()

int __API__ ucl_pkcs1_ssa_pss_ripemd160_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u32 | salt_length
 | ) |  |

RSA-SSA-PSS-RIPEMD160 signature generation.

Signature generation using the hash function RIPEMD160.

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_ripemd160_verify()

int __API__ ucl_pkcs1_ssa_pss_ripemd160_verify | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-RIPEMD160 signature verification.

Signature verification using the hash function RIPEMD160.

Parameters
[in] | signature | The signature to be verify
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA


Universal Crypto Library: RSASSA-PSS-SHA1

Functions
RSASSA-PSS-SHA1
PKCS #1 V2.1 » RSASSA-PSS

RSAPSS with the hash function SHA1. More...

+ Collaboration diagram for RSASSA-PSS-SHA1:

Functions

int | ucl_pkcs1_ssa_pss_sha1_verify_digest (u8 *signature, u8 *hash, u32 hash_length, ucl_rsa_public_key_t *keyPu, u32 salt_length)
RSASSA-PSS-SHA1 digest signature verification. More...
int | ucl_pkcs1_ssa_pss_sha1_verify (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu, u32 salt_length)
RSASSA-PSS-SHA1 signature verification. More...
int __API__ | ucl_pkcs1_ssa_pss_sha1_verify_ (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu, u32 salt_length, int is_digest)
RSASSA-PSS-SHA1 signature verification. More...
int | ucl_pkcs1_ssa_pss_sha1_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr, u32 salt_length)
RSA-SSA-PSS-SHA1 signature generation. More...
int | ucl_pkcs1_ssa_pss_sha1_hashed_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr, u32 salt_length)
RSA-SSA-PSS-SHA1 signature generation. More...
int | ucl_pkcs1_ssa_pss_sha1_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *key, u32 salt_length)
RSASSA-PSS-SHA1 signature generation with CRT. More...
int | ucl_pkcs1_ssa_pss_sha1_hashed_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *key, u32 salt_length)
RSASSA-PSS-SHA1 signature generation with CRT. More...

Detailed Description

RSAPSS with the hash function SHA1.

Header:
ucl_pkcs1_ssa_pss_sha1.h

Function Documentation

◆ ucl_pkcs1_ssa_pss_sha1_crt_sign()

int ucl_pkcs1_ssa_pss_sha1_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-SHA1 signature generation with CRT.

Signature generation with CRT using the hash function SHA1. the message is hashed using the SHA1 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | key | RSA CRT private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha1_hashed_crt_sign()

int ucl_pkcs1_ssa_pss_sha1_hashed_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-SHA1 signature generation with CRT.

Signature generation with CRT using the hash function SHA1. it uses pre-hashed data, using the SHA1 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | key | RSA CRT private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha1_hashed_sign()

int ucl_pkcs1_ssa_pss_sha1_hashed_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u32 | salt_length
 | ) |  |

RSA-SSA-PSS-SHA1 signature generation.

Signature generation using the hash function SHA1. it uses pre-hashed data, using the SHA1 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha1_sign()

int ucl_pkcs1_ssa_pss_sha1_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u32 | salt_length
 | ) |  |

RSA-SSA-PSS-SHA1 signature generation.

Signature generation using the hash function SHA1. the message is hashed using the SHA1 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha1_verify()

int ucl_pkcs1_ssa_pss_sha1_verify | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-SHA1 signature verification.

Signature verification using the hash function SHA1.

Parameters
[in] | signature | The signature to be verify
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha1_verify_()

int __API__ ucl_pkcs1_ssa_pss_sha1_verify_ | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length,
 |  | int | is_digest
 | ) |  |

RSASSA-PSS-SHA1 signature verification.

Signature verification using the hash function SHA1.

Parameters
[in] | signature | Pointer to the signature to be checked
[in] | message | The original message to be verified
[in] | message_length | The byte length of the message
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
[in] | is_digest | Use a digest instead of the message (use UCL_FALSE if not)
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha1_verify_digest()

int ucl_pkcs1_ssa_pss_sha1_verify_digest | ( | u8 * | signature,
 |  | u8 * | hash,
 |  | u32 | hash_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-SHA1 digest signature verification.

Signature verification using the hash function SHA1.

Parameters
[in] | signature | Pointer to the signature to be checked
[in] | hash | The original message digest to be verified
[in] | hash_length | The byte length of the digest
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA


Universal Crypto Library: RSASSA-PSS-SHA224

Functions
RSASSA-PSS-SHA224
PKCS #1 V2.1 » RSASSA-PSS

RSAPSS with the hash function SHA224. More...

+ Collaboration diagram for RSASSA-PSS-SHA224:

Functions

int | ucl_pkcs1_ssa_pss_sha224_verify_digest (u8 *signature, u8 *hash, u32 hash_length, ucl_rsa_public_key_t *keyPu, u32 salt_length)
RSASSA-PSS-SHA224 digest signature verification. More...
int | ucl_pkcs1_ssa_pss_sha224_verify (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu, u32 salt_length)
RSASSA-PSS-SHA224 signature verification. More...
int __API__ | ucl_pkcs1_ssa_pss_sha224_verify_ (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu, u32 salt_length, int is_digest)
RSASSA-PSS-SHA224 signature verification. More...
int | ucl_pkcs1_ssa_pss_sha224_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr, u32 salt_length)
RSA-SSA-PSS-SHA224 signature generation. More...
int | ucl_pkcs1_ssa_pss_sha224_hashed_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr, u32 salt_length)
RSA-SSA-PSS-SHA224 signature generation. More...
int | ucl_pkcs1_ssa_pss_sha224_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *key, u32 salt_length)
RSASSA-PSS-SHA224 signature generation with CRT. More...
int | ucl_pkcs1_ssa_pss_sha224_hashed_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *key, u32 salt_length)
RSASSA-PSS-SHA224 signature generation with CRT. More...

Detailed Description

RSAPSS with the hash function SHA224.

Header:
ucl_pkcs1_ssa_pss_sha224.h

Function Documentation

◆ ucl_pkcs1_ssa_pss_sha224_crt_sign()

int ucl_pkcs1_ssa_pss_sha224_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-SHA224 signature generation with CRT.

Signature generation with CRT using the hash function SHA224. the message is hashed using the SHA224 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | key | RSA CRT private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha224_hashed_crt_sign()

int ucl_pkcs1_ssa_pss_sha224_hashed_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-SHA224 signature generation with CRT.

Signature generation with CRT using the hash function SHA224. it uses pre-hashed data, using the SHA224 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | key | RSA CRT private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha224_hashed_sign()

int ucl_pkcs1_ssa_pss_sha224_hashed_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u32 | salt_length
 | ) |  |

RSA-SSA-PSS-SHA224 signature generation.

Signature generation using the hash function SHA224. it uses pre-hashed data, using the SHA224 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha224_sign()

int ucl_pkcs1_ssa_pss_sha224_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u32 | salt_length
 | ) |  |

RSA-SSA-PSS-SHA224 signature generation.

Signature generation using the hash function SHA224. the message is hashed using the SHA224 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha224_verify()

int ucl_pkcs1_ssa_pss_sha224_verify | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-SHA224 signature verification.

Signature verification using the hash function SHA224.

Parameters
[in] | signature | The signature to be verify
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha224_verify_()

int __API__ ucl_pkcs1_ssa_pss_sha224_verify_ | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length,
 |  | int | is_digest
 | ) |  |

RSASSA-PSS-SHA224 signature verification.

Signature verification using the hash function SHA224.

Parameters
[in] | signature | Pointer to the signature to be checked
[in] | message | The original message to be verified
[in] | message_length | The byte length of the message
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
[in] | is_digest | Use a digest instead of the message (use UCL_FALSE if not)
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha224_verify_digest()

int ucl_pkcs1_ssa_pss_sha224_verify_digest | ( | u8 * | signature,
 |  | u8 * | hash,
 |  | u32 | hash_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-SHA224 digest signature verification.

Signature verification using the hash function SHA224.

Parameters
[in] | signature | Pointer to the signature to be checked
[in] | hash | The original message digest to be verified
[in] | hash_length | The byte length of the digest
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA


Universal Crypto Library: RSASSA-PSS-SHA256

Functions
RSASSA-PSS-SHA256
PKCS #1 V2.1 » RSASSA-PSS

RSAPSS with the hash function SHA256. More...

+ Collaboration diagram for RSASSA-PSS-SHA256:

Functions

int | ucl_pkcs1_ssa_pss_sha256_verify_digest (u8 *signature, u8 *hash, u32 hash_length, ucl_rsa_public_key_t *keyPu, u32 salt_length)
RSASSA-PSS-SHA256 digest signature verification. More...
int | ucl_pkcs1_ssa_pss_sha256_verify (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu, u32 salt_length)
RSASSA-PSS-SHA256 signature verification. More...
int __API__ | ucl_pkcs1_ssa_pss_sha256_verify_ (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu, u32 salt_length, int is_digest)
RSASSA-PSS-SHA256 signature verification. More...
int | ucl_pkcs1_ssa_pss_sha256_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr, u32 salt_length)
RSA-SSA-PSS-SHA256 signature generation. More...
int | ucl_pkcs1_ssa_pss_sha256_hashed_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr, u32 salt_length)
RSA-SSA-PSS-SHA256 signature generation. More...
int | ucl_pkcs1_ssa_pss_sha256_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *key, u32 salt_length)
RSASSA-PSS-SHA256 signature generation with CRT. More...
int | ucl_pkcs1_ssa_pss_sha256_hashed_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *key, u32 salt_length)
RSASSA-PSS-SHA256 signature generation with CRT. More...

Detailed Description

RSAPSS with the hash function SHA256.

Header:
ucl_pkcs1_ssa_pss_sha256.h

Function Documentation

◆ ucl_pkcs1_ssa_pss_sha256_crt_sign()

int ucl_pkcs1_ssa_pss_sha256_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-SHA256 signature generation with CRT.

Signature generation with CRT using the hash function SHA256. the message is hashed using the SHA256 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | key | RSA CRT private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha256_hashed_crt_sign()

int ucl_pkcs1_ssa_pss_sha256_hashed_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-SHA256 signature generation with CRT.

Signature generation with CRT using the hash function SHA256. it uses pre-hashed data, using the SHA256 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | key | RSA CRT private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha256_hashed_sign()

int ucl_pkcs1_ssa_pss_sha256_hashed_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u32 | salt_length
 | ) |  |

RSA-SSA-PSS-SHA256 signature generation.

Signature generation using the hash function SHA256. it uses pre-hashed data, using the SHA256 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha256_sign()

int ucl_pkcs1_ssa_pss_sha256_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u32 | salt_length
 | ) |  |

RSA-SSA-PSS-SHA256 signature generation.

Signature generation using the hash function SHA256. the message is hashed using the SHA256 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha256_verify()

int ucl_pkcs1_ssa_pss_sha256_verify | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-SHA256 signature verification.

Signature verification using the hash function SHA256.

Parameters
[in] | signature | The signature to be verify
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha256_verify_()

int __API__ ucl_pkcs1_ssa_pss_sha256_verify_ | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length,
 |  | int | is_digest
 | ) |  |

RSASSA-PSS-SHA256 signature verification.

Signature verification using the hash function SHA256.

Parameters
[in] | signature | Pointer to the signature to be checked
[in] | message | The original message to be verified
[in] | message_length | The byte length of the message
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
[in] | is_digest | Use a digest instead of the message (use UCL_FALSE if not)
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha256_verify_digest()

int ucl_pkcs1_ssa_pss_sha256_verify_digest | ( | u8 * | signature,
 |  | u8 * | hash,
 |  | u32 | hash_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-SHA256 digest signature verification.

Signature verification using the hash function SHA256.

Parameters
[in] | signature | Pointer to the signature to be checked
[in] | hash | The original message digest to be verified
[in] | hash_length | The byte length of the digest
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA


Universal Crypto Library: RSASSA-PSS-SHA384

Functions
RSASSA-PSS-SHA384
PKCS #1 V2.1 » RSASSA-PSS

RSAPSS with the hash function SHA384. More...

+ Collaboration diagram for RSASSA-PSS-SHA384:

Functions

int | ucl_pkcs1_ssa_pss_sha384_verify_digest (u8 *signature, u8 *hash, u32 hash_length, ucl_rsa_public_key_t *keyPu, u32 salt_length)
RSASSA-PSS-SHA384 digest signature verification. More...
int | ucl_pkcs1_ssa_pss_sha384_verify (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu, u32 salt_length)
RSASSA-PSS-SHA384 signature verification. More...
int __API__ | ucl_pkcs1_ssa_pss_sha384_verify_ (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu, u32 salt_length, int is_digest)
RSASSA-PSS-SHA384 signature verification. More...
int | ucl_pkcs1_ssa_pss_sha384_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr, u32 salt_length)
RSA-SSA-PSS-SHA384 signature generation. More...
int | ucl_pkcs1_ssa_pss_sha384_hashed_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr, u32 salt_length)
RSA-SSA-PSS-SHA384 signature generation. More...
int | ucl_pkcs1_ssa_pss_sha384_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *key, u32 salt_length)
RSASSA-PSS-SHA384 signature generation with CRT. More...
int | ucl_pkcs1_ssa_pss_sha384_hashed_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *key, u32 salt_length)
RSASSA-PSS-SHA384 signature generation with CRT. More...

Detailed Description

RSAPSS with the hash function SHA384.

Header:
ucl_pkcs1_ssa_pss_sha384.h

Function Documentation

◆ ucl_pkcs1_ssa_pss_sha384_crt_sign()

int ucl_pkcs1_ssa_pss_sha384_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-SHA384 signature generation with CRT.

Signature generation with CRT using the hash function SHA384. the message is hashed using the SHA384 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | key | RSA CRT private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha384_hashed_crt_sign()

int ucl_pkcs1_ssa_pss_sha384_hashed_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-SHA384 signature generation with CRT.

Signature generation with CRT using the hash function SHA384. it uses pre-hashed data, using the SHA384 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | key | RSA CRT private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha384_hashed_sign()

int ucl_pkcs1_ssa_pss_sha384_hashed_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u32 | salt_length
 | ) |  |

RSA-SSA-PSS-SHA384 signature generation.

Signature generation using the hash function SHA384. it uses pre-hashed data, using the SHA384 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha384_sign()

int ucl_pkcs1_ssa_pss_sha384_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u32 | salt_length
 | ) |  |

RSA-SSA-PSS-SHA384 signature generation.

Signature generation using the hash function SHA384. the message is hashed using the SHA384 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha384_verify()

int ucl_pkcs1_ssa_pss_sha384_verify | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-SHA384 signature verification.

Signature verification using the hash function SHA384.

Parameters
[in] | signature | The signature to be verify
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha384_verify_()

int __API__ ucl_pkcs1_ssa_pss_sha384_verify_ | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length,
 |  | int | is_digest
 | ) |  |

RSASSA-PSS-SHA384 signature verification.

Signature verification using the hash function SHA384.

Parameters
[in] | signature | Pointer to the signature to be checked
[in] | message | The original message to be verified
[in] | message_length | The byte length of the message
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
[in] | is_digest | Use a digest instead of the message (use UCL_FALSE if not)
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha384_verify_digest()

int ucl_pkcs1_ssa_pss_sha384_verify_digest | ( | u8 * | signature,
 |  | u8 * | hash,
 |  | u32 | hash_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-SHA384 digest signature verification.

Signature verification using the hash function SHA384.

Parameters
[in] | signature | Pointer to the signature to be checked
[in] | hash | The original message digest to be verified
[in] | hash_length | The byte length of the digest
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA


Universal Crypto Library: RSASSA-PSS-SHA512

Functions
RSASSA-PSS-SHA512
PKCS #1 V2.1 » RSASSA-PSS

RSAPSS with the hash function SHA512. More...

+ Collaboration diagram for RSASSA-PSS-SHA512:

Functions

int | ucl_pkcs1_ssa_pss_sha512_verify_digest (u8 *signature, u8 *hash, u32 hash_length, ucl_rsa_public_key_t *keyPu, u32 salt_length)
RSASSA-PSS-SHA512 digest signature verification. More...
int | ucl_pkcs1_ssa_pss_sha512_verify (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu, u32 salt_length)
RSASSA-PSS-SHA512 signature verification. More...
int __API__ | ucl_pkcs1_ssa_pss_sha512_verify_ (u8 *signature, u8 *message, u32 message_length, ucl_rsa_public_key_t *keyPu, u32 salt_length, int is_digest)
RSASSA-PSS-SHA512 signature verification. More...
int | ucl_pkcs1_ssa_pss_sha512_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr, u32 salt_length)
RSA-SSA-PSS-SHA512 signature generation. More...
int | ucl_pkcs1_ssa_pss_sha512_hashed_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_private_key_t *keyPr, u32 salt_length)
RSA-SSA-PSS-SHA512 signature generation. More...
int | ucl_pkcs1_ssa_pss_sha512_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *key, u32 salt_length)
RSASSA-PSS-SHA512 signature generation with CRT. More...
int | ucl_pkcs1_ssa_pss_sha512_hashed_crt_sign (u8 *signature, u8 *message, u32 message_length, ucl_rsa_crt_private_key_t *key, u32 salt_length)
RSASSA-PSS-SHA512 signature generation with CRT. More...

Detailed Description

RSAPSS with the hash function SHA512.

Header:
ucl_pkcs1_ssa_pss_sha512.h

Function Documentation

◆ ucl_pkcs1_ssa_pss_sha512_crt_sign()

int ucl_pkcs1_ssa_pss_sha512_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-SHA512 signature generation with CRT.

Signature generation with CRT using the hash function SHA512. the message is hashed using the SHA512 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | key | RSA CRT private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha512_hashed_crt_sign()

int ucl_pkcs1_ssa_pss_sha512_hashed_crt_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_crt_private_key_t * | key,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-SHA512 signature generation with CRT.

Signature generation with CRT using the hash function SHA512. it uses pre-hashed data, using the SHA512 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | key | RSA CRT private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha512_hashed_sign()

int ucl_pkcs1_ssa_pss_sha512_hashed_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u32 | salt_length
 | ) |  |

RSA-SSA-PSS-SHA512 signature generation.

Signature generation using the hash function SHA512. it uses pre-hashed data, using the SHA512 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha512_sign()

int ucl_pkcs1_ssa_pss_sha512_sign | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_private_key_t * | keyPr,
 |  | u32 | salt_length
 | ) |  |

RSA-SSA-PSS-SHA512 signature generation.

Signature generation using the hash function SHA512. the message is hashed using the SHA512 function

Parameters
[out] | signature | The generated signature
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPr | RSA private key
[in] | salt_length | Optional salt byte length
Note
The output length is the modulus length
Returns
Error code
Return values
UCL_OK if no error occurred
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha512_verify()

int ucl_pkcs1_ssa_pss_sha512_verify | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-SHA512 signature verification.

Signature verification using the hash function SHA512.

Parameters
[in] | signature | The signature to be verify
[in] | message | The message
[in] | message_length | The message byte length
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
Note
The signature length is the modulus length
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha512_verify_()

int __API__ ucl_pkcs1_ssa_pss_sha512_verify_ | ( | u8 * | signature,
 |  | u8 * | message,
 |  | u32 | message_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length,
 |  | int | is_digest
 | ) |  |

RSASSA-PSS-SHA512 signature verification.

Signature verification using the hash function SHA512.

Parameters
[in] | signature | Pointer to the signature to be checked
[in] | message | The original message to be verified
[in] | message_length | The byte length of the message
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
[in] | is_digest | Use a digest instead of the message (use UCL_FALSE if not)
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA

◆ ucl_pkcs1_ssa_pss_sha512_verify_digest()

int ucl_pkcs1_ssa_pss_sha512_verify_digest | ( | u8 * | signature,
 |  | u8 * | hash,
 |  | u32 | hash_length,
 |  | ucl_rsa_public_key_t * | keyPu,
 |  | u32 | salt_length
 | ) |  |

RSASSA-PSS-SHA512 digest signature verification.

Signature verification using the hash function SHA512.

Parameters
[in] | signature | Pointer to the signature to be checked
[in] | hash | The original message digest to be verified
[in] | hash_length | The byte length of the digest
[in] | keyPu | RSA public key
[in] | salt_length | Optional salt byte length
Returns
Error code
Return values
UCL_OK | if the signature is valid
UCL_ERROR | if the signature is invalid
See also
RSA


Universal Crypto Library: PKCS #5 v2.0

Modules
PKCS #5 v2.0

Password-Based Cryptography Standard. More...

+ Collaboration diagram for PKCS #5 v2.0:

Modules

PBKDF
Password Base Key derivation functions.

Detailed Description

Password-Based Cryptography Standard.

This module provides implementation of password-based cryptography, covering the following aspects:

  • key derivation functions
  • encryption schemes
  • message-authentication schemes
  • ASN.1 syntax identifying the techniques

The implementation follows the recommandation of the RSA Laboratories documentation PKCS #5 v2.0 Password-Based Cryptography Standard.

Note
Module Version 1.0


Universal Crypto Library: PBKDF

Modules
PBKDF
PKCS #5 v2.0

Password Base Key derivation functions. More...

+ Collaboration diagram for PBKDF:

Modules

PBKDF2
PKCS #5 v2.0 Section 5.2: PBKDF2.

Detailed Description

Password Base Key derivation functions.

A key derivation function produces a derived key from a base key and other parameters. In a password-based key derivation function, the base key is a password and the other parameters are a salt value and an iteration count.


Universal Crypto Library: PBKDF2

Modules
PBKDF2
PKCS #5 v2.0 » PBKDF

PKCS #5 v2.0 Section 5.2: PBKDF2. More...

+ Collaboration diagram for PBKDF2:

Modules

PBKDF2 HMAC-SHA1
PBKDF2 using HMAC-SHA1.
PBKDF2 HMAC-SHA256
PBKDF2 using HMAC-SHA256.
PBKDF2 HMAC-SHA512
PBKDF2 using HMAC-SHA512.
PBKDF2 HMAC-SHA384
PBKDF2 using HMAC-SHA384.

Detailed Description

PKCS #5 v2.0 Section 5.2: PBKDF2.

PBKDF2 applies a pseudorandom function to derive keys. The length of the derived key is essentially unbounded. (However, the maximum effective search space for the derived key may be limited by the structure of the underlying pseudorandom function.)

PBKDF2 is recommended for new applications.


Universal Crypto Library: PBKDF2 HMAC-SHA1

Functions
PBKDF2 HMAC-SHA1
PKCS #5 v2.0 » PBKDF » PBKDF2

PBKDF2 using HMAC-SHA1. More...

+ Collaboration diagram for PBKDF2 HMAC-SHA1:

Functions

int ucl_pkcs5_pbkdf2_hmac_sha1 (u8 *derived_key, u32 derived_key_byteLen, u8 *password, u32 password_byteLen, u8 *salt, u32 salt_byteLen, u32 count)
PBKDF2-HMAC-SHA1. More...

Detailed Description

PBKDF2 using HMAC-SHA1.

Header:
ucl_pkcs5_pbkdf2.h

Function Documentation

◆ ucl_pkcs5_pbkdf2_hmac_sha1()

int ucl_pkcs5_pbkdf2_hmac_sha1 | ( | u8 * | derived_key,
 |  | u32 | derived_key_byteLen,
 |  | u8 * | password,
 |  | u32 | password_byteLen,
 |  | u8 * | salt,
 |  | u32 | salt_byteLen,
 |  | u32 | count
 | ) |  |

PBKDF2-HMAC-SHA1.

PBKDF2 using HMAC-SHA1

Parameters
[out] | derived_key | Pointer to the derived key
[in] | derived_key_byteLen | Key byte length
[in] | password | Pointer to the password
[in] | password_byteLen | Password byte length
[in] | salt | Pointer to the Salt
[in] | salt_byteLen | Salt byte Length
[in] | count | Count
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if derived_key is the pointer NULL
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_ARG | if count < 1000
See also
HMAC SHA1


Universal Crypto Library: PBKDF2 HMAC-SHA256

Functions
PBKDF2 HMAC-SHA256
PKCS #5 v2.0 » PBKDF » PBKDF2

PBKDF2 using HMAC-SHA256. More...

+ Collaboration diagram for PBKDF2 HMAC-SHA256:

Functions

int ucl_pkcs5_pbkdf2_hmac_sha256 (u8 *derived_key, u32 derived_key_byteLen, u8 *password, u32 password_byteLen, u8 *salt, u32 salt_byteLen, u32 count)
PBKDF2-HMAC-SHA256. More...

Detailed Description

PBKDF2 using HMAC-SHA256.

Header:
ucl_pkcs5_pbkdf2.h

Function Documentation

◆ ucl_pkcs5_pbkdf2_hmac_sha256()

int ucl_pkcs5_pbkdf2_hmac_sha256 | ( | u8 * | derived_key,
 |  | u32 | derived_key_byteLen,
 |  | u8 * | password,
 |  | u32 | password_byteLen,
 |  | u8 * | salt,
 |  | u32 | salt_byteLen,
 |  | u32 | count
 | ) |  |

PBKDF2-HMAC-SHA256.

PBKDF2 using HMAC-SHA256

Parameters
[out] | derived_key | Pointer to the derived key
[in] | derived_key_byteLen | Key byte length
[in] | password | Pointer to the password
[in] | password_byteLen | Password byte length
[in] | salt | Pointer to the Salt
[in] | salt_byteLen | Salt byte Length
[in] | count | Count
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if derived_key is the pointer NULL
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_ARG | if count < 1000
See also
HMAC SHA256


Universal Crypto Library: PBKDF2 HMAC-SHA512

Functions
PBKDF2 HMAC-SHA512
PKCS #5 v2.0 » PBKDF » PBKDF2

PBKDF2 using HMAC-SHA512. More...

+ Collaboration diagram for PBKDF2 HMAC-SHA512:

Functions

int ucl_pkcs5_pbkdf2_hmac_sha512 (u8 *derived_key, u32 derived_key_byteLen, u8 *password, u32 password_byteLen, u8 *salt, u32 salt_byteLen, u32 count)
PBKDF2-HMAC-SHA512. More...

Detailed Description

PBKDF2 using HMAC-SHA512.

Header:
ucl_pkcs5_pbkdf2.h

Function Documentation

◆ ucl_pkcs5_pbkdf2_hmac_sha512()

int ucl_pkcs5_pbkdf2_hmac_sha512 | ( | u8 * | derived_key,
 |  | u32 | derived_key_byteLen,
 |  | u8 * | password,
 |  | u32 | password_byteLen,
 |  | u8 * | salt,
 |  | u32 | salt_byteLen,
 |  | u32 | count
 | ) |  |

PBKDF2-HMAC-SHA512.

PBKDF2 using HMAC-SHA512

Parameters
[out] | derived_key | Pointer to the derived key
[in] | derived_key_byteLen | Key byte length
[in] | password | Pointer to the password
[in] | password_byteLen | Password byte length
[in] | salt | Pointer to the Salt
[in] | salt_byteLen | Salt byte Length
[in] | count | Count
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if derived_key is the pointer NULL
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_ARG | if count < 1000
See also
HMAC SHA512


Universal Crypto Library: PBKDF2 HMAC-SHA384

Functions
PBKDF2 HMAC-SHA384
PKCS #5 v2.0 » PBKDF » PBKDF2

PBKDF2 using HMAC-SHA384. More...

+ Collaboration diagram for PBKDF2 HMAC-SHA384:

Functions

int ucl_pkcs5_pbkdf2_hmac_sha384 (u8 *derived_key, u32 derived_key_byteLen, u8 *password, u32 password_byteLen, u8 *salt, u32 salt_byteLen, u32 count)
PBKDF2-HMAC-SHA384. More...

Detailed Description

PBKDF2 using HMAC-SHA384.

Header:
ucl_pkcs5_pbkdf2.h

Function Documentation

◆ ucl_pkcs5_pbkdf2_hmac_sha384()

int ucl_pkcs5_pbkdf2_hmac_sha384 | ( | u8 * | derived_key,
 |  | u32 | derived_key_byteLen,
 |  | u8 * | password,
 |  | u32 | password_byteLen,
 |  | u8 * | salt,
 |  | u32 | salt_byteLen,
 |  | u32 | count
 | ) |  |

PBKDF2-HMAC-SHA384.

PBKDF2 using HMAC-SHA384

Parameters
[out] | derived_key | Pointer to the derived key
[in] | derived_key_byteLen | Key byte length
[in] | password | Pointer to the password
[in] | password_byteLen | Password byte length
[in] | salt | Pointer to the Salt
[in] | salt_byteLen | Salt byte Length
[in] | count | Count
Returns
Error code
Return values
UCL_OK | if no error occurred
UCL_INVALID_OUTPUT | if derived_key is the pointer NULL
UCL_INVALID_INPUT | if one of the inputs is the pointer NULL
UCL_INVALID_ARG | if count < 1000
See also
HMAC SHA384


Universal Crypto Library: Random

Modules
Random

Random Number Generation. More...

+ Collaboration diagram for Random:

Modules

RNG Interface
Interface for Random Number Generator.
SP800-90A interface
SP800-90A Hash DRBG-compliant source for random numbers.
USIP TRNG
USIP® True Random Number Generation.

Detailed Description

Random Number Generation.

This module provides functions to generate random octet strings.

Note
Module Version 1.0


Universal Crypto Library: RNG Interface

Macros | Functions
RNG Interface
Random

Interface for Random Number Generator. More...

+ Collaboration diagram for RNG Interface:

Macros

#define EMV_TVP_BYTESIZE 8
RNG Read with postprocess. More...

Functions

int | ucl_rng_attach (int(*rng)(u8 *rand, u32 rand_byteLen, int option))
Attach. More...
int | ucl_rng_detach (void)
Detach. More...
void * | ucl_rng_getpt (void)
Get pointer. More...
int | ucl_lowlevel_rng_read (u8 *rand, u32 rand_byteLen, int option)
RNG Read. More...
int | ucl_rng_read (u8 *rand, u32 rand_byteLen, int option)
RNG Read. More...
int | ucl_fips_rng_read (u8 *rand, u32 rand_byteLen, int option)
FIPS 140-2 RNG Read. More...
int | test_fips_trng_health (void)
FIPS 140 TRNG health test. More...
int | ucl_fips_rng_stest (void)
FIPS 140 RNG quality testing. More...
int | ucl_sha256_whitening_rng_read (u8 *rand, u32 rand_byteLen)
RNG Read with postprocess. More...
int | ucl_sha256_whitening_rng_read_generic (u8 *rand, u32 rand_byteLen, int option)
RNG Read with postprocess. More...
int | ucl_sha256_whitening_rng_read_non_zero (u8 *rand, u32 rand_byteLen)
RNG Read with postprocess. More...
int | ucl_sha256_whitening_rng_read_leading_non_zero (u8 *rand, u32 rand_byteLen)
RNG Read with postprocess. More...
int | ucl_sm3_whitening_rng_read (u8 *rand, u32 rand_byteLen)
RNG Read with postprocess. More...
int | ucl_sm3_whitening_rng_read_non_zero (u8 *rand, u32 rand_byteLen)
RNG Read with postprocess. More...
int | ucl_sm3_whitening_rng_read_leading_non_zero (u8 *rand, u32 rand_byteLen)
RNG Read with postprocess. More...
int | ucl_emv_unpredictable_number_transaction_p_refresh (u8 *p, u8 *tvp, u8 *rand, u8 *ac)
RNG Read. More...
int | ucl_emv_unpredictable_number_transaction_un_generation (u8 *un, u8 *rand, u8 *p)
RNG Read. More...
int | ucl_emv_unpredictable_number_power_up (u8 *q, u8 *tid, u8 *ifdsn, u8 *tvp, u8 *rand, u8 *p)
RNG Read. More...
int | ucl_rng_stest (void)
RNG quality testing. More...
int __API__ | ucl_sp80090a_rng_read (u8 *rand, u32 rand_byteLen, int rand_option, int prediction_resistance_option)
SP800-90A RNG Read. More...

Detailed Description

Interface for Random Number Generator.

This interface allows to attach any RNG for all random needs of the UCL. The default RNG is the hardware USIP® TRNG.

Header:
ucl_rng.h

Macro Definition Documentation

◆ EMV_TVP_BYTESIZE

#define EMV_TVP_BYTESIZE 8

RNG Read with postprocess.

EMV Unpredictable Number generation power down function see EMV bulletin no144 (june-2014)

Parameters
[out] | q | persistent variant of P, 32 bytes
[in] | p | pre-image of UN, 32 bytes
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_OUTPUT | If q is the pointer NULL
UCL_INVALID_INPUT | If p is the pointer NULL

Function Documentation

◆ test_fips_trng_health()

int test_fips_trng_health ( void )

FIPS 140 TRNG health test.

test the TRNG health by checking the oscillators are not stuck if the oscillator is stuck, the function shall never return only available on max32550, max32552, max32555, max32560, max32565, max32566, max32590 no parameter

Returns
Error code
Return values
UCL_OK if everything is ok

◆ ucl_emv_unpredictable_number_power_up()

int ucl_emv_unpredictable_number_power_up | ( | u8 * | q,
 |  | u8 * | tid,
 |  | u8 * | ifdsn,
 |  | u8 * | tvp,
 |  | u8 * | rand,
 |  | u8 * | p
 | ) |  |

RNG Read.

EMV Unpredictable Number generation power down function see EMV bulletin no144 (june-2014)

Parameters
[in,out] | q | persistent variant of P, 32 bytes
[in] | tid | Terminal ID, 8 bytes
[in] | ifdsn | IFD Serial, 8 bytes
[in] | tvp | time-varying parameter, 8 bytes
[in] | rand | value from external RNG, 8 bytes, optional (shall be NULL if not available)
[in] | p | pre-image of UN, 32 bytes
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_OUTPUT | If q is the pointer NULL
UCL_INVALID_INPUT | If tid is the pointer NULL
UCL_INVALID_INPUT | If ifdsn is the pointer NULL
UCL_INVALID_INPUT | If tvp is the pointer NULL
UCL_INVALID_INPUT | If p is the pointer NULL

◆ ucl_emv_unpredictable_number_transaction_p_refresh()

int ucl_emv_unpredictable_number_transaction_p_refresh | ( | u8 * | p,
 |  | u8 * | tvp,
 |  | u8 * | rand,
 |  | u8 * | ac
 | ) |  |

RNG Read.

EMV Unpredictable Number generation per transaction P refresh see EMV bulletin no144 (june-2014)

Parameters
[in,out] | p | pre-image of UN, 32 bytes
[in] | tvp | time-varying parameter, 8 bytes
[in] | rand | value from external RNG, 8 bytes, optional (shall be NULL if not available)
[in] | ac | application cryptogram, 8 bytes
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_OUTPUT | If p is the pointer NULL
UCL_INVALID_INPUT | If tvp is the pointer NULL
UCL_INVALID_INPUT | If ac is the pointer NULL

◆ ucl_emv_unpredictable_number_transaction_un_generation()

int ucl_emv_unpredictable_number_transaction_un_generation | ( | u8 * | un,
 |  | u8 * | rand,
 |  | u8 * | p
 | ) |  |

RNG Read.

EMV Unpredictable Number generation see EMV bulletin no144 (june-2014)

Parameters
[out] | un | unpredictable number, 4 bytes
[in] | rand | value from external RNG, 8 bytes, optional (shall be NULL if not available)
[in] | p | pre-image of UN, 32 bytes
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_OUTPUT | If un is the pointer NULL
UCL_INVALID_INPUT | If p is the pointer NULL

◆ ucl_fips_rng_read()

int ucl_fips_rng_read | ( | u8 * | rand,
 |  | u32 | rand_byteLen,
 |  | int | option
 | ) |  |

FIPS 140-2 RNG Read.

Read random octet string using the attached RNG. in a FIPS 140-2 compliant way (being sure the entropy is maximum) it is slower than the ucl_rng_read() function

Parameters
[out] | rand | Random octet string
[in] | rand_byteLen | Random byte length
[in] option A value between:
  • UCL_RAND_DEFAULT
  • UCL_RAND_NO_NULL
Returns
Error code or a positive value equal to the generated byte number
Return values
UCL_INVALID_INPUT | in case of incorrect option
UCL_INVALID_OUTPUT | in case of rand pointer equal to NULL
UCL_TRNG_ERROR | in case of TRNG malfunctioning
otherwise,returns | the number of bytes effectively generated

◆ ucl_fips_rng_stest()

int ucl_fips_rng_stest ( void )

FIPS 140 RNG quality testing.

FIPS 140 TRNG quality testing testing performed on 20Kbits directly from the TRNG using the FIPS-compliant TRNG access function testing consisting in FIPS 140 max-run test, runs test, poker test

Returns
Error code
Return values
UCL_OK | No error occurred
UCL_ERROR | error has occurred

◆ ucl_lowlevel_rng_read()

int ucl_lowlevel_rng_read | ( | u8 * | rand,
 |  | u32 | rand_byteLen,
 |  | int | option
 | ) |  |

RNG Read.

Read random octet string using the hardware RNG.

Parameters
[out] | rand | Random octet string
[in] | rand_byteLen | Random byte length
[in] option A value between:
  • UCL_RAND_DEFAULT
  • UCL_RAND_NO_NULL
by default, this function is called by the ucl_rng_read
Returns
Error code or a positive value equal to the generated byte number
Return values
UCL_INVALID_INPUT | in case of incorrect option
UCL_INVALID_OUTPUT | in case of rand pointer equal to NULL
UCL_TRNG_ERROR | in case of TRNG malfunctioning
otherwise,returns | the number of bytes effectively generated

◆ ucl_rng_attach()

int ucl_rng_attach ( int(*)(u8 *rand, u32 rand_byteLen, int option) rng )

Attach.

Attach a RNG.

Parameters
[in] rng The pointer to the RNG
Returns
Error code
Return values
UCL_OK No error occurred

◆ ucl_rng_detach()

int ucl_rng_detach ( void )

Detach.

Detach the previously attached RNG.

Returns
Error code
Return values
UCL_OK No error occurred

◆ ucl_rng_getpt()

void* ucl_rng_getpt ( void )

Get pointer.

Get the pointer of the current RNG.

Returns
A function pointer

◆ ucl_rng_read()

int ucl_rng_read | ( | u8 * | rand,
 |  | u32 | rand_byteLen,
 |  | int | option
 | ) |  |

RNG Read.

Read random octet string using the attached RNG.

Parameters
[out] | rand | Random octet string
[in] | rand_byteLen | Random byte length
[in] option A value between:
  • UCL_RAND_DEFAULT
  • UCL_RAND_NO_NULL
by default, this function calls the ucl_lowlevel_rng_read if the ucl_rng_attach function has been used, this function calls the new RNG function
Returns
Error code or a positive value equal to the generated byte number
Return values
UCL_INVALID_INPUT | in case of incorrect option
UCL_INVALID_OUTPUT | in case of rand pointer equal to NULL
UCL_TRNG_ERROR | in case of TRNG malfunctioning
otherwise,returns | the number of bytes effectively generated

◆ ucl_rng_stest()

int ucl_rng_stest ( void )

RNG quality testing.

TRNG quality testing testing performed on 20Kbits directly from the TRNG or indirectly with SHA-256 post-process testing consisting in FIPS 140 max-run test, runs test, poker test

Returns
Error code
Return values
UCL_OK | No error occurred
UCL_ERROR | error has occurred

◆ ucl_sha256_whitening_rng_read()

int ucl_sha256_whitening_rng_read | ( | u8 * | rand,
 |  | u32 | rand_byteLen
 | ) |  |

RNG Read with postprocess.

Read random octet string using the attached RNG postprocessed with SHA-256

Parameters
[out] | rand | Random octet string
[in] | rand_byteLen | Random byte length
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_OUTPUT | If rand is the pointer NULL
UCL_NOP | If rand_byteLen = 0
UCL_ERROR | if there is no interface to the TRNG

◆ ucl_sha256_whitening_rng_read_generic()

int ucl_sha256_whitening_rng_read_generic | ( | u8 * | rand,
 |  | u32 | rand_byteLen,
 |  | int | option
 | ) |  |

RNG Read with postprocess.

Read random octet string using the attached RNG postprocessed with SHA-256

Parameters
[out] | rand | Random octet string
[in] | rand_byteLen | Random byte length
[in] option A value between:
  • UCL_RAND_DEFAULT
  • UCL_RAND_NO_NULL
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_OUTPUT | If rand is the pointer NULL
UCL_NOP | If rand_byteLen = 0
UCL_ERROR | if there is no interface to the TRNG

◆ ucl_sha256_whitening_rng_read_leading_non_zero()

int ucl_sha256_whitening_rng_read_leading_non_zero | ( | u8 * | rand,
 |  | u32 | rand_byteLen
 | ) |  |

RNG Read with postprocess.

Read random octet string using the attached RNG postprocessed with SHA-256 the first byte is not null

Parameters
[out] | rand | Random octet string
[in] | rand_byteLen | Random byte length
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_OUTPUT | If rand is the pointer NULL
UCL_NOP | If rand_byteLen = 0
UCL_ERROR | if there is no interface to the TRNG

◆ ucl_sha256_whitening_rng_read_non_zero()

int ucl_sha256_whitening_rng_read_non_zero | ( | u8 * | rand,
 |  | u32 | rand_byteLen
 | ) |  |

RNG Read with postprocess.

Read random octet string using the attached RNG postprocessed with SHA-256 no null byte is produced

Parameters
[out] | rand | Random octet string
[in] | rand_byteLen | Random byte length
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_OUTPUT | If rand is the pointer NULL
UCL_NOP | If rand_byteLen = 0
UCL_ERROR | if there is no interface to the TRNG

◆ ucl_sm3_whitening_rng_read()

int ucl_sm3_whitening_rng_read | ( | u8 * | rand,
 |  | u32 | rand_byteLen
 | ) |  |

RNG Read with postprocess.

Read random octet string using the attached RNG postprocessed with SM3

Parameters
[out] | rand | Random octet string
[in] | rand_byteLen | Random byte length
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_OUTPUT | If rand is the pointer NULL
UCL_NOP | If rand_byteLen = 0
UCL_ERROR | if there is no interface to the TRNG

◆ ucl_sm3_whitening_rng_read_leading_non_zero()

int ucl_sm3_whitening_rng_read_leading_non_zero | ( | u8 * | rand,
 |  | u32 | rand_byteLen
 | ) |  |

RNG Read with postprocess.

Read random octet string using the attached RNG postprocessed with SM3 the first byte is not null

Parameters
[out] | rand | Random octet string
[in] | rand_byteLen | Random byte length
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_OUTPUT | If rand is the pointer NULL
UCL_NOP | If rand_byteLen = 0
UCL_ERROR | if there is no interface to the TRNG

◆ ucl_sm3_whitening_rng_read_non_zero()

int ucl_sm3_whitening_rng_read_non_zero | ( | u8 * | rand,
 |  | u32 | rand_byteLen
 | ) |  |

RNG Read with postprocess.

Read random octet string using the attached RNG postprocessed with SM3 no null byte is produced

Parameters
[out] | rand | Random octet string
[in] | rand_byteLen | Random byte length
Returns
Error code
Return values
UCL_OK | No error occurred
UCL_INVALID_OUTPUT | If rand is the pointer NULL
UCL_NOP | If rand_byteLen = 0
UCL_ERROR | if there is no interface to the TRNG

◆ ucl_sp80090a_rng_read()

int __API__ ucl_sp80090a_rng_read | ( | u8 * | rand,
 |  | u32 | rand_byteLen,
 |  | int | rand_option,
 |  | int | prediction_resistance_option
 | ) |  |

SP800-90A RNG Read.

Read random octet string using SP800-90A RNG SHA-256 HASH DRBG. This function adjusts the entropy and nonce input w.r.t SP800-90A specifications and assumes the caller needs UCL_MAX_SECURITY_BITS of security. It re-seeds automatically.

Parameters
[out] | rand | Random octet string
[in] | rand_byteLen | Random byte length
[in] rand_option A value between:
  • UCL_RAND_DEFAULT
  • UCL_RAND_NO_NULL
  • UCL_RAND_LEADING_NONZERO
[in] prediction_resistance_option A value between:
  • #PREDICTION_RESISTANT_READ
  • #NON_PREDICTION_RESISTANT_READ
Returns
Error code or a positive value equal to the generated byte number
Return values
UCL_INVALID_ARG | in case of incorrect option
UCL_INVALID_OUTPUT | in case of rand pointer equal to NULL
UCL_TRNG_ERROR | in case of TRNG malfunctioning
UCL_OK | in case of success


Universal Crypto Library: SP800-90A interface

Data Structures | Functions
SP800-90A interface
Random

SP800-90A Hash DRBG-compliant source for random numbers. More...

+ Collaboration diagram for SP800-90A interface:

Data Structures

struct ucl_sp80090a_internal_state_t
SP800-90A Hash DRBG Internal State structure. More...

Functions

int __API__ | ucl_sp80090a_hash_df_sha256 (u8 *requested_bits, u8 *entropy_input, u32 entropy_input_len, u8 *nonce, u32 nonce_len, u8 *personalization_string, u32 personalization_string_len, u32 nb_of_bits_to_return)
SP800690A hash DRBG hash_df function based on SHA-256. More...
int __API__ | ucl_sp80090a_reseeding_sha256 (ucl_sp80090a_internal_state_t *internal_state, u8 *entropy_input, u32 entropy_input_len, u8 *additional_input, u32 additional_input_len)
SP800690A hash DRBG internal state reseeding based on SHA-256. More...
int __API__ | ucl_sp80090a_instantiate_sha256 (ucl_sp80090a_internal_state_t *internal_state, u8 *entropy_input, u32 entropy_input_len, u8 *nonce, u32 nonce_len, u8 *personalization_string, u32 personalization_string_len)
SP800690A hash DRBG internal state instantiation based on SHA-256. More...
int __API__ | hashgen_sha256 (u8 *requested_bits, int nb_of_bits_to_return, u8 *v)
SP800690A hashgen function based on SHA-256. More...
int __API__ | ucl_sp80090a_hash_drbg_sha256_generate (u8 *requested_bits, int nb_of_bits_to_return, ucl_sp80090a_internal_state_t *internal_state, u8 *additional_input, int additional_input_len)
SP800690A bits generation function based on SHA-256 . More...

Detailed Description

SP800-90A Hash DRBG-compliant source for random numbers.

Header:
ucl_sp80090a_hash_drbg.h

Function Documentation

◆ hashgen_sha256()

int __API__ hashgen_sha256 | ( | u8 * | requested_bits,
 |  | int | nb_of_bits_to_return,
 |  | u8 * | v
 | ) |  |

SP800690A hashgen function based on SHA-256.

this function returns generated bits to the generate function defined p43

Parameters
[out] | requested_bits | the pointer to the requested bits
[in] | v | the pointer to the V value in the internal state
[in] | nb_of_bits_to_return | the requested bits number, expressed in bits, being a multiple of 8
Returns
Error code
Return values
UCL_OK
UCL_ERROR | if an error has occured in the hash df operation
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_INPUT | if one of the input is the pointer NULL

◆ ucl_sp80090a_hash_df_sha256()

int __API__ ucl_sp80090a_hash_df_sha256 | ( | u8 * | requested_bits,
 |  | u8 * | entropy_input,
 |  | u32 | entropy_input_len,
 |  | u8 * | nonce,
 |  | u32 | nonce_len,
 |  | u8 * | personalization_string,
 |  | u32 | personalization_string_len,
 |  | u32 | nb_of_bits_to_return
 | ) |  |

SP800690A hash DRBG hash_df function based on SHA-256.

this function is a derivation function using the SHA-256 hash function the input parameters are given as three distinct parameters instead of one single input_string as specified, to ease giving various kinds of parameters, with various lengths

Parameters
[out] | requested_bits | the pointer to the requested bits
[in] | entropy_input | the pointer to the string of bits obtained from the source of entropy input
[in] | entropy_input_len | The length in bytes of the entropy_input string
[in] | nonce | the pointer the string of the nonce string
[in] | nonce_len | the length in bytes of the nonce input string
[in] | personalization_string | the pointer the string of personalization string
[in] | personalization_string_len | the length in bytes of the personalization string
[in] | nb_of_bits_to_return | the requested bits number, expressed in bits, being a multiple of 8
Returns
Error code
Return values
UCL_OK
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_INPUT | if one of the input is the pointer NULL

◆ ucl_sp80090a_hash_drbg_sha256_generate()

int __API__ ucl_sp80090a_hash_drbg_sha256_generate | ( | u8 * | requested_bits,
 |  | int | nb_of_bits_to_return,
 |  | ucl_sp80090a_internal_state_t * | internal_state,
 |  | u8 * | additional_input,
 |  | int | additional_input_len
 | ) |  |

SP800690A bits generation function based on SHA-256 .

this function returns requested pseudorandom bits defined p42, section 10.1.1.4

Parameters
[out] | requested_bits | the pointer to the requested bits
[in] | nb_of_bits_to_return | the requested bits number, expressed in bits, being a multiple of 8
[in] | internal_state | the pointer to the internal state
[in] | additional_input | the pointer the string of additional input string received from the consuming applcation
[in] | additional_input_len | the length in bytes of the additional input string
Returns
Error code
Return values
UCL_OK
#UCL_RESEED_REQUIRED | if a reseeding is required; no bits are outputted
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_INPUT | if one of the input is the pointer NULL

◆ ucl_sp80090a_instantiate_sha256()

int __API__ ucl_sp80090a_instantiate_sha256 | ( | ucl_sp80090a_internal_state_t * | internal_state,
 |  | u8 * | entropy_input,
 |  | u32 | entropy_input_len,
 |  | u8 * | nonce,
 |  | u32 | nonce_len,
 |  | u8 * | personalization_string,
 |  | u32 | personalization_string_len
 | ) |  |

SP800690A hash DRBG internal state instantiation based on SHA-256.

this function instantiates the internal state, using the provided entropy input, the nonce and the personalization string

Parameters
[out] | internal_state | The pointer to the internal state structure
[in] | entropy_input | the pointer to the string of bits obtained from the source of entropy input
[in] | entropy_input_len | The length in bytes of the entropy_input string
[in] | nonce | the pointer the string of the nonce string
[in] | nonce_len | the length in bytes of the nonce input string
[in] | personalization_string | the pointer the string of personalization string
[in] | personalization_string_len | the length in bytes of the personalization string
[in] | additional_input | the pointer the string of additional input string received from the consuming applcation
[in] | additional_input_len | the length in bytes of the additional input string
Returns
Error code
Return values
UCL_OK
UCL_ERROR | if an error has occured in the hash df operation
UCL_INVALID_OUTPUT | if the output is the pointer NULL
UCL_INVALID_INPUT | if one of the input is the pointer NULL

◆ ucl_sp80090a_reseeding_sha256()

int __API__ ucl_sp80090a_reseeding_sha256 | ( | ucl_sp80090a_internal_state_t * | internal_state,
 |  | u8 * | entropy_input,
 |  | u32 | entropy_input_len,
 |  | u8 * | additional_input,
 |  | u32 | additional_input_len
 | ) |  |

SP800690A hash DRBG internal state reseeding based on SHA-256.

this function updates the internal state, using the provided entropy input and the additional input

Parameters


Universal Crypto Library: ucl_sp80090a_internal_state_t Struct Reference

Data Fields
ucl_sp80090a_internal_state_t Struct Reference
Random » SP800-90A interface

SP800-90A Hash DRBG Internal State structure. More...

Data Fields

u8 | v [UCL_SP800_90A_SHA512_SEEDLENGTH]
the value V, updated during each call
u8 | c [UCL_SP800_90A_SHA512_SEEDLENGTH]
the constant C, depending on the seed
u64 | reseed_counter
the reseed counter, indicating how many requests can be made since the instantiation or a reseeding
u64 | reseed_limit
the reseed limit number, requiring a reseeding if the reseed counter reaches this value

Detailed Description

SP800-90A Hash DRBG Internal State structure.

The implementation follow the specification. Therefore, the functions names are similar to the specification routines names.


Universal Crypto Library: USIP TRNG

Macros | Functions
USIP TRNG
Random

USIP® True Random Number Generation. More...

+ Collaboration diagram for USIP TRNG:

Macros

#define | UCL_RAND_LEADING_NONZERO 2
TRNG Interface Option. More...
#define | UCL_RAND_NO_NULL 1
TRNG Interface Option. More...
#define | UCL_RAND_DEFAULT 0
TRNG Interface Option. More...

Functions

int ucl_trng_read (u8 *rand, u32 rand_byteLen, int option)
USIP® TRNG Read. More...

Detailed Description

USIP® True Random Number Generation.

Header:
ucl_trng.h
Warning
The Linux UCL use the device '/dev/hwrandom' as source of random. If the file does not exists the ucl_init function will return an error.

Macro Definition Documentation

◆ UCL_RAND_DEFAULT

#define UCL_RAND_DEFAULT 0

TRNG Interface Option.

No constraint for the random output.

◆ UCL_RAND_LEADING_NONZERO

#define UCL_RAND_LEADING_NONZERO 2

TRNG Interface Option.

The random output does not contain null byte in the leading position.

◆ UCL_RAND_NO_NULL

#define UCL_RAND_NO_NULL 1

TRNG Interface Option.

The random output does not contain any null byte.

Function Documentation

◆ ucl_trng_read()

int ucl_trng_read | ( | u8 * | rand,
 |  | u32 | rand_byteLen,
 |  | int | option
 | ) |  |

USIP® TRNG Read.

Read random octet string from USIP® TRNG.

Parameters
[out] | rand | Random octet string
[in] | rand_byteLen | Random byte length
[in] option A value between:
  • UCL_RAND_DEFAULT
  • UCL_RAND_NO_NULL
Returns
Error code or a positive value equal to the generated byte number
Return values
UCL_INVALID_OUTPUT | If rand is the pointer NULL
UCL_NOP | If rand_byteLen = 0
UCL_NO_TRNG_INTERFACE | IF there is no interface to the USIP® TRNG


Universal Crypto Library: Data Structures

Data Structures
Here are the data structures with brief descriptions:
C me13_mxc_crypto_regs_t | Structure type to access the CRYPTO Registers
C RSA_PrKEY | RSA General Private Key
C RSA_PuKEY | RSA General Public Key
C RSACRT_KEY | General RSA Private Key for CRT
C sha3_ctx | The SHA3 context
C sm4_context | SM4 Key
C ucl_3des_ctx_t | 3DES Context
C ucl_aes_ctx_t | AES Context
C ucl_aes_key_t | AES Key
C ucl_des_ctx_t | DES Context
C ucl_dh_ctx_t | DH Context
C ucl_hdes_ctx_t | The HDES context
C ucl_rsa_crt_private_key_t | RSA CRT Private Key Structure
C ucl_rsa_private_key_t | RSA Private Key Structure
C ucl_rsa_public_key_t | RSA Public Key Structure
C ucl_sha256_ctx_t | The SHA256 context
C ucl_sia256_ctx_t | The SIA256 context
C ucl_sp80090a_internal_state_t | SP800-90A Hash DRBG Internal State structure
C ucl_tdes_ctx_t | TDES-CBC-MAC Context
C ucl_type_ecc_digit_affine_point | ECC word affine point coordinates
C ucl_type_ecc_jacobian_point | ECC word Jacobian point coordinates
C ucl_type_ecc_u8_affine_point | ECC byte affine point coordinates
C ucl_type_ecdsa_signature | ECC byte signature structure
C ucl_uaes_ctx_t | USIP® AES Context
C usip_aes_t | USIP® AES Interface definition


Universal Crypto Library: Data Structure Index

Data Structure Index
m | r | s | u
m
RSACRT_KEY ucl_aes_ctx ucl_rsa_public_key ucl_type_ecc_u8_affine_point
s
ucl_aes_key ucl_sha256_ctx ucl_type_ecdsa_signature
me13_mxc_crypto_regs_t ucl_des_ctx ucl_sia256_ctx ucl_uaes_ctx
r
sha3_ctx ucl_dh_ctx ucl_sp80090a_internal_state usip_aes
sm4_context ucl_hdes_ctx_t ucl_tdes_ctx
RSA_PrKEY
u
ucl_rsa_crt_private_key ucl_type_ecc_digit_affine_point
RSA_PuKEY ucl_rsa_private_key ucl_type_ecc_jacobian_point
ucl_3des_ctx
m | r | s | u


Universal Crypto Library: Data Fields

Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:

- b -

  • base : ucl_dh_ctx_t
  • buffer : ucl_hdes_ctx_t , ucl_sha256_ctx_t , ucl_sia256_ctx_t

- c -

  • c : ucl_sp80090a_internal_state_t
  • cipher_ctrl : me13_mxc_crypto_regs_t
  • cipher_init : me13_mxc_crypto_regs_t
  • cipher_key : me13_mxc_crypto_regs_t
  • coefficient : ucl_rsa_crt_private_key_t
  • count : ucl_hdes_ctx_t , ucl_sha256_ctx_t , ucl_sia256_ctx_t
  • crc_ctrl : me13_mxc_crypto_regs_t
  • crc_poly : me13_mxc_crypto_regs_t
  • crc_prng : me13_mxc_crypto_regs_t
  • crc_val : me13_mxc_crypto_regs_t
  • ctrl : me13_mxc_crypto_regs_t
  • ctx : ucl_dh_ctx_t

- d -

  • d : RSA_PrKEY
  • decrypt : usip_aes_t
  • des_ctx : ucl_tdes_ctx_t
  • din : me13_mxc_crypto_regs_t
  • dkeygen : usip_aes_t
  • dma_cnt : me13_mxc_crypto_regs_t
  • dma_dest : me13_mxc_crypto_regs_t
  • dma_src : me13_mxc_crypto_regs_t
  • dout : me13_mxc_crypto_regs_t
  • dp : RSACRT_KEY
  • dq : RSACRT_KEY

- e -

  • e : RSA_PuKEY
  • encrypt : usip_aes_t
  • exponent1 : ucl_rsa_crt_private_key_t
  • exponent2 : ucl_rsa_crt_private_key_t

- h -

  • ham_ecc : me13_mxc_crypto_regs_t
  • hash_ctrl : me13_mxc_crypto_regs_t
  • hash_digest : me13_mxc_crypto_regs_t
  • hash_msg_sz : me13_mxc_crypto_regs_t

- i -

  • index : ucl_3des_ctx_t , ucl_aes_ctx_t , ucl_des_ctx_t

- k -

  • key : ucl_aes_ctx_t , ucl_uaes_ctx_t
  • key2 : ucl_tdes_ctx_t

- l -

  • len : RSA_PrKEY , RSA_PuKEY , RSACRT_KEY , ucl_dh_ctx_t

- m -

  • memory : ucl_3des_ctx_t , ucl_aes_ctx_t , ucl_des_ctx_t , ucl_uaes_ctx_t
  • mode : ucl_3des_ctx_t , ucl_aes_ctx_t , ucl_des_ctx_t , ucl_uaes_ctx_t
  • module : ucl_dh_ctx_t
  • modulus : ucl_rsa_private_key_t , ucl_rsa_public_key_t
  • modulus_length : ucl_rsa_crt_private_key_t , ucl_rsa_private_key_t , ucl_rsa_public_key_t

- n -

  • n : RSA_PrKEY , RSA_PuKEY

- o -

  • origin_key : ucl_aes_ctx_t

- p -

  • p : RSACRT_KEY
  • prime1 : ucl_rsa_crt_private_key_t
  • prime2 : ucl_rsa_crt_private_key_t
  • private_exponent : ucl_rsa_private_key_t
  • public_exponent : ucl_rsa_crt_private_key_t , ucl_rsa_public_key_t
  • public_exponent_length : ucl_rsa_crt_private_key_t , ucl_rsa_public_key_t

- q -

  • q : RSACRT_KEY
  • qInv : RSACRT_KEY

- r -

  • r : ucl_type_ecdsa_signature
  • rd_key : ucl_aes_key_t
  • reseed_counter : ucl_sp80090a_internal_state_t
  • reseed_limit : ucl_sp80090a_internal_state_t
  • rounds : ucl_aes_key_t

- s -

  • s : ucl_type_ecdsa_signature
  • secret : ucl_dh_ctx_t
  • setkey : usip_aes_t
  • state : ucl_hdes_ctx_t , ucl_sha256_ctx_t , ucl_sia256_ctx_t
  • subKeys : ucl_3des_ctx_t , ucl_des_ctx_t

- v -

  • v : ucl_sp80090a_internal_state_t

- x -

  • x : ucl_type_ecc_digit_affine_point , ucl_type_ecc_jacobian_point , ucl_type_ecc_u8_affine_point

- y -

  • y : ucl_type_ecc_digit_affine_point , ucl_type_ecc_jacobian_point , ucl_type_ecc_u8_affine_point

- z -

  • z : ucl_type_ecc_jacobian_point


Universal Crypto Library: Data Fields - Variables

- b -

  • base : ucl_dh_ctx_t
  • buffer : ucl_hdes_ctx_t , ucl_sha256_ctx_t , ucl_sia256_ctx_t

- c -

  • c : ucl_sp80090a_internal_state_t
  • cipher_ctrl : me13_mxc_crypto_regs_t
  • cipher_init : me13_mxc_crypto_regs_t
  • cipher_key : me13_mxc_crypto_regs_t
  • coefficient : ucl_rsa_crt_private_key_t
  • count : ucl_hdes_ctx_t , ucl_sha256_ctx_t , ucl_sia256_ctx_t
  • crc_ctrl : me13_mxc_crypto_regs_t
  • crc_poly : me13_mxc_crypto_regs_t
  • crc_prng : me13_mxc_crypto_regs_t
  • crc_val : me13_mxc_crypto_regs_t
  • ctrl : me13_mxc_crypto_regs_t
  • ctx : ucl_dh_ctx_t

- d -

  • d : RSA_PrKEY
  • decrypt : usip_aes_t
  • des_ctx : ucl_tdes_ctx_t
  • din : me13_mxc_crypto_regs_t
  • dkeygen : usip_aes_t
  • dma_cnt : me13_mxc_crypto_regs_t
  • dma_dest : me13_mxc_crypto_regs_t
  • dma_src : me13_mxc_crypto_regs_t
  • dout : me13_mxc_crypto_regs_t
  • dp : RSACRT_KEY
  • dq : RSACRT_KEY

- e -

  • e : RSA_PuKEY
  • encrypt : usip_aes_t
  • exponent1 : ucl_rsa_crt_private_key_t
  • exponent2 : ucl_rsa_crt_private_key_t

- h -

  • ham_ecc : me13_mxc_crypto_regs_t
  • hash_ctrl : me13_mxc_crypto_regs_t
  • hash_digest : me13_mxc_crypto_regs_t
  • hash_msg_sz : me13_mxc_crypto_regs_t

- i -

  • index : ucl_3des_ctx_t , ucl_aes_ctx_t , ucl_des_ctx_t

- k -

  • key : ucl_aes_ctx_t , ucl_uaes_ctx_t
  • key2 : ucl_tdes_ctx_t

- l -

  • len : RSA_PrKEY , RSA_PuKEY , RSACRT_KEY , ucl_dh_ctx_t

- m -

  • memory : ucl_3des_ctx_t , ucl_aes_ctx_t , ucl_des_ctx_t , ucl_uaes_ctx_t
  • mode : ucl_3des_ctx_t , ucl_aes_ctx_t , ucl_des_ctx_t , ucl_uaes_ctx_t
  • module : ucl_dh_ctx_t
  • modulus : ucl_rsa_private_key_t , ucl_rsa_public_key_t
  • modulus_length : ucl_rsa_crt_private_key_t , ucl_rsa_private_key_t , ucl_rsa_public_key_t

- n -

  • n : RSA_PrKEY , RSA_PuKEY

- o -

  • origin_key : ucl_aes_ctx_t

- p -

  • p : RSACRT_KEY
  • prime1 : ucl_rsa_crt_private_key_t
  • prime2 : ucl_rsa_crt_private_key_t
  • private_exponent : ucl_rsa_private_key_t
  • public_exponent : ucl_rsa_crt_private_key_t , ucl_rsa_public_key_t
  • public_exponent_length : ucl_rsa_crt_private_key_t , ucl_rsa_public_key_t

- q -

  • q : RSACRT_KEY
  • qInv : RSACRT_KEY

- r -

  • r : ucl_type_ecdsa_signature
  • rd_key : ucl_aes_key_t
  • reseed_counter : ucl_sp80090a_internal_state_t
  • reseed_limit : ucl_sp80090a_internal_state_t
  • rounds : ucl_aes_key_t

- s -

  • s : ucl_type_ecdsa_signature
  • secret : ucl_dh_ctx_t
  • setkey : usip_aes_t
  • state : ucl_hdes_ctx_t , ucl_sha256_ctx_t , ucl_sia256_ctx_t
  • subKeys : ucl_3des_ctx_t , ucl_des_ctx_t

- v -

  • v : ucl_sp80090a_internal_state_t

- x -

  • x : ucl_type_ecc_digit_affine_point , ucl_type_ecc_jacobian_point , ucl_type_ecc_u8_affine_point

- y -

  • y : ucl_type_ecc_digit_affine_point , ucl_type_ecc_jacobian_point , ucl_type_ecc_u8_affine_point

- z -

  • z : ucl_type_ecc_jacobian_point


Universal Crypto Library: /var/lib/jenkins/build/workspace/MnS/Universal_Crypto_Library/docs/modules Directory Reference

  • docs
  • modules
modules Directory Reference


Universal Crypto Library: /var/lib/jenkins/build/workspace/MnS/Universal_Crypto_Library/include/ucl Directory Reference

  • include
  • ucl
ucl Directory Reference

Files

file | ecdsa_generic_api.h
file | sm4.h
file | ucl_3des.h
file | ucl_3des_cbc.h
file | ucl_3des_cfb.h
file | ucl_3des_cmac.h
file | ucl_3des_ecb.h
file | ucl_3des_ofb.h
file | ucl_aes.h
file | ucl_aes_cbc.h
file | ucl_aes_cbc_mac.h
file | ucl_aes_ccm.h
file | ucl_aes_cmac.h
file | ucl_aes_ctr.h
file | ucl_aes_ecb.h
file | ucl_aes_gcm.h
file | ucl_data_conv.h
file | ucl_des.h
file | ucl_des_cbc.h
file | ucl_des_cbc_mac.h
file | ucl_des_cfb.h
file | ucl_des_ecb.h
file | ucl_des_ofb.h
file | ucl_dh.h
file | ucl_hdes.h
file | ucl_hmac_md5.h
file | ucl_hmac_ripemd160.h
file | ucl_hmac_sha1.h
file | ucl_hmac_sha224.h
file | ucl_hmac_sha256.h
file | ucl_hmac_sha384.h
file | ucl_hmac_sha512.h
file | ucl_info.h
file | ucl_misc_math.h
file | ucl_pkcs1_es_oaep_md5.h
file | ucl_pkcs1_es_oaep_ripemd160.h
file | ucl_pkcs1_es_oaep_sha1.h
file | ucl_pkcs1_es_oaep_sha224.h
file | ucl_pkcs1_es_oaep_sha256.h
file | ucl_pkcs1_es_oaep_sha384.h
file | ucl_pkcs1_es_oaep_sha512.h
file | ucl_pkcs1_es_pkcs1v15.h
file | ucl_pkcs1_mgf1.h
file | ucl_pkcs1_ssa_pkcs1v15.h
file | ucl_pkcs1_ssa_pkcs1v15_md5.h
file | ucl_pkcs1_ssa_pkcs1v15_ripemd160.h
file | ucl_pkcs1_ssa_pkcs1v15_sha1.h
file | ucl_pkcs1_ssa_pkcs1v15_sha224.h
file | ucl_pkcs1_ssa_pkcs1v15_sha256.h
file | ucl_pkcs1_ssa_pkcs1v15_sha384.h
file | ucl_pkcs1_ssa_pkcs1v15_sha512.h
file | ucl_pkcs1_ssa_pss.h
file | ucl_pkcs1_ssa_pss_md5.h
file | ucl_pkcs1_ssa_pss_ripemd160.h
file | ucl_pkcs1_ssa_pss_sha1.h
file | ucl_pkcs1_ssa_pss_sha224.h
file | ucl_pkcs1_ssa_pss_sha256.h
file | ucl_pkcs1_ssa_pss_sha384.h
file | ucl_pkcs1_ssa_pss_sha512.h
file | ucl_pkcs5_pbkdf2.h
file | ucl_retdefs.h
file | ucl_rng.h
file | ucl_rsa.h
file | ucl_sha224.h
file | ucl_sha256.h
file | ucl_sha3.h
SHA3 Algorithm context.
file | ucl_sha384.h
file | ucl_sia256.h
file | ucl_sm3.h
file | ucl_sp80090a_hash_drbg.h
file | ucl_sp800_56.h
file | ucl_stack.h
file | ucl_stest.h
file | ucl_sys.h
file | ucl_tdes_cbc_mac.h
file | ucl_trng.h
file | ucl_uaes.h
file | ucl_uaes_cbc.h
file | ucl_uaes_ecb.h


Universal Crypto Library: /var/lib/jenkins/build/workspace/MnS/Universal_Crypto_Library/docs Directory Reference

  • docs
docs Directory Reference

Directories

Maxim Integrated 2.5.18


Universal Crypto Library: /var/lib/jenkins/build/workspace/MnS/Universal_Crypto_Library/include Directory Reference

  • include
include Directory Reference

Directories

Maxim Integrated 2.5.18


Universal Crypto Library: Graph Legend

Graph Legend

This page explains how to interpret the graphs that are generated by doxygen.

Consider the following example:

/*! Invisible class because of truncation */
class Invisible { };
/*! Truncated class, inheritance relation is hidden */
class Truncated : public Invisible { };
/* Class not documented with doxygen comments */
class Undocumented { };
/*! Class that is inherited using public inheritance */
class PublicBase : public Truncated { };
/*! A template class */
template<class T> class Templ { };
/*! Class that is inherited using protected inheritance */
class ProtectedBase { };
/*! Class that is inherited using private inheritance */
class PrivateBase { };
/*! Class that is used by the Inherited class */
class Used { };
/*! Super class that inherits a number of other classes */
class Inherited : public PublicBase,
protected ProtectedBase,
private PrivateBase,
public Undocumented,
public Templ<int>
{
private:
Used *m_usedClass;
};

This will result in the following graph:

The boxes in the above graph have the following meaning:

  • A filled gray box represents the struct or class for which the graph is generated.
  • A box with a black border denotes a documented struct or class.
  • A box with a gray border denotes an undocumented struct or class.
  • A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries.

The arrows have the following meaning:

  • A dark blue arrow is used to visualize a public inheritance relation between two classes.
  • A dark green arrow is used for protected inheritance.
  • A dark red arrow is used for private inheritance.
  • A purple dashed arrow is used if a class is contained or used by another class. The arrow is labelled with the variable(s) through which the pointed class or struct is accessible.
  • A yellow dashed arrow denotes a relation between a template instance and the template class it was instantiated from. The arrow is labelled with the template parameters of the instance.


Universal Crypto Library: Main Page

Universal Crypto Library Documentation

This section describes the Universal Crypto Library [UCL]. It provides the means to reach some information security objectives.

  • Privacy or confidentiality
  • Data integrity
  • Entity authentication or identification
  • Signature
See also
Release Notes, Universal Crypto Library Integration, Documentation Confidentiality, Disclaimer, Configuration, Warning, and Recommendations
Author
Maxim Integrated - Micros & Security BU


Universal Crypto Library: Related Pages

Related Pages
Here is a list of all related documentation pages:
Confidentiality and Disclaimer |
Configuration and Use |
Integration |
References | Cryptographic References: Standard
Release Notes |
Version Information | The library is based on different modules and for certification process each module has its own version
Warning and Recommendations |
Deprecated List |