diff options
| author | SkyperTHC | 2026-03-03 06:28:55 +0000 |
|---|---|---|
| committer | SkyperTHC | 2026-03-03 06:28:55 +0000 |
| commit | 5d3573ef7a109ee70416fe94db098fe6a769a798 (patch) | |
| tree | dc2d5b294c9db8ab2db7433511f94e1c4bb8b698 /other/openssh-reverse/mpaux.c | |
| parent | c6c59dc73cc4586357f93ab38ecf459e98675cc5 (diff) | |
packetstorm sync
Diffstat (limited to 'other/openssh-reverse/mpaux.c')
| -rw-r--r-- | other/openssh-reverse/mpaux.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/other/openssh-reverse/mpaux.c b/other/openssh-reverse/mpaux.c new file mode 100644 index 0000000..6caae64 --- /dev/null +++ b/other/openssh-reverse/mpaux.c | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | /* | ||
| 2 | * | ||
| 3 | * mpaux.c | ||
| 4 | * | ||
| 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | ||
| 6 | * | ||
| 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | ||
| 8 | * All rights reserved | ||
| 9 | * | ||
| 10 | * Created: Sun Jul 16 04:29:30 1995 ylo | ||
| 11 | * | ||
| 12 | * This file contains various auxiliary functions related to multiple | ||
| 13 | * precision integers. | ||
| 14 | * | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "includes.h" | ||
| 18 | RCSID("$OpenBSD: mpaux.c,v 1.13 2000/06/20 01:39:42 markus Exp $"); | ||
| 19 | |||
| 20 | #include <openssl/bn.h> | ||
| 21 | #include "getput.h" | ||
| 22 | #include "xmalloc.h" | ||
| 23 | |||
| 24 | #include <openssl/md5.h> | ||
| 25 | |||
| 26 | void | ||
| 27 | compute_session_id(unsigned char session_id[16], | ||
| 28 | unsigned char cookie[8], | ||
| 29 | BIGNUM* host_key_n, | ||
| 30 | BIGNUM* session_key_n) | ||
| 31 | { | ||
| 32 | unsigned int host_key_bytes = BN_num_bytes(host_key_n); | ||
| 33 | unsigned int session_key_bytes = BN_num_bytes(session_key_n); | ||
| 34 | unsigned int bytes = host_key_bytes + session_key_bytes; | ||
| 35 | unsigned char *buf = xmalloc(bytes); | ||
| 36 | MD5_CTX md; | ||
| 37 | |||
| 38 | BN_bn2bin(host_key_n, buf); | ||
| 39 | BN_bn2bin(session_key_n, buf + host_key_bytes); | ||
| 40 | MD5_Init(&md); | ||
| 41 | MD5_Update(&md, buf, bytes); | ||
| 42 | MD5_Update(&md, cookie, 8); | ||
| 43 | MD5_Final(session_id, &md); | ||
| 44 | memset(buf, 0, bytes); | ||
| 45 | xfree(buf); | ||
| 46 | } | ||
