1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

libcli/auth: add netlogon_creds_aes_{en|de}crypt routines.

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Günther Deschner 2012-11-29 21:23:30 +01:00 committed by Stefan Metzmacher
parent b6e2be8e14
commit 429600c5f3
2 changed files with 30 additions and 0 deletions

View File

@ -222,6 +222,34 @@ void netlogon_creds_arcfour_crypt(struct netlogon_creds_CredentialState *creds,
data_blob_free(&session_key); data_blob_free(&session_key);
} }
/*
AES encrypt a password buffer using the session key
*/
void netlogon_creds_aes_encrypt(struct netlogon_creds_CredentialState *creds, uint8_t *data, size_t len)
{
AES_KEY key;
uint8_t iv[AES_BLOCK_SIZE];
AES_set_encrypt_key(creds->session_key, 128, &key);
ZERO_STRUCT(iv);
aes_cfb8_encrypt(data, data, len, &key, iv, AES_ENCRYPT);
}
/*
AES decrypt a password buffer using the session key
*/
void netlogon_creds_aes_decrypt(struct netlogon_creds_CredentialState *creds, uint8_t *data, size_t len)
{
AES_KEY key;
uint8_t iv[AES_BLOCK_SIZE];
AES_set_encrypt_key(creds->session_key, 128, &key);
ZERO_STRUCT(iv);
aes_cfb8_encrypt(data, data, len, &key, iv, AES_DECRYPT);
}
/***************************************************************** /*****************************************************************
The above functions are common to the client and server interface The above functions are common to the client and server interface
next comes the client specific functions next comes the client specific functions

View File

@ -16,6 +16,8 @@ void netlogon_creds_des_decrypt_LMKey(struct netlogon_creds_CredentialState *cre
void netlogon_creds_des_encrypt(struct netlogon_creds_CredentialState *creds, struct samr_Password *pass); void netlogon_creds_des_encrypt(struct netlogon_creds_CredentialState *creds, struct samr_Password *pass);
void netlogon_creds_des_decrypt(struct netlogon_creds_CredentialState *creds, struct samr_Password *pass); void netlogon_creds_des_decrypt(struct netlogon_creds_CredentialState *creds, struct samr_Password *pass);
void netlogon_creds_arcfour_crypt(struct netlogon_creds_CredentialState *creds, uint8_t *data, size_t len); void netlogon_creds_arcfour_crypt(struct netlogon_creds_CredentialState *creds, uint8_t *data, size_t len);
void netlogon_creds_aes_encrypt(struct netlogon_creds_CredentialState *creds, uint8_t *data, size_t len);
void netlogon_creds_aes_decrypt(struct netlogon_creds_CredentialState *creds, uint8_t *data, size_t len);
/***************************************************************** /*****************************************************************
The above functions are common to the client and server interface The above functions are common to the client and server interface