Ejemplo n.º 1
0
int clock_gettime(clockid_t clk_id, struct timespec *tp)
{
    switch (clk_id) {
	case CLOCK_MONOTONIC:
	{
	    struct timeval tv;

	    gettimeofday(&tv, NULL);

	    tp->tv_sec = tv.tv_sec;
	    tp->tv_nsec = tv.tv_usec * 1000;

	    break;
	}
	case CLOCK_REALTIME:
	{
	    uint64_t nsec = monotonic_clock();

	    tp->tv_sec = nsec / 1000000000ULL;
	    tp->tv_nsec = nsec % 1000000000ULL;

	    break;
	}
	default:
	    print_unsupported("clock_gettime(%ld)", (long) clk_id);
	    errno = EINVAL;
	    return -1;
    }

    return 0;
}
Ejemplo n.º 2
0
int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, int indent,
                          ASN1_PCTX *pctx) {
  if (pkey->ameth && pkey->ameth->param_print) {
    return pkey->ameth->param_print(out, pkey, indent, pctx);
  }

  return print_unsupported(out, pkey, indent, "Parameters");
}
Ejemplo n.º 3
0
int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, int indent,
                           ASN1_PCTX *pctx) {
  if (pkey->ameth && pkey->ameth->priv_print) {
    return pkey->ameth->priv_print(out, pkey, indent, pctx);
  }

  return print_unsupported(out, pkey, indent, "Private Key");
}