Print this page
6640 dca gets the instance number a lot, never actually uses it

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/crypto/io/dca.c
          +++ new/usr/src/uts/common/crypto/io/dca.c
↓ open down ↓ 406 lines elided ↑ open up ↑
 407  407          NULL,                           /* pi_provider_dev */
 408  408          NULL,                           /* pi_provider_handle */
 409  409          &dca_crypto_ops2,
 410  410          sizeof (dca_mech_info_tab2)/sizeof (crypto_mech_info_t),
 411  411          dca_mech_info_tab2,
 412  412          0,                              /* pi_logical_provider_count */
 413  413          NULL                            /* pi_logical_providers */
 414  414  };
 415  415  
 416  416  /* Convenience macros */
 417      -/* Retrieve the softc and instance number from a SPI crypto context */
 418      -#define DCA_SOFTC_FROM_CTX(ctx, softc, instance) {              \
 419      -        (softc) = (dca_t *)(ctx)->cc_provider;                  \
 420      -        (instance) = ddi_get_instance((softc)->dca_dip);        \
 421      -}
 422      -
      417 +#define DCA_SOFTC_FROM_CTX(ctx) ((dca_t *)(ctx)->cc_provider)
 423  418  #define DCA_MECH_FROM_CTX(ctx) \
 424  419          (((dca_request_t *)(ctx)->cc_provider_private)->dr_ctx.ctx_cm_type)
 425  420  
 426  421  static int dca_bindchains_one(dca_request_t *reqp, size_t cnt, int dr_offset,
 427  422      caddr_t kaddr, ddi_dma_handle_t handle, uint_t flags,
 428  423      dca_chain_t *head, int *n_chain);
 429  424  static uint64_t dca_ena(uint64_t ena);
 430  425  static caddr_t dca_bufdaddr_out(crypto_data_t *data);
 431  426  static char *dca_fma_eclass_string(char *model, dca_fma_eclass_t index);
 432  427  static int dca_check_acc_handle(dca_t *dca, ddi_acc_handle_t handle,
↓ open down ↓ 3254 lines elided ↑ open up ↑
3687 3682   */
3688 3683  
3689 3684  /* ARGSUSED */
3690 3685  static int
3691 3686  dca_encrypt_init(crypto_ctx_t *ctx, crypto_mechanism_t *mechanism,
3692 3687      crypto_key_t *key, crypto_spi_ctx_template_t ctx_template,
3693 3688      crypto_req_handle_t req)
3694 3689  {
3695 3690          int error = CRYPTO_FAILED;
3696 3691          dca_t *softc;
3697      -        /* LINTED E_FUNC_SET_NOT_USED */
3698      -        int instance;
3699 3692  
3700      -        /* extract softc and instance number from context */
3701      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     3693 +        softc = DCA_SOFTC_FROM_CTX(ctx);
3702 3694          DBG(softc, DENTRY, "dca_encrypt_init: started");
3703 3695  
3704 3696          /* check mechanism */
3705 3697          switch (mechanism->cm_type) {
3706 3698          case DES_CBC_MECH_INFO_TYPE:
3707 3699                  error = dca_3desctxinit(ctx, mechanism, key, KM_SLEEP,
3708 3700                      DR_ENCRYPT);
3709 3701                  break;
3710 3702          case DES3_CBC_MECH_INFO_TYPE:
3711 3703                  error = dca_3desctxinit(ctx, mechanism, key, KM_SLEEP,
↓ open down ↓ 18 lines elided ↑ open up ↑
3730 3722          return (error);
3731 3723  }
3732 3724  
3733 3725  /* ARGSUSED */
3734 3726  static int
3735 3727  dca_encrypt(crypto_ctx_t *ctx, crypto_data_t *plaintext,
3736 3728      crypto_data_t *ciphertext, crypto_req_handle_t req)
3737 3729  {
3738 3730          int error = CRYPTO_FAILED;
3739 3731          dca_t *softc;
3740      -        /* LINTED E_FUNC_SET_NOT_USED */
3741      -        int instance;
3742 3732  
3743 3733          if (!ctx || !ctx->cc_provider || !ctx->cc_provider_private)
3744 3734                  return (CRYPTO_OPERATION_NOT_INITIALIZED);
3745 3735  
3746      -        /* extract softc and instance number from context */
3747      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     3736 +        softc = DCA_SOFTC_FROM_CTX(ctx);
3748 3737          DBG(softc, DENTRY, "dca_encrypt: started");
3749 3738  
3750 3739          /* handle inplace ops */
3751 3740          if (!ciphertext) {
3752 3741                  dca_request_t *reqp = ctx->cc_provider_private;
3753 3742                  reqp->dr_flags |= DR_INPLACE;
3754 3743                  ciphertext = plaintext;
3755 3744          }
3756 3745  
3757 3746          /* check mechanism */
↓ open down ↓ 27 lines elided ↑ open up ↑
3785 3774          return (error);
3786 3775  }
3787 3776  
3788 3777  /* ARGSUSED */
3789 3778  static int
3790 3779  dca_encrypt_update(crypto_ctx_t *ctx, crypto_data_t *plaintext,
3791 3780      crypto_data_t *ciphertext, crypto_req_handle_t req)
3792 3781  {
3793 3782          int error = CRYPTO_FAILED;
3794 3783          dca_t *softc;
3795      -        /* LINTED E_FUNC_SET_NOT_USED */
3796      -        int instance;
3797 3784  
3798 3785          if (!ctx || !ctx->cc_provider || !ctx->cc_provider_private)
3799 3786                  return (CRYPTO_OPERATION_NOT_INITIALIZED);
3800 3787  
3801      -        /* extract softc and instance number from context */
3802      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     3788 +        softc = DCA_SOFTC_FROM_CTX(ctx);
3803 3789          DBG(softc, DENTRY, "dca_encrypt_update: started");
3804 3790  
3805 3791          /* handle inplace ops */
3806 3792          if (!ciphertext) {
3807 3793                  dca_request_t *reqp = ctx->cc_provider_private;
3808 3794                  reqp->dr_flags |= DR_INPLACE;
3809 3795                  ciphertext = plaintext;
3810 3796          }
3811 3797  
3812 3798          /* check mechanism */
↓ open down ↓ 18 lines elided ↑ open up ↑
3831 3817          return (error);
3832 3818  }
3833 3819  
3834 3820  /* ARGSUSED */
3835 3821  static int
3836 3822  dca_encrypt_final(crypto_ctx_t *ctx, crypto_data_t *ciphertext,
3837 3823      crypto_req_handle_t req)
3838 3824  {
3839 3825          int error = CRYPTO_FAILED;
3840 3826          dca_t *softc;
3841      -        /* LINTED E_FUNC_SET_NOT_USED */
3842      -        int instance;
3843 3827  
3844 3828          if (!ctx || !ctx->cc_provider || !ctx->cc_provider_private)
3845 3829                  return (CRYPTO_OPERATION_NOT_INITIALIZED);
3846 3830  
3847      -        /* extract softc and instance number from context */
3848      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     3831 +        softc = DCA_SOFTC_FROM_CTX(ctx);
3849 3832          DBG(softc, DENTRY, "dca_encrypt_final: started");
3850 3833  
3851 3834          /* check mechanism */
3852 3835          switch (DCA_MECH_FROM_CTX(ctx)) {
3853 3836          case DES_CBC_MECH_INFO_TYPE:
3854 3837                  error = dca_3desfinal(ctx, ciphertext, DR_ENCRYPT);
3855 3838                  break;
3856 3839          case DES3_CBC_MECH_INFO_TYPE:
3857 3840                  error = dca_3desfinal(ctx, ciphertext, DR_ENCRYPT | DR_TRIPLE);
3858 3841                  break;
↓ open down ↓ 62 lines elided ↑ open up ↑
3921 3904  }
3922 3905  
3923 3906  /* ARGSUSED */
3924 3907  static int
3925 3908  dca_decrypt_init(crypto_ctx_t *ctx, crypto_mechanism_t *mechanism,
3926 3909      crypto_key_t *key, crypto_spi_ctx_template_t ctx_template,
3927 3910      crypto_req_handle_t req)
3928 3911  {
3929 3912          int error = CRYPTO_FAILED;
3930 3913          dca_t *softc;
3931      -        /* LINTED E_FUNC_SET_NOT_USED */
3932      -        int instance;
3933 3914  
3934      -        /* extract softc and instance number from context */
3935      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     3915 +        softc = DCA_SOFTC_FROM_CTX(ctx);
3936 3916          DBG(softc, DENTRY, "dca_decrypt_init: started");
3937 3917  
3938 3918          /* check mechanism */
3939 3919          switch (mechanism->cm_type) {
3940 3920          case DES_CBC_MECH_INFO_TYPE:
3941 3921                  error = dca_3desctxinit(ctx, mechanism, key, KM_SLEEP,
3942 3922                      DR_DECRYPT);
3943 3923                  break;
3944 3924          case DES3_CBC_MECH_INFO_TYPE:
3945 3925                  error = dca_3desctxinit(ctx, mechanism, key, KM_SLEEP,
↓ open down ↓ 18 lines elided ↑ open up ↑
3964 3944          return (error);
3965 3945  }
3966 3946  
3967 3947  /* ARGSUSED */
3968 3948  static int
3969 3949  dca_decrypt(crypto_ctx_t *ctx, crypto_data_t *ciphertext,
3970 3950      crypto_data_t *plaintext, crypto_req_handle_t req)
3971 3951  {
3972 3952          int error = CRYPTO_FAILED;
3973 3953          dca_t *softc;
3974      -        /* LINTED E_FUNC_SET_NOT_USED */
3975      -        int instance;
3976 3954  
3977 3955          if (!ctx || !ctx->cc_provider || !ctx->cc_provider_private)
3978 3956                  return (CRYPTO_OPERATION_NOT_INITIALIZED);
3979 3957  
3980      -        /* extract softc and instance number from context */
3981      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     3958 +        softc = DCA_SOFTC_FROM_CTX(ctx);
3982 3959          DBG(softc, DENTRY, "dca_decrypt: started");
3983 3960  
3984 3961          /* handle inplace ops */
3985 3962          if (!plaintext) {
3986 3963                  dca_request_t *reqp = ctx->cc_provider_private;
3987 3964                  reqp->dr_flags |= DR_INPLACE;
3988 3965                  plaintext = ciphertext;
3989 3966          }
3990 3967  
3991 3968          /* check mechanism */
↓ open down ↓ 28 lines elided ↑ open up ↑
4020 3997          return (error);
4021 3998  }
4022 3999  
4023 4000  /* ARGSUSED */
4024 4001  static int
4025 4002  dca_decrypt_update(crypto_ctx_t *ctx, crypto_data_t *ciphertext,
4026 4003      crypto_data_t *plaintext, crypto_req_handle_t req)
4027 4004  {
4028 4005          int error = CRYPTO_FAILED;
4029 4006          dca_t *softc;
4030      -        /* LINTED E_FUNC_SET_NOT_USED */
4031      -        int instance;
4032 4007  
4033 4008          if (!ctx || !ctx->cc_provider || !ctx->cc_provider_private)
4034 4009                  return (CRYPTO_OPERATION_NOT_INITIALIZED);
4035 4010  
4036      -        /* extract softc and instance number from context */
4037      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     4011 +        softc = DCA_SOFTC_FROM_CTX(ctx);
4038 4012          DBG(softc, DENTRY, "dca_decrypt_update: started");
4039 4013  
4040 4014          /* handle inplace ops */
4041 4015          if (!plaintext) {
4042 4016                  dca_request_t *reqp = ctx->cc_provider_private;
4043 4017                  reqp->dr_flags |= DR_INPLACE;
4044 4018                  plaintext = ciphertext;
4045 4019          }
4046 4020  
4047 4021          /* check mechanism */
↓ open down ↓ 18 lines elided ↑ open up ↑
4066 4040          return (error);
4067 4041  }
4068 4042  
4069 4043  /* ARGSUSED */
4070 4044  static int
4071 4045  dca_decrypt_final(crypto_ctx_t *ctx, crypto_data_t *plaintext,
4072 4046      crypto_req_handle_t req)
4073 4047  {
4074 4048          int error = CRYPTO_FAILED;
4075 4049          dca_t *softc;
4076      -        /* LINTED E_FUNC_SET_NOT_USED */
4077      -        int instance;
4078 4050  
4079 4051          if (!ctx || !ctx->cc_provider || !ctx->cc_provider_private)
4080 4052                  return (CRYPTO_OPERATION_NOT_INITIALIZED);
4081 4053  
4082      -        /* extract softc and instance number from context */
4083      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     4054 +        softc = DCA_SOFTC_FROM_CTX(ctx);
4084 4055          DBG(softc, DENTRY, "dca_decrypt_final: started");
4085 4056  
4086 4057          /* check mechanism */
4087 4058          switch (DCA_MECH_FROM_CTX(ctx)) {
4088 4059          case DES_CBC_MECH_INFO_TYPE:
4089 4060                  error = dca_3desfinal(ctx, plaintext, DR_DECRYPT);
4090 4061                  break;
4091 4062          case DES3_CBC_MECH_INFO_TYPE:
4092 4063                  error = dca_3desfinal(ctx, plaintext, DR_DECRYPT | DR_TRIPLE);
4093 4064                  break;
↓ open down ↓ 66 lines elided ↑ open up ↑
4160 4131   */
4161 4132  
4162 4133  /* ARGSUSED */
4163 4134  static int
4164 4135  dca_sign_init(crypto_ctx_t *ctx, crypto_mechanism_t *mechanism,
4165 4136      crypto_key_t *key, crypto_spi_ctx_template_t ctx_template,
4166 4137      crypto_req_handle_t req)
4167 4138  {
4168 4139          int error = CRYPTO_FAILED;
4169 4140          dca_t *softc;
4170      -        /* LINTED E_FUNC_SET_NOT_USED */
4171      -        int instance;
4172 4141  
4173      -        /* extract softc and instance number from context */
4174      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     4142 +        softc = DCA_SOFTC_FROM_CTX(ctx);
4175 4143          DBG(softc, DENTRY, "dca_sign_init: started\n");
4176 4144  
4177 4145          if (ctx_template != NULL)
4178 4146                  return (CRYPTO_ARGUMENTS_BAD);
4179 4147  
4180 4148          /* check mechanism */
4181 4149          switch (mechanism->cm_type) {
4182 4150          case RSA_PKCS_MECH_INFO_TYPE:
4183 4151          case RSA_X_509_MECH_INFO_TYPE:
4184 4152                  error = dca_rsainit(ctx, mechanism, key, KM_SLEEP);
↓ open down ↓ 16 lines elided ↑ open up ↑
4201 4169  
4202 4170          return (error);
4203 4171  }
4204 4172  
4205 4173  static int
4206 4174  dca_sign(crypto_ctx_t *ctx, crypto_data_t *data,
4207 4175      crypto_data_t *signature, crypto_req_handle_t req)
4208 4176  {
4209 4177          int error = CRYPTO_FAILED;
4210 4178          dca_t *softc;
4211      -        /* LINTED E_FUNC_SET_NOT_USED */
4212      -        int instance;
4213 4179  
4214 4180          if (!ctx || !ctx->cc_provider || !ctx->cc_provider_private)
4215 4181                  return (CRYPTO_OPERATION_NOT_INITIALIZED);
4216 4182  
4217      -        /* extract softc and instance number from context */
4218      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     4183 +        softc = DCA_SOFTC_FROM_CTX(ctx);
4219 4184          DBG(softc, DENTRY, "dca_sign: started\n");
4220 4185  
4221 4186          /* check mechanism */
4222 4187          switch (DCA_MECH_FROM_CTX(ctx)) {
4223 4188          case RSA_PKCS_MECH_INFO_TYPE:
4224 4189          case RSA_X_509_MECH_INFO_TYPE:
4225 4190                  error = dca_rsastart(ctx, data, signature, req, DCA_RSA_SIGN);
4226 4191                  break;
4227 4192          case DSA_MECH_INFO_TYPE:
4228 4193                  error = dca_dsa_sign(ctx, data, signature, req);
↓ open down ↓ 9 lines elided ↑ open up ↑
4238 4203          return (error);
4239 4204  }
4240 4205  
4241 4206  /* ARGSUSED */
4242 4207  static int
4243 4208  dca_sign_update(crypto_ctx_t *ctx, crypto_data_t *data,
4244 4209      crypto_req_handle_t req)
4245 4210  {
4246 4211          int error = CRYPTO_MECHANISM_INVALID;
4247 4212          dca_t *softc;
4248      -        /* LINTED E_FUNC_SET_NOT_USED */
4249      -        int instance;
4250 4213  
4251 4214          if (!ctx || !ctx->cc_provider || !ctx->cc_provider_private)
4252 4215                  return (CRYPTO_OPERATION_NOT_INITIALIZED);
4253 4216  
4254      -        /* extract softc and instance number from context */
4255      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     4217 +        softc = DCA_SOFTC_FROM_CTX(ctx);
4256 4218          DBG(softc, DENTRY, "dca_sign_update: started\n");
4257 4219  
4258 4220          cmn_err(CE_WARN, "dca_sign_update: unexpected mech type "
4259 4221              "0x%llx\n", (unsigned long long)DCA_MECH_FROM_CTX(ctx));
4260 4222  
4261 4223          DBG(softc, DENTRY, "dca_sign_update: done, err = 0x%x", error);
4262 4224  
4263 4225          return (error);
4264 4226  }
4265 4227  
4266 4228  /* ARGSUSED */
4267 4229  static int
4268 4230  dca_sign_final(crypto_ctx_t *ctx, crypto_data_t *signature,
4269 4231      crypto_req_handle_t req)
4270 4232  {
4271 4233          int error = CRYPTO_MECHANISM_INVALID;
4272 4234          dca_t *softc;
4273      -        /* LINTED E_FUNC_SET_NOT_USED */
4274      -        int instance;
4275 4235  
4276 4236          if (!ctx || !ctx->cc_provider || !ctx->cc_provider_private)
4277 4237                  return (CRYPTO_OPERATION_NOT_INITIALIZED);
4278 4238  
4279      -        /* extract softc and instance number from context */
4280      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     4239 +        softc = DCA_SOFTC_FROM_CTX(ctx);
4281 4240          DBG(softc, DENTRY, "dca_sign_final: started\n");
4282 4241  
4283 4242          cmn_err(CE_WARN, "dca_sign_final: unexpected mech type "
4284 4243              "0x%llx\n", (unsigned long long)DCA_MECH_FROM_CTX(ctx));
4285 4244  
4286 4245          DBG(softc, DENTRY, "dca_sign_final: done, err = 0x%x", error);
4287 4246  
4288 4247          return (error);
4289 4248  }
4290 4249  
↓ open down ↓ 34 lines elided ↑ open up ↑
4325 4284  }
4326 4285  
4327 4286  /* ARGSUSED */
4328 4287  static int
4329 4288  dca_sign_recover_init(crypto_ctx_t *ctx, crypto_mechanism_t *mechanism,
4330 4289      crypto_key_t *key, crypto_spi_ctx_template_t ctx_template,
4331 4290      crypto_req_handle_t req)
4332 4291  {
4333 4292          int error = CRYPTO_FAILED;
4334 4293          dca_t *softc;
4335      -        /* LINTED E_FUNC_SET_NOT_USED */
4336      -        int instance;
4337 4294  
4338      -        /* extract softc and instance number from context */
4339      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     4295 +        softc = DCA_SOFTC_FROM_CTX(ctx);
4340 4296          DBG(softc, DENTRY, "dca_sign_recover_init: started\n");
4341 4297  
4342 4298          if (ctx_template != NULL)
4343 4299                  return (CRYPTO_ARGUMENTS_BAD);
4344 4300  
4345 4301          /* check mechanism */
4346 4302          switch (mechanism->cm_type) {
4347 4303          case RSA_PKCS_MECH_INFO_TYPE:
4348 4304          case RSA_X_509_MECH_INFO_TYPE:
4349 4305                  error = dca_rsainit(ctx, mechanism, key, KM_SLEEP);
↓ open down ↓ 12 lines elided ↑ open up ↑
4362 4318  
4363 4319          return (error);
4364 4320  }
4365 4321  
4366 4322  static int
4367 4323  dca_sign_recover(crypto_ctx_t *ctx, crypto_data_t *data,
4368 4324      crypto_data_t *signature, crypto_req_handle_t req)
4369 4325  {
4370 4326          int error = CRYPTO_FAILED;
4371 4327          dca_t *softc;
4372      -        /* LINTED E_FUNC_SET_NOT_USED */
4373      -        int instance;
4374 4328  
4375 4329          if (!ctx || !ctx->cc_provider || !ctx->cc_provider_private)
4376 4330                  return (CRYPTO_OPERATION_NOT_INITIALIZED);
4377 4331  
4378      -        /* extract softc and instance number from context */
4379      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     4332 +        softc = DCA_SOFTC_FROM_CTX(ctx);
4380 4333          DBG(softc, DENTRY, "dca_sign_recover: started\n");
4381 4334  
4382 4335          /* check mechanism */
4383 4336          switch (DCA_MECH_FROM_CTX(ctx)) {
4384 4337          case RSA_PKCS_MECH_INFO_TYPE:
4385 4338          case RSA_X_509_MECH_INFO_TYPE:
4386 4339                  error = dca_rsastart(ctx, data, signature, req, DCA_RSA_SIGNR);
4387 4340                  break;
4388 4341          default:
4389 4342                  cmn_err(CE_WARN, "dca_sign_recover: unexpected mech type "
↓ open down ↓ 7 lines elided ↑ open up ↑
4397 4350  }
4398 4351  
4399 4352  static int
4400 4353  dca_sign_recover_atomic(crypto_provider_handle_t provider,
4401 4354      crypto_session_id_t session_id, crypto_mechanism_t *mechanism,
4402 4355      crypto_key_t *key, crypto_data_t *data, crypto_data_t *signature,
4403 4356      crypto_spi_ctx_template_t ctx_template, crypto_req_handle_t req)
4404 4357  {
4405 4358          int error = CRYPTO_FAILED;
4406 4359          dca_t *softc = (dca_t *)provider;
4407      -        /* LINTED E_FUNC_SET_NOT_USED */
4408      -        int instance;
4409 4360  
4410      -        instance = ddi_get_instance(softc->dca_dip);
4411 4361          DBG(softc, DENTRY, "dca_sign_recover_atomic: started\n");
4412 4362  
4413 4363          if (ctx_template != NULL)
4414 4364                  return (CRYPTO_ARGUMENTS_BAD);
4415 4365  
4416 4366          /* check mechanism */
4417 4367          switch (mechanism->cm_type) {
4418 4368          case RSA_PKCS_MECH_INFO_TYPE:
4419 4369          case RSA_X_509_MECH_INFO_TYPE:
4420 4370                  error = dca_rsaatomic(provider, session_id, mechanism, key,
↓ open down ↓ 15 lines elided ↑ open up ↑
4436 4386   */
4437 4387  
4438 4388  /* ARGSUSED */
4439 4389  static int
4440 4390  dca_verify_init(crypto_ctx_t *ctx, crypto_mechanism_t *mechanism,
4441 4391      crypto_key_t *key, crypto_spi_ctx_template_t ctx_template,
4442 4392      crypto_req_handle_t req)
4443 4393  {
4444 4394          int error = CRYPTO_FAILED;
4445 4395          dca_t *softc;
4446      -        /* LINTED E_FUNC_SET_NOT_USED */
4447      -        int instance;
4448 4396  
4449      -        /* extract softc and instance number from context */
4450      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     4397 +        softc = DCA_SOFTC_FROM_CTX(ctx);
4451 4398          DBG(softc, DENTRY, "dca_verify_init: started\n");
4452 4399  
4453 4400          if (ctx_template != NULL)
4454 4401                  return (CRYPTO_ARGUMENTS_BAD);
4455 4402  
4456 4403          /* check mechanism */
4457 4404          switch (mechanism->cm_type) {
4458 4405          case RSA_PKCS_MECH_INFO_TYPE:
4459 4406          case RSA_X_509_MECH_INFO_TYPE:
4460 4407                  error = dca_rsainit(ctx, mechanism, key, KM_SLEEP);
↓ open down ↓ 16 lines elided ↑ open up ↑
4477 4424  
4478 4425          return (error);
4479 4426  }
4480 4427  
4481 4428  static int
4482 4429  dca_verify(crypto_ctx_t *ctx, crypto_data_t *data, crypto_data_t *signature,
4483 4430      crypto_req_handle_t req)
4484 4431  {
4485 4432          int error = CRYPTO_FAILED;
4486 4433          dca_t *softc;
4487      -        /* LINTED E_FUNC_SET_NOT_USED */
4488      -        int instance;
4489 4434  
4490 4435          if (!ctx || !ctx->cc_provider || !ctx->cc_provider_private)
4491 4436                  return (CRYPTO_OPERATION_NOT_INITIALIZED);
4492 4437  
4493      -        /* extract softc and instance number from context */
4494      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     4438 +        softc = DCA_SOFTC_FROM_CTX(ctx);
4495 4439          DBG(softc, DENTRY, "dca_verify: started\n");
4496 4440  
4497 4441          /* check mechanism */
4498 4442          switch (DCA_MECH_FROM_CTX(ctx)) {
4499 4443          case RSA_PKCS_MECH_INFO_TYPE:
4500 4444          case RSA_X_509_MECH_INFO_TYPE:
4501 4445                  error = dca_rsastart(ctx, signature, data, req, DCA_RSA_VRFY);
4502 4446                  break;
4503 4447          case DSA_MECH_INFO_TYPE:
4504 4448                  error = dca_dsa_verify(ctx, data, signature, req);
↓ open down ↓ 9 lines elided ↑ open up ↑
4514 4458          return (error);
4515 4459  }
4516 4460  
4517 4461  /* ARGSUSED */
4518 4462  static int
4519 4463  dca_verify_update(crypto_ctx_t *ctx, crypto_data_t *data,
4520 4464      crypto_req_handle_t req)
4521 4465  {
4522 4466          int error = CRYPTO_MECHANISM_INVALID;
4523 4467          dca_t *softc;
4524      -        /* LINTED E_FUNC_SET_NOT_USED */
4525      -        int instance;
4526 4468  
4527 4469          if (!ctx || !ctx->cc_provider || !ctx->cc_provider_private)
4528 4470                  return (CRYPTO_OPERATION_NOT_INITIALIZED);
4529 4471  
4530      -        /* extract softc and instance number from context */
4531      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     4472 +        softc = DCA_SOFTC_FROM_CTX(ctx);
4532 4473          DBG(softc, DENTRY, "dca_verify_update: started\n");
4533 4474  
4534 4475          cmn_err(CE_WARN, "dca_verify_update: unexpected mech type "
4535 4476              "0x%llx\n", (unsigned long long)DCA_MECH_FROM_CTX(ctx));
4536 4477  
4537 4478          DBG(softc, DENTRY, "dca_verify_update: done, err = 0x%x", error);
4538 4479  
4539 4480          return (error);
4540 4481  }
4541 4482  
4542 4483  /* ARGSUSED */
4543 4484  static int
4544 4485  dca_verify_final(crypto_ctx_t *ctx, crypto_data_t *signature,
4545 4486      crypto_req_handle_t req)
4546 4487  {
4547 4488          int error = CRYPTO_MECHANISM_INVALID;
4548 4489          dca_t *softc;
4549      -        /* LINTED E_FUNC_SET_NOT_USED */
4550      -        int instance;
4551 4490  
4552 4491          if (!ctx || !ctx->cc_provider || !ctx->cc_provider_private)
4553 4492                  return (CRYPTO_OPERATION_NOT_INITIALIZED);
4554 4493  
4555      -        /* extract softc and instance number from context */
4556      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     4494 +        softc = DCA_SOFTC_FROM_CTX(ctx);
4557 4495          DBG(softc, DENTRY, "dca_verify_final: started\n");
4558 4496  
4559 4497          cmn_err(CE_WARN, "dca_verify_final: unexpected mech type "
4560 4498              "0x%llx\n", (unsigned long long)DCA_MECH_FROM_CTX(ctx));
4561 4499  
4562 4500          DBG(softc, DENTRY, "dca_verify_final: done, err = 0x%x", error);
4563 4501  
4564 4502          return (error);
4565 4503  }
4566 4504  
↓ open down ↓ 34 lines elided ↑ open up ↑
4601 4539  }
4602 4540  
4603 4541  /* ARGSUSED */
4604 4542  static int
4605 4543  dca_verify_recover_init(crypto_ctx_t *ctx, crypto_mechanism_t *mechanism,
4606 4544      crypto_key_t *key, crypto_spi_ctx_template_t ctx_template,
4607 4545      crypto_req_handle_t req)
4608 4546  {
4609 4547          int error = CRYPTO_MECHANISM_INVALID;
4610 4548          dca_t *softc;
4611      -        /* LINTED E_FUNC_SET_NOT_USED */
4612      -        int instance;
4613 4549  
4614      -        /* extract softc and instance number from context */
4615      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     4550 +        softc = DCA_SOFTC_FROM_CTX(ctx);
4616 4551          DBG(softc, DENTRY, "dca_verify_recover_init: started\n");
4617 4552  
4618 4553          if (ctx_template != NULL)
4619 4554                  return (CRYPTO_ARGUMENTS_BAD);
4620 4555  
4621 4556          /* check mechanism */
4622 4557          switch (mechanism->cm_type) {
4623 4558          case RSA_PKCS_MECH_INFO_TYPE:
4624 4559          case RSA_X_509_MECH_INFO_TYPE:
4625 4560                  error = dca_rsainit(ctx, mechanism, key, KM_SLEEP);
↓ open down ↓ 11 lines elided ↑ open up ↑
4637 4572  
4638 4573          return (error);
4639 4574  }
4640 4575  
4641 4576  static int
4642 4577  dca_verify_recover(crypto_ctx_t *ctx, crypto_data_t *signature,
4643 4578      crypto_data_t *data, crypto_req_handle_t req)
4644 4579  {
4645 4580          int error = CRYPTO_MECHANISM_INVALID;
4646 4581          dca_t *softc;
4647      -        /* LINTED E_FUNC_SET_NOT_USED */
4648      -        int instance;
4649 4582  
4650 4583          if (!ctx || !ctx->cc_provider || !ctx->cc_provider_private)
4651 4584                  return (CRYPTO_OPERATION_NOT_INITIALIZED);
4652 4585  
4653      -        /* extract softc and instance number from context */
4654      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     4586 +        softc = DCA_SOFTC_FROM_CTX(ctx);
4655 4587          DBG(softc, DENTRY, "dca_verify_recover: started\n");
4656 4588  
4657 4589          /* check mechanism */
4658 4590          switch (DCA_MECH_FROM_CTX(ctx)) {
4659 4591          case RSA_PKCS_MECH_INFO_TYPE:
4660 4592          case RSA_X_509_MECH_INFO_TYPE:
4661 4593                  error = dca_rsastart(ctx, signature, data, req, DCA_RSA_VRFYR);
4662 4594                  break;
4663 4595          default:
4664 4596                  cmn_err(CE_WARN, "dca_verify_recover: unexpected mech type "
↓ open down ↓ 43 lines elided ↑ open up ↑
4708 4640   */
4709 4641  
4710 4642  /* ARGSUSED */
4711 4643  static int
4712 4644  dca_generate_random(crypto_provider_handle_t provider,
4713 4645      crypto_session_id_t session_id,
4714 4646      uchar_t *buf, size_t len, crypto_req_handle_t req)
4715 4647  {
4716 4648          int error = CRYPTO_FAILED;
4717 4649          dca_t *softc = (dca_t *)provider;
4718      -        /* LINTED E_FUNC_SET_NOT_USED */
4719      -        int instance;
4720 4650  
4721      -        instance = ddi_get_instance(softc->dca_dip);
4722 4651          DBG(softc, DENTRY, "dca_generate_random: started");
4723 4652  
4724 4653          error = dca_rng(softc, buf, len, req);
4725 4654  
4726 4655          DBG(softc, DENTRY, "dca_generate_random: done, err = 0x%x", error);
4727 4656  
4728 4657          return (error);
4729 4658  }
4730 4659  
4731 4660  /*
4732 4661   * Context management entry points.
4733 4662   */
4734 4663  
4735 4664  int
4736 4665  dca_free_context(crypto_ctx_t *ctx)
4737 4666  {
4738 4667          int error = CRYPTO_SUCCESS;
4739 4668          dca_t *softc;
4740      -        /* LINTED E_FUNC_SET_NOT_USED */
4741      -        int instance;
4742 4669  
4743      -        /* extract softc and instance number from context */
4744      -        DCA_SOFTC_FROM_CTX(ctx, softc, instance);
     4670 +        softc = DCA_SOFTC_FROM_CTX(ctx);
4745 4671          DBG(softc, DENTRY, "dca_free_context: entered");
4746 4672  
4747 4673          if (ctx->cc_provider_private == NULL)
4748 4674                  return (error);
4749 4675  
4750 4676          dca_rmlist2(ctx->cc_provider_private, &softc->dca_ctx_list_lock);
4751 4677  
4752 4678          error = dca_free_context_low(ctx);
4753 4679  
4754 4680          DBG(softc, DENTRY, "dca_free_context: done, err = 0x%x", error);
↓ open down ↓ 277 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX