Print this page
4896 Performance improvements for KCF AES modes

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/crypto/core/kcf_prov_lib.c
          +++ new/usr/src/uts/common/crypto/core/kcf_prov_lib.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
       25 +/*
       26 + * Copyright 2015 by Saso Kiselkov. All rights reserved.
       27 + */
  25   28  
  26   29  #include <sys/strsun.h>
  27   30  #include <sys/systm.h>
  28   31  #include <sys/sysmacros.h>
  29   32  #include <sys/kmem.h>
  30   33  #include <sys/md5.h>
  31   34  #include <sys/sha1.h>
  32   35  #include <sys/sha2.h>
  33   36  #include <modes/modes.h>
  34   37  #include <sys/crypto/common.h>
↓ open down ↓ 354 lines elided ↑ open up ↑
 389  392          if (flag & CRYPTO_DO_FINAL) {
 390  393                  final(digest, dctx);
 391  394          }
 392  395  
 393  396          return (CRYPTO_SUCCESS);
 394  397  }
 395  398  
 396  399  int
 397  400  crypto_update_iov(void *ctx, crypto_data_t *input, crypto_data_t *output,
 398  401      int (*cipher)(void *, caddr_t, size_t, crypto_data_t *),
 399      -    void (*copy_block)(uint8_t *, uint64_t *))
      402 +    void (*copy_block)(const uint8_t *, uint64_t *))
 400  403  {
 401  404          common_ctx_t *common_ctx = ctx;
 402  405          int rv;
 403  406  
 404  407          if (input->cd_miscdata != NULL) {
 405  408                  copy_block((uint8_t *)input->cd_miscdata,
 406  409                      &common_ctx->cc_iv[0]);
 407  410          }
 408  411  
 409  412          if (input->cd_raw.iov_len < input->cd_length)
↓ open down ↓ 1 lines elided ↑ open up ↑
 411  414  
 412  415          rv = (cipher)(ctx, input->cd_raw.iov_base + input->cd_offset,
 413  416              input->cd_length, (input == output) ? NULL : output);
 414  417  
 415  418          return (rv);
 416  419  }
 417  420  
 418  421  int
 419  422  crypto_update_uio(void *ctx, crypto_data_t *input, crypto_data_t *output,
 420  423      int (*cipher)(void *, caddr_t, size_t, crypto_data_t *),
 421      -    void (*copy_block)(uint8_t *, uint64_t *))
      424 +    void (*copy_block)(const uint8_t *, uint64_t *))
 422  425  {
 423  426          common_ctx_t *common_ctx = ctx;
 424  427          uio_t *uiop = input->cd_uio;
 425  428          off_t offset = input->cd_offset;
 426  429          size_t length = input->cd_length;
 427  430          uint_t vec_idx;
 428  431          size_t cur_len;
 429  432  
 430  433          if (input->cd_miscdata != NULL) {
 431  434                  copy_block((uint8_t *)input->cd_miscdata,
↓ open down ↓ 44 lines elided ↑ open up ↑
 476  479  
 477  480                  return (CRYPTO_DATA_LEN_RANGE);
 478  481          }
 479  482  
 480  483          return (CRYPTO_SUCCESS);
 481  484  }
 482  485  
 483  486  int
 484  487  crypto_update_mp(void *ctx, crypto_data_t *input, crypto_data_t *output,
 485  488      int (*cipher)(void *, caddr_t, size_t, crypto_data_t *),
 486      -    void (*copy_block)(uint8_t *, uint64_t *))
      489 +    void (*copy_block)(const uint8_t *, uint64_t *))
 487  490  {
 488  491          common_ctx_t *common_ctx = ctx;
 489  492          off_t offset = input->cd_offset;
 490  493          size_t length = input->cd_length;
 491  494          mblk_t *mp;
 492  495          size_t cur_len;
 493  496  
 494  497          if (input->cd_miscdata != NULL) {
 495  498                  copy_block((uint8_t *)input->cd_miscdata,
 496  499                      &common_ctx->cc_iv[0]);
↓ open down ↓ 62 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX