diff options
Diffstat (limited to 'cipher.c')
-rw-r--r-- | cipher.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -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 | |||
436 | cipher_set_key_string(CipherContext *cc, const Cipher *cipher, | 436 | cipher_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 | /* |