Lines Matching refs:b2b
61 BLAKE2B_CTX *b2b, in blake2b_transform() argument
66 OPENSSL_STATIC_ASSERT(sizeof(v) == sizeof(b2b->h) + sizeof(kIV), ""); in blake2b_transform()
67 OPENSSL_memcpy(v, b2b->h, sizeof(b2b->h)); in blake2b_transform()
70 b2b->t_low += num_bytes; in blake2b_transform()
71 if (b2b->t_low < num_bytes) { in blake2b_transform()
72 b2b->t_high++; in blake2b_transform()
74 v[12] ^= b2b->t_low; in blake2b_transform()
75 v[13] ^= b2b->t_high; in blake2b_transform()
93 for (size_t i = 0; i < OPENSSL_ARRAY_SIZE(b2b->h); i++) { in blake2b_transform()
94 b2b->h[i] ^= v[i]; in blake2b_transform()
95 b2b->h[i] ^= v[i + 8]; in blake2b_transform()
99 void BLAKE2B256_Init(BLAKE2B_CTX *b2b) { in BLAKE2B256_Init() argument
100 OPENSSL_memset(b2b, 0, sizeof(BLAKE2B_CTX)); in BLAKE2B256_Init()
102 OPENSSL_STATIC_ASSERT(sizeof(kIV) == sizeof(b2b->h), ""); in BLAKE2B256_Init()
103 OPENSSL_memcpy(&b2b->h, kIV, sizeof(kIV)); in BLAKE2B256_Init()
106 b2b->h[0] ^= 0x01010000 | BLAKE2B256_DIGEST_LENGTH; in BLAKE2B256_Init()
109 void BLAKE2B256_Update(BLAKE2B_CTX *b2b, const void *in_data, size_t len) { in BLAKE2B256_Update() argument
112 size_t todo = sizeof(b2b->block.bytes) - b2b->block_used; in BLAKE2B256_Update()
116 OPENSSL_memcpy(&b2b->block.bytes[b2b->block_used], data, todo); in BLAKE2B256_Update()
117 b2b->block_used += todo; in BLAKE2B256_Update()
126 assert(b2b->block_used == BLAKE2B_CBLOCK); in BLAKE2B256_Update()
127 blake2b_transform(b2b, b2b->block.words, BLAKE2B_CBLOCK, in BLAKE2B256_Update()
129 b2b->block_used = 0; in BLAKE2B256_Update()
134 blake2b_transform(b2b, block_words, BLAKE2B_CBLOCK, /*is_final_block=*/0); in BLAKE2B256_Update()
139 OPENSSL_memcpy(b2b->block.bytes, data, len); in BLAKE2B256_Update()
140 b2b->block_used = len; in BLAKE2B256_Update()
143 void BLAKE2B256_Final(uint8_t out[BLAKE2B256_DIGEST_LENGTH], BLAKE2B_CTX *b2b) { in BLAKE2B256_Final() argument
144 OPENSSL_memset(&b2b->block.bytes[b2b->block_used], 0, in BLAKE2B256_Final()
145 sizeof(b2b->block.bytes) - b2b->block_used); in BLAKE2B256_Final()
146 blake2b_transform(b2b, b2b->block.words, b2b->block_used, in BLAKE2B256_Final()
148 OPENSSL_STATIC_ASSERT(BLAKE2B256_DIGEST_LENGTH <= sizeof(b2b->h), ""); in BLAKE2B256_Final()
149 memcpy(out, b2b->h, BLAKE2B256_DIGEST_LENGTH); in BLAKE2B256_Final()