[Swan-dev] aliases in struct state

D. Hugh Redelmeier hugh at mimosa.com
Mon Feb 17 20:44:59 EET 2014


In struct state:

#define st_skeyid   st_skeyseed
        chunk_t st_skeyseed;                    /* Key material */
#define st_skeyid_d st_skey_d
        chunk_t st_skey_d;                      /* KM for non-ISAKMP key derivation */
#define st_skeyid_a st_skey_ai
        chunk_t st_skey_ai;                     /* KM for ISAKMP authentication */
        chunk_t st_skey_ar;                     /* KM for ISAKMP authentication */
#define st_skeyid_e st_skey_ei
        chunk_t st_skey_ei;                     /* KM for ISAKMP encryption */
        chunk_t st_skey_er;                     /* KM for ISAKMP encryption */
        chunk_t st_skey_pi;                     /* KM for ISAKMP encryption */
        chunk_t st_skey_pr;                     /* KM for ISAKMP encryption */

I'm not sure why some fields have aliases (created by #define).
Perhaps one name is for V1 and the other is for V2 -- it's not really clear.

In any case, aliasing makes it really easy to create bugs.  And those
bugs are hard to find by reading the code.

I think that we should move to get rid of these.

(I'd do it now but I have higher priorities.  So this message is to
put it on the queue.)


More information about the Swan-dev mailing list