This is currently not critical as we only use keytabs
only as acceptor, but in future we'll also use them
for kinit() and there we should prefer the newest type.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
uint32_t enctype_bitmap,
krb5_enctype **enctypes)
{
- unsigned int i, j = 0;
+ size_t max_bits = 8 * sizeof(enctype_bitmap);
+ size_t j = 0;
+ ssize_t i;
+
*enctypes = talloc_zero_array(mem_ctx, krb5_enctype,
- (8 * sizeof(enctype_bitmap)) + 1);
+ max_bits + 1);
if (!*enctypes) {
return ENOMEM;
}
- for (i = 0; i < (8 * sizeof(enctype_bitmap)); i++) {
+
+ for (i = max_bits - 1; i >= 0; i--) {
uint32_t bit_value = (1U << i) & enctype_bitmap;
if (bit_value & enctype_bitmap) {
(*enctypes)[j] = ms_suptype_to_ietf_enctype(bit_value);