Esempio n. 1
0
SCM
yacl_scm_sha256 (SCM bv)
{
    int rc;
    uint8_t out[YACL_SHA256_LEN] = {};
    signed char* p = SCM_BYTEVECTOR_CONTENTS (bv);
    size_t len = SCM_BYTEVECTOR_LENGTH (bv);

    rc = yacl_sha256 (p, len, out);

    SCM digest = scm_c_make_bytevector (YACL_SHA256_LEN);

    memcpy (SCM_BYTEVECTOR_CONTENTS (digest), &out, YACL_SHA256_LEN);

    return digest;

}
Esempio n. 2
0
File: api.c Progetto: icholy/yacl
int
yacl_hash_verify(const uint8_t *data, size_t len,
                 const uint8_t public_key[YACL_P256_COORD_SIZE*2],
                 const uint8_t signature[YACL_P256_COORD_SIZE*2])
{
  int rc = -1;
  uint8_t digest[YACL_SHA256_LEN];

  if (NULL == data)
    return rc;

  rc = yacl_sha256 (data, len, digest);
  if (rc) return rc;

  rc = yacl_ecdsa_verify (public_key, digest, signature);

  return rc;
}
Esempio n. 3
0
void
jose_sha256 (const uint8_t *in, size_t len, uint8_t *out)
{
  assert (0 == yacl_sha256 (in, len, out));
}