summaryrefslogtreecommitdiff
path: root/cipher.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2014-02-04 11:03:36 +1100
committerDamien Miller <djm@mindrot.org>2014-02-04 11:03:36 +1100
commit4a1c7aa640fb97d3472d51b215b6a0ec0fd025c7 (patch)
tree6fb1bfba860987b5d9042c478ae218d848850b64 /cipher.c
parent4e8d937af79ce4e253f77ec93489d098b25becc3 (diff)
- markus@cvs.openbsd.org 2014/01/27 19:18:54
[auth-rsa.c cipher.c ssh-agent.c sshconnect1.c sshd.c] replace openssl MD5 with our ssh_digest_*; ok djm@
Diffstat (limited to 'cipher.c')
-rw-r--r--cipher.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/cipher.c b/cipher.c
index 2476e6539..98961be1a 100644
--- a/cipher.c
+++ b/cipher.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cipher.c,v 1.94 2014/01/25 10:12:50 dtucker Exp $ */ 1/* $OpenBSD: cipher.c,v 1.95 2014/01/27 19:18:54 markus Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -39,8 +39,6 @@
39 39
40#include <sys/types.h> 40#include <sys/types.h>
41 41
42#include <openssl/md5.h>
43
44#include <string.h> 42#include <string.h>
45#include <stdarg.h> 43#include <stdarg.h>
46#include <stdio.h> 44#include <stdio.h>
@@ -49,6 +47,8 @@
49#include "log.h" 47#include "log.h"
50#include "misc.h" 48#include "misc.h"
51#include "cipher.h" 49#include "cipher.h"
50#include "buffer.h"
51#include "digest.h"
52 52
53/* compatibility with old or broken OpenSSL versions */ 53/* compatibility with old or broken OpenSSL versions */
54#include "openbsd-compat/openssl-compat.h" 54#include "openbsd-compat/openssl-compat.h"
@@ -436,17 +436,15 @@ void
436cipher_set_key_string(CipherContext *cc, const Cipher *cipher, 436cipher_set_key_string(CipherContext *cc, const Cipher *cipher,
437 const char *passphrase, int do_encrypt) 437 const char *passphrase, int do_encrypt)
438{ 438{
439 MD5_CTX md;
440 u_char digest[16]; 439 u_char digest[16];
441 440
442 MD5_Init(&md); 441 if (ssh_digest_memory(SSH_DIGEST_MD5, passphrase, strlen(passphrase),
443 MD5_Update(&md, (const u_char *)passphrase, strlen(passphrase)); 442 digest, sizeof(digest)) < 0)
444 MD5_Final(digest, &md); 443 fatal("%s: md5 failed", __func__);
445 444
446 cipher_init(cc, cipher, digest, 16, NULL, 0, do_encrypt); 445 cipher_init(cc, cipher, digest, 16, NULL, 0, do_encrypt);
447 446
448 memset(digest, 0, sizeof(digest)); 447 memset(digest, 0, sizeof(digest));
449 memset(&md, 0, sizeof(md));
450} 448}
451 449
452/* 450/*