1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

add modssl_dh_configure() function to fold some duplication in

get_dh{512,1024} and provide toolkit compat for sslc 2.x


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94225 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Doug MacEachern
2002-03-27 18:19:44 +00:00
parent aeb7f9eb0b
commit 72518a3153
3 changed files with 36 additions and 18 deletions

View File

@@ -103,16 +103,10 @@ static unsigned char dh512_g[] =
static DH *get_dh512(void)
{
DH *dh;
if ((dh = DH_new()) == NULL)
return (NULL);
dh->p = BN_bin2bn(dh512_p, sizeof(dh512_p), NULL);
dh->g = BN_bin2bn(dh512_g, sizeof(dh512_g), NULL);
if ((dh->p == NULL) || (dh->g == NULL))
return (NULL);
return (dh);
return modssl_dh_configure(dh512_p, sizeof(dh512_p),
dh512_g, sizeof(dh512_g));
}
static unsigned char dh1024_p[] =
{
0xE6, 0x96, 0x9D, 0x3D, 0x49, 0x5B, 0xE3, 0x2C, 0x7C, 0xF1, 0x80, 0xC3,
@@ -134,15 +128,8 @@ static unsigned char dh1024_g[] =
static DH *get_dh1024(void)
{
DH *dh;
if ((dh = DH_new()) == NULL)
return (NULL);
dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
if ((dh->p == NULL) || (dh->g == NULL))
return (NULL);
return (dh);
return modssl_dh_configure(dh1024_p, sizeof(dh1024_p),
dh1024_g, sizeof(dh1024_g));
}
/* ----END GENERATED SECTION---------- */

View File

@@ -566,3 +566,31 @@ int modssl_session_get_time(SSL_SESSION *session)
return CRYPTO_time_to_int(&ct);
#endif
}
#ifndef SSLC_VERSION_NUMBER
#define SSLC_VERSION_NUMBER 0x0000
#endif
DH *modssl_dh_configure(unsigned char *p, int plen,
unsigned char *g, int glen)
{
DH *dh;
if (!(dh = DH_new())) {
return NULL;
}
#if defined(OPENSSL_VERSION_NUMBER) || (SSLC_VERSION_NUMBER < 0x2000)
dh->p = BN_bin2bn(p, plen, NULL);
dh->g = BN_bin2bn(g, glen, NULL);
if (!(dh->p && dh->g)) {
DH_free(dh);
return NULL;
}
#else
R_EITEMS_add(dh->data, PK_TYPE_DH, PK_DH_P, 0, p, plen, R_EITEMS_PF_COPY);
R_EITEMS_add(dh->data, PK_TYPE_DH, PK_DH_G, 0, g, glen, R_EITEMS_PF_COPY);
#endif
return dh;
}

View File

@@ -106,4 +106,7 @@ BOOL SSL_load_CrtAndKeyInfo_path(apr_pool_t *, STACK_OF(X509_INFO) *, cha
int SSL_CTX_use_certificate_chain(SSL_CTX *, char *, int, int (*)(char*,int,int,void*));
char *SSL_SESSION_id2sz(unsigned char *, int, char *, int);
DH *modssl_dh_configure(unsigned char *p, int plen,
unsigned char *g, int glen);
#endif /* __SSL_UTIL_SSL_H__ */