Print this page
4896 Performance improvements for KCF AES modes


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.

  23  */
  24 
  25 #ifndef _SYS_CRYPTO_IMPL_H
  26 #define _SYS_CRYPTO_IMPL_H
  27 
  28 /*
  29  * Kernel Cryptographic Framework private implementation definitions.
  30  */
  31 
  32 #include <sys/types.h>
  33 #include <sys/param.h>
  34 
  35 #ifdef _KERNEL
  36 #include <sys/crypto/common.h>
  37 #include <sys/crypto/api.h>
  38 #include <sys/crypto/spi.h>
  39 #include <sys/crypto/ioctl.h>
  40 #include <sys/tnf_probe.h>
  41 #include <sys/atomic.h>
  42 #include <sys/project.h>


1339 extern void undo_register_provider(kcf_provider_desc_t *, boolean_t);
1340 extern void redo_register_provider(kcf_provider_desc_t *);
1341 extern void kcf_rnd_init();
1342 extern boolean_t kcf_rngprov_check(void);
1343 extern int kcf_rnd_get_pseudo_bytes(uint8_t *, size_t);
1344 extern int kcf_rnd_get_bytes(uint8_t *, size_t, boolean_t);
1345 extern int random_add_pseudo_entropy(uint8_t *, size_t, uint_t);
1346 extern void kcf_rnd_chpoll(short, int, short *, struct pollhead **);
1347 extern int crypto_uio_data(crypto_data_t *, uchar_t *, int, cmd_type_t,
1348     void *, void (*update)());
1349 extern int crypto_mblk_data(crypto_data_t *, uchar_t *, int, cmd_type_t,
1350     void *, void (*update)());
1351 extern int crypto_put_output_data(uchar_t *, crypto_data_t *, int);
1352 extern int crypto_get_input_data(crypto_data_t *, uchar_t **, uchar_t *);
1353 extern int crypto_copy_key_to_ctx(crypto_key_t *, crypto_key_t **, size_t *,
1354     int kmflag);
1355 extern int crypto_digest_data(crypto_data_t *, void *, uchar_t *,
1356     void (*update)(), void (*final)(), uchar_t);
1357 extern int crypto_update_iov(void *, crypto_data_t *, crypto_data_t *,
1358     int (*cipher)(void *, caddr_t, size_t, crypto_data_t *),
1359     void (*copy_block)(uint8_t *, uint64_t *));
1360 extern int crypto_update_uio(void *, crypto_data_t *, crypto_data_t *,
1361     int (*cipher)(void *, caddr_t, size_t, crypto_data_t *),
1362     void (*copy_block)(uint8_t *, uint64_t *));
1363 extern int crypto_update_mp(void *, crypto_data_t *, crypto_data_t *,
1364     int (*cipher)(void *, caddr_t, size_t, crypto_data_t *),
1365     void (*copy_block)(uint8_t *, uint64_t *));
1366 extern int crypto_get_key_attr(crypto_key_t *, crypto_attr_type_t, uchar_t **,
1367     ssize_t *);
1368 
1369 /* Access to the provider's table */
1370 extern void kcf_prov_tab_init(void);
1371 extern int kcf_prov_tab_add_provider(kcf_provider_desc_t *);
1372 extern int kcf_prov_tab_rem_provider(crypto_provider_id_t);
1373 extern kcf_provider_desc_t *kcf_prov_tab_lookup_by_name(char *);
1374 extern kcf_provider_desc_t *kcf_prov_tab_lookup_by_dev(char *, uint_t);
1375 extern int kcf_get_hw_prov_tab(uint_t *, kcf_provider_desc_t ***, int,
1376     char *, uint_t, boolean_t);
1377 extern int kcf_get_slot_list(uint_t *, kcf_provider_desc_t ***, boolean_t);
1378 extern void kcf_free_provider_tab(uint_t, kcf_provider_desc_t **);
1379 extern kcf_provider_desc_t *kcf_prov_tab_lookup(crypto_provider_id_t);
1380 extern int kcf_get_sw_prov(crypto_mech_type_t, kcf_provider_desc_t **,
1381     kcf_mech_entry_t **, boolean_t);
1382 
1383 extern kmutex_t prov_tab_mutex;
1384 extern boolean_t kcf_need_provtab_walk;
1385 extern int kcf_get_refcnt(kcf_provider_desc_t *, boolean_t);




   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright 2015 by Saso Kiselkov. All rights reserved.
  24  */
  25 
  26 #ifndef _SYS_CRYPTO_IMPL_H
  27 #define _SYS_CRYPTO_IMPL_H
  28 
  29 /*
  30  * Kernel Cryptographic Framework private implementation definitions.
  31  */
  32 
  33 #include <sys/types.h>
  34 #include <sys/param.h>
  35 
  36 #ifdef _KERNEL
  37 #include <sys/crypto/common.h>
  38 #include <sys/crypto/api.h>
  39 #include <sys/crypto/spi.h>
  40 #include <sys/crypto/ioctl.h>
  41 #include <sys/tnf_probe.h>
  42 #include <sys/atomic.h>
  43 #include <sys/project.h>


