1
1
/* Loading of PEM encoded files with optional encryption
2
* Copyright (C) 2001-2003 Andreas Steffen, Zuercher Hochschule Winterthur
2
* Copyright (C) 2001-2004 Andreas Steffen, Zuercher Hochschule Winterthur
4
4
* This program is free software; you can redistribute it and/or modify it
5
5
* under the terms of the GNU General Public License as published by the
11
11
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
12
* for more details.
14
* RCSID $Id: pem.c,v 1.2.6.1 2004/03/21 05:23:34 mcr Exp $
14
* RCSID $Id: pem.c,v 1.7 2004/11/05 04:03:37 ken Exp $
17
17
/* decrypt a PEM encoded data block using DES-EDE3-CBC
193
193
u_char padding, *last_padding_pos, *first_padding_pos;
195
195
/* Convert passphrase to 3des key */
197
MD5Update(&context, passphrase, strlen(passphrase));
198
MD5Update(&context, iv->ptr, iv->len);
199
MD5Final(digest, &context);
197
osMD5Update(&context, passphrase, strlen(passphrase));
198
osMD5Update(&context, iv->ptr, iv->len);
199
osMD5Final(digest, &context);
201
201
memcpy(key, digest, MD5_DIGEST_SIZE);
204
MD5Update(&context, digest, MD5_DIGEST_SIZE);
205
MD5Update(&context, passphrase, strlen(passphrase));
206
MD5Update(&context, iv->ptr, iv->len);
207
MD5Final(digest, &context);
204
osMD5Update(&context, digest, MD5_DIGEST_SIZE);
205
osMD5Update(&context, passphrase, strlen(passphrase));
206
osMD5Update(&context, iv->ptr, iv->len);
207
osMD5Final(digest, &context);
209
209
memcpy(key + MD5_DIGEST_SIZE, digest, 24 - MD5_DIGEST_SIZE);