... the "net ads join" fails on T4 (sun4v) systems on Solaris 10.
/* if key is longer than 64 bytes reset it to key=MD5(key) */
if (key_len > 64)
{
- struct MD5Context tctx;
+ MD5_CTX tctx;
MD5Init(&tctx);
MD5Update(&tctx, key, key_len);
***********************************************************************/
_PUBLIC_ void hmac_md5_final(uint8_t *digest, HMACMD5Context *ctx)
{
- struct MD5Context ctx_o;
+ MD5_CTX ctx_o;
MD5Final(digest, &ctx->ctx);
typedef struct
{
- struct MD5Context ctx;
+ MD5_CTX ctx;
uint8_t k_ipad[65];
uint8_t k_opad[65];
#define HEADER_MD5_H
#endif
+#ifdef HAVE_MD5_H
+/*
+ * Try to avoid clashes with Solaris MD5 implementation.
+ * ...where almost all implementations follows:
+ * "Schneier's Cryptography Classics Library"
+ */
+#include <md5.h>
+#else
+
struct MD5Context {
uint32_t buf[4];
uint32_t bits[2];
uint8_t in[64];
};
+typedef struct MD5Context MD5_CTX;
void MD5Init(struct MD5Context *context);
void MD5Update(struct MD5Context *context, const uint8_t *buf,
size_t len);
void MD5Final(uint8_t digest[16], struct MD5Context *context);
+#endif /* !HAVE_MD5_H */
+
#endif /* !MD5_H */
};
for (i=0; i < ARRAY_SIZE(testarray); i++) {
- struct MD5Context ctx;
+ MD5_CTX ctx;
uint8_t md5[16];
int e;
{
unsigned char zero[4], tmp[16];
HMACMD5Context ctx;
- struct MD5Context md5;
+ MD5_CTX md5;
ZERO_STRUCT(creds->session_key);
*/
if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_NTLM2) {
if (ntlmssp_state->nt_resp.length == 24 && ntlmssp_state->lm_resp.length == 24) {
- struct MD5Context md5_session_nonce_ctx;
+ MD5_CTX md5_session_nonce_ctx;
state->doing_ntlm2 = true;
memcpy(state->session_nonce, ntlmssp_state->internal_chal.data, 8);
DATA_BLOB session_key,
const char *constant)
{
- struct MD5Context ctx3;
+ MD5_CTX ctx3;
MD5Init(&ctx3);
MD5Update(&ctx3, session_key.data, session_key.length);
MD5Update(&ctx3, (const uint8_t *)constant, strlen(constant)+1);
{
uint8_t packet_digest[16];
static const uint8_t zeros[4];
- struct MD5Context ctx;
+ MD5_CTX ctx;
MD5Init(&ctx);
MD5Update(&ctx, zeros, 4);
void E_md5hash(const uint8_t salt[16], const uint8_t nthash[16], uint8_t hash_out[16])
{
- struct MD5Context tctx;
+ MD5_CTX tctx;
MD5Init(&tctx);
MD5Update(&tctx, salt, 16);
MD5Update(&tctx, nthash, 16);
void encode_or_decode_arc4_passwd_buffer(unsigned char pw_buf[532], const DATA_BLOB *psession_key)
{
- struct MD5Context tctx;
+ MD5_CTX tctx;
unsigned char key_out[16];
/* Confounder is last 16 bytes. */
struct wkssvc_PasswordBuffer **pwd_buf)
{
uint8_t buffer[516];
- struct MD5Context ctx;
+ MD5_CTX ctx;
struct wkssvc_PasswordBuffer *my_pwd_buf = NULL;
DATA_BLOB confounded_session_key;
int confounder_len = 8;
char **pwd)
{
uint8_t buffer[516];
- struct MD5Context ctx;
+ MD5_CTX ctx;
size_t pwd_len;
DATA_BLOB confounded_session_key;
DATA_BLOB confounder;
DATA_BLOB enc_buffer;
- struct MD5Context md5;
+ MD5_CTX md5;
uint8_t _enc_key[16];
DATA_BLOB enc_key;
DATA_BLOB rid_crypt_out = data_blob(NULL, 0);
DATA_BLOB confounder;
- struct MD5Context md5;
+ MD5_CTX md5;
uint8_t _enc_key[16];
DATA_BLOB enc_key;
../lib/util/blocking.o ../lib/util/rfc1738.o \
../lib/util/select.o ../lib/util/util_pw.o
-CRYPTO_OBJ = ../lib/crypto/crc32.o ../lib/crypto/md5.o \
+CRYPTO_OBJ = ../lib/crypto/crc32.o @CRYPTO_MD5_OBJ@ \
../lib/crypto/hmacmd5.o ../lib/crypto/arcfour.o \
../lib/crypto/md4.o \
../lib/crypto/sha256.o ../lib/crypto/hmacsha256.o \
AC_CHECK_HEADERS(netgroup.h)
AC_CHECK_HEADERS(linux/falloc.h)
+dnl check for OS implementation of md5 conformant to rfc1321
+AC_CHECK_HEADERS(md5.h)
+if test x"$ac_cv_header_md5_h" = x"yes"; then
+ AC_DEFINE(HAVE_MD5_H, 1,
+ [Whether md5.h is available.])
+ AC_CHECK_LIB(md5, MD5Update,
+ [
+ LIBS="${LIBS} -lmd5"
+ CRYPTO_MD5_OBJ=
+ AC_DEFINE(HAVE_LIBMD5, 1,
+ [Whether libmd5 conformant to rfc1321 is available.])],
+ [
+ CRYPTO_MD5_OBJ="../lib/crypto/md5.o"])
+else
+ CRYPTO_MD5_OBJ="../lib/crypto/md5.o"
+fi
+AC_SUBST(CRYPTO_MD5_OBJ)
+
+
AC_CHECK_HEADERS(rpcsvc/yp_prot.h,,,[[
#if HAVE_RPC_RPC_H
#include <rpc/rpc.h>
return NT_STATUS_NO_MEMORY;
}
} else if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_NTLM2) {
- struct MD5Context md5_session_nonce_ctx;
+ MD5_CTX md5_session_nonce_ctx;
uint8_t session_nonce[16];
uint8_t session_nonce_hash[16];
uint8_t user_session_key[16];
{
const size_t offset_end_of_sig = (smb_ss_field + 8);
uint8_t sequence_buf[8];
- struct MD5Context md5_ctx;
+ MD5_CTX md5_ctx;
/*
* Firstly put the sequence number into the first 4 bytes.
static SMB_INO_T stream_inode(const SMB_STRUCT_STAT *sbuf, const char *sname)
{
- struct MD5Context ctx;
+ MD5_CTX ctx;
unsigned char hash[16];
SMB_INO_T result;
char *upper_sname;
/* samr_CryptPasswordEx */
uchar pwbuf[532];
- struct MD5Context md5_ctx;
+ MD5_CTX md5_ctx;
uint8_t confounder[16];
DATA_BLOB confounded_session_key = data_blob(NULL, 16);
void get_xsrf_token(const char *username, const char *pass,
const char *formname, time_t xsrf_time, char token_str[33])
{
- struct MD5Context md5_ctx;
+ MD5_CTX md5_ctx;
uint8_t token[16];
int i;
/* LM Key is incompatible... */
*flags &= ~CLI_CRED_LANMAN_AUTH;
} else if (*flags & CLI_CRED_NTLM2) {
- struct MD5Context md5_session_nonce_ctx;
+ MD5_CTX md5_session_nonce_ctx;
uint8_t session_nonce[16];
uint8_t session_nonce_hash[16];
uint8_t user_session_key[16];
}
for (i=0; i < ARRAY_SIZE(wdigest); i++) {
- struct MD5Context md5;
+ MD5_CTX md5;
MD5Init(&md5);
if (wdigest[i].nt4dom) {
MD5Update(&md5, wdigest[i].nt4dom->data, wdigest[i].nt4dom->length);
void sign_outgoing_message(struct smb_request_buffer *out, DATA_BLOB *mac_key, unsigned int seq_num)
{
uint8_t calc_md5_mac[16];
- struct MD5Context md5_ctx;
+ MD5_CTX md5_ctx;
/*
* Firstly put the sequence number into the first 4 bytes.
uint8_t calc_md5_mac[16];
uint8_t *server_sent_mac;
uint8_t sequence_buf[8];
- struct MD5Context md5_ctx;
+ MD5_CTX md5_ctx;
const size_t offset_end_of_sig = (HDR_SS_FIELD + 8);
int i;
const int sign_range = 0;
DATA_BLOB session_key;
DATA_BLOB confounded_session_key = data_blob_talloc(mem_ctx, NULL, 16);
uint8_t confounder[16];
- struct MD5Context md5;
+ MD5_CTX md5;
if (r->samr_handle.in.info21) {
return NT_STATUS_INVALID_PARAMETER_MIX;
DATA_BLOB session_key;
DATA_BLOB confounded_session_key = data_blob_talloc(mem_ctx, NULL, 16);
uint8_t confounder[16];
- struct MD5Context md5;
+ MD5_CTX md5;
if (!r->samr_handle.in.info21) {
return NT_STATUS_INVALID_PARAMETER_MIX;
enum ndr_err_code ndr_err;
struct ldb_result *res;
const char *attrs[] = { "unicodePwd", "userAccountControl", "cn", NULL };
- struct MD5Context ctx;
+ MD5_CTX ctx;
struct samr_Password *nt_hash;
uint32_t user_account_control;
int ret;
DATA_BLOB new_password;
DATA_BLOB co_session_key;
DATA_BLOB session_key = data_blob(NULL, 0);
- struct MD5Context ctx;
+ MD5_CTX ctx;
nt_status = dcesrv_fetch_session_key(dce_call->conn, &session_key);
if (!NT_STATUS_IS_OK(nt_status)) {
char *unix_address;
int sys_errno;
- struct MD5Context ctx;
+ MD5_CTX ctx;
uint8_t sig[16];
enum ndr_err_code ndr_err;
bool ok;
DATA_BLOB session_key;
DATA_BLOB confounded_session_key = data_blob_talloc(
mem_ctx, NULL, 16);
- struct MD5Context ctx;
+ MD5_CTX ctx;
uint8_t confounder[16];
ZERO_STRUCT(u_info);
uint8_t session_nonce_hash[16];
uint8_t client_chall[8];
- struct MD5Context md5_session_nonce_ctx;
+ MD5_CTX md5_session_nonce_ctx;
HMACMD5Context hmac_ctx;
ZERO_STRUCT(user_session_key);
uint8_t confounder[16];
char *newpass;
struct dcerpc_binding_handle *b = p->binding_handle;
- struct MD5Context ctx;
+ MD5_CTX ctx;
struct samr_GetUserPwInfo pwp;
struct samr_PwInfo info;
int policy_min_pw_len = 0;
bool ret = true;
DATA_BLOB session_key;
DATA_BLOB confounded_session_key = data_blob_talloc(tctx, NULL, 16);
- struct MD5Context ctx;
+ MD5_CTX ctx;
uint8_t confounder[16];
char *newpass;
struct dcerpc_binding_handle *b = p->binding_handle;
bool ret = true;
DATA_BLOB session_key;
DATA_BLOB confounded_session_key = data_blob_talloc(tctx, NULL, 16);
- struct MD5Context ctx;
+ MD5_CTX ctx;
uint8_t confounder[16];
char *newpass;
struct dcerpc_binding_handle *b = p->binding_handle;
DATA_BLOB session_key;
DATA_BLOB confounded_session_key = data_blob_talloc(tctx, NULL, 16);
uint8_t confounder[16];
- struct MD5Context ctx;
+ MD5_CTX ctx;
bool ret = true;
struct lsa_String server, account;