third_party/wolfssl/wolfcrypt/src/curve25519.c
/* import curve25519 public key (Big or Little endian)
 * return 0 on success */
import curve25519 public key (Big or Little endian)
return 0 on success
import curve25519 public key ( Big or Little endian ) return 0 on success
int wc_curve25519_import_public_ex(const byte* in, word32 inLen,
                                curve25519_key* key, int endian)
{
    if (key == NULL || in == NULL)
        return BAD_FUNC_ARG;
    if (inLen != CURVE25519_KEYSIZE)
       return ECC_BAD_ARG_E;
    if (endian == EC25519_BIG_ENDIAN) {
        int i;
        for (i = 0; i < CURVE25519_KEYSIZE; i++)
            key->p.point[i] = in[CURVE25519_KEYSIZE - i - 1];
    }
    else
        XMEMCPY(key->p.point, in, inLen);
    key->dp = &curve25519_sets[0];
    #ifdef FREESCALE_LTC_ECC
        ltc_pkha_ecc_point_t ltcPoint;
        ltcPoint.X = &key->p.point[0];
        ltcPoint.Y = &key->p.pointY[0];
        LTC_PKHA_Curve25519ComputeY(&ltcPoint);
    #endif
    return 0;
}
int wc_curve25519_import_public_ex ( const byte * in , word32 inLen , curve25519_key * key , int endian ) { if ( key == NULL || in == NULL ) return BAD_FUNC_ARG ; if ( inLen != CURVE25519_KEYSIZE ) return ECC_BAD_ARG_E ; if ( endian == EC25519_BIG_ENDIAN ) { int i ; for ( i = 0 ; i < CURVE25519_KEYSIZE ; i ++ ) key -> p . point [ i ] = in [ CURVE25519_KEYSIZE - i - 1 ] ; } else XMEMCPY ( key -> p . point , in , inLen ) ; key -> dp = & curve25519_sets [ 0 ] ; #ifdef FREESCALE_LTC_ECC ltc_pkha_ecc_point_t ltcPoint ; ltcPoint . X = & key -> p . point [ 0 ] ; ltcPoint . Y = & key -> p . pointY [ 0 ] ; LTC_PKHA_Curve25519ComputeY ( & ltcPoint ) ; #endif return 0 ; }
import curve25519 public key (Big or Little endian)
 return 0 on success
import curve25519 public key ( Big or Little endian ) return 0 on success
/* sanity check */ /* check size of incoming keys */ /* read keys in Big Endian format */ /* LTC needs also Y coordinate - let's compute it */