[noprint] DATA_BLOB signing_key_blob;
[ignore] smb2_signing_key *signing_key;
[noprint] DATA_BLOB encryption_key_blob;
+ [ignore] smb2_signing_key *encryption_key;
[noprint] DATA_BLOB decryption_key_blob;
[noprint] DATA_BLOB application_key;
[range(1, 1024)] uint32 num_channels;
if (req->do_encryption) {
struct smbXsrv_session *x = req->session;
- DATA_BLOB encryption_key = x->global->encryption_key_blob;
+ struct smb2_signing_key *encryption_key = x->global->encryption_key;
- status = smb2_signing_encrypt_pdu(encryption_key,
+ status = smb2_signing_encrypt_pdu(encryption_key->blob,
xconn->smb2.server.cipher,
&state->vector[1+SMBD_SMB2_TF_IOV_OFS],
SMBD_SMB2_NUM_IOV_PER_REQ);
(firsttf->iov_len == 0) &&
(req->first_key.length == 0) &&
(req->session != NULL) &&
- (req->session->global->encryption_key_blob.length != 0))
+ smb2_signing_key_valid(req->session->global->encryption_key))
{
- DATA_BLOB encryption_key = req->session->global->encryption_key_blob;
+ struct smb2_signing_key *encryption_key =
+ req->session->global->encryption_key;
uint8_t *tf;
uint64_t session_id = req->session->global->session_wire_id;
uint64_t nonce_high;
* we are sure that we do not change
* the header again.
*/
- req->first_key = data_blob_dup_talloc(req, encryption_key);
+ req->first_key = data_blob_dup_talloc(req,
+ encryption_key->blob);
if (req->first_key.data == NULL) {
return NT_STATUS_NO_MEMORY;
}
}
if (do_encryption) {
- DATA_BLOB encryption_key = session->global->encryption_key_blob;
+ struct smb2_signing_key *encryption_key =
+ session->global->encryption_key;
- status = smb2_signing_encrypt_pdu(encryption_key,
+ status = smb2_signing_encrypt_pdu(encryption_key->blob,
xconn->smb2.server.cipher,
&state->vector[1+SMBD_SMB2_TF_IOV_OFS],
SMBD_SMB2_NUM_IOV_PER_REQ);
struct _derivation *d = &derivation.encryption;
size_t nonce_size;
- x->global->encryption_key_blob = data_blob_talloc(x->global,
- session_key,
- sizeof(session_key));
- if (x->global->encryption_key_blob.data == NULL) {
+ x->global->encryption_key =
+ talloc_zero(x->global, struct smb2_signing_key);
+ if (x->global->encryption_key == NULL) {
+ ZERO_STRUCT(session_key);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ x->global->encryption_key->blob =
+ x->global->encryption_key_blob =
+ data_blob_talloc(x->global->encryption_key,
+ session_key,
+ sizeof(session_key));
+ if (!smb2_signing_key_valid(x->global->encryption_key)) {
ZERO_STRUCT(session_key);
return NT_STATUS_NO_MEMORY;
}
+ talloc_keep_secret(x->global->encryption_key->blob.data);
status = smb2_key_derivation(session_key, sizeof(session_key),
d->label.data, d->label.length,
d->context.data, d->context.length,
- x->global->encryption_key_blob.data);
+ x->global->encryption_key->blob.data);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
dump_data(0, x->global->decryption_key_blob.data,
x->global->decryption_key_blob.length);
DEBUGADD(0, ("ServerOut Key "));
- dump_data(0, x->global->encryption_key_blob.data,
- x->global->encryption_key_blob.length);
+ dump_data(0, x->global->encryption_key->blob.data,
+ x->global->encryption_key->blob.length);
}
ZERO_STRUCT(session_key);