Print this page
9697 Add digest tests to crypto test framework


 358         update.du_encrbuf = op->in + offset;
 359 
 360         ret = kcf_do_ioctl(CRYPTO_DECRYPT_UPDATE, (uint_t *)&update, "update");
 361         *encrlen += update.du_datalen;
 362         return (ret);
 363 }
 364 
 365 int
 366 decrypt_final(crypto_op_t *op, size_t encrlen)
 367 {
 368         crypto_decrypt_final_t final;
 369 
 370         bzero((void *)&final, sizeof (final));
 371 
 372         final.df_session = op->hsession;
 373         final.df_datalen = op->outlen - encrlen;
 374         final.df_databuf = op->out + encrlen;
 375 
 376         return (kcf_do_ioctl(CRYPTO_DECRYPT_FINAL, (uint_t *)&final, "final"));
 377 }


































































 358         update.du_encrbuf = op->in + offset;
 359 
 360         ret = kcf_do_ioctl(CRYPTO_DECRYPT_UPDATE, (uint_t *)&update, "update");
 361         *encrlen += update.du_datalen;
 362         return (ret);
 363 }
 364 
 365 int
 366 decrypt_final(crypto_op_t *op, size_t encrlen)
 367 {
 368         crypto_decrypt_final_t final;
 369 
 370         bzero((void *)&final, sizeof (final));
 371 
 372         final.df_session = op->hsession;
 373         final.df_datalen = op->outlen - encrlen;
 374         final.df_databuf = op->out + encrlen;
 375 
 376         return (kcf_do_ioctl(CRYPTO_DECRYPT_FINAL, (uint_t *)&final, "final"));
 377 }
 378 
 379 int
 380 digest_init(crypto_op_t *op)
 381 {
 382         crypto_digest_init_t init;
 383 
 384         bzero(&init, sizeof (init));
 385 
 386         init.di_session = op->hsession;
 387 
 388         init.di_mech.cm_type = op->mech;
 389         init.di_mech.cm_param = NULL;
 390         init.di_mech.cm_param_len = 0;
 391 
 392         return (kcf_do_ioctl(CRYPTO_DIGEST_INIT, (uint_t *)&init, "init"));
 393 }
 394 
 395 int
 396 digest_single(crypto_op_t *op)
 397 {
 398         crypto_digest_t digest;
 399 
 400         bzero(&digest, sizeof (digest));
 401 
 402         digest.cd_session = op->hsession;
 403 
 404         digest.cd_datalen = op->inlen;
 405         digest.cd_databuf = op->in;
 406         digest.cd_digestlen = op->outlen;
 407         digest.cd_digestbuf = op->out;
 408 
 409         return (kcf_do_ioctl(CRYPTO_DIGEST, (uint_t *)&digest, "digest"));
 410 }
 411 
 412 int
 413 digest_update(crypto_op_t *op, int offset)
 414 {
 415         crypto_digest_update_t update;
 416 
 417         bzero(&update, sizeof (update));
 418 
 419         update.du_session = op->hsession;
 420 
 421         update.du_datalen = op->updatelen;
 422         update.du_databuf = op->in + offset;
 423 
 424         return (kcf_do_ioctl(CRYPTO_DIGEST_UPDATE, (uint_t *)&update,
 425             "update"));
 426 }
 427 
 428 int
 429 digest_final(crypto_op_t *op)
 430 {
 431         crypto_digest_final_t final;
 432 
 433         bzero(&final, sizeof (final));
 434 
 435         final.df_session = op->hsession;
 436 
 437         final.df_digestlen = op->outlen;
 438         final.df_digestbuf = op->out;
 439 
 440         return (kcf_do_ioctl(CRYPTO_DIGEST_FINAL, (uint_t *)&final, "final"));
 441 }