Print this page
9697 Add digest tests to crypto test framework
   1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.

  14  */
  15 
  16 #ifndef _CRYPTOTEST_H
  17 #define _CRYPTOTEST_H
  18 
  19 #ifdef __cplusplus
  20 extern "C" {
  21 #endif
  22 
  23 #include <sys/crypto/ioctl.h>
  24 
  25 #define CTEST_INIT_FAILED (-1)
  26 #define CTEST_NAME_RESOLVE_FAILED (-2)
  27 #define CTEST_MECH_NO_PROVIDER (-3)
  28 
  29 typedef struct cryptotest {
  30         uint8_t *in;
  31         uint8_t *out;
  32         uint8_t *key;
  33         void *param;


  60 int get_hsession_by_mech(crypto_op_t *op);
  61 
  62 /* CRYPTO_MAC */
  63 int mac_init(crypto_op_t *op);
  64 int mac_single(crypto_op_t *op);
  65 int mac_update(crypto_op_t *op, int offset);
  66 int mac_final(crypto_op_t *op);
  67 
  68 /* CRYPTO_ENCRYPT */
  69 int encrypt_init(crypto_op_t *op);
  70 int encrypt_single(crypto_op_t *op);
  71 int encrypt_update(crypto_op_t *op, int offset, size_t *encrlen);
  72 int encrypt_final(crypto_op_t *op, size_t encrlen);
  73 
  74 /* CRYPTO_DECRYPT */
  75 int decrypt_init(crypto_op_t *op);
  76 int decrypt_single(crypto_op_t *op);
  77 int decrypt_update(crypto_op_t *op, int offset, size_t *encrlen);
  78 int decrypt_final(crypto_op_t *op, size_t encrlen);
  79 






  80 /* wrappers */
  81 int test_mac_single(cryptotest_t *args);
  82 int test_mac(cryptotest_t *args);
  83 
  84 int test_encrypt_single(cryptotest_t *args);
  85 int test_encrypt(cryptotest_t *args);
  86 
  87 int test_decrypt_single(cryptotest_t *args);
  88 int test_decrypt(cryptotest_t *args);
  89 



  90 extern test_fg_t cryptotest_decr_fg;
  91 extern test_fg_t cryptotest_encr_fg;
  92 extern test_fg_t cryptotest_mac_fg;

  93 
  94 #define MAC_FG (&cryptotest_mac_fg)
  95 #define ENCR_FG (&cryptotest_encr_fg)
  96 #define DECR_FG (&cryptotest_decr_fg)

  97 
  98 #ifdef __cplusplus
  99 }
 100 #endif
 101 
 102 #endif /* _CRYPTOTEST_H */
   1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  14  * Copyright 2018, Joyent, Inc.
  15  */
  16 
  17 #ifndef _CRYPTOTEST_H
  18 #define _CRYPTOTEST_H
  19 
  20 #ifdef __cplusplus
  21 extern "C" {
  22 #endif
  23 
  24 #include <sys/crypto/ioctl.h>
  25 
  26 #define CTEST_INIT_FAILED (-1)
  27 #define CTEST_NAME_RESOLVE_FAILED (-2)
  28 #define CTEST_MECH_NO_PROVIDER (-3)
  29 
  30 typedef struct cryptotest {
  31         uint8_t *in;
  32         uint8_t *out;
  33         uint8_t *key;
  34         void *param;


  61 int get_hsession_by_mech(crypto_op_t *op);
  62 
  63 /* CRYPTO_MAC */
  64 int mac_init(crypto_op_t *op);
  65 int mac_single(crypto_op_t *op);
  66 int mac_update(crypto_op_t *op, int offset);
  67 int mac_final(crypto_op_t *op);
  68 
  69 /* CRYPTO_ENCRYPT */
  70 int encrypt_init(crypto_op_t *op);
  71 int encrypt_single(crypto_op_t *op);
  72 int encrypt_update(crypto_op_t *op, int offset, size_t *encrlen);
  73 int encrypt_final(crypto_op_t *op, size_t encrlen);
  74 
  75 /* CRYPTO_DECRYPT */
  76 int decrypt_init(crypto_op_t *op);
  77 int decrypt_single(crypto_op_t *op);
  78 int decrypt_update(crypto_op_t *op, int offset, size_t *encrlen);
  79 int decrypt_final(crypto_op_t *op, size_t encrlen);
  80 
  81 /* CRYPTO_DIGEST */
  82 int digest_init(crypto_op_t *op);
  83 int digest_single(crypto_op_t *op);
  84 int digest_update(crypto_op_t *op, int);
  85 int digest_final(crypto_op_t *op);
  86 
  87 /* wrappers */
  88 int test_mac_single(cryptotest_t *args);
  89 int test_mac(cryptotest_t *args);
  90 
  91 int test_encrypt_single(cryptotest_t *args);
  92 int test_encrypt(cryptotest_t *args);
  93 
  94 int test_decrypt_single(cryptotest_t *args);
  95 int test_decrypt(cryptotest_t *args);
  96 
  97 int test_digest_single(cryptotest_t *args);
  98 int test_digest(cryptotest_t *args);
  99 
 100 extern test_fg_t cryptotest_decr_fg;
 101 extern test_fg_t cryptotest_encr_fg;
 102 extern test_fg_t cryptotest_mac_fg;
 103 extern test_fg_t cryptotest_digest_fg;
 104 
 105 #define MAC_FG (&cryptotest_mac_fg)
 106 #define ENCR_FG (&cryptotest_encr_fg)
 107 #define DECR_FG (&cryptotest_decr_fg)
 108 #define DIGEST_FG (&cryptotest_digest_fg)
 109 
 110 #ifdef __cplusplus
 111 }
 112 #endif
 113 
 114 #endif /* _CRYPTOTEST_H */