Deleted Added
full compact
tls.c (141858) tls.c (147078)
1/*
1/*
2 * Copyright (c) 2000-2004 Sendmail, Inc. and its suppliers.
2 * Copyright (c) 2000-2005 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 *
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
8 *
9 */
10
11#include <sendmail.h>
12
3 * All rights reserved.
4 *
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
8 *
9 */
10
11#include <sendmail.h>
12
13SM_RCSID("@(#)$Id: tls.c,v 8.96 2004/08/04 21:17:58 ca Exp $")
13SM_RCSID("@(#)$Id: tls.c,v 8.97 2005/03/08 22:20:52 ca Exp $")
14
15#if STARTTLS
16# include <openssl/err.h>
17# include <openssl/bio.h>
18# include <openssl/pem.h>
19# ifndef HASURANDOMDEV
20# include <openssl/rand.h>
21# endif /* ! HASURANDOMDEV */

--- 1128 unchanged lines hidden (view full) ---

1150 X509_NAME_get_text_by_NID(X509_get_subject_name(cert),
1151 NID_commonName, buf, sizeof buf);
1152 macdefine(mac, A_TEMP, macid("{cn_subject}"),
1153 xtextify(buf, "<>\")"));
1154 X509_NAME_get_text_by_NID(X509_get_issuer_name(cert),
1155 NID_commonName, buf, sizeof buf);
1156 macdefine(mac, A_TEMP, macid("{cn_issuer}"),
1157 xtextify(buf, "<>\")"));
14
15#if STARTTLS
16# include <openssl/err.h>
17# include <openssl/bio.h>
18# include <openssl/pem.h>
19# ifndef HASURANDOMDEV
20# include <openssl/rand.h>
21# endif /* ! HASURANDOMDEV */

--- 1128 unchanged lines hidden (view full) ---

1150 X509_NAME_get_text_by_NID(X509_get_subject_name(cert),
1151 NID_commonName, buf, sizeof buf);
1152 macdefine(mac, A_TEMP, macid("{cn_subject}"),
1153 xtextify(buf, "<>\")"));
1154 X509_NAME_get_text_by_NID(X509_get_issuer_name(cert),
1155 NID_commonName, buf, sizeof buf);
1156 macdefine(mac, A_TEMP, macid("{cn_issuer}"),
1157 xtextify(buf, "<>\")"));
1158 if (X509_digest(cert, EVP_md5(), md, &n))
1158 n = 0;
1159 if (X509_digest(cert, EVP_md5(), md, &n) != 0 && n > 0)
1159 {
1160 char md5h[EVP_MAX_MD_SIZE * 3];
1161 static const char hexcodes[] = "0123456789ABCDEF";
1162
1163 SM_ASSERT((n * 3) + 2 < sizeof(md5h));
1164 for (r = 0; r < (int) n; r++)
1165 {
1166 md5h[r * 3] = hexcodes[(md[r] & 0xf0) >> 4];

--- 444 unchanged lines hidden ---
1160 {
1161 char md5h[EVP_MAX_MD_SIZE * 3];
1162 static const char hexcodes[] = "0123456789ABCDEF";
1163
1164 SM_ASSERT((n * 3) + 2 < sizeof(md5h));
1165 for (r = 0; r < (int) n; r++)
1166 {
1167 md5h[r * 3] = hexcodes[(md[r] & 0xf0) >> 4];

--- 444 unchanged lines hidden ---