[Openswan dev] Re: algorithm code - ipsec_alg.h

JuanJo Ciarlante jjo-ipsec at mendoza.gov.ar
Thu Mar 25 10:25:17 CET 2004


On Sun, Mar 21, 2004 at 07:44:21PM -0500, Michael Richardson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> 
> 
> JuanJo, why did you do:
> 
> #define IPSEC_ALG_STRUCT_COMMON stuff
> 
> struct ipsec_alg {
> 	IPSEC_ALG_STRUCT_COMMON
> };
> /* 
>  * 	Note the const in cbc_encrypt IV arg:
>  * 	some ciphers like to toast passed IV (eg. 3DES): make a local IV copy
>  */
> struct ipsec_alg_enc {
> 	IPSEC_ALG_STRUCT_COMMON
> 	unsigned ixt_e_keylen;		/* raw key length in bytes          */
> 
> 
> instead of doing:
> 
> struct ipsec_alg {
>        stuff;		 
> };
> 
> struct ipsec_alg_eng {
>        struct ipsec_alg common;
>        unsigned ixt_e_keylen;
>        ....
> };

Sort of "syntactic sugar" ... or poor man's OO; mainly to avoid the added
".common" typing overhead and I really dont like things like
#define field1 common.field1

Regards!

-- 
--Juanjo

#  Juan Jose Ciarlante (JuanJo PGP) jjo ;at; mendoza.gov.ar              #
#  Key fingerprint = 76 60 A5 76 FD D2 53 E3  50 C7 90 20 22 8C F1 2D    #


More information about the Dev mailing list