Skip to main content

Module crypto

Module crypto 

Source
Expand description

Cryptographic primitives used by the NTLM family and SMB signing.

Thin re-export of the [smb_server_csp] crypto service provider. The active backend is selected at compile time in smb-server-csp itself:

  • default — RustCrypto crates (lib feature),
  • --no-default-features --features handrolled — bundled implementations.

Modules§

sha256
SHA-256 module alias for callers importing by path (crypto::sha256::sha256).
sha512
SHA-512 module alias for callers importing by path.

Functions§

aes128_cmac
AES-CMAC over data under key ([RFC 4493]) — SMB 3.x signing.
aes128_encrypt_block
Encrypt one 16-byte AES-128 block.
aes128_gmac
AES-128-GMAC authentication tag over msg with nonce ([RFC4543]): the SMB 3.1.1 AES-GMAC signature ([MS-SMB2] §3.1.4.1). GMAC is AES-GCM with an empty plaintext and the message supplied as additional authenticated data; the 16-byte GCM tag is the signature.
aes128ccm_open
AES-128-CCM open; ciphertext carries the trailing 16-byte tag.
aes128ccm_seal
AES-128-CCM seal with an 11-byte nonce ([MS-SMB2] CCM variant).
aes128gcm_open
AES-128-GCM open; ciphertext carries the trailing 16-byte tag.
aes128gcm_seal
AES-128-GCM seal: appends the 16-byte tag to the ciphertext. nonce = 12 bytes from the transform header’s Nonce field; aad = the 32-byte header tail (MsgSize..SessionId end).
aes256ccm_open
AES-256-CCM open; ciphertext carries the trailing 16-byte tag.
aes256ccm_seal
AES-256-CCM seal with an 11-byte nonce ([MS-SMB2] CCM variant).
aes256gcm_open
AES-256-GCM open; ciphertext carries the trailing 16-byte tag.
aes256gcm_seal
AES-256-GCM seal ([MS-SMB2] AES-256-GCM cipher); appends the 16-byte tag.
des_encrypt_key7
DES-ECB encrypt one block under a 56-bit NTLM key chunk.
hmac_md5
HMAC-MD5 of data under key ([RFC 2104]).
hmac_sha256
HMAC-SHA256 of data under key.
kdf_counter_mode_hmac_sha256
SP800-108 counter-mode KDF with HMAC-SHA256 PRF ([MS-SMB2] §3.1.4.1): K(i) = HMAC-SHA256(key, [i]_32BE || label || 0x00 || context || [L]_32BE)
md4
MD4 digest ([RFC 1320]).
md5
MD5 digest ([RFC 1321]).
nt_hash
NT hash = MD4 of the UTF-16LE encoded password ([MS-NLMP] §3.3.1.1).
ntlm_mech_list_mic
NTLMSSP MIC for the SPNEGO mechListMIC ([RFC 4178] / [MS-NLMP] §3.4.6), matching samba’s calc_ntlmv2_key + ntlmssp_make_packet_signature:
ntlmv1_response
NTLMv1/LM response: three DES encryptions of the challenge under successive 7-byte chunks of the 21-byte expanded hash ([MS-NLMP] §3.3.1).
rc4
XOR data with the RC4 keystream generated from key ([MS-NLMP] §3.2.5.1.2 session-key transport).
sha256
SHA-256 digest ([FIPS 180-4]).
sha512
SHA-512 digest ([FIPS 180-4]).