* number actually chosen by the MSG3 sender.
*
* Aside from that, an empty bitmask is treated the same as
- * 1u<<CAPAB_TRANSFORMNUM_ANCIENT
+ * 1u<<CAPAB_BIT_ANCIENTTRANSFORM
*/
/* bit indices, 0 is ls bit */
-#define CAPAB_TRANSFORMNUM_USER_MIN 0
-#define CAPAB_TRANSFORMNUM_USER_MAX 7
-#define CAPAB_TRANSFORMNUM_SERPENT256CBC 8
-#define CAPAB_TRANSFORMNUM_EAXSERPENT 9
-#define CAPAB_TRANSFORMNUM_MAX 15
+#define CAPAB_BIT_USER_MIN 0
+#define CAPAB_BIT_USER_MAX 7
+#define CAPAB_BIT_SERPENT256CBC 8
+#define CAPAB_BIT_EAXSERPENT 9
+#define CAPAB_BIT_MAX 15
-#define CAPAB_TRANSFORMNUM_ANCIENT CAPAB_TRANSFORMNUM_SERPENT256CBC
+#define CAPAB_BIT_ANCIENTTRANSFORM CAPAB_BIT_SERPENT256CBC
#endif /* magic_h */
slog(st,LOG_SETUP_INIT,"key exchange negotiated transform"
" %d (capabilities ours=%#"PRIx32" theirs=%#"PRIx32")",
- st->chosen_transform->capab_transformnum,
+ st->chosen_transform->capab_bit,
st->local_capabilities, st->remote_capabilities);
return True;
}
if (hacky_par_mid_failnow()) return False;
if (type==LABEL_MSG3BIS)
- buf_append_uint8(&st->buffer,st->chosen_transform->capab_transformnum);
+ buf_append_uint8(&st->buffer,st->chosen_transform->capab_bit);
dhpub=st->dh->makepublic(st->dh->st,st->dhsecret,st->dh->len);
buf_append_string(&st->buffer,dhpub);
CHECK_AVAIL(msg,1);
m->capab_transformnum = buf_unprepend_uint8(msg);
} else {
- m->capab_transformnum = CAPAB_TRANSFORMNUM_ANCIENT;
+ m->capab_transformnum = CAPAB_BIT_ANCIENTTRANSFORM;
}
CHECK_AVAIL(msg,2);
m->pklen=buf_unprepend_uint16(msg);
uint32_t remote_transforms = st->remote_capabilities & CAPAB_TRANSFORM_MASK;
if (!remote_transforms)
/* old secnets only had this one transform */
- remote_transforms = 1UL << CAPAB_TRANSFORMNUM_ANCIENT;
+ remote_transforms = 1UL << CAPAB_BIT_ANCIENTTRANSFORM;
struct transform_if *ti;
int i;
for (i=0; i<st->ntransforms; i++) {
ti=st->transforms[i];
- if ((1UL << ti->capab_transformnum) & remote_transforms)
+ if ((1UL << ti->capab_bit) & remote_transforms)
goto transform_found;
}
slog(st,LOG_ERROR,"no transforms in common"
int i;
for (i=0; i<st->ntransforms; i++) {
ti=st->transforms[i];
- if (ti->capab_transformnum == m.capab_transformnum)
+ if (ti->capab_bit == m.capab_transformnum)
goto transform_found;
}
slog(st,LOG_SEC,"peer chose unknown-to-us transform %d!",
for (i=0; i<st->ntransforms; i++) {
struct transform_if *ti=st->transforms[i];
- uint32_t capbit = 1UL << ti->capab_transformnum;
+ uint32_t capbit = 1UL << ti->capab_bit;
if (st->local_capabilities & capbit)
- slog(st,LOG_ERROR,"transformnum capability bit"
- " %d (%#"PRIx32") reused", ti->capab_transformnum, capbit);
+ slog(st,LOG_ERROR,"bit capability bit"
+ " %d (%#"PRIx32") reused", ti->capab_bit, capbit);
st->local_capabilities |= capbit;
}
free(st); \
}
-#define SET_CAPAB_TRANSFORMNUM(def) do{ \
- st->ops.capab_transformnum=dict_read_number(dict, "capab-num", \
+#define SET_CAPAB_BIT(def) do{ \
+ st->ops.capab_bit=dict_read_number(dict, "capab-num", \
False, "transform", loc, (def)); \
- if (st->ops.capab_transformnum > CAPAB_TRANSFORMNUM_MAX) \
+ if (st->ops.capab_bit > CAPAB_BIT_MAX) \
cfgfatal(loc,"transform","capab-num out of range 0..%d\n", \
- CAPAB_TRANSFORMNUM_MAX); \
+ CAPAB_BIT_MAX); \
}while(0)
#define TRANSFORM_CREATE_CORE \