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>
#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,
#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,