Lines Matching refs:ahc
888 static void ip_short(uhash_ctx_t ahc, UINT8 *nh_res, u_char *res) in ip_short() argument
893 t = ip_aux(0,ahc->ip_keys, nhp[0]); in ip_short()
894 STORE_UINT32_BIG((UINT32 *)res+0, ip_reduce_p36(t) ^ ahc->ip_trans[0]); in ip_short()
896 t = ip_aux(0,ahc->ip_keys+4, nhp[1]); in ip_short()
897 STORE_UINT32_BIG((UINT32 *)res+1, ip_reduce_p36(t) ^ ahc->ip_trans[1]); in ip_short()
900 t = ip_aux(0,ahc->ip_keys+8, nhp[2]); in ip_short()
901 STORE_UINT32_BIG((UINT32 *)res+2, ip_reduce_p36(t) ^ ahc->ip_trans[2]); in ip_short()
904 t = ip_aux(0,ahc->ip_keys+12, nhp[3]); in ip_short()
905 STORE_UINT32_BIG((UINT32 *)res+3, ip_reduce_p36(t) ^ ahc->ip_trans[3]); in ip_short()
913 static void ip_long(uhash_ctx_t ahc, u_char *res) in ip_long() argument
920 if (ahc->poly_accum[i] >= p64) in ip_long()
921 ahc->poly_accum[i] -= p64; in ip_long()
922 t = ip_aux(0,ahc->ip_keys+(i*4), ahc->poly_accum[i]); in ip_long()
924 ip_reduce_p36(t) ^ ahc->ip_trans[i]); in ip_long()
958 static void uhash_init(uhash_ctx_t ahc, aes_int_key prf_key) in uhash_init() argument
964 memset(ahc, 0, sizeof(uhash_ctx)); in uhash_init()
967 nh_init(&ahc->hash, prf_key); in uhash_init()
976 memcpy(ahc->poly_key_8+i, buf+24*i, 8); in uhash_init()
977 endian_convert_if_le(ahc->poly_key_8+i, 8, 8); in uhash_init()
979 ahc->poly_key_8[i] &= ((UINT64)0x01ffffffu << 32) + 0x01ffffffu; in uhash_init()
980 ahc->poly_accum[i] = 1; /* Our polyhash prepends a non-zero word */ in uhash_init()
986 memcpy(ahc->ip_keys+4*i, buf+(8*i+4)*sizeof(UINT64), in uhash_init()
988 endian_convert_if_le(ahc->ip_keys, sizeof(UINT64), in uhash_init()
989 sizeof(ahc->ip_keys)); in uhash_init()
991 ahc->ip_keys[i] %= p36; /* Bring into Z_p36 */ in uhash_init()
995 kdf(ahc->ip_trans, prf_key, 4, STREAMS * sizeof(UINT32)); in uhash_init()
996 endian_convert_if_le(ahc->ip_trans, sizeof(UINT32), in uhash_init()
1125 static int uhash(uhash_ctx_t ahc, u_char *msg, long len, u_char *res)
1143 nh(&ahc->hash, (UINT8 *)msg, nh_len, len, nh_result);
1144 ip_short(ahc,nh_result, res);
1150 nh(&ahc->hash, (UINT8 *)msg, L1_KEY_LEN, L1_KEY_LEN, nh_result);
1151 poly_hash(ahc,(UINT32 *)nh_result);
1159 nh(&ahc->hash, (UINT8 *)msg, nh_len, len, nh_result);
1160 poly_hash(ahc,(UINT32 *)nh_result);
1163 ip_long(ahc, res);
1166 uhash_reset(ahc);