1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

libcli:smb: Introduce a structure for the smb2_singing_key

This also adds a new function to validate the structure.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Andreas Schneider 2019-03-04 16:53:39 +01:00 committed by Andrew Bartlett
parent 604c0b2620
commit 11e3552c9f
2 changed files with 23 additions and 0 deletions

View File

@ -27,6 +27,19 @@
#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>
bool smb2_signing_key_valid(const struct smb2_signing_key *key)
{
if (key == NULL) {
return false;
}
if (key->blob.length == 0 || key->blob.data == NULL) {
return false;
}
return true;
}
NTSTATUS smb2_signing_sign_pdu(DATA_BLOB signing_key,
enum protocol_types protocol,
struct iovec *vector,

View File

@ -21,8 +21,18 @@
#ifndef _LIBCLI_SMB_SMB2_SIGNING_H_
#define _LIBCLI_SMB_SMB2_SIGNING_H_
#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>
struct iovec;
struct smb2_signing_key {
gnutls_hmac_hd_t hmac_hnd;
DATA_BLOB blob;
};
bool smb2_signing_key_valid(const struct smb2_signing_key *key);
NTSTATUS smb2_signing_sign_pdu(DATA_BLOB signing_key,
enum protocol_types protocol,
struct iovec *vector,