/freebsd/sys/contrib/libsodium/test/default/ |
H A D | chacha20.c | 29 size_t plen; in tv() local 40 for (plen = 1U; plen < sizeof out; plen++) { in tv() 41 part = (unsigned char *) sodium_malloc(plen); in tv() 42 crypto_stream_chacha20_xor(part, out, plen, nonce, key); in tv() 43 if (memcmp(part, zero, plen) != 0) { in tv() 44 printf("Failed with length %lu\n", (unsigned long) plen); in tv() 50 for (plen = 1U; plen < 66; plen += 3) { in tv() 51 memset(out, (int) (plen & 0xff), sizeof out); in tv() 52 crypto_stream_chacha20(out, plen, nonce, key); in tv() 116 size_t plen; in tv_ietf() local [all …]
|
/freebsd/crypto/openssl/providers/implementations/ciphers/ |
H A D | cipher_chacha20_poly1305_hw.c | 124 size_t tail, tohash_len, buf_len, plen = ctx->tls_payload_length; in chacha20_poly1305_tls_cipher() local 134 if (plen <= 3 * CHACHA_BLK_SIZE) { in chacha20_poly1305_tls_cipher() 136 buf_len = (plen + 2 * CHACHA_BLK_SIZE - 1) & (0 - CHACHA_BLK_SIZE); in chacha20_poly1305_tls_cipher() 143 ctx->len.text = plen; in chacha20_poly1305_tls_cipher() 145 if (plen) { in chacha20_poly1305_tls_cipher() 147 ctr = xor128_encrypt_n_pad(out, in, ctr, plen); in chacha20_poly1305_tls_cipher() 149 ctr = xor128_decrypt_n_pad(out, in, ctr, plen); in chacha20_poly1305_tls_cipher() 151 in += plen; in chacha20_poly1305_tls_cipher() 152 out += plen; in chacha20_poly1305_tls_cipher() 157 if (plen <= CHACHA_BLK_SIZE) { in chacha20_poly1305_tls_cipher() [all …]
|
H A D | cipher_rc4_hmac_md5_hw.c | 61 size_t plen = ctx->payload_length; in cipher_hw_rc4_hmac_md5_cipher() local 63 if (plen != NO_PAYLOAD_LENGTH && len != (plen + MD5_DIGEST_LENGTH)) in cipher_hw_rc4_hmac_md5_cipher() 67 if (plen == NO_PAYLOAD_LENGTH) in cipher_hw_rc4_hmac_md5_cipher() 68 plen = len; in cipher_hw_rc4_hmac_md5_cipher() 74 if (plen > md5_off in cipher_hw_rc4_hmac_md5_cipher() 75 && (blocks = (plen - md5_off) / MD5_CBLOCK) in cipher_hw_rc4_hmac_md5_cipher() 94 MD5_Update(&ctx->md, in + md5_off, plen - md5_off); in cipher_hw_rc4_hmac_md5_cipher() 96 if (plen != len) { /* "TLS" mode of operation */ in cipher_hw_rc4_hmac_md5_cipher() 98 memcpy(out + rc4_off, in + rc4_off, plen - rc4_off); in cipher_hw_rc4_hmac_md5_cipher() 101 MD5_Final(out + plen, &ctx->md); in cipher_hw_rc4_hmac_md5_cipher() [all …]
|
/freebsd/contrib/bearssl/src/rsa/ |
H A D | rsa_i15_modulus.c | 34 size_t nlen, plen, qlen, tlen; in br_rsa_i15_compute_modulus() local 40 plen = sk->plen; in br_rsa_i15_compute_modulus() 41 while (plen > 0 && *pbuf == 0) { in br_rsa_i15_compute_modulus() 43 plen --; in br_rsa_i15_compute_modulus() 58 if ((15 * tlen) < (plen << 3) + 15) { in br_rsa_i15_compute_modulus() 61 br_i15_decode(t, pbuf, plen); in br_rsa_i15_compute_modulus() 63 plen = (p[0] + 31) >> 4; in br_rsa_i15_compute_modulus() 64 t += plen; in br_rsa_i15_compute_modulus() 65 tlen -= plen; in br_rsa_i15_compute_modulus() 83 if (tlen < (plen + qlen + 1)) { in br_rsa_i15_compute_modulus()
|
H A D | rsa_i31_modulus.c | 34 size_t nlen, plen, qlen, tlen; in br_rsa_i31_compute_modulus() local 40 plen = sk->plen; in br_rsa_i31_compute_modulus() 41 while (plen > 0 && *pbuf == 0) { in br_rsa_i31_compute_modulus() 43 plen --; in br_rsa_i31_compute_modulus() 58 if ((31 * tlen) < (plen << 3) + 31) { in br_rsa_i31_compute_modulus() 61 br_i31_decode(t, pbuf, plen); in br_rsa_i31_compute_modulus() 63 plen = (p[0] + 63) >> 5; in br_rsa_i31_compute_modulus() 64 t += plen; in br_rsa_i31_compute_modulus() 65 tlen -= plen; in br_rsa_i31_compute_modulus() 83 if (tlen < (plen + qlen + 1)) { in br_rsa_i31_compute_modulus()
|
H A D | rsa_i31_pubexp.c | 32 get_pubexp(const unsigned char *pbuf, size_t plen, in get_pubexp() argument 55 while (plen > 0 && *pbuf == 0) { in get_pubexp() 57 plen --; in get_pubexp() 59 if (plen == 0 || plen < 5 || plen > (BR_MAX_RSA_FACTOR / 8)) { in get_pubexp() 71 if (dplen > plen || dplen == 0 in get_pubexp() 72 || (dplen == plen && dpbuf[0] > pbuf[0])) in get_pubexp() 80 if ((pbuf[plen - 1] & 3) != 3 || (dpbuf[dplen - 1] & 1) != 1) { in get_pubexp() 88 br_i31_decode(p, pbuf, plen); in get_pubexp() 149 ep = get_pubexp(sk->p, sk->plen, sk->dp, sk->dplen); in br_rsa_i31_compute_pubexp()
|
H A D | rsa_i15_pubexp.c | 32 get_pubexp(const unsigned char *pbuf, size_t plen, in get_pubexp() argument 55 while (plen > 0 && *pbuf == 0) { in get_pubexp() 57 plen --; in get_pubexp() 59 if (plen == 0 || plen < 5 || plen > (BR_MAX_RSA_FACTOR / 8)) { in get_pubexp() 71 if (dplen > plen || dplen == 0 in get_pubexp() 72 || (dplen == plen && dpbuf[0] > pbuf[0])) in get_pubexp() 80 if ((pbuf[plen - 1] & 3) != 3 || (dpbuf[dplen - 1] & 1) != 1) { in get_pubexp() 88 br_i15_decode(p, pbuf, plen); in get_pubexp() 149 ep = get_pubexp(sk->p, sk->plen, sk->dp, sk->dplen); in br_rsa_i15_compute_pubexp()
|
H A D | rsa_i15_privexp.c | 64 size_t plen, qlen, u, len, dlen; in br_rsa_i15_compute_privexp() local 79 plen = sk->plen; in br_rsa_i15_compute_privexp() 80 while (plen > 0 && *pbuf == 0) { in br_rsa_i15_compute_privexp() 82 plen --; in br_rsa_i15_compute_privexp() 84 if (plen < 5 || plen > (BR_MAX_RSA_FACTOR / 8) in br_rsa_i15_compute_privexp() 85 || (pbuf[plen - 1] & 1) != 1) in br_rsa_i15_compute_privexp() 110 br_i15_decode(p, pbuf, plen); in br_rsa_i15_compute_privexp() 111 plen = (p[0] + 15) >> 4; in br_rsa_i15_compute_privexp() 112 q = p + 1 + plen; in br_rsa_i15_compute_privexp()
|
H A D | rsa_i31_privexp.c | 64 size_t plen, qlen, u, len, dlen; in br_rsa_i31_compute_privexp() local 79 plen = sk->plen; in br_rsa_i31_compute_privexp() 80 while (plen > 0 && *pbuf == 0) { in br_rsa_i31_compute_privexp() 82 plen --; in br_rsa_i31_compute_privexp() 84 if (plen < 5 || plen > (BR_MAX_RSA_FACTOR / 8) in br_rsa_i31_compute_privexp() 85 || (pbuf[plen - 1] & 1) != 1) in br_rsa_i31_compute_privexp() 110 br_i31_decode(p, pbuf, plen); in br_rsa_i31_compute_privexp() 111 plen = (p[0] + 31) >> 5; in br_rsa_i31_compute_privexp() 112 q = p + 1 + plen; in br_rsa_i31_compute_privexp()
|
/freebsd/crypto/openssl/crypto/evp/ |
H A D | e_chacha20_poly1305.c | 218 size_t tail, tohash_len, buf_len, plen = actx->tls_payload_length; in chacha20_poly1305_tls_cipher() local 221 if (len != plen + POLY1305_BLOCK_SIZE) in chacha20_poly1305_tls_cipher() 229 if (plen <= 3 * CHACHA_BLK_SIZE) { in chacha20_poly1305_tls_cipher() 231 buf_len = (plen + 2 * CHACHA_BLK_SIZE - 1) & (0 - CHACHA_BLK_SIZE); in chacha20_poly1305_tls_cipher() 239 actx->len.text = plen; in chacha20_poly1305_tls_cipher() 241 if (plen) { in chacha20_poly1305_tls_cipher() 243 ctr = xor128_encrypt_n_pad(out, in, ctr, plen); in chacha20_poly1305_tls_cipher() 245 ctr = xor128_decrypt_n_pad(out, in, ctr, plen); in chacha20_poly1305_tls_cipher() 247 in += plen; in chacha20_poly1305_tls_cipher() 248 out += plen; in chacha20_poly1305_tls_cipher() [all …]
|
H A D | e_rc4_hmac_md5.c | 86 size_t plen = key->payload_length; in rc4_hmac_md5_cipher() local 88 if (plen != NO_PAYLOAD_LENGTH && len != (plen + MD5_DIGEST_LENGTH)) in rc4_hmac_md5_cipher() 92 if (plen == NO_PAYLOAD_LENGTH) in rc4_hmac_md5_cipher() 93 plen = len; in rc4_hmac_md5_cipher() 99 if (plen > md5_off && (blocks = (plen - md5_off) / MD5_CBLOCK) && in rc4_hmac_md5_cipher() 118 MD5_Update(&key->md, in + md5_off, plen - md5_off); in rc4_hmac_md5_cipher() 120 if (plen != len) { /* "TLS" mode of operation */ in rc4_hmac_md5_cipher() 122 memcpy(out + rc4_off, in + rc4_off, plen - rc4_off); in rc4_hmac_md5_cipher() 125 MD5_Final(out + plen, &key->md); in rc4_hmac_md5_cipher() 127 MD5_Update(&key->md, out + plen, MD5_DIGEST_LENGTH); in rc4_hmac_md5_cipher() [all …]
|
/freebsd/contrib/tcpdump/ |
H A D | print-bgp.c | 586 u_int plen, plenbytes; in decode_prefix4() local 589 plen = GET_U_1(pptr); in decode_prefix4() 590 if (32 < plen) in decode_prefix4() 595 plenbytes = (plen + 7) / 8; in decode_prefix4() 598 if (plen % 8) { in decode_prefix4() 599 ((u_char *)&addr)[plenbytes - 1] &= ((0xff00 >> (plen % 8)) & 0xff); in decode_prefix4() 601 snprintf(buf, buflen, "%s/%u", ipaddr_string(ndo, (const u_char *)&addr), plen); in decode_prefix4() 614 u_int plen, plenbytes; in decode_labeled_prefix4() local 619 plen = GET_U_1(pptr); /* get prefix length */ in decode_labeled_prefix4() 629 if (24 > plen) in decode_labeled_prefix4() [all …]
|
H A D | print-babel.c | 141 format_prefix(netdissect_options *ndo, const u_char *prefix, unsigned char plen) in format_prefix() argument 150 if(plen >= 96 && memcmp(prefix, v4prefix, 12) == 0) in format_prefix() 151 snprintf(buf, 50, "%s/%u", ipaddr_string(ndo, prefix + 12), plen - 96); in format_prefix() 153 snprintf(buf, 50, "%s/%u", ip6addr_string(ndo, prefix), plen); in format_prefix() 200 network_prefix(int ae, int plen, unsigned int omitted, in network_prefix() argument 208 if(plen >= 0) in network_prefix() 209 pb = (plen + 7) / 8; in network_prefix() 536 u_char ae, plen; in babel_print_v2_tlvs() local 542 plen = GET_U_1(message + 4) + (GET_U_1(message + 2) == 1 ? 96 : 0); in babel_print_v2_tlvs() 557 ae == 0 ? "any" : format_prefix(ndo, prefix, plen), in babel_print_v2_tlvs() [all …]
|
/freebsd/contrib/wpa/src/tls/ |
H A D | tlsv1_record.c | 356 size_t plen; in tlsv1_record_receive() local 362 plen = in_len; in tlsv1_record_receive() 364 "data", out_data, plen); in tlsv1_record_receive() 380 if (plen < rl->iv_size) { in tlsv1_record_receive() 387 plen - rl->iv_size); in tlsv1_record_receive() 388 plen -= rl->iv_size; in tlsv1_record_receive() 392 if (plen == 0) { in tlsv1_record_receive() 398 padlen = out_data[plen - 1]; in tlsv1_record_receive() 399 if (padlen >= plen) { in tlsv1_record_receive() 403 padlen, (unsigned long) plen); in tlsv1_record_receive() [all …]
|
/freebsd/sys/i386/i386/ |
H A D | copyout.c | 97 int error, i, plen; in cp_slow0() local 100 plen = howmany(uva - trunc_page(uva) + len, PAGE_SIZE); in cp_slow0() 101 MPASS(plen <= nitems(m)); in cp_slow0() 106 if (i != plen) in cp_slow0() 120 pmap_cp_slow0_map(kaddr, plen, m); in cp_slow0() 128 vm_page_unhold_pages(m, plen); in cp_slow0() 162 size_t plen; in copyinstr() local 167 for (plen = 0, uc = (vm_offset_t)udaddr, ca.kc = (vm_offset_t)kaddr; in copyinstr() 168 plen < maxlen && !ca.end; uc += ca.alen, plen += ca.alen) { in copyinstr() 172 if (plen + ca.len > maxlen) in copyinstr() [all …]
|
/freebsd/sys/contrib/dpdk_rte_lpm/ |
H A D | dpdk_lpm6.c | 161 const struct in6_addr addr6, int plen, uint32_t scopeid) in handle_ll_change() argument 168 pack_parent_rule(struct dpdk_lpm6_data *dd, const struct in6_addr *addr6, int plen, in pack_parent_rule() argument 177 rt = rt_get_inet6_parent(dd->fibnum, addr6, plen); in pack_parent_rule() 182 rt_get_inet6_prefix_plen(rt, &new_addr6, &plen, &scopeid); in pack_parent_rule() 183 if (plen > 0) { in pack_parent_rule() 185 lsp_rule = fill_rule6(buffer, (uint8_t *)&new_addr6, plen, nhop_idx); in pack_parent_rule() 187 *pplen = plen; in pack_parent_rule() 196 const struct in6_addr *addr6, int plen) in handle_gu_change() argument 215 plen, nhidx, (rc->rc_cmd == RTM_ADD) ? 1 : 0); in handle_gu_change() 218 abuf, plen, in handle_gu_change() [all …]
|
H A D | dpdk_lpm.c | 137 get_parent_rule(struct dpdk_lpm_data *dd, struct in_addr addr, int plen, in get_parent_rule() argument 142 rt = rt_get_inet_parent(dd->fibnum, addr, plen); in get_parent_rule() 162 const struct in_addr addr, int plen) in handle_gu_change() argument 184 ret = rte_lpm_add(dd->lpm, ip, plen, nhidx); in handle_gu_change() 187 abuf, plen, in handle_gu_change() 196 get_parent_rule(dd, addr, plen, &parent_plen, &parent_nhop_idx); in handle_gu_change() 198 ret = rte_lpm_delete(dd->lpm, ip, plen, parent_plen, parent_nhop_idx); in handle_gu_change() 200 "DEL", abuf, plen, parent_plen, fib_get_nhop_idx(dd->fd, rc->rc_nh_old), in handle_gu_change() 221 int plen; in handle_rtable_change_cb() local 224 rt_get_inet_prefix_plen(rc->rc_rt, &addr4, &plen, &scopeid); in handle_rtable_change_cb() [all …]
|
/freebsd/sbin/ipfw/ |
H A D | nptv6.c | 192 int tcmd, flags, plen; in nptv6_create() local 195 plen = 0; in nptv6_create() 208 nptv6_parse_prefix(*av, &cfg->internal, &plen); in nptv6_create() 210 if (plen > 0) in nptv6_create() 219 nptv6_parse_prefix(*av, &cfg->external, &plen); in nptv6_create() 221 if (plen > 0) in nptv6_create() 239 plen = strtol(*av, &p, 10); in nptv6_create() 241 if (*p != '\0' || plen < 8 || plen > 64) in nptv6_create() 244 if (cfg->plen > 0 && cfg->plen != plen) { in nptv6_create() 247 cfg->plen, plen, MAX(plen, cfg->plen)); in nptv6_create() [all …]
|
/freebsd/sys/dev/nvmf/ |
H A D | nvmf_tcp.h | 39 uint32_t data_len, plen; in nvmf_tcp_validate_pdu_header() local 43 plen = le32toh(ch->plen); in nvmf_tcp_validate_pdu_header() 47 if (plen == full_hlen) in nvmf_tcp_validate_pdu_header() 50 data_len = plen - ch->pdo; in nvmf_tcp_validate_pdu_header() 82 if (plen < sizeof(struct nvme_tcp_term_req_hdr) || in nvmf_tcp_validate_pdu_header() 83 plen > NVME_TCP_TERM_REQ_PDU_MAX_SIZE) { in nvmf_tcp_validate_pdu_header() 221 if (ch->pdo < full_hlen || ch->pdo > plen || in nvmf_tcp_validate_pdu_header() 233 if (plen < ch->hlen) { in nvmf_tcp_validate_pdu_header() 234 printf("NVMe/TCP: Invalid PDU length %u\n", plen); in nvmf_tcp_validate_pdu_header() 236 *fei = offsetof(struct nvme_tcp_common_pdu_hdr, plen); in nvmf_tcp_validate_pdu_header() [all …]
|
/freebsd/lib/libc/db/btree/ |
H A D | bt_overflow.c | 78 size_t nb, plen; in __ovfl_get() local 101 plen = t->bt_psize - BTDATAOFF; in __ovfl_get() 106 nb = MIN(sz, plen); in __ovfl_get() 133 size_t nb, plen; in __ovfl_put() local 140 plen = t->bt_psize - BTDATAOFF; in __ovfl_put() 142 p = (char *)p + plen, last = h) { in __ovfl_put() 151 nb = MIN(sz, plen); in __ovfl_put() 183 size_t plen; in __ovfl_delete() local 203 for (plen = t->bt_psize - BTDATAOFF;; sz -= plen) { in __ovfl_delete() 206 if (sz <= plen) in __ovfl_delete()
|
/freebsd/usr.sbin/ppp/ |
H A D | tcpmss.c | 156 size_t hlen, plen; in tcpmss_Check() local 162 plen = m_length(bp); in tcpmss_Check() 163 if (plen < sizeof(struct ip)) in tcpmss_Check() 175 ntohs(pip->ip_len) == plen && hlen <= plen && in tcpmss_Check() 176 plen >= sizeof(struct tcphdr) + hlen) in tcpmss_Check() 177 MSSFixup((struct tcphdr *)(MBUF_CTOP(bp) + hlen), plen - hlen, in tcpmss_Check() 187 if (plen < sizeof(struct ip6_hdr)) in tcpmss_Check() 190 if (ntohs(pip6->ip6_plen) + sizeof(struct ip6_hdr) != plen) in tcpmss_Check() 198 if (plen >= sizeof(struct ip6_frag) + sizeof(struct ip6_hdr)) { in tcpmss_Check() 206 if (hlen > 0 && plen >= sizeof(struct tcphdr) + hlen) in tcpmss_Check() [all …]
|
/freebsd/contrib/libpcap/rpcapd/ |
H A D | daemon.c | 126 static int daemon_msg_err(PCAP_SOCKET sockctrl, SSL *, uint32 plen); 127 static int daemon_msg_auth_req(struct daemon_slpars *pars, uint32 plen); 131 uint32 plen); 134 uint32 plen, char *source, size_t sourcelen); 136 uint32 plen, char *source, struct session **sessionp, 142 struct session *session, uint32 plen); 146 struct session *session, uint32 plen, struct pcap_stat *stats, 150 uint32 plen, struct rpcap_sampling *samp_param); 161 static int rpcapd_recv(PCAP_SOCKET sock, SSL *, char *buffer, size_t toread, uint32 *plen, char *er… 225 uint32 plen; // payload length from header in daemon_serviceloop() local [all …]
|
/freebsd/sys/netpfil/ipfw/nat64/ |
H A D | nat64_translate.c | 352 nat64_embed_ip4(struct in6_addr *ip6, int plen, in_addr_t ia) in nat64_embed_ip4() argument 355 switch (plen) { in nat64_embed_ip4() 358 ip6->s6_addr32[plen / 32] = ia; in nat64_embed_ip4() 368 ip6->s6_addr32[1] &= 0xffffffff << (32 - plen % 32); in nat64_embed_ip4() 370 ip6->s6_addr32[1] |= ia >> (plen % 32); in nat64_embed_ip4() 371 ip6->s6_addr32[2] = ia << (24 - plen % 32); in nat64_embed_ip4() 373 ip6->s6_addr32[1] |= ia << (plen % 32); in nat64_embed_ip4() 374 ip6->s6_addr32[2] = ia >> (24 - plen % 32); in nat64_embed_ip4() 387 panic("Wrong plen: %d", plen); in nat64_embed_ip4() 398 nat64_extract_ip4(const struct in6_addr *ip6, int plen) in nat64_extract_ip4() argument [all …]
|
/freebsd/crypto/openssl/crypto/asn1/ |
H A D | bio_ndef.c | 45 static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg); 46 static int ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen, 48 static int ndef_suffix(BIO *b, unsigned char **pbuf, int *plen, void *parg); 49 static int ndef_suffix_free(BIO *b, unsigned char **pbuf, int *plen, 129 static int ndef_prefix(BIO *b, unsigned char **pbuf, int *plen, void *parg) in ndef_prefix() argument 155 *plen = *ndef_aux->boundary - *pbuf; in ndef_prefix() 160 static int ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen, in ndef_prefix_free() argument 177 *plen = 0; in ndef_prefix_free() 181 static int ndef_suffix_free(BIO *b, unsigned char **pbuf, int *plen, in ndef_suffix_free() argument 185 if (!ndef_prefix_free(b, pbuf, plen, parg)) in ndef_suffix_free() [all …]
|
/freebsd/contrib/ofed/libcxgb4/ |
H A D | qp.c | 107 u32 plen = 0; in build_immd() local 113 if ((plen + wr->sg_list[i].length) > max) in build_immd() 116 plen += wr->sg_list[i].length; in build_immd() 122 len = ROUND_UP(plen + 8, 16) - (plen + 8); in build_immd() 128 immdp->immdlen = htobe32(plen); in build_immd() 129 *plenp = plen; in build_immd() 137 u32 plen = 0; in build_isgl() local 141 if ((plen + sg_list[i].length) < plen) in build_isgl() 143 plen += sg_list[i].length; in build_isgl() 154 *plenp = plen; in build_isgl() [all …]
|