# Intel® Enhanced Privacy ID SDK: epid/common/math/ecgroup.c File Reference

ecgroup.c File Reference

Elliptic curve group implementation. More...

`#include <string.h>`
`#include "epid/common/math/bignum-internal.h"`
`#include "epid/common/math/ecgroup-internal.h"`
`#include "epid/common/math/ecgroup.h"`
`#include "epid/common/math/finitefield-internal.h"`
`#include "epid/common/memory.h"`
`#include "ext/ipp/include/ippcp.h"`
`#include "ext/ipp/include/ippcpepid.h"`

## Macros

#define | EPID_ECHASH_WATCHDOG (50)
| The number of attempts to hash a message to an element.

## Functions

EpidStatus | NewEcGroup (FiniteField const *ff, FfElement const *a, FfElement const *b, FfElement const *x, FfElement const *y, BigNum const *order, BigNum const *cofactor, EcGroup **g)
| Constructs a new EcGroup. More...
void | DeleteEcGroup (EcGroup **g)
| Deletes a previously allocated EcGroup. More...
EpidStatus | NewEcPoint (EcGroup const *g, EcPoint **p)
| Creates a new EcPoint. More...
void | DeleteEcPoint (EcPoint **p)
| Deletes a previously allocated EcPoint. More...
EpidStatus | eccontains (EcGroup *g, void const *p_str, size_t strlen, EcPoint *p, bool *in_group)
| Check and initialize element if it is in elliptic curve group. More...
EpidStatus | ReadEcPoint (EcGroup *g, void const *p_str, size_t strlen, EcPoint *p)
| Deserializes an EcPoint from a string. More...
EpidStatus | WriteEcPoint (EcGroup *g, EcPoint const *p, void *p_str, size_t strlen)
| Serializes an EcPoint to a string. More...
EpidStatus | EcMul (EcGroup *g, EcPoint const *a, EcPoint const *b, EcPoint *r)
| Multiplies two elements in an elliptic curve group. More...
EpidStatus | EcExp (EcGroup *g, EcPoint const *a, BigNumStr const *b, EcPoint *r)
| Raises a point in an elliptic curve group to a power. More...
EpidStatus | EcSscmExp (EcGroup *g, EcPoint const *a, BigNumStr const *b, EcPoint *r)
| Software side-channel mitigated implementation of EcExp. More...
EpidStatus | EcMultiExp (EcGroup *g, EcPoint const **a, BigNumStr const **b, size_t m, EcPoint *r)
| Multi-exponentiates elements in elliptic curve group. More...
EpidStatus | EcSscmMultiExp (EcGroup *g, EcPoint const **a, BigNumStr const **b, size_t m, EcPoint *r)
| Software side-channel mitigated implementation of EcMultiExp. More...
EpidStatus | EcGetRandom (EcGroup *g, BitSupplier rnd_func, void *rnd_func_param, EcPoint *r)
| Generates a random element from an elliptic curve group. More...
EpidStatus | EcInGroup (EcGroup *g, void const *p_str, size_t strlen, bool *in_group)
| Checks if a point is in an elliptic curve group. More...
EpidStatus | EcHash (EcGroup *g, void const *msg, size_t msg_len, HashAlg hash_alg, EcPoint *r)
| Hashes an arbitrary message to an element in an elliptic curve group. More...
EpidStatus | EcMakePoint (EcGroup *g, FfElement const *x, EcPoint *r)
| Sets an EcPoint variable to a point on a curve. More...
EpidStatus | EcInverse (EcGroup *g, EcPoint const *p, EcPoint *r)
| Computes the additive inverse of an EcPoint. More...
EpidStatus | EcIsEqual (EcGroup *g, EcPoint const *a, EcPoint const *b, bool *is_equal)
| Checks if two EcPoints are equal. More...
EpidStatus | EcIsIdentity (EcGroup *g, EcPoint const *p, bool *is_identity)
| Checks if an EcPoint is the identity element. More...

## Detailed Description

Elliptic curve group implementation.

## Function Documentation

EpidStatus eccontains | ( | EcGroup * | g,
|  | void const * | p_str,
|  | size_t | strlen,
|  | EcPoint * | p,
|  | bool * | in_group
| ) |  |

Check and initialize element if it is in elliptic curve group.

This is internal function. Takes a value p as input. If p is indeed an element of g, it outputs true, otherwise, it outputs false.

This is only used to check if input buffer are actually valid elements in group. If p is in g, this fills p and initializes it to internal FfElement format.

Parameters

  [in] | g | The eliptic curve group in which to perform the check
  [in] | p_str | Serialized eliptic curve group element to check
  [in] | strlen | The size of p_str in bytes.
  [out] | p | Deserialized value of p_str
  [out] | in_group | Result of the check

Returns
  EpidStatus

See also
  NewEcPoint