32 #if defined( INC_ALL )
78 #if defined(__cplusplus)
84 # undef GF_REPRESENTATION
86 # define GF_REPRESENTATION REVERSE_BITS
88 # define GF_REPRESENTATION REVERSE_BYTES | REVERSE_BITS
90 # define GF_REPRESENTATION REVERSE_NONE
92 # define GF_REPRESENTATION REVERSE_BITS
95 #define BLOCK_SIZE GCM_BLOCK_SIZE
96 #define BLK_ADR_MASK (BLOCK_SIZE - 1)
100 { int i = BLOCK_SIZE; while(i-- > CTR_POS && !++(UI8_PTR(x)[i])) ; }
103 const unsigned char key[],
104 unsigned long key_len,
115 #if defined( GF_REPRESENTATION )
119 #if defined( TABLES_64K )
121 #elif defined( TABLES_8K )
123 #elif defined( TABLES_4K )
125 #elif defined( TABLES_256 )
128 #if defined( GF_REPRESENTATION )
136 #if defined( GF_REPRESENTATION ) || !defined( NO_TABLES )
139 #if defined( GF_REPRESENTATION )
143 #if defined( TABLES_64K )
145 #elif defined( TABLES_8K )
147 #elif defined( TABLES_4K )
149 #elif defined( TABLES_256 )
152 # if defined( GF_REPRESENTATION )
160 #if defined( GF_REPRESENTATION )
166 const unsigned char iv[],
167 unsigned long iv_len,
169 { uint_32t i, n_pos = 0;
194 n_pos = (iv_len << 3);
195 for(i =
BLOCK_SIZE - 1; n_pos; --i, n_pos >>= 8)
209 const unsigned char hdr[],
210 unsigned long hdr_len,
222 while(cnt < hdr_len && (b_pos & BUF_ADRMASK))
266 const unsigned char data[],
267 unsigned long data_len,
279 while(cnt < data_len && (b_pos & BUF_ADRMASK))
308 while(cnt < data_len)
323 unsigned char data[],
324 unsigned long data_len,
335 while(cnt < data_len && (b_pos & BUF_ADRMASK))
368 while(cnt < data_len)
385 unsigned long tag_len,
403 # if defined( GF_REPRESENTATION )
418 i = ln | ln >> 1; i |= i >> 2; i |= i >> 4;
419 i |= i >> 8; i |= i >> 16; i &= ~(i >> 1);
424 # if defined( GF_REPRESENTATION )
428 # if defined( GF_REPRESENTATION )
435 # if defined( GF_REPRESENTATION )
441 #if defined( GF_REPRESENTATION )
449 { uint_64t tm = ((uint_64t)ctx->
txt_acnt) << 3;
453 tm = (i == 8 ? (((uint_64t)ctx->
hdr_cnt) << 3) : tm >> 8);
479 for(i = 0; i < (
unsigned int)tag_len; ++i)
488 memset(ctx, 0,
sizeof(
gcm_ctx));
493 unsigned char data[],
494 unsigned long data_len,
504 unsigned char data[],
505 unsigned long data_len,
514 const unsigned char iv[],
515 unsigned long iv_len,
516 const unsigned char hdr[],
517 unsigned long hdr_len,
519 unsigned long msg_len,
521 unsigned long tag_len,
531 const unsigned char iv[],
532 unsigned long iv_len,
533 const unsigned char hdr[],
534 unsigned long hdr_len,
536 unsigned long msg_len,
537 const unsigned char tag[],
538 unsigned long tag_len,
550 #if defined(__cplusplus)