本文整理汇总了C++中LE32函数的典型用法代码示例。如果您正苦于以下问题:C++ LE32函数的具体用法?C++ LE32怎么用?C++ LE32使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LE32函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CheckRpcHeaders
// Check Header of RPC Response
static int CheckRpcHeaders(const RPC_HEADER *const ResponseHeader, const RPC_HEADER *const RequestHeader, const BYTE desiredPacketType, const PRINTFUNC p)
{
int status = CheckRpcHeader(ResponseHeader, desiredPacketType, p);
if (desiredPacketType == RPC_PT_BIND_ACK)
{
if ((ResponseHeader->PacketFlags & RPC_PF_MULTIPLEX) != (RequestHeader->PacketFlags & RPC_PF_MULTIPLEX))
{
p("Warning: RPC_PF_MULTIPLEX of RPC request and response should match\n");
}
}
else
{
if (ResponseHeader->PacketFlags & RPC_PF_MULTIPLEX)
{
p("Warning: %s should not be set\n", "RPC_PF_MULTIPLEX");
}
}
if (ResponseHeader->CallId != RequestHeader->CallId)
{
p("Fatal: Sent Call Id %u but received answer for Call Id %u\n",
(uint32_t)LE32(RequestHeader->CallId),
(uint32_t)LE32(ResponseHeader->CallId)
);
status = !0;
}
return status;
}
开发者ID:jhbsz,项目名称:openwrt-packages-1,代码行数:32,代码来源:rpc.c
示例2: do_check32
static inline bool
do_check32 (size_t i, const Elf32_auxv_t (*a32)[], uint_fast8_t *elfdata)
{
/* The AUXV pointer might not even be naturally aligned for 32-bit
data, because note payloads in a core file are not aligned. */
uint32_t type = read_4ubyte_unaligned_noncvt (&(*a32)[i].a_type);
uint32_t val = read_4ubyte_unaligned_noncvt (&(*a32)[i].a_un.a_val);
if (type == BE32 (PROBE_TYPE)
&& val == BE32 (PROBE_VAL32))
{
*elfdata = ELFDATA2MSB;
return true;
}
if (type == LE32 (PROBE_TYPE)
&& val == LE32 (PROBE_VAL32))
{
*elfdata = ELFDATA2LSB;
return true;
}
return false;
}
开发者ID:Fox-Heracles,项目名称:platform_external_elfutils,代码行数:25,代码来源:link_map.c
示例3: RpcRequest
static int RpcRequest(const RPC_REQUEST *const Request, RPC_RESPONSE *const Response, const DWORD RpcAssocGroup, const SOCKET sock, const unsigned int len)
{
uint_fast16_t _v;
_v = LE16(((WORD*)Request->Data)[1]) - 4;
int ResponseSize = _Versions[_v].CreateResponse(Request->Data, Response->Data);
if ( ResponseSize )
{
Response->Ndr.DataSizeIs1 = LE32(0x00020000);
Response->Ndr.DataLength =
Response->Ndr.DataSizeIs2 = LE32(ResponseSize);
int len = ResponseSize + sizeof(Response->Ndr);
BYTE* pRpcReturnCode = ((BYTE*)&Response->Ndr) + len;
UA32(pRpcReturnCode) = 0; //LE16 not needed for 0
len += sizeof(DWORD);
// Pad zeros to 32-bit align (seems not neccassary but Windows RPC does it this way)
int pad = ((~len & 3) + 1) & 3;
memset(pRpcReturnCode + sizeof(DWORD), 0, pad);
len += pad;
Response->AllocHint = LE32(len);
Response->AllocHint +=
Response->ContextId = Request->ContextId;
*((WORD*)&Response->CancelCount) = 0; // CancelCount + Pad1
}
return ResponseSize;
}
开发者ID:jhbsz,项目名称:openwrt-packages-1,代码行数:34,代码来源:rpc.c
示例4: logResponseVerbose
void logResponseVerbose(const char *const ePID, const BYTE *const hwid, const RESPONSE *const response, const PRINTFUNC p)
{
char guidBuffer[GUID_STRING_LENGTH + 1];
//SYSTEMTIME st;
p("Protocol version : %u.%u\n", (uint32_t)LE16(response->MajorVer), (uint32_t)LE16(response->MinorVer));
p("KMS host extended PID : %s\n", ePID);
if (LE16(response->MajorVer) > 5)
# ifndef _WIN32
p("KMS host Hardware ID : %016llX\n", (unsigned long long)BE64(*(uint64_t*)hwid));
# else // _WIN32
p("KMS host Hardware ID : %016I64X\n", (unsigned long long)BE64(*(uint64_t*)hwid));
# endif // WIN32
uuid2StringLE(&response->CMID, guidBuffer);
p("Client machine ID : %s\n", guidBuffer);
char mbstr[64];
time_t st;
st = fileTimeToUnixTime(&response->ClientTime);
strftime(mbstr, sizeof(mbstr), "%Y-%m-%d %X", gmtime(&st));
p("Client request timestamp (UTC) : %s\n", mbstr);
p("KMS host current active clients : %u\n", (uint32_t)LE32(response->Count));
p("Renewal interval policy : %u\n", (uint32_t)LE32(response->VLRenewalInterval));
p("Activation interval policy : %u\n", (uint32_t)LE32(response->VLActivationInterval));
}
开发者ID:galaxysd,项目名称:GalaxyCodeBases,代码行数:28,代码来源:output.c
示例5: client_give_level
/* Give a Blue Burst client some free level ups. */
int client_give_level(ship_client_t *c, uint32_t level_req) {
uint32_t exp_total;
bb_level_entry_t *ent;
int cl;
uint32_t exp_gained;
if(c->version != CLIENT_VERSION_BB || !c->bb_pl || level_req > 199)
return -1;
/* No need if they've already at that level. */
if(c->bb_pl->character.level >= level_req)
return 0;
/* Grab the entry for that level... */
cl = c->bb_pl->character.ch_class;
ent = &char_stats.levels[cl][level_req];
/* Add in the experience to their total so far. */
exp_total = LE32(c->bb_pl->character.exp);
exp_gained = ent->exp - exp_total;
c->bb_pl->character.exp = LE32(ent->exp);
/* Send the packet telling them they've gotten experience. */
if(subcmd_send_bb_exp(c, exp_gained))
return -1;
/* Send the level-up packet. */
c->bb_pl->character.level = LE32(level_req);
if(subcmd_send_bb_level(c))
return -1;
return 0;
}
开发者ID:Sylverant,项目名称:ship_server,代码行数:34,代码来源:clients.c
示例6: handle_ship_select
/* Handle a client's ship select packet. */
static int handle_ship_select(login_client_t *c, bb_select_pkt *pkt) {
uint32_t menu_id = LE32(pkt->menu_id);
uint32_t item_id = LE32(pkt->item_id);
switch(menu_id & 0xFF) {
/* Initial menu */
case 0x00:
if(item_id == ITEM_ID_INIT_SHIP) {
/* Ship Select */
return send_ship_list(c, 0);
}
return -1;
/* Ship */
case 0x01:
if(item_id == 0) {
/* A "Ship List" menu item */
return send_ship_list(c, (uint16_t)(menu_id >> 8));
}
else {
/* An actual ship */
return ship_transfer(c, item_id);
}
default:
return -1;
}
开发者ID:Sylverant,项目名称:login_server,代码行数:29,代码来源:bbcharacter.c
示例7: BlowfishEncryptLE
void BlowfishEncryptLE (unsigned char *inBlock, unsigned char *outBlock, BF_KEY *key, int encrypt)
{
word32 left = LE32 (((word32 *) inBlock)[0]);
word32 right = LE32 (((word32 *) inBlock)[1]);
const word32 *const s = key->sbox;
const word32 * p = encrypt ? key->pbox : key->pbox_dec;
unsigned i;
left ^= p[0];
for (i=0; i<ROUNDS/2; i++)
{
right ^= (((s[GETBYTE(left,3)] + s[256+GETBYTE(left,2)])
^ s[2*256+GETBYTE(left,1)]) + s[3*256+GETBYTE(left,0)])
^ p[2*i+1];
left ^= (((s[GETBYTE(right,3)] + s[256+GETBYTE(right,2)])
^ s[2*256+GETBYTE(right,1)]) + s[3*256+GETBYTE(right,0)])
^ p[2*i+2];
}
right ^= p[ROUNDS+1];
((word32 *) outBlock)[0] = LE32 (right);
((word32 *) outBlock)[1] = LE32 (left);
}
开发者ID:4nt1m0n,项目名称:truecrypt,代码行数:28,代码来源:Blowfish.c
示例8: CRYPT_PC_CryptData
void CRYPT_PC_CryptData(CRYPT_SETUP* pc,void* data,unsigned long size)
{
uint32_t x, tmp;
for (x = 0; x < size; x += 4) {
tmp = *((uint32_t *)(data + x));
tmp = LE32(tmp) ^ CRYPT_PC_GetNextKey(pc);
*((uint32_t *)(data + x)) = LE32(tmp);
}
}
开发者ID:dcrodman,项目名称:tethealla2.0,代码行数:9,代码来源:psopc-crypt.c
示例9: ext2_dir_lookup
/* read in the dir, look for the entry */
static int ext2_dir_lookup(ext2_t *ext2, struct ext2_inode *dir_inode, const char *name, inodenum_t *inum)
{
uint file_blocknum;
int err;
uint8_t *buf;
size_t namelen = strlen(name);
if (!S_ISDIR(dir_inode->i_mode))
return ERR_NOT_DIR;
buf = malloc(EXT2_BLOCK_SIZE(ext2->sb));
file_blocknum = 0;
for (;;) {
/* read in the offset */
err = ext2_read_inode(ext2, dir_inode, buf, file_blocknum * EXT2_BLOCK_SIZE(ext2->sb), EXT2_BLOCK_SIZE(ext2->sb));
if (err <= 0) {
free(buf);
return -1;
}
/* walk through the directory entries, looking for the one that matches */
struct ext2_dir_entry_2 *ent;
uint pos = 0;
while (pos < EXT2_BLOCK_SIZE(ext2->sb)) {
ent = (struct ext2_dir_entry_2 *)&buf[pos];
LTRACEF("ent %d:%d: inode 0x%x, reclen %d, namelen %d\n",
file_blocknum, pos, LE32(ent->inode), LE16(ent->rec_len), ent->name_len/* , ent->name*/);
/* sanity check the record length */
if (LE16(ent->rec_len) == 0)
break;
if (ent->name_len == namelen && memcmp(name, ent->name, ent->name_len) == 0) {
// match
*inum = LE32(ent->inode);
LTRACEF("match: inode %d\n", *inum);
free(buf);
return 1;
}
pos += ROUNDUP(LE16(ent->rec_len), 4);
}
file_blocknum++;
/* sanity check the directory. 4MB should be enough */
if (file_blocknum > 1024) {
free(buf);
return -1;
}
}
}
开发者ID:LetsUnlockiPhone,项目名称:moboot,代码行数:55,代码来源:dir.c
示例10: RpcBind
static int RpcBind(const RPC_BIND_REQUEST *const Request, RPC_BIND_RESPONSE *const Response, const DWORD RpcAssocGroup, const SOCKET sock, const unsigned int len)
{
unsigned int i, _st = 0;
for (i = 0; i < LE32(Request->NumCtxItems); i++)
{
if ( IsEqualGUID((GUID*)TransferSyntaxNDR32, &Request->CtxItems[i].TransferSyntax) )
{
Response->Results[i].SyntaxVersion = LE32(2);
Response->Results[i].AckResult =
Response->Results[i].AckReason = 0;
memcpy(&Response->Results[i].TransferSyntax, TransferSyntaxNDR32, sizeof(GUID));
_st = !0;
}
else
{
Response->Results[i].SyntaxVersion = 0;
Response->Results[i].AckResult =
Response->Results[i].AckReason = LE16(2); // Unsupported
memset(&Response->Results[i].TransferSyntax, 0, sizeof(GUID));
}
}
if ( _st )
{
Response->MaxXmitFrag = Request->MaxXmitFrag;
Response->MaxRecvFrag = Request->MaxRecvFrag;
Response->AssocGroup = LE32(RpcAssocGroup);
socklen_t len;
struct sockaddr_storage addr;
// M$ RPC does not do this. Excess bytes contain apparently random data
memset(Response->SecondaryAddress, 0, sizeof(Response->SecondaryAddress));
len = sizeof addr;
if (getsockname(sock, (struct sockaddr*)&addr, &len) ||
getnameinfo((struct sockaddr*)&addr, len, NULL, 0, (char*)Response->SecondaryAddress, sizeof(Response->SecondaryAddress), NI_NUMERICSERV))
{
// In case of failure (should never happen) use default port (doesn't seem to break activation)
strcpy((char*)Response->SecondaryAddress, "1688");
}
uint_fast8_t temp = strlen((char*)Response->SecondaryAddress) + 1;
////FIXME: Temporary workaround for TCP ports < 10. sizeof(Response->SecondaryAddress) must be padded to 2, 6, 10, ...
if (temp < 3) temp = 3;
Response->SecondaryAddressLength = LE16(temp);
Response->NumResults = Request->NumCtxItems;
}
return _st;
}
开发者ID:jhbsz,项目名称:openwrt-packages-1,代码行数:54,代码来源:rpc.c
示例11: handle_guild_chunk
static int handle_guild_chunk(login_client_t *c, bb_guildcard_req_pkt *pkt) {
uint32_t chunk, cont;
chunk = LE32(pkt->chunk);
cont = LE32(pkt->cont);
/* Send data as long as the client is still looking for it. */
if(cont) {
/* Send the chunk */
return send_bb_guild_chunk(c, chunk);
}
return 0;
}
开发者ID:Sylverant,项目名称:login_server,代码行数:14,代码来源:bbcharacter.c
示例12: InitSectorIVAndWhitening
// Initializes IV and whitening values for sector encryption/decryption in CBC mode.
// IMPORTANT: This function has been deprecated (legacy).
static void
InitSectorIVAndWhitening (unsigned __int64 unitNo,
int blockSize,
unsigned __int32 *iv,
unsigned __int64 *ivSeed,
unsigned __int32 *whitening)
{
/* IMPORTANT: This function has been deprecated (legacy) */
unsigned __int64 iv64[4];
unsigned __int32 *iv32 = (unsigned __int32 *) iv64;
iv64[0] = ivSeed[0] ^ LE64(unitNo);
iv64[1] = ivSeed[1] ^ LE64(unitNo);
iv64[2] = ivSeed[2] ^ LE64(unitNo);
if (blockSize == 16)
{
iv64[3] = ivSeed[3] ^ LE64(unitNo);
}
iv[0] = iv32[0];
iv[1] = iv32[1];
switch (blockSize)
{
case 16:
// 128-bit block
iv[2] = iv32[2];
iv[3] = iv32[3];
whitening[0] = LE32( crc32int ( &iv32[4] ) ^ crc32int ( &iv32[7] ) );
whitening[1] = LE32( crc32int ( &iv32[5] ) ^ crc32int ( &iv32[6] ) );
break;
case 8:
// 64-bit block
whitening[0] = LE32( crc32int ( &iv32[2] ) ^ crc32int ( &iv32[5] ) );
whitening[1] = LE32( crc32int ( &iv32[3] ) ^ crc32int ( &iv32[4] ) );
break;
default:
GST_THROW_FATAL_EXCEPTION;
}
}
开发者ID:ggielly,项目名称:GostCrypt_Windows_1.0,代码行数:51,代码来源:Crypto.c
示例13: logRequestVerbose
void logRequestVerbose(const REQUEST *const Request, const PRINTFUNC p)
{
char guidBuffer[GUID_STRING_LENGTH + 1];
char WorkstationBuffer[3 * WORKSTATION_NAME_BUFFER];
const char *productName;
ProdListIndex_t index;
p("Protocol version : %u.%u\n", LE16(Request->MajorVer), LE16(Request->MinorVer));
p("Client is a virtual machine : %s\n", LE32(Request->VMInfo) ? "Yes" : "No");
p("Licensing status : %u (%s)\n", (uint32_t)LE32(Request->LicenseStatus), LE32(Request->LicenseStatus) < _countof(LicenseStatusText) ? LicenseStatusText[LE32(Request->LicenseStatus)] : "Unknown");
p("Remaining time (0 = forever) : %i minutes\n", (uint32_t)LE32(Request->BindingExpiration));
uuid2StringLE(&Request->AppID, guidBuffer);
productName = getProductNameLE(&Request->AppID, AppList, getAppListSize(), &index);
p("Application ID : %s (%s)\n", guidBuffer, productName);
uuid2StringLE(&Request->ActID, guidBuffer);
# ifndef NO_EXTENDED_PRODUCT_LIST
productName = getProductNameLE(&Request->ActID, ExtendedProductList, getExtendedProductListSize(), &index);
# else
productName = "Unknown";
# endif
p("SKU ID (aka Activation ID) : %s (%s)\n", guidBuffer, productName);
uuid2StringLE(&Request->KMSID, guidBuffer);
productName = getProductNameLE(&Request->KMSID, ProductList, getProductListSize(), &index);
p("KMS ID (aka KMS counted ID) : %s (%s)\n", guidBuffer, productName);
uuid2StringLE(&Request->CMID, guidBuffer);
p("Client machine ID : %s\n", guidBuffer);
uuid2StringLE(&Request->CMID_prev, guidBuffer);
p("Previous client machine ID : %s\n", guidBuffer);
char mbstr[64];
time_t st;
st = fileTimeToUnixTime(&Request->ClientTime);
strftime(mbstr, sizeof(mbstr), "%Y-%m-%d %X", gmtime(&st));
p("Client request timestamp (UTC) : %s\n", mbstr);
ucs2_to_utf8(Request->WorkstationName, WorkstationBuffer, WORKSTATION_NAME_BUFFER, sizeof(WorkstationBuffer));
p("Workstation name : %s\n", WorkstationBuffer);
p("N count policy (minimum clients): %u\n", (uint32_t)LE32(Request->N_Policy));
}
开发者ID:galaxysd,项目名称:GalaxyCodeBases,代码行数:48,代码来源:output.c
示例14: checkRpcRequestSize
/*
* check RPC request for (somewhat) correct size
* allow any size that does not cause CreateResponse to fail badly
*/
static unsigned int checkRpcRequestSize(const RPC_REQUEST64 *const Request, const unsigned int requestSize, WORD* NdrCtx, WORD* Ndr64Ctx)
{
WORD Ctx = LE16(Request->ContextId);
# if defined(_PEDANTIC) && !defined(NO_LOG)
CheckRpcRequest(Request, requestSize, NdrCtx, Ndr64Ctx, Ctx);
# endif // defined(_PEDANTIC) && !defined(NO_LOG)
// Anything that is smaller than a v4 request is illegal
if (requestSize < sizeof(REQUEST_V4) + (Ctx != *Ndr64Ctx ? sizeof(RPC_REQUEST) : sizeof(RPC_REQUEST64))) return 0;
// Get KMS major version
uint16_t majorIndex, minor;
DWORD version;
# ifndef SIMPLE_RPC
if (Ctx != *Ndr64Ctx)
{
version = LE32(*(DWORD*)Request->Ndr.Data);
}
else
{
version = LE32(*(DWORD*)Request->Ndr64.Data);
}
# else // SIMPLE_RPC
version = LE32(*(DWORD*)Request->Ndr.Data);
# endif // SIMPLE_RPC
majorIndex = (uint16_t)(version >> 16) - 4;
minor = (uint16_t)(version & 0xffff);
// Only KMS v4, v5 and v6 are supported
if (majorIndex >= vlmcsd_countof(_Versions) || minor)
{
# ifndef NO_LOG
logger("Fatal: KMSv%hu.%hu unsupported\n", (unsigned short)majorIndex + 4, (unsigned short)minor);
# endif // NO_LOG
return 0;
}
// Could check for equality but allow bigger requests to support buggy RPC clients (e.g. wine)
// Buffer overrun is check by caller.
return (requestSize >= _Versions[majorIndex].RequestSize);
}
开发者ID:CatPressMax,项目名称:vlmcsd,代码行数:52,代码来源:rpc.c
示例15: main
int main(int argc, char *argv[]) {
uint8_t *dat = NULL;
uint32_t sz, ocnt, area;
int alt, idx = 0, i, type = 0;
const quest_dat_hdr_t *ptrs[2][18] = { { 0 } };
const quest_dat_hdr_t *hdr;
/* Parse the command line... */
parse_command_line(argc, argv);
/* See if we got a .qst file a .dat file. */
type = is_qst(filename, version);
if(type == 1) {
dat = read_qst(filename, &sz, version);
}
else if(!type) {
dat = read_dat(filename, &sz, compressed);
}
if(!dat) {
printf("Confused by earlier errors, bailing out.\n");
return -1;
}
parse_quest_objects(dat, sz, &ocnt, ptrs);
printf("Found %d objects\n", (int)ocnt);
for(i = 0; i < 18; ++i) {
if((hdr = ptrs[1][i])) {
/* XXXX: Ugly! */
sz = LE32(hdr->size);
area = LE32(hdr->area);
alt = 0;
if((episode == 3 && area > 5) || (episode == 2 && area > 15))
alt = 1;
if(parse_map((map_enemy_t *)(hdr->data), sz / sizeof(map_enemy_t),
episode, alt, &idx, (int)area)) {
printf("Cannot parse map!\n");
return -4;
}
}
}
return 0;
}
开发者ID:Sylverant,项目名称:pso_tools,代码行数:48,代码来源:quest_enemies.c
示例16: jitter_buffer_ctl
/* Used like the ioctl function to control the jitter buffer parameters */
EXPORT int jitter_buffer_ctl(JitterBuffer *jitter, int request, void *ptr)
{
int count, i;
switch(request)
{
case JITTER_BUFFER_SET_MARGIN:
jitter->buffer_margin = *(spx_int32_t*)ptr;
break;
case JITTER_BUFFER_GET_MARGIN:
*(spx_int32_t*)ptr = jitter->buffer_margin;
break;
case JITTER_BUFFER_GET_AVALIABLE_COUNT:
count = 0;
for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
{
if (jitter->packets[i].data && LE32(jitter->pointer_timestamp, jitter->packets[i].timestamp))
{
count++;
}
}
*(spx_int32_t*)ptr = count;
break;
case JITTER_BUFFER_SET_DESTROY_CALLBACK:
jitter->destroy = (void (*) (void *))ptr;
break;
case JITTER_BUFFER_GET_DESTROY_CALLBACK:
*(void (**) (void *))ptr = jitter->destroy;
break;
case JITTER_BUFFER_SET_DELAY_STEP:
jitter->delay_step = *(spx_int32_t*)ptr;
break;
case JITTER_BUFFER_GET_DELAY_STEP:
*(spx_int32_t*)ptr = jitter->delay_step;
break;
case JITTER_BUFFER_SET_CONCEALMENT_SIZE:
jitter->concealment_size = *(spx_int32_t*)ptr;
break;
case JITTER_BUFFER_GET_CONCEALMENT_SIZE:
*(spx_int32_t*)ptr = jitter->concealment_size;
break;
case JITTER_BUFFER_SET_MAX_LATE_RATE:
jitter->max_late_rate = *(spx_int32_t*)ptr;
jitter->window_size = 100*TOP_DELAY/jitter->max_late_rate;
jitter->subwindow_size = jitter->window_size/MAX_BUFFERS;
break;
case JITTER_BUFFER_GET_MAX_LATE_RATE:
*(spx_int32_t*)ptr = jitter->max_late_rate;
break;
case JITTER_BUFFER_SET_LATE_COST:
jitter->latency_tradeoff = *(spx_int32_t*)ptr;
break;
case JITTER_BUFFER_GET_LATE_COST:
*(spx_int32_t*)ptr = jitter->latency_tradeoff;
break;
default:
speex_warning_int("Unknown jitter_buffer_ctl request: ", request);
return -1;
}
return 0;
}
开发者ID:0359xiaodong,项目名称:TeamTalk,代码行数:61,代码来源:jitter.c
示例17: serpent_set_key
void serpent_set_key(const unsigned __int8 userKey[], int keylen, unsigned __int8 *ks)
{
unsigned __int32 a,b,c,d,e;
unsigned __int32 *k = (unsigned __int32 *)ks;
unsigned __int32 t;
int i;
for (i = 0; i < keylen / (int)sizeof(__int32); i++)
k[i] = LE32(((unsigned __int32*)userKey)[i]);
if (keylen < 32)
k[keylen/4] |= (unsigned __int32)1 << ((keylen%4)*8);
k += 8;
t = k[-1];
for (i = 0; i < 132; ++i)
k[i] = t = rotlFixed(k[i-8] ^ k[i-5] ^ k[i-3] ^ t ^ 0x9e3779b9 ^ i, 11);
k -= 20;
for (i=0; i<4; i++)
{
LKf (k, 20, &a, &e, &b, &d); S3f (&a, &e, &b, &d, &c); SKf (k, 16, &e, &b, &d, &c);
LKf (k, 24, &c, &b, &a, &e); S2f (&c, &b, &a, &e, &d); SKf (k, 20, &a, &e, &b, &d);
LKf (k, 28, &b, &e, &c, &a); S1f (&b, &e, &c, &a, &d); SKf (k, 24, &c, &b, &a, &e);
LKf (k, 32, &a, &b, &c, &d); S0f (&a, &b, &c, &d, &e); SKf (k, 28, &b, &e, &c, &a);
k += 8*4;
LKf (k, 4, &a, &c, &d, &b); S7f (&a, &c, &d, &b, &e); SKf (k, 0, &d, &e, &b, &a);
LKf (k, 8, &a, &c, &b, &e); S6f (&a, &c, &b, &e, &d); SKf (k, 4, &a, &c, &d, &b);
LKf (k, 12, &b, &a, &e, &c); S5f (&b, &a, &e, &c, &d); SKf (k, 8, &a, &c, &b, &e);
LKf (k, 16, &e, &b, &d, &c); S4f (&e, &b, &d, &c, &a); SKf (k, 12, &b, &a, &e, &c);
}
LKf (k, 20, &a, &e, &b, &d); S3f (&a, &e, &b, &d, &c); SKf (k, 16, &e, &b, &d, &c);
}
开发者ID:CSRedRat,项目名称:CipherShed,代码行数:33,代码来源:Serpent.c
示例18: ext2_get_indirect_block_pointer_cache_block
// This function returns a pointer to the cache block that corresponds to the indirect block pointer.
int ext2_get_indirect_block_pointer_cache_block(ext2_t *ext2, struct ext2_inode *inode, blocknum_t **cache_block, uint32_t level, uint32_t pos[], uint *block_loaded)
{
uint32_t current_level = 0;
uint current_block = 0, last_block;
blocknum_t *block = NULL;
int err;
if ((level > 3) || (level == 0)) {
err = -1;
goto error;
}
// Dig down into the indirect blocks. When done, current_block should point to the target.
while (current_level < level) {
if (current_level == 0) {
// read the direct block, simulates a prior loop
current_block = LE32(inode->i_block[pos[0]]);
}
if (current_block == 0) {
err = -1;
goto error;
}
last_block = current_block;
current_level++;
*block_loaded = current_block;
err = ext2_get_block(ext2, (void **)(void *)&block, current_block);
if (err < 0) {
goto error;
}
if (current_level < level) {
current_block = LE32(block[pos[current_level]]);
ext2_put_block(ext2, last_block);
}
}
*cache_block = block;
return 0;
error:
*cache_block = NULL;
*block_loaded = 0;
return err;
}
开发者ID:0xBADCA7,项目名称:lk,代码行数:48,代码来源:io.c
示例19: rj_send_event
int rj_send_event(int type, unsigned int value) {
struct JoyEvent event;
if (rj_sock < 0)
return -1;
// Swap endianness for the PSP
event.magic = LE32(JOY_MAGIC);
event.type = LE32(type);
event.value = LE32(value);
const void *buf = (void *) &event;
int written = 0;
int len = sizeof(event);
while (written < len) {
int ret = write(rj_sock, buf + written, len - written);
if (ret < 0) {
if (errno != EINTR) {
perror("write");
written = -1;
break;
}
} else
written += ret;
}
if (written != len) {
fprintf(stderr, "Could not write out data to socket.\n");
return -1;
}
return 0;
}
开发者ID:luqmana,项目名称:RemoteJoyPlus,代码行数:47,代码来源:rj_interface.c
示例20: RpcServer
void RpcServer(const SOCKET sock, const DWORD RpcAssocGroup)
{
RPC_HEADER _Header;
RandomNumberInit();
while (_recv(sock, &_Header, sizeof(_Header)))
{
unsigned int _st, request_len, response_len, _a;
BYTE *_Request /* = NULL */; //uncomment to avoid false warnings when compiling with -Og
#if defined(_PEDANTIC) && !defined(NO_LOG)
CheckRpcHeader(&_Header, _Header.PacketType, &logger);
#endif // defined(_PEDANTIC) && !defined(NO_LOG)
switch (_Header.PacketType)
{
case RPC_PT_BIND_REQ: _a = 0; break;
case RPC_PT_REQUEST: _a = 1; break;
default: return;
}
if ( (_st = ( (signed)( request_len = LE16(_Header.FragLength) - sizeof(_Header) )) > 0
&& (_Request = (BYTE*)malloc(request_len) )))
{
BYTE *_Response /* = NULL */; //uncomment to avoid warnings when compiling with -Og
if ((_st = (_recv(sock, _Request, request_len))
&& ( response_len = _Actions[_a].GetResponseSize(_Request, request_len) )
&& (_Response = (BYTE*)malloc( response_len += sizeof(_Header) ))))
{
if ( (_st = _Actions[_a].GetResponse(_Request, _Response + sizeof(_Header), RpcAssocGroup, sock, request_len)) )
{
RPC_HEADER *rh = (RPC_HEADER *)_Response;
if (_Actions[_a].ResponsePacketType == RPC_PT_RESPONSE)
response_len = LE32(((RPC_RESPONSE*)(_Response + sizeof(_Header)))->AllocHint) + 24;
/* *((WORD*)rh) = *((WORD*)&_Header);
rh->PacketFlags = RPC_PF_FIRST | RPC_PF_LAST;
rh->DataRepresentation = _Header.DataRepresentation;
rh->AuthLength = _Header.AuthLength;
rh->CallId = _Header.CallId;*/
memcpy(rh, &_Header, sizeof(RPC_HEADER));
rh->PacketType = _Actions[_a].ResponsePacketType;
rh->FragLength = LE16(response_len);
_st = _send(sock, _Response, response_len);
if (DisconnectImmediately && rh->PacketType == RPC_PT_RESPONSE)
shutdown(sock, VLMCSD_SHUT_RDWR);
}
free(_Response);
}
free(_Request);
}
if (!_st) return;
}
}
开发者ID:jhbsz,项目名称:openwrt-packages-1,代码行数:59,代码来源:rpc.c
注:本文中的LE32函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论