1340 extern void undo_register_provider(kcf_provider_desc_t *, boolean_t);
1341 extern void redo_register_provider(kcf_provider_desc_t *);
1342 extern void kcf_rnd_init();
1343 extern boolean_t kcf_rngprov_check(void);
1344 extern int kcf_rnd_get_pseudo_bytes(uint8_t *, size_t);
1345 extern int kcf_rnd_get_bytes(uint8_t *, size_t, boolean_t);
1346 extern int random_add_pseudo_entropy(uint8_t *, size_t, uint_t);
1347 extern void kcf_rnd_chpoll(short, int, short *, struct pollhead **);
1348 extern int crypto_uio_data(crypto_data_t *, uchar_t *, int, cmd_type_t,
1349     void *, void (*update)());
1350 extern int crypto_mblk_data(crypto_data_t *, uchar_t *, int, cmd_type_t,
1351     void *, void (*update)());
1352 extern int crypto_put_output_data(uchar_t *, crypto_data_t *, int);
1353 extern int crypto_get_input_data(crypto_data_t *, uchar_t **, uchar_t *);
1354 extern int crypto_copy_key_to_ctx(crypto_key_t *, crypto_key_t **, size_t *,
1355     int kmflag);
1356 extern int crypto_digest_data(crypto_data_t *, void *, uchar_t *,
1357     void (*update)(), void (*final)(), uchar_t);
1358 extern int crypto_update_iov(void *, crypto_data_t *, crypto_data_t *,
1359     int (*cipher)(void *, caddr_t, size_t, crypto_data_t *),
1360     void (*copy_block)(const uint8_t *, uint64_t *));
1361 extern int crypto_update_uio(void *, crypto_data_t *, crypto_data_t *,
1362     int (*cipher)(void *, caddr_t, size_t, crypto_data_t *),
1363     void (*copy_block)(const uint8_t *, uint64_t *));
1364 extern int crypto_update_mp(void *, crypto_data_t *, crypto_data_t *,
1365     int (*cipher)(void *, caddr_t, size_t, crypto_data_t *),
1366     void (*copy_block)(const uint8_t *, uint64_t *));
1367 extern int crypto_get_key_attr(crypto_key_t *, crypto_attr_type_t, uchar_t **,
1368     ssize_t *);
1369 
1370 /* Access to the provider's table */
1371 extern void kcf_prov_tab_init(void);
1372 extern int kcf_prov_tab_add_provider(kcf_provider_desc_t *);
1373 extern int kcf_prov_tab_rem_provider(crypto_provider_id_t);
1374 extern kcf_provider_desc_t *kcf_prov_tab_lookup_by_name(char *);
1375 extern kcf_provider_desc_t *kcf_prov_tab_lookup_by_dev(char *, uint_t);
1376 extern int kcf_get_hw_prov_tab(uint_t *, kcf_provider_desc_t ***, int,
1377     char *, uint_t, boolean_t);
1378 extern int kcf_get_slot_list(uint_t *, kcf_provider_desc_t ***, boolean_t);
1379 extern void kcf_free_provider_tab(uint_t, kcf_provider_desc_t **);
1380 extern kcf_provider_desc_t *kcf_prov_tab_lookup(crypto_provider_id_t);
1381 extern int kcf_get_sw_prov(crypto_mech_type_t, kcf_provider_desc_t **,
1382     kcf_mech_entry_t **, boolean_t);
1383 
1384 extern kmutex_t prov_tab_mutex;
1385 extern boolean_t kcf_need_provtab_walk;
1386 extern int kcf_get_refcnt(kcf_provider_desc_t *, boolean_t);