Re: [PATCH] clean up include/linux/crypto.h and [RFC] API changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch against i10 was sent befor I read this mail, so don't feel
like being ignored :-)

Alexander S A Kjeldaas wrote:
> 
<snip> 
> I also think we need something like constructors and destructors for
> "transform_contexts" which basically becomes an opaque type.
> 
> > The constructors could be loaded with all the things that need to be
> > (re-)defined only seldomly, if at all:
> >
> > o block size (for ciphers that support variable block sizes, e.g. AES)
> > o key length (dto.)
> > o mode (either ECB or CBC or Counter or...)
> > o encryption/keysetup speed tradeoffs. (??)
> > etc.
> >
> > set_key() would then only accept a pointer to the key. This could also
> > speed up implementations where re-keying can be done faster than an
> > initial key-setup (e.g. twofish's 'compiled' option).
> 
> I am not sure I follow you.  Could you expand on this with example
> function prototypes?
> 
> set_key is currently:
> 
>         cipherXYZ_set_key)(struct cipher_context *cx,
>                            unsigned char *key, int key_len);
> 
> so in the case of a rekeying, it should be able to access the previous
> key.  No change of interface needed.  However, something would have to
> be done to make it know when to ignore the previously set key.
> 

/* spits out a cipher_context for a given ci and other parameters.
 + flags could contain bits that indicate if the call to encrypt
 * should be sync or async, if encrytion functions might sleep or not,
 * a bit field indicating encrypt/key setup speed tradeoffs and cipher 
 * implementation specific stuff.
 +/
struct cipher_context
*cipherXYZ_construct (struct cipher_implementation *ci,
		int blocksize, int keysize, int mode, u32 flags);

/* sets the key. The keylength has been set with a call to
 * construct() */
int cipherXYZ_set_key (struct cipher_context *cx, u8 *key);

Marc

-- 
Marc Mutz <Marc@xxxxxxxx>     http://EncryptionHOWTO.sourceforge.net/
University of Bielefeld, Dep. of Mathematics / Dep. of Physics

PGP-keyID's:   0xd46ce9ab (RSA), 0x7ae55b9e (DSS/DH)



Linux-crypto:  cryptography in and on the Linux system
Archive:       http://mail.nl.linux.org/linux-crypto/


[Index of Archives]     [Kernel]     [Linux Crypto]     [Gnu Crypto]     [Gnu Classpath]     [Netfilter]     [Bugtraq]
  Powered by Linux