Print this page
fixup .text where possible
additional style updates in crypto
7127  remove -Wno-missing-braces from Makefile.uts

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/crypto/io/dprov.c
          +++ new/usr/src/uts/common/crypto/io/dprov.c
↓ open down ↓ 182 lines elided ↑ open up ↑
 183  183          &devops
 184  184  };
 185  185  
 186  186  static struct modlcrypto modlcrypto = {
 187  187          &mod_cryptoops,
 188  188          "Pseudo KCF Prov (crypto)"
 189  189  };
 190  190  
 191  191  static struct modlinkage modlinkage = {
 192  192          MODREV_1,
 193      -        &modldrv,
 194      -        &modlcrypto,
 195      -        NULL
      193 +        {   &modldrv,
      194 +            &modlcrypto,
      195 +            NULL }
 196  196  };
 197  197  
 198  198  /*
 199  199   * CSPI information (entry points, provider info, etc.)
 200  200   */
 201  201  
 202  202  typedef enum dprov_mech_type {
 203  203          MD4_MECH_INFO_TYPE,             /* SUN_CKM_MD4 */
 204  204  
 205  205          MD5_MECH_INFO_TYPE,             /* SUN_CKM_MD5 */
↓ open down ↓ 827 lines elided ↑ open up ↑
1033 1033      crypto_session_id_t, crypto_mechanism_t *, crypto_key_t *,
1034 1034      crypto_object_attribute_t *, uint_t, crypto_object_attribute_t *,
1035 1035      uint_t, crypto_req_handle_t);
1036 1036  
1037 1037  static crypto_nostore_key_ops_t dprov_nostore_key_ops = {
1038 1038          dprov_nostore_key_generate,
1039 1039          dprov_nostore_key_generate_pair,
1040 1040          dprov_nostore_key_derive
1041 1041  };
1042 1042  
1043      -static crypto_ops_t dprov_crypto_ops = {
1044      -        &dprov_control_ops,
1045      -        &dprov_digest_ops,
1046      -        &dprov_cipher_ops,
1047      -        &dprov_mac_ops,
1048      -        &dprov_sign_ops,
1049      -        &dprov_verify_ops,
1050      -        &dprov_dual_ops,
1051      -        &dprov_cipher_mac_ops,
1052      -        &dprov_random_number_ops,
1053      -        &dprov_session_ops,
1054      -        &dprov_object_ops,
1055      -        &dprov_key_ops,
1056      -        &dprov_management_ops,
1057      -        &dprov_ctx_ops,
     1043 +static crypto_ops_t dprov_crypto_ops = { .cou.cou_v2 = {
     1044 +        {   &dprov_control_ops,
     1045 +            &dprov_digest_ops,
     1046 +            &dprov_cipher_ops,
     1047 +            &dprov_mac_ops,
     1048 +            &dprov_sign_ops,
     1049 +            &dprov_verify_ops,
     1050 +            &dprov_dual_ops,
     1051 +            &dprov_cipher_mac_ops,
     1052 +            &dprov_random_number_ops,
     1053 +            &dprov_session_ops,
     1054 +            &dprov_object_ops,
     1055 +            &dprov_key_ops,
     1056 +            &dprov_management_ops,
     1057 +            &dprov_ctx_ops },
1058 1058          &dprov_mech_ops
1059      -};
     1059 +}};
1060 1060  
1061 1061  
1062 1062  /* maximum SO and user PIN lengths */
1063 1063  #define DPROV_MAX_PIN_LEN       128
1064 1064  
1065 1065  /*
1066 1066   * Objects: each session is associated with an array of objects.
1067 1067   * Unlike PKCS#11, the objects cannot be shared between sessions.
1068 1068   * The ioctl driver multiplexes PKCS#11 sessions to providers
1069 1069   * sessions in order to support this semantic. This simplifies
↓ open down ↓ 132 lines elided ↑ open up ↑
1202 1202          DPROV_SESSION_STATE_USER        /* user logged in */
1203 1203  } dprov_session_state_t;
1204 1204  
1205 1205  /* session description */
1206 1206  typedef struct dprov_session {
1207 1207          dprov_session_state_t ds_state; /* session state */
1208 1208          dprov_object_t *ds_objects[DPROV_MAX_OBJECTS];  /* session objects */
1209 1209  } dprov_session_t;
1210 1210  
1211 1211  
1212      -static crypto_provider_info_t dprov_prov_info = {
1213      -        CRYPTO_SPI_VERSION_2,
1214      -        "Dummy Pseudo HW Provider",
1215      -        CRYPTO_HW_PROVIDER,
1216      -        NULL,                           /* pi_provider_dev */
1217      -        NULL,                           /* pi_provider_handle */
1218      -        &dprov_crypto_ops,
1219      -        sizeof (dprov_mech_info_tab)/sizeof (crypto_mech_info_t),
1220      -        dprov_mech_info_tab,
1221      -        0,                              /* pi_logical_provider_count */
1222      -        NULL,                           /* pi_logical_providers */
     1212 +static crypto_provider_info_t dprov_prov_info = {{{
     1213 +        {   CRYPTO_SPI_VERSION_2,
     1214 +            "Dummy Pseudo HW Provider",
     1215 +            CRYPTO_HW_PROVIDER,
     1216 +            { NULL },                   /* pi_provider_dev */
     1217 +            NULL,                       /* pi_provider_handle */
     1218 +            &dprov_crypto_ops,
     1219 +            sizeof (dprov_mech_info_tab)/sizeof (crypto_mech_info_t),
     1220 +            dprov_mech_info_tab,
     1221 +            0,                          /* pi_logical_provider_count */
     1222 +            NULL },                     /* pi_logical_providers */
1223 1223          0                               /* pi_flags */
1224      -};
     1224 +}}};
1225 1225  
1226 1226  /*
1227 1227   * Per-instance info.
1228 1228   */
1229 1229  typedef struct dprov_state {
1230 1230          kmutex_t ds_lock;               /* per-instance lock */
1231 1231          dev_info_t *ds_dip;             /* device info */
1232 1232          crypto_kcf_provider_handle_t ds_prov_handle;    /* framework handle */
1233 1233          taskq_t *ds_taskq;              /* taskq for async behavior */
1234 1234          char ds_user_pin[DPROV_MAX_PIN_LEN];    /* normal user PIN */
↓ open down ↓ 8571 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX