Lines Matching refs:ctx
65 # define readLane(x, y) load64(ctx->state+sizeof(uint64_t)*idx(x, y))
66 # define writeLane(x, y, v) store64(ctx->state+sizeof(uint64_t)*idx(x, y), v)
67 # define XORLane(x, y, v) xor64(ctx->state+sizeof(uint64_t)*idx(x, y), v)
69 # define readLane(x, y) (((uint64_t*)ctx->state)[idx(x,y)])
70 # define writeLane(x, y, v) (((uint64_t*)ctx->state)[idx(x,y)] = v)
71 # define XORLane(x, y, v) (((uint64_t*)ctx->state)[idx(x,y)] ^= v)
88 static void permute(PHP_SHA3_CTX* ctx) { in permute() argument
150 static void PHP_SHA3_Init(PHP_SHA3_CTX* ctx, in PHP_SHA3_Init() argument
152 memset(ctx, 0, sizeof(PHP_SHA3_CTX)); in PHP_SHA3_Init()
155 static void PHP_SHA3_Update(PHP_SHA3_CTX* ctx, in PHP_SHA3_Update() argument
160 size_t len = block_size - ctx->pos; in PHP_SHA3_Update()
169 ctx->state[ctx->pos++] ^= *(buf++); in PHP_SHA3_Update()
172 if (ctx->pos >= block_size) { in PHP_SHA3_Update()
173 permute(ctx); in PHP_SHA3_Update()
174 ctx->pos = 0; in PHP_SHA3_Update()
180 PHP_SHA3_CTX* ctx, in PHP_SHA3_Final() argument
186 ctx->state[ctx->pos++] ^= 0x06; in PHP_SHA3_Final()
187 ctx->state[block_size-1] ^= 0x80; in PHP_SHA3_Final()
188 permute(ctx); in PHP_SHA3_Final()
193 memcpy(digest, ctx->state, bs); in PHP_SHA3_Final()
197 permute(ctx); in PHP_SHA3_Final()
201 ZEND_SECURE_ZERO(ctx, sizeof(PHP_SHA3_CTX)); in PHP_SHA3_Final()
209 PHP_SHA3_CTX *ctx = (PHP_SHA3_CTX *) hash->context; in php_sha3_unserialize() local
213 && ctx->pos < block_size) { in php_sha3_unserialize()
223 void PHP_SHA3##bits##Init(PHP_SHA3_##bits##_CTX* ctx, ZEND_ATTRIBUTE_UNUSED HashTable *args) { \
224 PHP_SHA3_Init(ctx, bits); \
226 void PHP_SHA3##bits##Update(PHP_SHA3_##bits##_CTX* ctx, \
229 PHP_SHA3_Update(ctx, input, inputLen, \
233 PHP_SHA3_##bits##_CTX* ctx) { \
234 PHP_SHA3_Final(digest, ctx, \
304 Keccak_HashInstance *ctx = (Keccak_HashInstance *) hash->context; in php_keccak_unserialize() local
308 && ctx->sponge.byteIOIndex < ctx->sponge.rate / 8) { in php_keccak_unserialize()
318 void PHP_SHA3##bits##Init(PHP_SHA3_##bits##_CTX* ctx, ZEND_ATTRIBUTE_UNUSED HashTable *args) { \
320 Keccak_HashInitialize_SHA3_##bits((Keccak_HashInstance *)ctx); \
322 void PHP_SHA3##bits##Update(PHP_SHA3_##bits##_CTX* ctx, \
325 Keccak_HashUpdate((Keccak_HashInstance *)ctx, input, inputLen * 8); \
328 PHP_SHA3_##bits##_CTX* ctx) { \
329 Keccak_HashFinal((Keccak_HashInstance *)ctx, digest); \