[Pkg-openssl-changes] r184 - in openssl/trunk: crypto/asn1
crypto/dh crypto/dsa crypto/ec crypto/rsa debian ssl
Kurt Roeckx
kroeckx at alioth.debian.org
Thu Nov 30 21:52:53 CET 2006
Author: kroeckx
Date: 2006-11-30 21:52:52 +0100 (Thu, 30 Nov 2006)
New Revision: 184
Modified:
openssl/trunk/crypto/asn1/tasn_dec.c
openssl/trunk/crypto/dh/dh.h
openssl/trunk/crypto/dh/dh_err.c
openssl/trunk/crypto/dh/dh_key.c
openssl/trunk/crypto/dsa/dsa.h
openssl/trunk/crypto/dsa/dsa_err.c
openssl/trunk/crypto/dsa/dsa_ossl.c
openssl/trunk/crypto/ec/ec.h
openssl/trunk/crypto/ec/ec_asn1.c
openssl/trunk/crypto/ec/ec_err.c
openssl/trunk/crypto/rsa/rsa.h
openssl/trunk/crypto/rsa/rsa_eay.c
openssl/trunk/crypto/rsa/rsa_err.c
openssl/trunk/debian/changelog
openssl/trunk/debian/libssl0.9.8.postinst
openssl/trunk/ssl/s2_clnt.c
openssl/trunk/ssl/s3_srvr.c
openssl/trunk/ssl/ssl_lib.c
Log:
* Fix security vulnerabilities (CVE-2006-2937, CVE-2006-2940,
CVE-2006-3738, CVE-2006-4343). Urgency set to high.
Modified: openssl/trunk/crypto/asn1/tasn_dec.c
===================================================================
--- openssl/trunk/crypto/asn1/tasn_dec.c 2006-11-30 20:51:56 UTC (rev 183)
+++ openssl/trunk/crypto/asn1/tasn_dec.c 2006-11-30 20:52:52 UTC (rev 184)
@@ -832,6 +832,9 @@
}
else if (ret == -1)
return -1;
+
+ ret = 0;
+
/* SEQUENCE, SET and "OTHER" are left in encoded form */
if ((utype == V_ASN1_SEQUENCE)
|| (utype == V_ASN1_SET) || (utype == V_ASN1_OTHER))
Modified: openssl/trunk/crypto/dh/dh.h
===================================================================
--- openssl/trunk/crypto/dh/dh.h 2006-11-30 20:51:56 UTC (rev 183)
+++ openssl/trunk/crypto/dh/dh.h 2006-11-30 20:52:52 UTC (rev 184)
@@ -73,6 +73,10 @@
#include <openssl/bn.h>
#endif
+#ifndef OPENSSL_DH_MAX_MODULUS_BITS
+# define OPENSSL_DH_MAX_MODULUS_BITS 10000
+#endif
+
#define DH_FLAG_CACHE_MONT_P 0x01
#define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DH
* implementation now uses constant time
@@ -221,6 +225,7 @@
/* Reason codes. */
#define DH_R_BAD_GENERATOR 101
#define DH_R_INVALID_PUBKEY 102
+#define DH_R_MODULUS_TOO_LARGE 103
#define DH_R_NO_PRIVATE_VALUE 100
#ifdef __cplusplus
Modified: openssl/trunk/crypto/dh/dh_err.c
===================================================================
--- openssl/trunk/crypto/dh/dh_err.c 2006-11-30 20:51:56 UTC (rev 183)
+++ openssl/trunk/crypto/dh/dh_err.c 2006-11-30 20:52:52 UTC (rev 184)
@@ -84,6 +84,7 @@
{
{ERR_REASON(DH_R_BAD_GENERATOR) ,"bad generator"},
{ERR_REASON(DH_R_INVALID_PUBKEY) ,"invalid public key"},
+{ERR_REASON(DH_R_MODULUS_TOO_LARGE) ,"modulus too large"},
{ERR_REASON(DH_R_NO_PRIVATE_VALUE) ,"no private value"},
{0,NULL}
};
Modified: openssl/trunk/crypto/dh/dh_key.c
===================================================================
--- openssl/trunk/crypto/dh/dh_key.c 2006-11-30 20:51:56 UTC (rev 183)
+++ openssl/trunk/crypto/dh/dh_key.c 2006-11-30 20:52:52 UTC (rev 184)
@@ -179,6 +179,12 @@
int ret= -1;
int check_result;
+ if (BN_num_bits(dh->p) > OPENSSL_DH_MAX_MODULUS_BITS)
+ {
+ DHerr(DH_F_COMPUTE_KEY,DH_R_MODULUS_TOO_LARGE);
+ goto err;
+ }
+
ctx = BN_CTX_new();
if (ctx == NULL) goto err;
BN_CTX_start(ctx);
Modified: openssl/trunk/crypto/dsa/dsa.h
===================================================================
--- openssl/trunk/crypto/dsa/dsa.h 2006-11-30 20:51:56 UTC (rev 183)
+++ openssl/trunk/crypto/dsa/dsa.h 2006-11-30 20:52:52 UTC (rev 184)
@@ -84,6 +84,10 @@
#endif
#endif
+#ifndef OPENSSL_DSA_MAX_MODULUS_BITS
+# define OPENSSL_DSA_MAX_MODULUS_BITS 10000
+#endif
+
#define DSA_FLAG_CACHE_MONT_P 0x01
#define DSA_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DSA
* implementation now uses constant time
@@ -270,8 +274,10 @@
#define DSA_F_SIG_CB 114
/* Reason codes. */
+#define DSA_R_BAD_Q_VALUE 102
#define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 100
#define DSA_R_MISSING_PARAMETERS 101
+#define DSA_R_MODULUS_TOO_LARGE 103
#ifdef __cplusplus
}
Modified: openssl/trunk/crypto/dsa/dsa_err.c
===================================================================
--- openssl/trunk/crypto/dsa/dsa_err.c 2006-11-30 20:51:56 UTC (rev 183)
+++ openssl/trunk/crypto/dsa/dsa_err.c 2006-11-30 20:52:52 UTC (rev 184)
@@ -89,8 +89,10 @@
static ERR_STRING_DATA DSA_str_reasons[]=
{
+{ERR_REASON(DSA_R_BAD_Q_VALUE) ,"bad q value"},
{ERR_REASON(DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE),"data too large for key size"},
{ERR_REASON(DSA_R_MISSING_PARAMETERS) ,"missing parameters"},
+{ERR_REASON(DSA_R_MODULUS_TOO_LARGE) ,"modulus too large"},
{0,NULL}
};
Modified: openssl/trunk/crypto/dsa/dsa_ossl.c
===================================================================
--- openssl/trunk/crypto/dsa/dsa_ossl.c 2006-11-30 20:51:56 UTC (rev 183)
+++ openssl/trunk/crypto/dsa/dsa_ossl.c 2006-11-30 20:52:52 UTC (rev 184)
@@ -304,6 +304,18 @@
return -1;
}
+ if (BN_num_bits(dsa->q) != 160)
+ {
+ DSAerr(DSA_F_DSA_DO_VERIFY,DSA_R_BAD_Q_VALUE);
+ return -1;
+ }
+
+ if (BN_num_bits(dsa->p) > OPENSSL_DSA_MAX_MODULUS_BITS)
+ {
+ DSAerr(DSA_F_DSA_DO_VERIFY,DSA_R_MODULUS_TOO_LARGE);
+ return -1;
+ }
+
BN_init(&u1);
BN_init(&u2);
BN_init(&t1);
Modified: openssl/trunk/crypto/ec/ec.h
===================================================================
--- openssl/trunk/crypto/ec/ec.h 2006-11-30 20:51:56 UTC (rev 183)
+++ openssl/trunk/crypto/ec/ec.h 2006-11-30 20:52:52 UTC (rev 184)
@@ -93,6 +93,10 @@
#endif
+#ifndef OPENSSL_ECC_MAX_FIELD_BITS
+# define OPENSSL_ECC_MAX_FIELD_BITS 661
+#endif
+
typedef enum {
/* values as defined in X9.62 (ECDSA) and elsewhere */
POINT_CONVERSION_COMPRESSED = 2,
@@ -482,6 +486,7 @@
#define EC_R_D2I_ECPKPARAMETERS_FAILURE 117
#define EC_R_DISCRIMINANT_IS_ZERO 118
#define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 119
+#define EC_R_FIELD_TOO_LARGE 138
#define EC_R_GROUP2PKPARAMETERS_FAILURE 120
#define EC_R_I2D_ECPKPARAMETERS_FAILURE 121
#define EC_R_INCOMPATIBLE_OBJECTS 101
@@ -492,7 +497,9 @@
#define EC_R_INVALID_FIELD 103
#define EC_R_INVALID_FORM 104
#define EC_R_INVALID_GROUP_ORDER 122
+#define EC_R_INVALID_PENTANOMIAL_BASIS 132
#define EC_R_INVALID_PRIVATE_KEY 123
+#define EC_R_INVALID_TRINOMIAL_BASIS 137
#define EC_R_MISSING_PARAMETERS 124
#define EC_R_MISSING_PRIVATE_KEY 125
#define EC_R_NOT_A_NIST_PRIME 135
Modified: openssl/trunk/crypto/ec/ec_asn1.c
===================================================================
--- openssl/trunk/crypto/ec/ec_asn1.c 2006-11-30 20:51:56 UTC (rev 183)
+++ openssl/trunk/crypto/ec/ec_asn1.c 2006-11-30 20:52:52 UTC (rev 184)
@@ -741,6 +741,7 @@
EC_GROUP *ret = NULL;
BIGNUM *p = NULL, *a = NULL, *b = NULL;
EC_POINT *point=NULL;
+ long field_bits;
if (!params->fieldID || !params->fieldID->fieldType ||
!params->fieldID->p.ptr)
@@ -779,6 +780,13 @@
char_two = params->fieldID->p.char_two;
+ field_bits = char_two->m;
+ if (field_bits > OPENSSL_ECC_MAX_FIELD_BITS)
+ {
+ ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_FIELD_TOO_LARGE);
+ goto err;
+ }
+
if ((p = BN_new()) == NULL)
{
ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_MALLOC_FAILURE);
@@ -799,6 +807,13 @@
}
tmp_long = ASN1_INTEGER_get(char_two->p.tpBasis);
+
+ if (!(char_two->m > tmp_long && tmp_long > 0))
+ {
+ ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_INVALID_TRINOMIAL_BASIS);
+ goto err;
+ }
+
/* create the polynomial */
if (!BN_set_bit(p, (int)char_two->m))
goto err;
@@ -817,6 +832,13 @@
ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_ASN1_ERROR);
goto err;
}
+
+ if (!(char_two->m > penta->k3 && penta->k3 > penta->k2 && penta->k2 > penta->k1 && penta->k1 > 0))
+ {
+ ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_INVALID_PENTANOMIAL_BASIS);
+ goto err;
+ }
+
/* create the polynomial */
if (!BN_set_bit(p, (int)char_two->m)) goto err;
if (!BN_set_bit(p, (int)penta->k1)) goto err;
@@ -853,6 +875,20 @@
ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_ASN1_LIB);
goto err;
}
+
+ if (BN_is_negative(p) || BN_is_zero(p))
+ {
+ ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_INVALID_FIELD);
+ goto err;
+ }
+
+ field_bits = BN_num_bits(p);
+ if (field_bits > OPENSSL_ECC_MAX_FIELD_BITS)
+ {
+ ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_FIELD_TOO_LARGE);
+ goto err;
+ }
+
/* create the EC_GROUP structure */
ret = EC_GROUP_new_curve_GFp(p, a, b, NULL);
}
@@ -910,6 +946,16 @@
ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_ASN1_LIB);
goto err;
}
+ if (BN_is_negative(a) || BN_is_zero(a))
+ {
+ ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_INVALID_GROUP_ORDER);
+ goto err;
+ }
+ if (BN_num_bits(a) > (int)field_bits + 1) /* Hasse bound */
+ {
+ ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, EC_R_INVALID_GROUP_ORDER);
+ goto err;
+ }
/* extract the cofactor (optional) */
if (params->cofactor == NULL)
Modified: openssl/trunk/crypto/ec/ec_err.c
===================================================================
--- openssl/trunk/crypto/ec/ec_err.c 2006-11-30 20:51:56 UTC (rev 183)
+++ openssl/trunk/crypto/ec/ec_err.c 2006-11-30 20:52:52 UTC (rev 184)
@@ -188,6 +188,7 @@
{ERR_REASON(EC_R_D2I_ECPKPARAMETERS_FAILURE),"d2i ecpkparameters failure"},
{ERR_REASON(EC_R_DISCRIMINANT_IS_ZERO) ,"discriminant is zero"},
{ERR_REASON(EC_R_EC_GROUP_NEW_BY_NAME_FAILURE),"ec group new by name failure"},
+{ERR_REASON(EC_R_FIELD_TOO_LARGE) ,"field too large"},
{ERR_REASON(EC_R_GROUP2PKPARAMETERS_FAILURE),"group2pkparameters failure"},
{ERR_REASON(EC_R_I2D_ECPKPARAMETERS_FAILURE),"i2d ecpkparameters failure"},
{ERR_REASON(EC_R_INCOMPATIBLE_OBJECTS) ,"incompatible objects"},
@@ -198,7 +199,9 @@
{ERR_REASON(EC_R_INVALID_FIELD) ,"invalid field"},
{ERR_REASON(EC_R_INVALID_FORM) ,"invalid form"},
{ERR_REASON(EC_R_INVALID_GROUP_ORDER) ,"invalid group order"},
+{ERR_REASON(EC_R_INVALID_PENTANOMIAL_BASIS),"invalid pentanomial basis"},
{ERR_REASON(EC_R_INVALID_PRIVATE_KEY) ,"invalid private key"},
+{ERR_REASON(EC_R_INVALID_TRINOMIAL_BASIS),"invalid trinomial basis"},
{ERR_REASON(EC_R_MISSING_PARAMETERS) ,"missing parameters"},
{ERR_REASON(EC_R_MISSING_PRIVATE_KEY) ,"missing private key"},
{ERR_REASON(EC_R_NOT_A_NIST_PRIME) ,"not a NIST prime"},
Modified: openssl/trunk/crypto/rsa/rsa.h
===================================================================
--- openssl/trunk/crypto/rsa/rsa.h 2006-11-30 20:51:56 UTC (rev 183)
+++ openssl/trunk/crypto/rsa/rsa.h 2006-11-30 20:52:52 UTC (rev 184)
@@ -159,6 +159,17 @@
BN_BLINDING *mt_blinding;
};
+#ifndef OPENSSL_RSA_MAX_MODULUS_BITS
+# define OPENSSL_RSA_MAX_MODULUS_BITS 16384
+#endif
+
+#ifndef OPENSSL_RSA_SMALL_MODULUS_BITS
+# define OPENSSL_RSA_SMALL_MODULUS_BITS 3072
+#endif
+#ifndef OPENSSL_RSA_MAX_PUBEXP_BITS
+# define OPENSSL_RSA_MAX_PUBEXP_BITS 64 /* exponent limit enforced for "small" modulus only */
+#endif
+
#define RSA_3 0x3L
#define RSA_F4 0x10001L
@@ -407,6 +418,7 @@
#define RSA_R_IQMP_NOT_INVERSE_OF_Q 126
#define RSA_R_KEY_SIZE_TOO_SMALL 120
#define RSA_R_LAST_OCTET_INVALID 134
+#define RSA_R_MODULUS_TOO_LARGE 105
#define RSA_R_NO_PUBLIC_EXPONENT 140
#define RSA_R_NULL_BEFORE_BLOCK_MISSING 113
#define RSA_R_N_DOES_NOT_EQUAL_P_Q 127
Modified: openssl/trunk/crypto/rsa/rsa_eay.c
===================================================================
--- openssl/trunk/crypto/rsa/rsa_eay.c 2006-11-30 20:51:56 UTC (rev 183)
+++ openssl/trunk/crypto/rsa/rsa_eay.c 2006-11-30 20:52:52 UTC (rev 184)
@@ -168,6 +168,28 @@
unsigned char *buf=NULL;
BN_CTX *ctx=NULL;
+ if (BN_num_bits(rsa->n) > OPENSSL_RSA_MAX_MODULUS_BITS)
+ {
+ RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, RSA_R_MODULUS_TOO_LARGE);
+ return -1;
+ }
+
+ if (BN_ucmp(rsa->n, rsa->e) <= 0)
+ {
+ RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, RSA_R_BAD_E_VALUE);
+ return -1;
+ }
+
+ /* for large moduli, enforce exponent limit */
+ if (BN_num_bits(rsa->n) > OPENSSL_RSA_SMALL_MODULUS_BITS)
+ {
+ if (BN_num_bits(rsa->e) > OPENSSL_RSA_MAX_PUBEXP_BITS)
+ {
+ RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, RSA_R_BAD_E_VALUE);
+ return -1;
+ }
+ }
+
if ((ctx=BN_CTX_new()) == NULL) goto err;
BN_CTX_start(ctx);
f = BN_CTX_get(ctx);
@@ -597,6 +619,28 @@
unsigned char *buf=NULL;
BN_CTX *ctx=NULL;
+ if (BN_num_bits(rsa->n) > OPENSSL_RSA_MAX_MODULUS_BITS)
+ {
+ RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT, RSA_R_MODULUS_TOO_LARGE);
+ return -1;
+ }
+
+ if (BN_ucmp(rsa->n, rsa->e) <= 0)
+ {
+ RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT, RSA_R_BAD_E_VALUE);
+ return -1;
+ }
+
+ /* for large moduli, enforce exponent limit */
+ if (BN_num_bits(rsa->n) > OPENSSL_RSA_SMALL_MODULUS_BITS)
+ {
+ if (BN_num_bits(rsa->e) > OPENSSL_RSA_MAX_PUBEXP_BITS)
+ {
+ RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT, RSA_R_BAD_E_VALUE);
+ return -1;
+ }
+ }
+
if((ctx = BN_CTX_new()) == NULL) goto err;
BN_CTX_start(ctx);
f = BN_CTX_get(ctx);
Modified: openssl/trunk/crypto/rsa/rsa_err.c
===================================================================
--- openssl/trunk/crypto/rsa/rsa_err.c 2006-11-30 20:51:56 UTC (rev 183)
+++ openssl/trunk/crypto/rsa/rsa_err.c 2006-11-30 20:52:52 UTC (rev 184)
@@ -137,6 +137,7 @@
{ERR_REASON(RSA_R_IQMP_NOT_INVERSE_OF_Q) ,"iqmp not inverse of q"},
{ERR_REASON(RSA_R_KEY_SIZE_TOO_SMALL) ,"key size too small"},
{ERR_REASON(RSA_R_LAST_OCTET_INVALID) ,"last octet invalid"},
+{ERR_REASON(RSA_R_MODULUS_TOO_LARGE) ,"modulus too large"},
{ERR_REASON(RSA_R_NO_PUBLIC_EXPONENT) ,"no public exponent"},
{ERR_REASON(RSA_R_NULL_BEFORE_BLOCK_MISSING),"null before block missing"},
{ERR_REASON(RSA_R_N_DOES_NOT_EQUAL_P_Q) ,"n does not equal p q"},
Modified: openssl/trunk/debian/changelog
===================================================================
--- openssl/trunk/debian/changelog 2006-11-30 20:51:56 UTC (rev 183)
+++ openssl/trunk/debian/changelog 2006-11-30 20:52:52 UTC (rev 184)
@@ -1,3 +1,10 @@
+openssl (0.9.8c-2) unstable; urgency=high
+
+ * Fix security vulnerabilities (CVE-2006-2937, CVE-2006-2940,
+ CVE-2006-3738, CVE-2006-4343). Urgency set to high.
+
+ -- Kurt Roeckx <kurt at roeckx.be> Wed, 27 Sep 2006 21:24:55 +0000
+
openssl (0.9.8c-1) unstable; urgency=low
* New upstream release
Modified: openssl/trunk/debian/libssl0.9.8.postinst
===================================================================
--- openssl/trunk/debian/libssl0.9.8.postinst 2006-11-30 20:51:56 UTC (rev 183)
+++ openssl/trunk/debian/libssl0.9.8.postinst 2006-11-30 20:52:52 UTC (rev 184)
@@ -57,7 +57,7 @@
if [ "$1" = "configure" ]
then
if [ ! -z "$2" ]; then
- if dpkg --compare-versions "$2" lt 0.9.8b-3; then
+ if dpkg --compare-versions "$2" lt 0.9.8c-2; then
echo -n "Checking for services that may need to be restarted..."
check="sendmail openssh-server"
@@ -168,7 +168,7 @@
else
echo "Nothing to restart."
fi
- fi # end upgrading and $2 lt 0.9.8b-3
+ fi # end upgrading and $2 lt 0.9.8c-2
fi # Upgrading
fi
Modified: openssl/trunk/ssl/s2_clnt.c
===================================================================
--- openssl/trunk/ssl/s2_clnt.c 2006-11-30 20:51:56 UTC (rev 183)
+++ openssl/trunk/ssl/s2_clnt.c 2006-11-30 20:52:52 UTC (rev 184)
@@ -520,7 +520,8 @@
CRYPTO_add(&s->session->peer->references, 1, CRYPTO_LOCK_X509);
}
- if (s->session->peer != s->session->sess_cert->peer_key->x509)
+ if (s->session->sess_cert == NULL
+ || s->session->peer != s->session->sess_cert->peer_key->x509)
/* can't happen */
{
ssl2_return_error(s, SSL2_PE_UNDEFINED_ERROR);
Modified: openssl/trunk/ssl/s3_srvr.c
===================================================================
--- openssl/trunk/ssl/s3_srvr.c 2006-11-30 20:51:56 UTC (rev 183)
+++ openssl/trunk/ssl/s3_srvr.c 2006-11-30 20:52:52 UTC (rev 184)
@@ -2003,7 +2003,7 @@
if (kssl_ctx->client_princ)
{
- int len = strlen(kssl_ctx->client_princ);
+ size_t len = strlen(kssl_ctx->client_princ);
if ( len < SSL_MAX_KRB5_PRINCIPAL_LENGTH )
{
s->session->krb5_client_princ_len = len;
Modified: openssl/trunk/ssl/ssl_lib.c
===================================================================
--- openssl/trunk/ssl/ssl_lib.c 2006-11-30 20:51:56 UTC (rev 183)
+++ openssl/trunk/ssl/ssl_lib.c 2006-11-30 20:52:52 UTC (rev 184)
@@ -1219,7 +1219,7 @@
c=sk_SSL_CIPHER_value(sk,i);
for (cp=c->name; *cp; )
{
- if (len-- == 0)
+ if (len-- <= 0)
{
*p='\0';
return(buf);
More information about the Pkg-openssl-changes
mailing list