/freebsd/contrib/bearssl/src/rsa/ |
H A D | rsa_pss_sig_pad.c | 34 size_t xlen, hash_len; in br_rsa_pss_sig_pad() local 42 * notably, if the modulus length is equal to 1 modulo 8, then in br_rsa_pss_sig_pad() 46 n_bitlen --; in br_rsa_pss_sig_pad() 50 xlen = (n_bitlen + 7) >> 3; in br_rsa_pss_sig_pad() 56 if (hash_len > xlen || salt_len > xlen in br_rsa_pss_sig_pad() 57 || (hash_len + salt_len + 2) > xlen) in br_rsa_pss_sig_pad() 65 salt = x + xlen - hash_len - salt_len - 1; in br_rsa_pss_sig_pad() 67 (*rng)->generate(rng, salt, salt_len); in br_rsa_pss_sig_pad() 73 seed = x + xlen - hash_len - 1; in br_rsa_pss_sig_pad() 74 hf_data->init(&hc.vtable); in br_rsa_pss_sig_pad() [all …]
|
H A D | rsa_pss_sig_unpad.c | 34 size_t u, xlen, hash_len; in br_rsa_pss_sig_unpad() local 43 * Value r will be set to a non-zero value is any test fails. in br_rsa_pss_sig_unpad() 51 for (u = 0; u < pk->nlen; u ++) { in br_rsa_pss_sig_unpad() 52 if (pk->n[u] != 0) { in br_rsa_pss_sig_unpad() 56 if (u == pk->nlen) { in br_rsa_pss_sig_unpad() 59 n_bitlen = BIT_LENGTH(pk->n[u]) + ((uint32_t)(pk->nlen - u - 1) << 3); in br_rsa_pss_sig_unpad() 60 n_bitlen --; in br_rsa_pss_sig_unpad() 66 xlen = (n_bitlen + 7) >> 3; in br_rsa_pss_sig_unpad() 72 if (hash_len > xlen || salt_len > xlen in br_rsa_pss_sig_unpad() 73 || (hash_len + salt_len + 2) > xlen) in br_rsa_pss_sig_unpad() [all …]
|
H A D | rsa_i15_priv.c | 38 size_t xlen, u; in br_rsa_i15_private() local 39 uint16_t tmp[1 + TLEN]; in br_rsa_i15_private() 47 * them anyway in constant-time code). in br_rsa_i15_private() 49 p = sk->p; in br_rsa_i15_private() 50 plen = sk->plen; in br_rsa_i15_private() 53 plen --; in br_rsa_i15_private() 55 q = sk->q; in br_rsa_i15_private() 56 qlen = sk->qlen; in br_rsa_i15_private() 59 qlen --; in br_rsa_i15_private() 66 fwlen = 1; in br_rsa_i15_private() [all …]
|
H A D | rsa_i31_priv.c | 38 size_t xlen, u; in br_rsa_i31_private() local 39 uint32_t tmp[1 + TLEN]; in br_rsa_i31_private() 47 * them anyway in constant-time code). in br_rsa_i31_private() 49 p = sk->p; in br_rsa_i31_private() 50 plen = sk->plen; in br_rsa_i31_private() 53 plen --; in br_rsa_i31_private() 55 q = sk->q; in br_rsa_i31_private() 56 qlen = sk->qlen; in br_rsa_i31_private() 59 qlen --; in br_rsa_i31_private() 66 fwlen = 1; in br_rsa_i31_private() [all …]
|
H A D | rsa_i32_priv.c | 27 #define U (1 + (BR_MAX_RSA_FACTOR >> 5)) 38 size_t xlen, u; in br_rsa_i32_private() local 61 p = sk->p; in br_rsa_i32_private() 62 plen = sk->plen; in br_rsa_i32_private() 65 plen --; in br_rsa_i32_private() 67 q = sk->q; in br_rsa_i32_private() 68 qlen = sk->qlen; in br_rsa_i32_private() 71 qlen --; in br_rsa_i32_private() 90 xlen = (sk->n_bitlen + 7) >> 3; in br_rsa_i32_private() 91 br_i32_encode(t2 + 2 * U, xlen, t2); in br_rsa_i32_private() [all …]
|
H A D | rsa_i62_priv.c | 30 #define TLEN (4 * U) /* TLEN is counted in 64-bit words */ 40 size_t xlen, u; in br_rsa_i62_private() local 49 * them anyway in constant-time code). in br_rsa_i62_private() 51 p = sk->p; in br_rsa_i62_private() 52 plen = sk->plen; in br_rsa_i62_private() 55 plen --; in br_rsa_i62_private() 57 q = sk->q; in br_rsa_i62_private() 58 qlen = sk->qlen; in br_rsa_i62_private() 61 qlen --; in br_rsa_i62_private() 68 fwlen = 1; in br_rsa_i62_private() [all …]
|
H A D | rsa_pkcs1_sig_pad.c | 33 size_t u, x3, xlen; in br_rsa_pkcs1_sig_pad() local 41 * -- Total length is equal to the modulus length (unsigned in br_rsa_pkcs1_sig_pad() 44 * -- There must be at least eight bytes of value 0xFF. in br_rsa_pkcs1_sig_pad() 46 * -- x4 is equal to the hash length (hash_len). in br_rsa_pkcs1_sig_pad() 48 * -- x3 is equal to the encoded OID value length (hash_oid[0]). in br_rsa_pkcs1_sig_pad() 50 * -- x2 = x3 + 4. in br_rsa_pkcs1_sig_pad() 52 * -- x1 = x2 + x4 + 4 = x3 + x4 + 8. in br_rsa_pkcs1_sig_pad() 55 * that sequence exist in practice), but notes in PKCS#1 seem to in br_rsa_pkcs1_sig_pad() 57 * an ASN.1 NULL value for the hash parameters) may be slightly in br_rsa_pkcs1_sig_pad() 60 xlen = (n_bitlen + 7) >> 3; in br_rsa_pkcs1_sig_pad() [all …]
|
H A D | rsa_i32_pub.c | 29 br_rsa_i32_public(unsigned char *x, size_t xlen, in br_rsa_i32_public() argument 34 uint32_t m[1 + (BR_MAX_RSA_SIZE >> 5)]; in br_rsa_i32_public() 35 uint32_t a[1 + (BR_MAX_RSA_SIZE >> 5)]; in br_rsa_i32_public() 36 uint32_t t1[1 + (BR_MAX_RSA_SIZE >> 5)]; in br_rsa_i32_public() 37 uint32_t t2[1 + (BR_MAX_RSA_SIZE >> 5)]; in br_rsa_i32_public() 44 n = pk->n; in br_rsa_i32_public() 45 nlen = pk->nlen; in br_rsa_i32_public() 48 nlen --; in br_rsa_i32_public() 50 if (nlen == 0 || nlen > (BR_MAX_RSA_SIZE >> 3) || xlen != nlen) { in br_rsa_i32_public() 54 m0i = br_i32_ninv32(m[1]); in br_rsa_i32_public() [all …]
|
/freebsd/crypto/openssl/ssl/ |
H A D | t1_trce.c | 2 * Copyright 2012-2021 The OpenSSL Project Authors. All Rights Reserved. 34 if (tbl->num == val) in do_ssl_trace_str() 35 return tbl->name; in do_ssl_trace_str() 51 val = (val << 8) | msg[1]; in do_ssl_trace_list() 55 msglen -= vlen; in do_ssl_trace_list() 57 return 1; in do_ssl_trace_list() 430 {0xC102, "IANA-GOST2012-GOST8912-GOST8912"}, 445 {0xFF85, "LEGACY-GOST2012-GOST8912-GOST8912"}, 446 {0xFF87, "GOST2012-NULL-GOST12"}, 447 {0xC100, "GOST2012-KUZNYECHIK-KUZNYECHIKOMAC"}, [all …]
|
/freebsd/contrib/sendmail/libsm/ |
H A D | t-ixlen.c | 11 SM_IDSTR(id, "@(#)$Id: t-qic.c,v 1.10 2013-11-22 20:51:43 ca Exp $") 29 int xlen; local 31 xlen = ilenx(str); 32 SM_TEST(len == xlen); 33 if (len != xlen) 35 str, xlen, len); 54 XLEN(*obp); 57 fprintf(stderr, "str=\"%s\", ilen=%d, xlen=%d\n", 58 str, ilen, xlen); 63 SM_TEST(xlen == lenx); [all …]
|
/freebsd/contrib/llvm-project/clang/lib/CodeGen/Targets/ |
H A D | RISCV.cpp | 1 //===- RISCV.cpp ----------------------------------------------------------===// 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 //===----------------------------------------------------------------------===// 15 //===----------------------------------------------------------------------===// 16 // RISC-V ABI Implementation 17 //===----------------------------------------------------------------------===// 23 unsigned XLen; member in __anonb4a9a46e0111::RISCVABIInfo 38 RISCVABIInfo(CodeGen::CodeGenTypes &CGT, unsigned XLen, unsigned FLen, in RISCVABIInfo() argument 40 : DefaultABIInfo(CGT), XLen(XLen), FLen(FLen), NumArgGPRs(EABI ? 6 : 8), in RISCVABIInfo() 44 // non-virtual, but computeInfo is virtual, so we overload it. [all …]
|
H A D | CSKY.cpp | 1 //===- CSKY.cpp -----------------------------------------------------------===// 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 //===----------------------------------------------------------------------===// 15 //===----------------------------------------------------------------------===// 17 //===----------------------------------------------------------------------===// 23 static const unsigned XLen = 32; member in __anond0a0cca10111::CSKYABIInfo 52 int ArgGPRsLeft = IsRetIndirect ? NumArgGPRs - 1 : NumArgGPRs; in computeInfo() 62 CharUnits SlotSize = CharUnits::fromQuantity(XLen / 8); in EmitVAArg() 80 // Structures with either a non-trivial destructor or a non-trivial in classifyArgumentType() 84 ArgGPRsLeft -= 1; in classifyArgumentType() [all …]
|
/freebsd/sys/dev/syscons/daemon/ |
H A D | daemon_saver.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 12 * 1. Redistributions of source code must retain the above copyright 63 " /- _ `-/ '", 67 " `-^--'`< '", 70 " `-----' /", 71 "<----. __ / __ \\", 72 "<----|====O)))==) \\) /====", 73 "<----' `--' `.__,' \\", 77 " ,' ,-----' |", [all …]
|
/freebsd/contrib/bearssl/src/x509/ |
H A D | asn1enc.c | 29 br_asn1_uint_prepare(const void *xdata, size_t xlen) in br_asn1_uint_prepare() argument 35 while (xlen > 0 && *x == 0) { in br_asn1_uint_prepare() 37 xlen --; in br_asn1_uint_prepare() 40 t.len = xlen; in br_asn1_uint_prepare() 41 t.asn1len = xlen; in br_asn1_uint_prepare() 42 if (xlen == 0 || x[0] >= 0x80) { in br_asn1_uint_prepare() 61 return 1; in br_asn1_encode_length() 69 for (j = i - 1; j >= 0; j --) { in br_asn1_encode_length() 73 return i + 1; in br_asn1_encode_length() 84 return 1 + br_asn1_encode_length(NULL, pp.asn1len) + pp.asn1len; in br_asn1_encode_uint() [all …]
|
H A D | encode_ec_rawder.c | 57 * ASN.1 format: in br_encode_ec_raw_der_inner() 60 * version INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1), in br_encode_ec_raw_der_inner() 63 * publicKey [1] BIT STRING OPTIONAL in br_encode_ec_raw_der_inner() 66 * The tages '[0]' and '[1]' are explicit. The 'ECParameters' in br_encode_ec_raw_der_inner() 70 * The value of the 'privateKey' field is the raw unsigned big-endian in br_encode_ec_raw_der_inner() 72 * order); there is no INTEGER tag, and the leading bit may be 1. in br_encode_ec_raw_der_inner() 77 * by the unsigned big-endian encodings of the X and Y coordinates, in br_encode_ec_raw_der_inner() 86 oid = br_get_curve_OID(sk->curve); in br_encode_ec_raw_der_inner() 94 len_privateKey = 1 + len_of_len(sk->xlen) + sk->xlen; in br_encode_ec_raw_der_inner() 104 len_publicKey_bits = 2 + len_of_len(pk->qlen) + pk->qlen; in br_encode_ec_raw_der_inner() [all …]
|
/freebsd/contrib/llvm-project/llvm/lib/TargetParser/ |
H A D | RISCVISAInfo.cpp | 1 //===-- RISCVISAInfo.cpp - RISC-V Arch String Parser ----------------------===// 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 //===----------------------------------------------------------------------===// 84 outs() << "All available -march extensions for RISC-V\n\n"; in printSupportedExtensions() 103 PrintExtension(E.first, Version, DescMap["experimental-" + E.first]); in printSupportedExtensions() 114 outs() << "\nUse -march to specify the target's extension.\n" in printSupportedExtensions() 115 "For example, clang -march=rv32i_v1p0\n"; in printSupportedExtensions() 121 outs() << "Extensions enabled for the given RISC-V target\n\n"; in printEnabledExtensions() 141 if (EnabledFeatureNames.count("experimental-" + Name.str()) != 0) { in printEnabledExtensions() 149 PrintExtension(E.first, Version, DescMap["experimental-" + E.first]); in printEnabledExtensions() [all …]
|
/freebsd/contrib/bearssl/src/ec/ |
H A D | ecdsa_rta.c | 28 * Compute ASN.1 encoded length for the provided integer. The ASN.1 35 asn1_int_length(const unsigned char *x, size_t xlen) in asn1_int_length() argument 37 while (xlen > 0 && *x == 0) { in asn1_int_length() 39 xlen --; in asn1_int_length() 41 if (xlen == 0 || *x >= 0x80) { in asn1_int_length() 42 xlen ++; in asn1_int_length() 44 return xlen; in asn1_int_length() 62 if ((sig_len & 1) != 0) { in br_ecdsa_raw_to_asn1() 69 hlen = sig_len >> 1; in br_ecdsa_raw_to_asn1() 82 tmp[1] = 0x81; in br_ecdsa_raw_to_asn1() [all …]
|
/freebsd/contrib/bearssl/inc/ |
H A D | bearssl_rsa.h | 50 * such integers are represented with big-endian unsigned notation: 55 * relevant bytes. As a general rule, minimal-length encoding is not 60 * - the modulus (`n`); 61 * - the public exponent (`e`). 64 * [PKCS#1](https://tools.ietf.org/html/rfc3447), contain eight integers: 66 * - the modulus (`n`); 67 * - the public exponent (`e`); 68 * - the private exponent (`d`); 69 * - the first prime factor (`p`); 70 * - the second prime factor (`q`); [all …]
|
/freebsd/lib/libc/string/ |
H A D | strxfrm.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 17 * 1. Redistributions of source code must retain the above copyright 54 size_t xlen; in strxfrm_l() local 59 (struct xlocale_collate*)locale->components[XLC_COLLATE]; in strxfrm_l() 74 if (table->__collate_load_error) in strxfrm_l() 77 if ((wcs = malloc((slen + 1) * sizeof (wchar_t))) == NULL) in strxfrm_l() 80 if (mbstowcs_l(wcs, src, slen + 1, locale) == (size_t)-1) in strxfrm_l() 83 if ((xlen = _collate_sxfrm(table, wcs, dest, len)) == (size_t)-1) in strxfrm_l() 88 if (len > xlen) { in strxfrm_l() [all …]
|
/freebsd/contrib/wpa/src/crypto/ |
H A D | aes-gcm.c | 19 val = WPA_GET_BE32(block + AES_BLOCK_SIZE - 4); in inc32() 21 WPA_PUT_BE32(block + AES_BLOCK_SIZE - 4, val); in inc32() 41 val >>= 1; in shift_right_block() 47 val >>= 1; in shift_right_block() 53 val >>= 1; in shift_right_block() 59 val >>= 1; in shift_right_block() 75 if (x[i] & BIT(7 - j)) { in gf_mult() 76 /* Z_(i + 1) = Z_i XOR V_i */ in gf_mult() 79 /* Z_(i + 1) = Z_i */ in gf_mult() 83 /* V_(i + 1) = (V_i >> 1) XOR R */ in gf_mult() [all …]
|
/freebsd/contrib/bearssl/test/ |
H A D | test_math.c | 99 * that x-1 is not a multiple of 65537. 105 mpz_urandomb(x, RNG, size - 1); in rand_prime() 107 mpz_setbit(x, size - 1); in rand_prime() 109 mpz_sub_ui(x, x, 1); in rand_prime() 113 mpz_add_ui(x, x, 1); in rand_prime() 128 mpz_export(zb, &zlen, 1, 1, 0, 0, z); in print_z() 134 k = 4 - (zlen & 3); in print_z() 141 zb[k], zb[k + 1], zb[k + 2], zb[k + 3]); in print_z() 157 for (k = (x[0] + 31) >> 5; k > 0; k --) { in print_u() 171 size_t xlen, zlen; in check_eqz() local [all …]
|
/freebsd/contrib/bearssl/src/ssl/ |
H A D | ssl_scert_single_ec.c | 40 if (cc->eng.session.version < BR_TLS12) { in se_choose() 43 choices->chain = pc->chain; in se_choose() 44 choices->chain_len = pc->chain_len; in se_choose() 48 tt = st[u][1]; in se_choose() 51 if ((pc->allowed_usages & BR_KEYTYPE_KEYX) != 0 in se_choose() 52 && pc->cert_issuer_key_type == BR_KEYTYPE_RSA) in se_choose() 54 choices->cipher_suite = st[u][0]; in se_choose() 55 return 1; in se_choose() 59 if ((pc->allowed_usages & BR_KEYTYPE_KEYX) != 0 in se_choose() 60 && pc->cert_issuer_key_type == BR_KEYTYPE_EC) in se_choose() [all …]
|
/freebsd/contrib/bearssl/src/int/ |
H A D | i31_encode.c | 32 size_t k, xlen; in br_i31_encode() local 36 xlen = (x[0] + 31) >> 5; in br_i31_encode() 37 if (xlen == 0) { in br_i31_encode() 42 k = 1; in br_i31_encode() 48 w = (k <= xlen) ? x[k] : 0; in br_i31_encode() 57 acc_len --; in br_i31_encode() 58 acc = w >> (31 - acc_len); in br_i31_encode() 60 buf -= 4; in br_i31_encode() 61 len -= 4; in br_i31_encode() 66 buf[-3] = (unsigned char)(z >> 16); in br_i31_encode() [all …]
|
H A D | i15_encode.c | 32 size_t u, xlen; in br_i15_encode() local 36 xlen = (x[0] + 15) >> 4; in br_i15_encode() 37 if (xlen == 0) { in br_i15_encode() 41 u = 1; in br_i15_encode() 45 while (len -- > 0) { in br_i15_encode() 47 if (u <= xlen) { in br_i15_encode() 54 acc_len -= 8; in br_i15_encode()
|
/freebsd/sys/net80211/ |
H A D | ieee80211_crypto_gcm.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 9 * Originally sourced from hostapd 2.11 (src/crypto/aes-gcm.c). 14 * 1. Redistributions of source code must retain the above copyright 43 #define BIT(x) (1U << (x)) 57 a[1] = val >> 48; in WPA_PUT_BE64() 70 a[1] = (val >> 16) & 0xff; in WPA_PUT_BE32() 78 return (((uint32_t) a[0] << 24) | (a[1] << 16) | (a[2] << 8) | a[3]); in WPA_GET_BE32() 86 val = WPA_GET_BE32(block + AES_BLOCK_LEN - 4); in inc32() 88 WPA_PUT_BE32(block + AES_BLOCK_LEN - 4, val); in inc32() [all …]
|