Change key types to a 16-bit encoding

All key types now have an encoding on 32 bits where the bottom 16 bits
are zero. Change to using 16 bits only.

Keep 32 bits for key types in storage, but move the significant
half-word from the top to the bottom.

Likewise, change EC curve and DH group families from 32 bits out of
which the top 8 and bottom 16 bits are zero, to 8 bits only.

Reorder psa_core_key_attributes_t to avoid padding.
diff --git a/programs/psa/psa_constant_names.c b/programs/psa/psa_constant_names.c
index 73692d0..d8ffd46 100644
--- a/programs/psa/psa_constant_names.c
+++ b/programs/psa/psa_constant_names.c
@@ -80,7 +80,7 @@
                curve_name, strlen(curve_name));
     } else {
         append_integer(buffer, buffer_size, required_size,
-                       "0x%04x", curve);
+                       "0x%02x", curve);
     }
     append(buffer, buffer_size, required_size, ")", 1);
 }
@@ -98,7 +98,7 @@
                group_name, strlen(group_name));
     } else {
         append_integer(buffer, buffer_size, required_size,
-                       "0x%04x", group);
+                       "0x%02x", group);
     }
     append(buffer, buffer_size, required_size, ")", 1);
 }
@@ -144,7 +144,7 @@
 {
     const char *name = psa_ecc_curve_name(curve);
     if (name == NULL) {
-        return snprintf(buffer, buffer_size, "0x%04x", (unsigned) curve);
+        return snprintf(buffer, buffer_size, "0x%02x", (unsigned) curve);
     } else {
         size_t length = strlen(name);
         if (length < buffer_size) {
@@ -161,7 +161,7 @@
 {
     const char *name = psa_dh_group_name(group);
     if (name == NULL) {
-        return snprintf(buffer, buffer_size, "0x%04x", (unsigned) group);
+        return snprintf(buffer, buffer_size, "0x%02x", (unsigned) group);
     } else {
         size_t length = strlen(name);
         if (length < buffer_size) {