Skip to content
Snippets Groups Projects
Select Git revision
  • aba7c1206f7e79f81c5d4931b8a10bea1e02a4e5
  • master default protected
  • streebog
  • gost28147
  • master-updates
  • ed448
  • shake256
  • curve448
  • ecc-sqrt
  • gosthash94cp
  • cmac64
  • block16-refactor
  • siv-mode
  • cmac-layout
  • delete-des-compat
  • delete-rsa_blind
  • aes-struct-layout
  • release-3.4-fixes
  • struct-layout
  • attribute-deprecated
  • rename-data-symbols
  • nettle_3.5.1_release_20190627
  • nettle_3.5_release_20190626
  • nettle_3.5rc1
  • nettle_3.4.1_release_20181204
  • nettle_3.4.1rc1
  • nettle_3.4_release_20171119
  • nettle_3.4rc2
  • nettle_3.4rc1
  • nettle_3.3_release_20161001
  • nettle_3.2_release_20160128
  • nettle_3.1.1_release_20150424
  • nettle_3.1_release_20150407
  • nettle_3.1rc3
  • nettle_3.1rc2
  • nettle_3.1rc1
  • nettle_3.0_release_20140607
  • nettle_2.7.1_release_20130528
  • nettle_2.7_release_20130424
  • nettle_2.6_release_20130116
  • nettle_2.5_release_20120707
41 results

memxor.h

Blame
  • Forked from Nettle / nettle
    Source project has a limited visibility.
    • Niels Möller's avatar
      ef3668b2
      *** empty log message *** · ef3668b2
      Niels Möller authored
      Rev: src/nettle/ChangeLog:1.10
      Rev: src/nettle/aes.h:1.4
      Rev: src/nettle/arcfour.h:1.3
      Rev: src/nettle/blowfish.h:1.7
      Rev: src/nettle/cast128.h:1.3
      Rev: src/nettle/des.h:1.4
      Rev: src/nettle/md5.h:1.3
      Rev: src/nettle/memxor.h:1.2
      Rev: src/nettle/serpent.h:1.5
      Rev: src/nettle/sha1.h:1.3
      Rev: src/nettle/twofish.h:1.4
      ef3668b2
      History
      *** empty log message ***
      Niels Möller authored
      Rev: src/nettle/ChangeLog:1.10
      Rev: src/nettle/aes.h:1.4
      Rev: src/nettle/arcfour.h:1.3
      Rev: src/nettle/blowfish.h:1.7
      Rev: src/nettle/cast128.h:1.3
      Rev: src/nettle/des.h:1.4
      Rev: src/nettle/md5.h:1.3
      Rev: src/nettle/memxor.h:1.2
      Rev: src/nettle/serpent.h:1.5
      Rev: src/nettle/sha1.h:1.3
      Rev: src/nettle/twofish.h:1.4
    serpent.h 1.95 KiB
    
    /*
     *
     * Serpent is a 128-bit block cipher that accepts a key size of 256 bits,
     * designed by Ross Anderson, Eli Biham, and Lars Knudsen.  See
     * http://www.cl.cam.ac.uk/~rja14/serpent.html for details.
     */
    
    #if !defined(SERPENT_H)
    #define SERPENT_H
    
    #include <stdlib.h>
    #include "crypto_types.h"
    
    #define SERPENT_BLOCKSIZE 16
    
    /* Other key lengths are possible, but we only use 256 bits.  Besides, the
       design of Serpent makes other key lengths useless; they cheated with the
       AES requirements, using a 256-bit key length exclusively and just padding
       it out if the desired key length was less, so there really is no advantage
       to using key lengths less than 256 bits. */
    #define SERPENT_KEYSIZE 32
    
    /* Allow keys of size 128 <= bits <= 256 */
    
    #define SERPENT_MIN_KEYSIZE 16
    #define SERPENT_MAX_KEYSIZE 32
    
    typedef struct {
      UINT32 keys[33][4];		/* key schedule */
    } SERPENT_context;
    
    /* This performs Serpent's key scheduling algorithm. */
    void
    serpent_setup(SERPENT_context *ctx, UINT32 key_size, const UINT8 *key);
    
    /*
     * serpent_encrypt()
     *
     * Encrypt 16 bytes of data with the Serpent algorithm.  Before this
     * function can be used, serpent_setup must be used in order to initialize
     * Serpent's key schedule.
     *
     * This function always encrypts 16 bytes of plaintext to 16 bytes of
     * ciphertext.  The memory areas of the plaintext and the ciphertext can
     * overlap.
     */
    void
    serpent_encrypt(SERPENT_context *context,
    		const UINT8 *plaintext,
    		UINT8 *ciphertext);
    
    /*
     * serpent_decrypt()
     *
     * Decrypt 16 bytes of data with the Serpent algorithm.
     *
     * Before this function can be used, serpent_setup() must be used in order
     * to set up the key schedule required for the decryption algorithm.
     * 
     * This function always decrypts 16 bytes of ciphertext to 16 bytes of
     * plaintext.  The memory areas of the plaintext and the ciphertext can
     * overlap.
     */
    
    void
    serpent_decrypt(SERPENT_context *context,
    		const UINT8 *ciphertext,
    		UINT8 *plaintext);
    
    #endif /* SERPENT_H */