#include int ceph_armor(char *dst, const char *src, const char *end); int ceph_unarmor(char *dst, const char *src, const char *end); /* * base64 encode/decode. */ static const char *pem_key = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; static int encode_bits(int c) { return pem_key[c]; } static int decode_bits(char c) { if (c >= 'A' && c <= 'Z') return c - 'A'; if (c >= 'a' && c <= 'z') return c - 'a' + 26; if (c >= '0' && c <= '9') return c - '0' + 52; if (c == '+') return 62; if (c == '/') return 63; if (c == '=') return 0; /* just non-negative, please */ return -EINVAL; } int ceph_armor(char *dst, const char *src, const char *end) { int olen = 0; int line = 0; while (src < end) { unsigned char a, b, c; a = *src++; *dst++ = encode_bits(a >> 2); if (src < end) { b = *src++; *dst++ = encode_bits(((a & 3) << 4) | (b >> 4)); if (src < end) { c = *src++; *dst++ = encode_bits(((b & 15) << 2) | (c >> 6)); *dst++ = encode_bits(c & 63); } else { *dst++ = encode_bits((b & 15) << 2); *dst++ = '='; } } else { *dst++ = encode_bits(((a & 3) << 4)); *dst++ = '='; *dst++ = '='; } olen += 4; line += 4; if (line == 64) { line = 0; *(dst++) = '\n'; olen++; } } return olen; } int ceph_unarmor(char *dst, const char *src, const char *end) { int olen = 0; while (src < end) { int a, b, c, d; if (src[0] == '\n') { src++; continue; } if (src + 4 > end) return -EINVAL; a = decode_bits(src[0]); b = decode_bits(src[1]); c = decode_bits(src[2]); d = decode_bits(src[3]); if (a < 0 || b < 0 || c < 0 || d < 0) return -EINVAL; *dst++ = (a << 2) | (b >> 4); if (src[2] == '=') return olen + 1; *dst++ = ((b & 15) << 4) | (c >> 2); if (src[3] == '=') return olen + 2; *dst++ = ((c & 3) << 6) | d; olen += 3; src += 4; } return olen; } ude?h=nds-private-remove&id=baa2d42cff088d9f962697a10e0345b444c8c409'>commitdiff
path: root/include
AgeCommit message (Expand)AuthorFilesLines
2017-02-08netfilter: nf_tables: pass netns to set->ops->remove()Pablo Neira Ayuso1-1/+2
2017-02-08netfilter: nft_exthdr: Add support for existence checkPhil Sutter1-0/+6
2017-02-03net: remove support for per driver ndo_busy_poll()Eric Dumazet2-5/+0
2017-02-03Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-nextDavid S. Miller11-40/+60
2017-02-03sched: cls_flower: expose priority to offloading netdeviceJiri Pirko1-0/+1
2017-02-03lib: Introduce priority array area managerJiri Pirko1-0/+76
2017-02-03list: introduce list_for_each_entry_from_reverse helperJiri Pirko1-0/+13
2017-02-03trace: rename trace_print_hex_seq arg and add kdocDaniel Borkmann2-3/+3
2017-02-03bridge: uapi: add per vlan tunnel infoRoopa Prabhu3-0/+13
2017-02-03vxlan: support fdb and learning in COLLECT_METADATA modeRoopa Prabhu1-0/+1
2017-02-03ip_tunnels: new IP_TUNNEL_INFO_BRIDGE flag for ip_tunnel_info modeRoopa Prabhu1-0/+1
2017-02-03net/sched: act_ife: Change to use ife moduleYotam Gigi2-10/+1
2017-02-03net: Introduce ife encapsulation moduleYotam Gigi3-0/+70
2017-02-03net/sched: act_ife: Unexport ife_tlv_meta_encodeYotam Gigi1-2/+0
2017-02-03tcp: add tcp_mss_clamp() helperEric Dumazet1-0/+9
2017-02-02net: add LINUX_MIB_PFMEMALLOCDROP counterEric Dumazet1-0/+1
2017-02-02net: phy: marvell: Add support for 88e1545 PHYAndrew Lunn1-0/+1
2017-02-02unix: add ioctl to open a unix socket file with O_PATHAndrey Vagin1-0/+2
2017-02-02net: phy: Marvell: Add mv88e6390 internal PHYAndrew Lunn1-0/+6
2017-02-02Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller9-30/+40
2017-02-02netfilter: allow logging from non-init namespacesMichal Kubeček1-0/+3
2017-02-02ipvs: free ip_vs_dest structs when refcnt=0David Windsor1-1/+1
2017-02-02netfilter: merge ctinfo into nfct pointer storage areaFlorian Westphal2-17/+15
2017-02-02netfilter: guarantee 8 byte minalign for template addressesFlorian Westphal1-0/+2
2017-02-02netfilter: add and use nf_ct_set helperFlorian Westphal2-2/+9
2017-02-02skbuff: add and use skb_nfct helperFlorian Westphal2-4/+11
2017-02-02netfilter: reduce direct skb->nfct usageFlorian Westphal1-3/+6
2017-02-02netfilter: conntrack: no need to pass ctinfo to error handlerFlorian Westphal1-1/+1