Skip to content
Snippets Groups Projects
Select Git revision
  • 9c521a200bc3c12bd724e48a75c57d5358f672be
  • vme-testing default
  • ci-test
  • master
  • remoteproc
  • am625-sk-ov5640
  • pcal6534-upstreaming
  • lps22df-upstreaming
  • msc-upstreaming
  • imx8mp
  • iio/noa1305
  • vme-next
  • vme-next-4.14-rc4
  • v4.14-rc4
  • v4.14-rc3
  • v4.14-rc2
  • v4.14-rc1
  • v4.13
  • vme-next-4.13-rc7
  • v4.13-rc7
  • v4.13-rc6
  • v4.13-rc5
  • v4.13-rc4
  • v4.13-rc3
  • v4.13-rc2
  • v4.13-rc1
  • v4.12
  • v4.12-rc7
  • v4.12-rc6
  • v4.12-rc5
  • v4.12-rc4
  • v4.12-rc3
32 results

algapi.c

Blame
  • xfrm_user.c 61.64 KiB
    /* xfrm_user.c: User interface to configure xfrm engine.
     *
     * Copyright (C) 2002 David S. Miller (davem@redhat.com)
     *
     * Changes:
     *	Mitsuru KANDA @USAGI
     * 	Kazunori MIYAZAWA @USAGI
     * 	Kunihiro Ishiguro <kunihiro@ipinfusion.com>
     * 		IPv6 support
     *
     */
    
    #include <linux/crypto.h>
    #include <linux/module.h>
    #include <linux/kernel.h>
    #include <linux/types.h>
    #include <linux/slab.h>
    #include <linux/socket.h>
    #include <linux/string.h>
    #include <linux/net.h>
    #include <linux/skbuff.h>
    #include <linux/pfkeyv2.h>
    #include <linux/ipsec.h>
    #include <linux/init.h>
    #include <linux/security.h>
    #include <net/sock.h>
    #include <net/xfrm.h>
    #include <net/netlink.h>
    #include <asm/uaccess.h>
    #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
    #include <linux/in6.h>
    #endif
    
    static inline int aead_len(struct xfrm_algo_aead *alg)
    {
    	return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
    }
    
    static int verify_one_alg(struct nlattr **attrs, enum xfrm_attr_type_t type)
    {
    	struct nlattr *rt = attrs[type];
    	struct xfrm_algo *algp;
    
    	if (!rt)
    		return 0;
    
    	algp = nla_data(rt);
    	if (nla_len(rt) < xfrm_alg_len(algp))
    		return -EINVAL;
    
    	switch (type) {
    	case XFRMA_ALG_AUTH:
    	case XFRMA_ALG_CRYPT:
    	case XFRMA_ALG_COMP:
    		break;
    
    	default:
    		return -EINVAL;
    	}
    
    	algp->alg_name[CRYPTO_MAX_ALG_NAME - 1] = '\0';
    	return 0;
    }
    
    static int verify_aead(struct nlattr **attrs)
    {
    	struct nlattr *rt = attrs[XFRMA_ALG_AEAD];
    	struct xfrm_algo_aead *algp;
    
    	if (!rt)