Sha256: 6e65ae1c056f1dc11da16b2bd4aabad151db3abcd5ab7fbfaca7e784c18496d1

Contents?: true

Size: 987 Bytes

Versions: 26

Compression:

Stored size: 987 Bytes

Contents

#include "ge.h"

static const fe d = {
#include "d.h"
} ;

static const fe sqrtm1 = {
#include "sqrtm1.h"
} ;

int ge_frombytes_negate_vartime(ge_p3 *h,const unsigned char *s)
{
  fe u;
  fe v;
  fe v3;
  fe vxx;
  fe check;

  fe_frombytes(h->Y,s);
  fe_1(h->Z);
  fe_sq(u,h->Y);
  fe_mul(v,u,d);
  fe_sub(u,u,h->Z);       /* u = y^2-1 */
  fe_add(v,v,h->Z);       /* v = dy^2+1 */

  fe_sq(v3,v);
  fe_mul(v3,v3,v);        /* v3 = v^3 */
  fe_sq(h->X,v3);
  fe_mul(h->X,h->X,v);
  fe_mul(h->X,h->X,u);    /* x = uv^7 */

  fe_pow22523(h->X,h->X); /* x = (uv^7)^((q-5)/8) */
  fe_mul(h->X,h->X,v3);
  fe_mul(h->X,h->X,u);    /* x = uv^3(uv^7)^((q-5)/8) */

  fe_sq(vxx,h->X);
  fe_mul(vxx,vxx,v);
  fe_sub(check,vxx,u);    /* vx^2-u */
  if (fe_isnonzero(check)) {
    fe_add(check,vxx,u);  /* vx^2+u */
    if (fe_isnonzero(check)) return -1;
    fe_mul(h->X,h->X,sqrtm1);
  }

  if (fe_isnegative(h->X) == (s[31] >> 7))
    fe_neg(h->X,h->X);

  fe_mul(h->T,h->X,h->Y);
  return 0;
}

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
ed25519-1.2.2-jruby ext/ed25519_ref10/ge_frombytes.c
ed25519-1.2.2 ext/ed25519_ref10/ge_frombytes.c
ed25519-1.2.1-jruby ext/ed25519_ref10/ge_frombytes.c
ed25519-1.2.1 ext/ed25519_ref10/ge_frombytes.c
ed25519-1.2.0-jruby ext/ed25519_ref10/ge_frombytes.c
ed25519-1.2.0 ext/ed25519_ref10/ge_frombytes.c
ed25519-1.1.0-jruby ext/ed25519_ref10/ge_frombytes.c
ed25519-1.1.0 ext/ed25519_ref10/ge_frombytes.c
ed25519-1.0.0-jruby ext/ed25519_ref10/ge_frombytes.c
ed25519-1.0.0 ext/ed25519_ref10/ge_frombytes.c
rbnacl-libsodium-1.0.7 vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_frombytes.c
rbnacl-libsodium-1.0.6 vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_frombytes.c
rbnacl-libsodium-1.0.5 vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_frombytes.c
rbnacl-libsodium-1.0.4 vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_frombytes.c
rbnacl-libsodium-1.0.3 vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_frombytes.c
rbnacl-libsodium-1.0.2 vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_frombytes.c
rbnacl-libsodium-1.0.1 vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_frombytes.c
rbnacl-libsodium-1.0.0 vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_frombytes.c
rbnacl-libsodium-0.7.0 vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_frombytes.c
rbnacl-libsodium-0.6.1 vendor/libsodium/src/libsodium/crypto_sign/ed25519/ref10/ge_frombytes.c