void des_crypt56(uint8_t out[8], const uint8_t in[8], const uint8_t key[7], int forw);
int des_crypt56_gnutls(uint8_t out[8], const uint8_t in[8], const uint8_t key[7],
enum samba_gnutls_direction encrypt);
-void E_P16(const uint8_t *p14,uint8_t *p16);
+int E_P16(const uint8_t *p14,uint8_t *p16);
void E_P24(const uint8_t *p21, const uint8_t *c8, uint8_t *p24);
void D_P16(const uint8_t *p14, const uint8_t *in, uint8_t *out);
void E_old_pw_hash( uint8_t *p14, const uint8_t *in, uint8_t *out);
}
}
-void E_P16(const uint8_t *p14,uint8_t *p16)
+int E_P16(const uint8_t *p14,uint8_t *p16)
{
const uint8_t sp8[8] = {0x4b, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25};
- des_crypt56(p16, sp8, p14, 1);
- des_crypt56(p16+8, sp8, p14+7, 1);
+ int ret;
+
+ ret = des_crypt56_gnutls(p16, sp8, p14, SAMBA_GNUTLS_ENCRYPT);
+ if (ret != 0) {
+ return ret;
+ }
+
+ return des_crypt56_gnutls(p16+8, sp8, p14+7, SAMBA_GNUTLS_ENCRYPT);
}
void E_P24(const uint8_t *p21, const uint8_t *c8, uint8_t *p24)
bool E_deshash(const char *passwd, uint8_t p16[16])
{
bool ret;
+ int rc;
uint8_t dospwd[14];
TALLOC_CTX *frame = talloc_stackframe();
* case to avoid returning a fixed 'password' buffer, but
* callers should not use it when E_deshash returns false */
- E_P16((const uint8_t *)dospwd, p16);
+ rc = E_P16((const uint8_t *)dospwd, p16);
+ if (rc != 0) {
+ ret = false;
+ }
ZERO_STRUCT(dospwd);
0x1D, 0xEA, 0xD9, 0xFF, 0xB0, 0xA9, 0xA4, 0x05
};
- E_P16(key, buffer);
+ int rc;
+
+ rc = E_P16(key, buffer);
+ assert_int_equal(rc, 0);
assert_memory_equal(buffer, crypt_expected, 16);
}