Data Structures | |
| struct | C4eElement |
| Element of a set/field, a big number or binary polynomial. More... | |
Modules | |
| Architecture | |
| Symmetric Ciphers | |
| Discrete Logarithm Cryptography (DLC) | |
Fundamental declarations and definitions for algorithms based on discrete logarithm problem. | |
| Elliptic Curve Cryptography (ECC) | |
| Hash | |
| Random | |
| RSA | |
Defines | |
| #define | C4E_FALSE |
| #define | C4E_TRUE |
Typedefs | |
| typedef C4eArchUint | C4eSysStatus |
| typedef int | C4eSysBool |
| Boolean type. | |
Functions | |
| void | c4e_elem_os2e (C4E_CONST C4eArchUint8 *C4E_RESTRICT osp, C4eArchSize len, C4eElement *C4E_RESTRICT elem) |
| Octet string to element conversion primitive, according to IEEE Std 1363, section 5.5 and NIST SP800-56A, appendix C. | |
| C4eArchSize | c4e_elem_e2os (C4E_CONST C4eElement *C4E_RESTRICT elem, C4eArchSize bufsize, C4eArchUint8 *C4E_RESTRICT buf) |
| Element to octet string conversion primitive, according to IEEE Std 1363, section 5.5 and NIST SP800-56A, appendix C. | |
Error Numbers | |
|
| |
| #define | C4E_STATUS_OK |
| #define | C4E_STATUS_ERNG |
| #define | C4E_STATUS_EMOD |
| #define | C4E_STATUS_EKEYPRV |
| #define | C4E_STATUS_EKEYPUB |
| #define | C4E_STATUS_ELENGTH |
| #define | C4E_STATUS_ECODING |
| #define | C4E_STATUS_EASN1 |
| #define | C4E_STATUS_EVERIFY |
| #define | C4E_STATUS_EDOM |
| #define | C4E_STATUS_ERANGE |
| #define C4E_FALSE |
| #define C4E_TRUE |
| #define C4E_STATUS_OK |
C4eSysStatus: success
| #define C4E_STATUS_ERNG |
C4eSysStatus: RNG fault
| #define C4E_STATUS_EMOD |
C4eSysStatus: wrong modulus
| #define C4E_STATUS_EKEYPRV |
C4eSysStatus: wrong private key, respective CRT coefficient
| #define C4E_STATUS_EKEYPUB |
C4eSysStatus: wrong public key
| #define C4E_STATUS_ELENGTH |
C4eSysStatus: octet string length error (digest, signature, plain/cipher block)
| #define C4E_STATUS_ECODING |
C4eSysStatus: encoding (padding) error
| #define C4E_STATUS_EASN1 |
C4eSysStatus: ASN.1 decoding error
| #define C4E_STATUS_EVERIFY |
C4eSysStatus: signature verification error
| #define C4E_STATUS_EDOM |
C4eSysStatus: no result/solution in group/field (domain)
| #define C4E_STATUS_ERANGE |
C4eSysStatus: big number or polynomial out of range
| typedef C4eArchUint C4eSysStatus |
Return status, e.g. C4E_STATUS_OK
| void c4e_elem_os2e | ( | C4E_CONST C4eArchUint8 *C4E_RESTRICT | osp, | |
| C4eArchSize | len, | |||
| C4eElement *C4E_RESTRICT | elem | |||
| ) |
Octet string to element conversion primitive, according to IEEE Std 1363, section 5.5 and NIST SP800-56A, appendix C.
Converts a big number or binary polynomial (set/field element) from octet string (in network byte order) to internal representation.
len is shorter than the number osp represents then the least-significant bits/bytes are lost.elem->digits (in number of digits according to elem->size) must be at least: C4E_ELEM_DIGITS_NUM(len)
elem is normalized.| [in] | osp | Octet string pointer (network byte order, means most significant byte at lowest position). |
| [in] | len | Number of bytes in osp array (octet string). If len is zero, then elem becomes number zero. |
| [out] | elem | Pointer to set/field element (least significant digit first, means at lowest position) |
| C4eArchSize c4e_elem_e2os | ( | C4E_CONST C4eElement *C4E_RESTRICT | elem, | |
| C4eArchSize | bufsize, | |||
| C4eArchUint8 *C4E_RESTRICT | buf | |||
| ) |
Element to octet string conversion primitive, according to IEEE Std 1363, section 5.5 and NIST SP800-56A, appendix C.
Converts a big number or binary polynomial (set/field element) from internal representation into an octet string, where the first octet/byte (located at address buf) has most significance (network byte order). More control allows parameter bufsize:
bufsize is zero, then the converted element in buf will be normalized (the smallest representation of elem without leading zeros);bufsize is less than the number of bytes needed for a normalized representation of elem, then the converted element in buf is truncated (and so may be unusual);bufsize is greater then the number of bytes needed for a normalized representation of elem, then the leading bytes are filled with zero.| [in] | elem | Pointer to set/field element to be converted. |
| [in] | bufsize | Number of bytes expected in buffer buf. |
| [out] | buf | Output buffer, getting converted element elem in network byte order (most significant byte first, means at lowest address). |
elem. In case bufsize was greater than zero, then:buf was truncated, if the return value is greater than bufsize;buf is filled with leading zeros up to bufsize, if the return value is less/equal than bufsize.
1.6.1