Lines Matching defs:v
1 /* $OpenBSD: crypto_internal.h,v 1.15 2025/01/19 07:51:41 jsing Exp $ */
36 crypto_ct_ne_zero(size_t v)
38 return (v | ~(v - 1)) >> ((sizeof(v) * 8) - 1);
44 crypto_ct_ne_zero_mask(size_t v)
46 return 0 - crypto_ct_ne_zero(v);
52 crypto_ct_eq_zero(size_t v)
54 return 1 - crypto_ct_ne_zero(v);
60 crypto_ct_eq_zero_mask(size_t v)
62 return 0 - crypto_ct_eq_zero(v);
104 crypto_ct_ne_zero_u8(uint8_t v)
106 return (uint8_t)(v | ~(v - 1)) >> ((sizeof(v) * 8) - 1);
112 crypto_ct_ne_zero_mask_u8(uint8_t v)
114 return 0 - crypto_ct_ne_zero_u8(v);
120 crypto_ct_eq_zero_u8(uint8_t v)
122 return 1 - crypto_ct_ne_zero_u8(v);
128 crypto_ct_eq_zero_mask_u8(uint8_t v)
130 return 0 - crypto_ct_eq_zero_u8(v);
175 uint32_t v;
177 memcpy(&v, src, sizeof(v));
179 return be32toh(v);
190 crypto_store_htobe32(uint8_t *dst, uint32_t v)
192 v = htobe32(v);
193 memcpy(dst, &v, sizeof(v));
206 uint64_t v;
208 memcpy(&v, src, sizeof(v));
210 return be64toh(v);
221 crypto_store_htobe64(uint8_t *dst, uint64_t v)
223 v = htobe64(v);
224 memcpy(dst, &v, sizeof(v));
237 uint32_t v;
239 memcpy(&v, src, sizeof(v));
241 return le32toh(v);
252 crypto_store_htole32(uint8_t *dst, uint32_t v)
254 v = htole32(v);
255 memcpy(dst, &v, sizeof(v));
261 crypto_add_u32dw_u64(uint32_t *h, uint32_t *l, uint64_t v)
263 v += ((uint64_t)*h << 32) | *l;
264 *h = v >> 32;
265 *l = v;
271 crypto_rol_u32(uint32_t v, size_t shift)
273 return (v << shift) | (v >> (32 - shift));
279 crypto_ror_u32(uint32_t v, size_t shift)
281 return (v << (32 - shift)) | (v >> shift);
287 crypto_rol_u64(uint64_t v, size_t shift)
289 return (v << shift) | (v >> (64 - shift));
295 crypto_ror_u64(uint64_t v, size_t shift)
297 return (v << (64 - shift)) | (v >> shift);