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 2018 Nexenta Systems, Inc. All rights reserved. 14 */ 15 16 /* 17 * Helper functions for SMB3 encryption using PKCS#11 18 * 19 * There are two implementations of these functions: 20 * This one (for user space) and another for kernel. 21 * See: uts/common/fs/smbsrv/smb3_encrypt_kcf.c 22 * 23 * NOTE: CCM is not implemented in PKCS yet, so these are just stubs. 24 */ 25 26 #include <smbsrv/smb_kcrypt.h> 27 #include <smbsrv/smb2_kproto.h> 28 29 /* 30 * SMB3 encryption helpers: 31 * (getmech, init, update, final) 32 */ 33 34 /* ARGSUSED */ 35 int 36 smb3_encrypt_getmech(smb_crypto_mech_t *mech) 37 { 38 cmn_err(CE_NOTE, "fksmbsrv does not support SMB3 Encryption"); 39 return (-1); 40 } 41 42 /* ARGSUSED */ 43 void 44 smb3_crypto_init_param(smb3_crypto_param_t *param, 45 uint8_t *nonce, size_t noncesize, uint8_t *auth, size_t authsize, 46 size_t datasize) 47 { 48 } 49 50 /* 51 * Start the KCF session, load the key 52 */ 53 54 /* ARGSUSED */ 55 static int 56 smb3_crypto_init(smb3_enc_ctx_t *ctxp, smb_crypto_mech_t *mech, 57 uint8_t *key, size_t key_len, smb3_crypto_param_t *param, 58 boolean_t is_encrypt) 59 { 60 return (-1); 61 } 62 63 /* ARGSUSED */ 64 int 65 smb3_encrypt_init(smb3_enc_ctx_t *ctxp, smb_crypto_mech_t *mech, 66 smb3_crypto_param_t *param, uint8_t *key, size_t keylen, 67 uint8_t *buf, size_t buflen) 68 { 69 return (smb3_crypto_init(ctxp, mech, key, keylen, param, B_TRUE)); 70 } 71 72 int 73 smb3_decrypt_init(smb3_enc_ctx_t *ctxp, smb_crypto_mech_t *mech, 74 smb3_crypto_param_t *param, uint8_t *key, size_t keylen) 75 { 76 return (smb3_crypto_init(ctxp, mech, key, keylen, param, B_FALSE)); 77 } 78 79 /* 80 * Digest one segment 81 */ 82 83 /* ARGSUSED */ 84 int 85 smb3_encrypt_update(smb3_enc_ctx_t *ctxp, uint8_t *in, size_t len) 86 { 87 return (-1); 88 } 89 90 /* ARGSUSED */ 91 int 92 smb3_decrypt_update(smb3_enc_ctx_t *ctxp, uint8_t *in, size_t len) 93 { 94 return (-1); 95 } 96 97 /* ARGSUSED */ 98 int 99 smb3_encrypt_final(smb3_enc_ctx_t *ctxp, uint8_t *digest16) 100 { 101 return (-1); 102 } 103 104 /* ARGSUSED */ 105 int 106 smb3_decrypt_final(smb3_enc_ctx_t *ctxp, uint8_t *buf, size_t buflen) 107 { 108 return (-1); 109 } 110 111 /* ARGSUSED */ 112 void 113 smb3_encrypt_cancel(smb3_enc_ctx_t *ctxp) 114 { 115 } 116