~ubuntu-branches/ubuntu/hardy/openswan/hardy-updates

« back to all changes in this revision

Viewing changes to programs/pluto/pem.c

  • Committer: Bazaar Package Importer
  • Author(s): Rene Mayrhofer
  • Date: 2005-01-27 16:10:11 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050127161011-idgybmyz3vwhpfiq
Tags: 2.3.0-2
Urgency HIGH due to security issue and problems with build-deps in sarge.
* Fix the security issue. Please see
  http://www.idefense.com/application/poi/display?id=190&
      type=vulnerabilities&flashstatus=false
  for more details. Thanks to Martin Schulze for informing me about
  this issue.
  Closes: #292458: Openswan XAUTH/PAM Buffer Overflow Vulnerability
* Added a Build-Dependency to lynx.
  Closes: #291143: openswan: FTBFS: Missing build dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
3
3
 *
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.
13
13
 *
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 $
15
15
 */
16
16
 
17
17
/* decrypt a PEM encoded data block using DES-EDE3-CBC
193
193
    u_char padding, *last_padding_pos, *first_padding_pos;
194
194
 
195
195
    /* Convert passphrase to 3des key */
196
 
    MD5Init(&context);
197
 
    MD5Update(&context, passphrase, strlen(passphrase));
198
 
    MD5Update(&context, iv->ptr, iv->len);
199
 
    MD5Final(digest, &context);
 
196
    osMD5Init(&context);
 
197
    osMD5Update(&context, passphrase, strlen(passphrase));
 
198
    osMD5Update(&context, iv->ptr, iv->len);
 
199
    osMD5Final(digest, &context);
200
200
 
201
201
    memcpy(key, digest, MD5_DIGEST_SIZE);
202
202
 
203
 
    MD5Init(&context);
204
 
    MD5Update(&context, digest, MD5_DIGEST_SIZE);
205
 
    MD5Update(&context, passphrase, strlen(passphrase));
206
 
    MD5Update(&context, iv->ptr, iv->len);
207
 
    MD5Final(digest, &context);
 
203
    osMD5Init(&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);
208
208
 
209
209
    memcpy(key + MD5_DIGEST_SIZE, digest, 24 - MD5_DIGEST_SIZE);
210
210
 
389
389
                else if (match("DEK-Info", &name))
390
390
                {
391
391
                    const char *ugh = NULL;
392
 
                    int len = 0;
 
392
                    size_t len = 0;
393
393
                    chunk_t dek;
394
394
 
395
395
                    if (!extract_token(&dek, ',', &value))
411
411
            else /* state is PEM_BODY */
412
412
            {
413
413
                const char *ugh = NULL;
414
 
                int len = 0;
 
414
                size_t len = 0;
415
415
                chunk_t data;
416
416
 
417
417
                /* remove any trailing whitespace */