type stringclasses 5
values | content stringlengths 9 163k |
|---|---|
defines | #define RND(a, b, c, d, e, f, g, h, k) \ |
defines | #define RNDr(S, W, i, k) \ |
defines | #define R(a,b) (((a) << (b)) | ((a) >> (32 - (b)))) |
functions | uint32_t
be32dec(const void *pp)
{
const uint8_t *p = (uint8_t const *)pp;
return ((uint32_t)(p[3]) + ((uint32_t)(p[2]) << 8) +
((uint32_t)(p[1]) << 16) + ((uint32_t)(p[0]) << 24));
} |
functions | void
be32enc(void *pp, uint32_t x)
{
uint8_t * p = (uint8_t *)pp;
p[3] = x & 0xff;
p[2] = (x >> 8) & 0xff;
p[1] = (x >> 16) & 0xff;
p[0] = (x >> 24) & 0xff;
} |
functions | uint32_t
le32dec(const void *pp)
{
const uint8_t *p = (uint8_t const *)pp;
return ((uint32_t)(p[0]) + ((uint32_t)(p[1]) << 8) +
((uint32_t)(p[2]) << 16) + ((uint32_t)(p[3]) << 24));
} |
functions | void
le32enc(void *pp, uint32_t x)
{
uint8_t * p = (uint8_t *)pp;
p[0] = x & 0xff;
p[1] = (x >> 8) & 0xff;
p[2] = (x >> 16) & 0xff;
p[3] = (x >> 24) & 0xff;
} |
functions | void
be32enc_vect(unsigned char *dst, const uint32_t *src, size_t len)
{
size_t i;
for (i = 0; i < len / 4; i++)
be32enc(dst + i * 4, src[i]);
} |
functions | void
be32dec_vect(uint32_t *dst, const unsigned char *src, size_t len)
{
size_t i;
for (i = 0; i < len / 4; i++)
dst[i] = be32dec(src + i * 4);
} |
functions | void
SHA256_Transform(uint32_t * state, const unsigned char block[64])
{
uint32_t W[64];
uint32_t S[8];
uint32_t t0, t1;
int i;
/* 1. Prepare message schedule W. */
be32dec_vect(W, block, 64);
for (i = 16; i < 64; i++)
W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16];
/* 2. Initialize working vari... |
functions | void
SHA256_Init(SHA256_CTX * ctx)
{
/* Zero bits processed so far */
ctx->count[0] = ctx->count[1] = 0;
/* Magic initialization constants */
ctx->state[0] = 0x6A09E667;
ctx->state[1] = 0xBB67AE85;
ctx->state[2] = 0x3C6EF372;
ctx->state[3] = 0xA54FF53A;
ctx->state[4] = 0x510E527F;
ctx->state[5] = 0x9B05688C;... |
functions | void
SHA256_Update(SHA256_CTX * ctx, const void *in, size_t len)
{
uint32_t bitlen[2];
uint32_t r;
const unsigned char *src = in;
/* Number of bytes left in the buffer from previous updates */
r = (ctx->count[1] >> 3) & 0x3f;
/* Convert the length into a number of bits */
bitlen[1] = ((uint32_t)len) << 3;
bit... |
functions | void
SHA256_Pad(SHA256_CTX * ctx)
{
unsigned char len[8];
uint32_t r, plen;
/*
* Convert length to a vector of bytes -- we do this now rather
* than later because the length will change after we pad.
*/
be32enc_vect(len, ctx->count, 8);
/* Add 1--64 bytes so that the resulting length is 56 mod 64 */
r = (... |
functions | void
SHA256_Final(unsigned char digest[32], SHA256_CTX * ctx)
{
/* Add padding */
SHA256_Pad(ctx);
/* Write the hash */
be32enc_vect(digest, ctx->state, 32);
/* Clear the context state */
memset((void *)ctx, 0, sizeof(*ctx));
} |
functions | void
HMAC_SHA256_Init(HMAC_SHA256_CTX * ctx, const void * _K, size_t Klen)
{
unsigned char pad[64];
unsigned char khash[32];
const unsigned char * K = _K;
size_t i;
/* If Klen > 64, the key is really SHA256(K). */
if (Klen > 64) {
SHA256_Init(&ctx->ictx);
SHA256_Update(&ctx->ictx, K, Klen);
SHA256_Final(kh... |
functions | void
HMAC_SHA256_Update(HMAC_SHA256_CTX * ctx, const void *in, size_t len)
{
/* Feed data to the inner SHA256 operation. */
SHA256_Update(&ctx->ictx, in, len);
} |
functions | void
HMAC_SHA256_Final(unsigned char digest[32], HMAC_SHA256_CTX * ctx)
{
unsigned char ihash[32];
/* Finish the inner SHA256 operation. */
SHA256_Final(ihash, &ctx->ictx);
/* Feed the inner hash to the outer SHA256 operation. */
SHA256_Update(&ctx->octx, ihash, 32);
/* Finish the outer SHA256 operation. */
S... |
functions | void
PBKDF2_SHA256(const uint8_t * passwd, size_t passwdlen, const uint8_t * salt,
size_t saltlen, uint64_t c, uint8_t * buf, size_t dkLen)
{
HMAC_SHA256_CTX PShctx, hctx;
size_t i;
uint8_t ivec[4];
uint8_t U[32];
uint8_t T[32];
uint64_t j;
int k;
size_t clen;
/* Compute HMAC state after processing P and ... |
functions | void
blkcpy(void * dest, void * src, size_t len)
{
size_t * D = dest;
size_t * S = src;
size_t L = len / sizeof(size_t);
size_t i;
for (i = 0; i < L; i++)
D[i] = S[i];
} |
functions | void
blkxor(void * dest, void * src, size_t len)
{
size_t * D = dest;
size_t * S = src;
size_t L = len / sizeof(size_t);
size_t i;
for (i = 0; i < L; i++)
D[i] ^= S[i];
} |
functions | void
salsa20_8(uint32_t B[16])
{
uint32_t x[16];
size_t i;
blkcpy(x, B, 64);
for (i = 0; i < 8; i += 2) {
/* Operate on columns. */
x[ 4] ^= R(x[ 0]+x[12], 7); x[ 8] ^= R(x[ 4]+x[ 0], 9);
x[12] ^= R(x[ 8]+x[ 4],13); x[ 0] ^= R(x[12]+x[ 8],18);
x[ 9] ^= R(x[ 5]+x[ 1], 7); x[13] ^= R(x[ 9]+x[ 5], 9);
... |
functions | void
blockmix_salsa8(uint32_t * Bin, uint32_t * Bout, uint32_t * X, size_t r)
{
size_t i;
/* 1: X <-- B_{2r - 1} |
functions | uint64_t
integerify(void * B, size_t r)
{
uint32_t * X = (void *)((uintptr_t)(B) + (2 * r - 1) * 64);
return (((uint64_t)(X[1]) << 32) + X[0]);
} |
functions | void
smix(uint8_t * B, size_t r, uint64_t N, uint32_t * V, uint32_t * XY)
{
uint32_t * X = XY;
uint32_t * Y = &XY[32 * r];
uint32_t * Z = &XY[64 * r];
uint64_t i;
uint64_t j;
size_t k;
/* 1: X <-- B */
for (k = 0; k < 32 * r; k++)
X[k] = le32dec(&B[4 * k]);
/* 2: for i = 0 to N - 1 do */
for (i = 0; i < N... |
functions | void scrypt_1024_1_1_256_sp(const unsigned char *input, unsigned char *output, char *scratchpad)
{
uint8_t * B;
uint32_t * V;
uint32_t * XY;
uint32_t i;
const uint32_t N = 1024;
const uint32_t r = 1;
const uint32_t p = 1;
B = (uint8_t *)(((uintptr_t)(scratchpad) + 63) & ~ (uintptr_t)(63));
XY = (uint32_t *)(... |
functions | void scrypt_1024_1_1_256(const unsigned char *input, unsigned char *output)
{
char scratchpad[scrypt_scratchpad_size];
scrypt_1024_1_1_256_sp(input, output, scratchpad);
} |
functions | void midstate_sha256(const unsigned char *in, unsigned char *out)
{
SHA256_CTX ctx;
SHA256_Init(&ctx);
SHA256_Update(&ctx, in, 64);
memcpy(out, &ctx.state, 32);
} |
functions | void sha256(const unsigned char *in, size_t size, unsigned char *out)
{
SHA256_CTX ctx;
SHA256_Init(&ctx);
SHA256_Update(&ctx, in, size);
SHA256_Final(out, &ctx);
} |
functions | void double_sha256(const unsigned char *in, size_t size, unsigned char *out)
{
SHA256_CTX ctx;
SHA256_Init(&ctx);
SHA256_Update(&ctx, in, size);
SHA256_Final(out, &ctx);
SHA256_Init(&ctx);
SHA256_Update(&ctx, out, 32);
SHA256_Final(out, &ctx);
} |
includes | #include <config.h> |
includes |
#include <inttypes.h> |
defines |
#define VIR_FROM_THIS VIR_FROM_QEMU |
defines |
#define DO_PARSE_TEST(filename) \ |
functions | int
testParseFormatVU(const void *opaque)
{
const char *filename = opaque;
g_autofree char *path = NULL;
g_autoptr(qemuVhostUser) vu = NULL;
g_autofree char *buf = NULL;
g_autoptr(virJSONValue) json = NULL;
g_autofree char *expected = NULL;
g_autofree char *actual = NULL;
path = g_strdu... |
functions | int
testVUPrecedence(const void *opaque G_GNUC_UNUSED)
{
g_autofree char *fakehome = NULL;
g_auto(GStrv) vuList = NULL;
const char *expected[] = {
PREFIX "/share/qemu/vhost-user/30-gpu.json",
SYSCONFDIR "/qemu/vhost-user/40-gpu.json",
PREFIX "/share/qemu/vhost-user/60-gpu.json",
... |
functions | int
mymain(void)
{
int ret = 0;
virFileWrapperAddPrefix(SYSCONFDIR "/qemu/vhost-user",
abs_srcdir "/qemuvhostuserdata/etc/qemu/vhost-user");
virFileWrapperAddPrefix(PREFIX "/share/qemu/vhost-user",
abs_srcdir "/qemuvhostuserdata/usr/share/qemu/vhost-u... |
defines | #define __FUNCT__ "DSDPCheckConvergence" |
defines | #define __FUNCT__ "DSDPSetGapTolerance" |
defines | #define __FUNCT__ "DSDPGetGapTolerance" |
defines | #define __FUNCT__ "DSDPSetPNormTolerance" |
defines | #define __FUNCT__ "DSDPGetPNormTolerance" |
defines | #define __FUNCT__ "DSDPSetDualBound" |
defines | #define __FUNCT__ "DSDPGetDualBound" |
defines | #define __FUNCT__ "DSDPSetStepTolerance" |
defines | #define __FUNCT__ "DSDPGetStepTolerance" |
defines | #define __FUNCT__ "DSDPGetRHistory" |
defines | #define __FUNCT__ "DSDPGetGapHistory" |
functions | int DSDPDefaultConvergence(DSDP dsdp,void *ctx){
ConvergenceMonitor *conv=(ConvergenceMonitor*)ctx;
int info,i,iter;
double mu,mu2;
double rgap,rgap2,rgaptol=conv->rgaptol;
double infeastol=0;
double pnorm,dstep,pstep,steptol=conv->steptol,pnormtol=conv->pnormtol;
double ppobj,ddobj, gap, dualbound=conv-... |
functions | else if ( ddobj!=ddobj || pnorm < 0){
reason = DSDP_NUMERICAL_ERROR;
DSDPLogInfo(0,2,"Stop due to Numerical Error\n");
} |
functions | else if ( rgap <=rgaptol/1.01 && res<=infeastol ){
if (pnorm>pnormtol){
mu2=gap/np;
info = DSDPSetBarrierParameter(dsdp,mu2); DSDPCHKERR(info);
} |
functions | else if ( rgap2 <=rgaptol/100 && rgap<0.01){
reason = DSDP_CONVERGED;
DSDPLogInfo(0,2,"DSDP Converged: Relative Duality Gap %4.2e < %4.2e. Check Feasiblity \n",rgap,rgaptol);
} |
functions | else if ( ddobj > dualbound && res<=infeastol){
reason = DSDP_UPPERBOUND;
DSDPLogInfo(0,2,"DSDP Converged: Dual Objective: %4.2e > upper bound %4.2e\n",pnorm,dualbound);
} |
functions | else if ( iter > 5 && dstep<steptol && dstep*pnorm< steptol && rgap <= 1.0e-3 ) {
reason = DSDP_SMALL_STEPS;
DSDPLogInfo(0,2,"DSDP Terminated: Small relative gap and small steps detected (3)\n");
} |
functions | int DSDPSetGapTolerance(DSDP dsdp,double gaptol){
int info;
ConvergenceMonitor *conv;
DSDPFunctionBegin;
info=DSDPGetConvergenceMonitor(dsdp,&conv); DSDPCHKERR(info);
if (gaptol > 0) conv->rgaptol = gaptol;
DSDPLogInfo(0,2,"Set Relative Gap Tolerance: %4.4e\n",gaptol);
DSDPFunctionReturn(0);
} |
functions | int DSDPGetGapTolerance(DSDP dsdp,double *gaptol){
int info;
ConvergenceMonitor *conv;
DSDPFunctionBegin;
info=DSDPGetConvergenceMonitor(dsdp,&conv); DSDPCHKERR(info);
DSDPFunctionBegin;
*gaptol=conv->rgaptol;
DSDPFunctionReturn(0);
} |
functions | int DSDPSetPNormTolerance(DSDP dsdp,double ptol){
int info;
ConvergenceMonitor *conv;
DSDPFunctionBegin;
info=DSDPGetConvergenceMonitor(dsdp,&conv); DSDPCHKERR(info);
if (ptol > 0) conv->pnormtol = ptol;
DSDPLogInfo(0,2,"Set Relative PNorm Tolerance: %4.4e\n",ptol);
DSDPFunctionReturn(0);
} |
functions | int DSDPGetPNormTolerance(DSDP dsdp,double *ptol){
int info;
ConvergenceMonitor *conv;
DSDPFunctionBegin;
info=DSDPGetConvergenceMonitor(dsdp,&conv); DSDPCHKERR(info);
DSDPFunctionBegin;
*ptol=conv->pnormtol;
DSDPFunctionReturn(0);
} |
functions | int DSDPSetDualBound(DSDP dsdp,double dbound){
int info;
ConvergenceMonitor *conv;
DSDPFunctionBegin;
info=DSDPGetConvergenceMonitor(dsdp,&conv); DSDPCHKERR(info);
conv->dualbound=dbound;
DSDPLogInfo(0,2,"Set DualBound of %4.4e \n",dbound);
DSDPFunctionReturn(0);
} |
functions | int DSDPGetDualBound(DSDP dsdp,double *dbound){
int info;
ConvergenceMonitor *conv;
DSDPFunctionBegin;
info=DSDPGetConvergenceMonitor(dsdp,&conv); DSDPCHKERR(info);
*dbound=conv->dualbound;
DSDPFunctionReturn(0);
} |
functions | int DSDPSetStepTolerance(DSDP dsdp,double steptol){
int info;
ConvergenceMonitor *conv;
DSDPFunctionBegin;
info=DSDPGetConvergenceMonitor(dsdp,&conv); DSDPCHKERR(info);
if (steptol > 0) conv->steptol = steptol;
DSDPFunctionReturn(0);
} |
functions | int DSDPGetStepTolerance(DSDP dsdp,double *steptol){
int info;
ConvergenceMonitor *conv;
DSDPFunctionBegin;
info=DSDPGetConvergenceMonitor(dsdp,&conv); DSDPCHKERR(info);
*steptol=conv->steptol;
DSDPFunctionReturn(0);
} |
functions | int DSDPGetRHistory(DSDP dsdp, double hist[], int length){
int i,info;
ConvergenceMonitor *conv;
DSDPFunctionBegin;
info=DSDPGetConvergenceMonitor(dsdp,&conv); DSDPCHKERR(info);
for (i=0;i<length;i++) hist[i]=0.0;
for (i=0;i<DSDPMin(length,DSDPHistory);i++) hist[i]=conv->infhist[i];
DSDPFunctionReturn(0)... |
functions | int DSDPGetGapHistory(DSDP dsdp, double hist[], int length){
int i,info;
ConvergenceMonitor *conv;
DSDPFunctionBegin;
info=DSDPGetConvergenceMonitor(dsdp,&conv); DSDPCHKERR(info);
for (i=0;i<length;i++) hist[i]=0.0;
for (i=0;i<DSDPMin(length,DSDPHistory);i++) hist[i]=conv->gaphist[i];
DSDPFunctionReturn(... |
includes |
#include <stdlib.h> |
includes | #include <string.h> |
includes | #include <gst/rtp/gstrtpbuffer.h> |
defines | #define GST_CAT_DEFAULT (rtpdvpay_debug) |
defines |
#define DEFAULT_MODE GST_DV_PAY_MODE_VIDEO |
defines |
#define GST_TYPE_DV_PAY_MODE (gst_dv_pay_mode_get_type()) |
defines |
#define gst_rtp_dv_pay_parent_class parent_class |
functions | GType
gst_dv_pay_mode_get_type (void)
{
static GType dv_pay_mode_type = 0;
static const GEnumValue dv_pay_modes[] = {
{GST_DV_PAY_MODE_VIDEO, "Video only", "video"} |
functions | void
gst_rtp_dv_pay_class_init (GstRTPDVPayClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
GstRTPBasePayloadClass *gstrtpbasepayload_class;
GST_DEBUG_CATEGORY_INIT (rtpdvpay_debug, "rtpdvpay", 0, "DV RTP Payloader");
gobject_class = (GObjectClass *) klass;
gstelement_class... |
functions | void
gst_rtp_dv_pay_init (GstRTPDVPay * rtpdvpay)
{
} |
functions | void
gst_dv_pay_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec)
{
GstRTPDVPay *rtpdvpay = GST_RTP_DV_PAY (object);
switch (prop_id) {
case PROP_MODE:
rtpdvpay->mode = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (... |
functions | void
gst_dv_pay_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec)
{
GstRTPDVPay *rtpdvpay = GST_RTP_DV_PAY (object);
switch (prop_id) {
case PROP_MODE:
g_value_set_enum (value, rtpdvpay->mode);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object,... |
functions | gboolean
gst_rtp_dv_pay_setcaps (GstRTPBasePayload * payload, GstCaps * caps)
{
/* We don't do anything here, but we could check if it's a system stream and if
* it's not, default to sending the video only. We will negotiate downstream
* caps when we get to see the first frame. */
return TRUE;
} |
functions | gboolean
gst_dv_pay_negotiate (GstRTPDVPay * rtpdvpay, guint8 * data, gsize size)
{
const gchar *encode, *media;
gboolean audio_bundled, res;
if ((data[3] & 0x80) == 0) { /* DSF flag */
/* it's an NTSC format */
if ((data[80 * 5 + 48 + 3] & 0x4) && (data[80 * 5 + 48] == 0x60)) { /* 4:2:2 sampling */
... |
functions | gboolean
include_dif (GstRTPDVPay * rtpdvpay, guint8 * data)
{
gint block_type;
gboolean res;
block_type = data[0] >> 5;
switch (block_type) {
case 0: /* Header block */
case 1: /* Subcode block */
case 2: /* VAUX block */
/* always in... |
functions | GstFlowReturn
gst_rtp_dv_pay_handle_buffer (GstRTPBasePayload * basepayload,
GstBuffer * buffer)
{
GstRTPDVPay *rtpdvpay;
guint max_payload_size;
GstBuffer *outbuf;
GstFlowReturn ret = GST_FLOW_OK;
gint hdrlen;
gsize size;
GstMapInfo map;
guint8 *data;
guint8 *dest;
guint filled;
GstRTPBuffer ... |
functions | gboolean
gst_rtp_dv_pay_plugin_init (GstPlugin * plugin)
{
return gst_element_register (plugin, "rtpdvpay",
GST_RANK_SECONDARY, GST_TYPE_RTP_DV_PAY);
} |
includes |
#include <stdlib.h> |
includes | #include <stdint.h> |
includes | #include <assert.h> |
includes | #include <string.h> |
defines |
#define AES_ROUNDS 10 |
defines | #define AES_BLOCK_WORDS 4 |
defines | #define AES_KEY_BYTES 16 |
defines | #define OUTPUT_BYTES 16 |
functions | void aesrand_init(uint32_t seed)
{
memset(&aes_input, 0, sizeof(aes_input));
uint8_t key[AES_KEY_BYTES];
if (seed) {
memset(key, 0, AES_KEY_BYTES*sizeof(uint8_t));
memcpy(key, &seed, sizeof(uint32_t));
} |
functions | uint64_t aesrand_getword(void)
{
assert(init);
memcpy(aes_input, aes_output, sizeof(aes_input));
rijndaelEncrypt(aes_sched, AES_ROUNDS,
(uint8_t *)aes_input, aes_output);
uint64_t retval;
memcpy(&retval, aes_output, sizeof(retval));
return retval;
} |
includes | #include <config.h> |
includes |
#include <string.h> |
includes | #include <stdlib.h> |
includes | #include <assert.h> |
includes |
#include <stdio.h> |
includes |
#include <rlglue/Agent_common.h> |
includes | #include <rlglue/network/RL_network.h> |
includes | #include <rlglue/utils/C/RLStruct_util.h> |
functions | void agent_init(const char * theTaskSpec) {
int agentState = kAgentInit;
unsigned int theTaskSpecLength = 0;
unsigned int offset = 0;
if (theTaskSpec != NULL)
theTaskSpecLength = strlen(theTaskSpec);
if (theBuffer.capacity == 0)
rlBufferCreate(&theBuffer, 65536);
/* send across agent_init speci... |
functions | void agent_end(const double theReward) {
int agentState = kAgentEnd;
unsigned int offset = 0;
rlBufferClear(&theBuffer);
/*offset = rlBufferWrite(&theBuffer, offset, &agentState, 1, sizeof(int));*/ /* Removed, shouldn't have been sent. */
offset = rlBufferWrite(&theBuffer, offset, &theReward, 1, sizeof(doub... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.