Modules | |
Binary Field EC Temp. Space Qualifiers | |
Temp. space qualifiers for EC based cryptography over binary field. | |
EC Diffie-Hellman (ECDH) over binary fields | |
Diffie-Hellman shared secret computation in elliptic curve (EC) domain over binary field . | |
Elliptic Curve Digital Signature Algorithm (ECDSA) | |
Elliptic Curve Digital Signature Algorithm (ECDSA). | |
Functions | |
C4eSysStatus | c4e_ecc2n_domchk (C4eArchUint algos, C4E_CONST C4eEcDomain *dom, C4eArchDigit *C4E_RESTRICT tmp) |
A simple (and fast) domain parameter validity test for elliptic curves over binary field . | |
C4eSysStatus | c4e_ecc2n_keychk_prv (C4eArchUint algos, C4E_CONST C4eEcDomain *C4E_RESTRICT dom, C4E_CONST C4eElement *C4E_RESTRICT d, C4eArchDigit tmp[C4E_RESTRICT]) |
Elliptic curve (EC) over binary field private key validity test. | |
C4eSysStatus | c4e_ecc2n_keychk_pub (C4eArchUint algos, C4E_CONST C4eEcDomain *C4E_RESTRICT dom, C4E_CONST C4eEcPoint *C4E_RESTRICT q, C4eArchDigit tmp[C4E_RESTRICT]) |
Elliptic curve (EC) over binary field public key validity test. | |
C4eArchSize | c4e_ecc2n_pt2os (C4E_CONST C4eEcDomain *C4E_RESTRICT dom, C4E_CONST C4eEcPoint *C4E_RESTRICT pt, C4eArchUint ptfmt, C4eArchDigit tmp[C4E_RESTRICT], C4eArchSize bufsize, C4eArchUint8 *C4E_RESTRICT buf) |
Elliptic curve point to octet string conversion primitive, according to ANSI X9.63, section 4.3.6 and 4.2.2 and IEEE Std 1363, section A.9.6 and annex E.2.3. | |
C4eSysStatus | c4e_ecc2n_os2pt (C4E_CONST C4eEcDomain *C4E_RESTRICT dom, C4E_CONST C4eArchUint8 *C4E_RESTRICT osp, C4eArchSize len, C4eArchDigit tmp[C4E_RESTRICT], C4eEcPoint *C4E_RESTRICT pt) |
Octet string to elliptic curve point conversion primitive, according to ANSI X9.63, section 4.3.7 and 4.2.2 and IEEE Std 1363, section A.9.6 and annex E.2.3. | |
Binary Field ECC Algorithm Identifiers | |
Algorithm identifiers for ECC over binary field , to be used as parameter to c4e_ecc2n_domchk(). | |
#define | C4E_ECC2N_ALGO_NONE |
"unspecific" algorithm identifier. | |
#define | C4E_ECC2N_ALGO_DH |
ECDH algorithm identifier. | |
#define | C4E_ECC2N_ALGO_DSA |
ECDSA algorithm identifier. | |
#define | C4E_ECC2N_ALGO_ALL |
"all" algorithm identifier. |
C4eSysStatus c4e_ecc2n_domchk | ( | C4eArchUint | algos, | |
C4E_CONST C4eEcDomain * | dom, | |||
C4eArchDigit *C4E_RESTRICT | tmp | |||
) |
A simple (and fast) domain parameter validity test for elliptic curves over binary field .
Function c4e_ecc2n_domchk() checks the following conditions:
dom->m.val
must not be m(x) = 0, not m(x) = 1 and must not have a common (polynomial) factor x.dom->m.val
must be less/equal than C4E_ELEM_DIGITS_NUM(dom->m.len
).dom->m.len
must be less/equal C4E_EC_GF_BYTES_MAX (if defined).dom->a
and dom->b
must be less than dom->m.val
.dom->b
must not be zero (dom->a
is allowed to be zero, then elliptic curve E is a Koblitz curve).dom->q.val
must be greater than zero and odd (because #G must be a prime number).dom->q.val
must be less than the equivalent value derived from dom->q.len
.dom->q.val
must be less than the maximum group order of elliptic curve E (see C4E_EC_FIELD_DIGITS_MAX).dom->h
must be less than dom->q
(only if bit C4E_ECC2N_ALGO_DH set in algos
).algos
).tmp
is unequal to NULL
and bit C4E_ECC2N_ALGO_DSA set in algos
).So this function is able to check conditions #1, #2, #4, #5 and #7 of ANSI X9.62 section 5.1.2.2.
tmp
[], using macro C4E_ECC2N_TMP_NUM() in conjunction with temp. space qualifier C4E_ECC2N_TMPID_DOM_CHECK. Currently this is needed only if C4E_ECC2N_ALGO_DSA is set in algos
and the base point G must be validated by extended test (see last point of description).[in] | algos | Algorithm identifiers to check domain parameters for (or'ed together). |
[in] | dom | Pointer to domain parameters. |
tmp | Array of temporary space elements (see preconditions for details on size). Currently parameter tmp is allowed to be NULL if C4E_ECC2N_ALGO_DSA is not set in algos or the extended test should not be performed. |
dom
. C4E_STATUS_OK | If the domain parameters are usable for all calculations (valid in the sense of this implementation). | |
other | If one of the domain parameters is invalid. |
C4eSysStatus c4e_ecc2n_keychk_prv | ( | C4eArchUint | algos, | |
C4E_CONST C4eEcDomain *C4E_RESTRICT | dom, | |||
C4E_CONST C4eElement *C4E_RESTRICT | d, | |||
C4eArchDigit | tmp[C4E_RESTRICT] | |||
) |
Elliptic curve (EC) over binary field private key validity test.
The function validates parameter d
with respect to:
dom
must be assured by the caller, either implicit or by using function c4e_ecc2n_domchk(). dom
must be normalized, e.g. by using functions c4e_elem_norm(), c4e_elem_os2e() and/or c4e_ecc2n_os2pt(). d
, which is a big number, must be normalized, e.g. by using functions c4e_elem_norm() or c4e_elem_os2e().[in] | algos | Algorithm identifiers to check the private key for (or'ed together). |
[in] | dom | Pointer to EC domain parameters. |
[in] | d | Private EC key (a big number) to be tested. |
tmp | Array of temporary space elements (unused at the moment). |
d
. C4E_STATUS_OK | If the key seems to be valid. | |
other | If the key is invalid. |
C4eSysStatus c4e_ecc2n_keychk_pub | ( | C4eArchUint | algos, | |
C4E_CONST C4eEcDomain *C4E_RESTRICT | dom, | |||
C4E_CONST C4eEcPoint *C4E_RESTRICT | q, | |||
C4eArchDigit | tmp[C4E_RESTRICT] | |||
) |
Elliptic curve (EC) over binary field public key validity test.
dom
must be assured by the caller, either implicit or by using function c4e_ecc2n_domchk(). q
and dom
must be normalized, e.g. by using functions c4e_elem_norm(), c4e_elem_os2e() and/or c4e_ecc2n_os2pt(). tmp
[], using macro C4E_ECC2N_TMP_NUM() in conjunction with temp. space qualifier C4E_ECC2N_TMPID_KEY_CHECK.[in] | algos | Algorithm identifiers to check the public key for (or'ed together). |
[in] | dom | Pointer to EC domain parameters. |
[in] | q | Public EC key to be tested. |
tmp | Array of temporary space elements (see preconditions for details on size). |
key
. C4E_STATUS_OK | If the key seems to be valid. | |
other | If the key is invalid. |
C4eArchSize c4e_ecc2n_pt2os | ( | C4E_CONST C4eEcDomain *C4E_RESTRICT | dom, | |
C4E_CONST C4eEcPoint *C4E_RESTRICT | pt, | |||
C4eArchUint | ptfmt, | |||
C4eArchDigit | tmp[C4E_RESTRICT], | |||
C4eArchSize | bufsize, | |||
C4eArchUint8 *C4E_RESTRICT | buf | |||
) |
Elliptic curve point to octet string conversion primitive, according to ANSI X9.63, section 4.3.6 and 4.2.2 and IEEE Std 1363, section A.9.6 and annex E.2.3.
dom
must be assured by the caller, either implicit or by using function c4e_ecc2n_domchk(). pt
and dom
must be normalized, e.g. by using functions c4e_elem_norm(), c4e_elem_os2e() and/or c4e_ecc2n_os2pt(). pt
and dom
must be normalized, e.g. by using functions c4e_elem_norm() or c4e_elem_os2e(). tmp
[], using macro C4E_ECC2N_TMP_NUM() in conjunction with temp. space qualifier C4E_ECC2N_TMPID_PT2OS. buf
varies depending the point format ptfmt:
* hybrid: 2U * dom->m.len
+ 1U * uncompressed: 2U * dom->m.len
+ 1U * compressed: dom->m.len
+ 1U[in] | dom | Pointer to EC domain parameters. |
[in] | pt | Pointer to EC point. |
[in] | ptfmt | EC point format: * C4E_EC_PTFMT_PC_C: compressed * C4E_EC_PTFMT_PC_U: uncompressed * C4E_EC_PTFMT_PC_H: hybrid |
tmp | Array of temporary space elements (see preconditions for details on size). Parameter tmp may be NULL in case the format is pure "uncompressed". | |
[in] | bufsize | Maximum number of bytes to store in buf (must be greater than zero, else an assert is thrown). |
[out] | buf | Output buffer, getting converted EC point pt . |
pt
, 0 on error. C4eSysStatus c4e_ecc2n_os2pt | ( | C4E_CONST C4eEcDomain *C4E_RESTRICT | dom, | |
C4E_CONST C4eArchUint8 *C4E_RESTRICT | osp, | |||
C4eArchSize | len, | |||
C4eArchDigit | tmp[C4E_RESTRICT], | |||
C4eEcPoint *C4E_RESTRICT | pt | |||
) |
Octet string to elliptic curve point conversion primitive, according to ANSI X9.63, section 4.3.7 and 4.2.2 and IEEE Std 1363, section A.9.6 and annex E.2.3.
dom
must be assured by the caller, either implicit or by using function c4e_ecc2n_domchk(). dom
must be normalized, e.g. by using functions c4e_elem_norm() or c4e_elem_os2e(). tmp
[], using macro C4E_ECC2N_TMP_NUM() in conjunction with temp. space qualifier C4E_ECC2N_TMPID_OS2PT. pt->x.digits
respective pt->y.digits
(in number of digits according to pt->x.size
respective pt->y.size
) must be at least: C4E_ELEM_DIGITS_NUM(dom->m.len)
pt->x
and pt->y
are normalized.[in] | dom | Pointer to EC domain parameters. |
[in] | osp | Octet string pointer, which represents an EC point, according to the standards mentioned. |
[in] | len | Number of bytes in osp array (octet string). |
tmp | Array of temporary space elements (see preconditions for details on size). | |
[out] | pt | Pointer to EC point, with coordinate digits buffer prepared according to preconditions. |
C4E_STATUS_OK | If the octet string was converted successfully. | |
other | If conversion of octet string has failed. |