Skip to content
Snippets Groups Projects
Select Git revision
  • v3.12-rc6
  • master default protected
  • objtool-32bit
  • objtool
  • v5.9
  • v5.9-rc8
  • v5.9-rc7
  • v5.9-rc6
  • v5.9-rc5
  • v5.9-rc4
  • v5.9-rc3
  • v5.9-rc2
  • v5.9-rc1
  • v5.8
  • v5.8-rc7
  • v5.8-rc6
  • v5.8-rc5
  • v5.8-rc4
  • v5.8-rc3
  • v5.8-rc2
  • v5.8-rc1
  • v5.7
  • v5.7-rc7
  • v5.7-rc6
24 results

crypto_null.c

Blame
  • Forked from Jonas Rabenstein / Linux
    Source project has a limited visibility.
    crypto_null.c 4.37 KiB
    /*
     * Cryptographic API.
     *
     * Null algorithms, aka Much Ado About Nothing.
     *
     * These are needed for IPsec, and may be useful in general for
     * testing & debugging.
     *
     * The null cipher is compliant with RFC2410.
     *
     * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
     *
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License as published by
     * the Free Software Foundation; either version 2 of the License, or
     * (at your option) any later version.
     *
     */
    
    #include <crypto/internal/hash.h>
    #include <crypto/internal/skcipher.h>
    #include <linux/init.h>
    #include <linux/module.h>
    #include <linux/mm.h>
    #include <linux/string.h>
    
    #define NULL_KEY_SIZE		0
    #define NULL_BLOCK_SIZE		1
    #define NULL_DIGEST_SIZE	0
    #define NULL_IV_SIZE		0
    
    static int null_compress(struct crypto_tfm *tfm, const u8 *src,
    			 unsigned int slen, u8 *dst, unsigned int *dlen)
    {
    	if (slen > *dlen)
    		return -EINVAL;
    	memcpy(dst, src, slen);
    	*dlen = slen;
    	return 0;
    }
    
    static int null_init(struct shash_desc *desc)
    {
    	return 0;
    }
    
    static int null_update(struct shash_desc *desc, const u8 *data,
    		       unsigned int len)
    {
    	return 0;
    }
    
    static int null_final(struct shash_desc *desc, u8 *out)
    {
    	return 0;
    }
    
    static int null_digest(struct shash_desc *desc, const u8 *data,
    		       unsigned int len, u8 *out)
    {
    	return 0;
    }
    
    static int null_hash_setkey(struct crypto_shash *tfm, const u8 *key,
    			    unsigned int keylen)
    { return 0; }
    
    static int null_setkey(struct crypto_tfm *tfm, const u8 *key,
    		       unsigned int keylen)
    { return 0; }