OpenSSL CVS Repository
http://cvs.openssl.org/
____________________________________________________________
________________
Server: cvs.openssl.org Name: Bodo
Moeller
Root: /v/openssl/cvs Email: bodo openssl.org
Module: openssl Date:
22-May-2007 11:48:07
Branch: OpenSSL_0_9_8-stable Handle:
2007052210480204
Modified files: (Branch: OpenSSL_0_9_8-stable)
openssl CHANGES
openssl/crypto/ec ec.h ec_err.c ec_mult.c
ectest.c
Log:
Fix crypto/ec/ec_mult.c to work properly with scalars of
value 0
Summary:
Revision Changes Path
1.1238.2.71 +4 -0 openssl/CHANGES
1.77.2.4 +1 -0 openssl/crypto/ec/ec.h
1.36.2.5 +2 -1 openssl/crypto/ec/ec_err.c
1.32.2.2 +31 -3 openssl/crypto/ec/ec_mult.c
1.40.2.5 +11 -3 openssl/crypto/ec/ectest.c
____________________________________________________________
________________
patch -p0 <<' .'
Index: openssl/CHANGES
============================================================
================
$ cvs diff -u -r1.1238.2.70 -r1.1238.2.71 CHANGES
--- openssl/CHANGES 13 May 2007 15:04:12
-0000 1.1238.2.70
+++ openssl/CHANGES 22 May 2007 09:48:02
-0000 1.1238.2.71
 -4,6 +4,10 
Changes between 0.9.8e and 0.9.8f [xx XXX xxxx]
+ *) Fix crypto/ec/ec_mult.c to work properly with
scalars of value 0
+ (which previously caused an internal error).
+ [Bodo Moeller]
+
*) Squeeze another 10% out of IGE mode when in != out.
[Ben Laurie]
 .
patch -p0 <<' .'
Index: openssl/crypto/ec/ec.h
============================================================
================
$ cvs diff -u -r1.77.2.3 -r1.77.2.4 ec.h
--- openssl/crypto/ec/ec.h 28 Sep 2006 11:29:02
-0000 1.77.2.3
+++ openssl/crypto/ec/ec.h 22 May 2007 09:48:05
-0000 1.77.2.4
 -471,6 +471,7 
#define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP
126
#define EC_F_EC_POINT_SET_TO_INFINITY 127
#define EC_F_EC_PRE_COMP_DUP 207
+#define EC_F_EC_PRE_COMP_NEW 196
#define EC_F_EC_WNAF_MUL 187
#define EC_F_EC_WNAF_PRECOMPUTE_MULT 188
#define EC_F_I2D_ECPARAMETERS 190
 .
patch -p0 <<' .'
Index: openssl/crypto/ec/ec_err.c
============================================================
================
$ cvs diff -u -r1.36.2.4 -r1.36.2.5 ec_err.c
--- openssl/crypto/ec/ec_err.c 21 Nov 2006 20:14:41
-0000 1.36.2.4
+++ openssl/crypto/ec/ec_err.c 22 May 2007 09:48:05
-0000 1.36.2.5
 -1,6 +1,6 
/* crypto/ec/ec_err.c */
/*
============================================================
========
- * Copyright (c) 1999-2005 The OpenSSL Project. All
rights reserved.
+ * Copyright (c) 1999-2007 The OpenSSL Project. All
rights reserved.
*
* Redistribution and use in source and binary forms,
with or without
* modification, are permitted provided that the
following conditions
 -170,6 +170,7 
{ERR_FUNC(EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP), &q
uot;EC_POINT_set_Jprojective_coordinates_GFp"},
{ERR_FUNC(EC_F_EC_POINT_SET_TO_INFINITY), "EC_POINT_set
_to_infinity"},
{ERR_FUNC(EC_F_EC_PRE_COMP_DUP), "EC_PRE_COMP_DUP"
},
+{ERR_FUNC(EC_F_EC_PRE_COMP_NEW), "EC_PRE_COMP_NEW"
;},
{ERR_FUNC(EC_F_EC_WNAF_MUL), "ec_wNAF_mul"},
{ERR_FUNC(EC_F_EC_WNAF_PRECOMPUTE_MULT), "ec_wNAF_preco
mpute_mult"},
{ERR_FUNC(EC_F_I2D_ECPARAMETERS), "i2d_ECParameters&quo
t;},
 .
patch -p0 <<' .'
Index: openssl/crypto/ec/ec_mult.c
============================================================
================
$ cvs diff -u -r1.32.2.1 -r1.32.2.2 ec_mult.c
--- openssl/crypto/ec/ec_mult.c 14 Mar 2006 22:48:31
-0000 1.32.2.1
+++ openssl/crypto/ec/ec_mult.c 22 May 2007 09:48:06
-0000 1.32.2.2
 -3,7 +3,7 
* Originally written by Bodo Moeller and Nils Larsch for
the OpenSSL project.
*/
/*
============================================================
========
- * Copyright (c) 1998-2003 The OpenSSL Project. All
rights reserved.
+ * Copyright (c) 1998-2007 The OpenSSL Project. All
rights reserved.
*
* Redistribution and use in source and binary forms,
with or without
* modification, are permitted provided that the
following conditions
 -104,7 +104,10 
ret = (EC_PRE_COMP
*)OPENSSL_malloc(sizeof(EC_PRE_COMP));
if (!ret)
+ {
+ ECerr(EC_F_EC_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
return ret;
+ }
ret->group = group;
ret->blocksize = 8; /* default */
ret->numblocks = 0;
 -194,6 +197,19 
int bit, next_bit, mask;
size_t len = 0, j;
+ if (BN_is_zero(scalar))
+ {
+ r = OPENSSL_malloc(1);
+ if (!r)
+ {
+ ECerr(EC_F_COMPUTE_WNAF, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ r[0] = 0;
+ *ret_len = 1;
+ return r;
+ }
+
if (w <= 0 || w > 7) /* 'signed char' can
represent integers with absolute values less than 2^7 */
{
ECerr(EC_F_COMPUTE_WNAF, ERR_R_INTERNAL_ERROR);
 -212,7 +228,11 
r = OPENSSL_malloc(len + 1); /* modified wNAF may be one
digit longer than binary representation
* (*ret_len will be set to
the actual length, i.e. at most
* BN_num_bits(scalar) + 1)
*/
- if (r == NULL) goto err;
+ if (r == NULL)
+ {
+ ECerr(EC_F_COMPUTE_WNAF, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
if (scalar->d == NULL || scalar->top == 0)
{
 -425,7 +445,10 
val_sub = OPENSSL_malloc(totalnum * sizeof
val_sub[0]);
if (!wsize || !wNAF_len || !wNAF || !val_sub)
+ {
+ ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE);
goto err;
+ }
wNAF[0] = NULL; /* preliminary pivot */
 -538,6 +561,7 
wNAF[i] = OPENSSL_malloc(wNAF_len[i]);
if (wNAF[i] == NULL)
{
+ ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE);
OPENSSL_free(tmp_wNAF);
goto err;
}
 -564,7 +588,11 
* 'val_sub[i]' is a pointer to the subarray for the
i-th point,
* or to a subarray of 'pre_comp->points' if we
already have precomputation. */
val = OPENSSL_malloc((num_val + 1) * sizeof val[0]);
- if (val == NULL) goto err;
+ if (val == NULL)
+ {
+ ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
val[num_val] = NULL; /* pivot element */
/* allocate points for precomputation */
 .
patch -p0 <<' .'
Index: openssl/crypto/ec/ectest.c
============================================================
================
$ cvs diff -u -r1.40.2.4 -r1.40.2.5 ectest.c
--- openssl/crypto/ec/ectest.c 28 Aug 2005 23:20:44
-0000 1.40.2.4
+++ openssl/crypto/ec/ectest.c 22 May 2007 09:48:06
-0000 1.40.2.5
 -659,13 +659,15 
if (!EC_POINT_is_at_infinity(group, R)) ABORT; /* R = P
+ 2Q */
{
- const EC_POINT *points[3];
- const BIGNUM *scalars[3];
+ const EC_POINT *points[4];
+ const BIGNUM *scalars[4];
+ BIGNUM scalar3;
if (EC_POINT_is_at_infinity(group, Q)) ABORT;
points[0] = Q;
points[1] = Q;
points[2] = Q;
+ points[3] = Q;
if (!BN_add(y, z, BN_value_one())) ABORT;
if (BN_is_odd(y)) ABORT;
 -704,10 +706,16 
scalars[1] = y;
scalars[2] = z; /* z = -(x+y) */
- if (!EC_POINTs_mul(group, P, NULL, 3, points, scalars,
ctx)) ABORT;
+ BN_init(&scalar3);
+ BN_zero(&scalar3);
+ scalars[3] = &scalar3;
+
+ if (!EC_POINTs_mul(group, P, NULL, 4, points, scalars,
ctx)) ABORT;
if (!EC_POINT_is_at_infinity(group, P)) ABORT;
fprintf(stdout, " oknn");
+
+ BN_free(&scalar3);
}
 .
____________________________________________________________
__________
OpenSSL Project http://www.openssl.org
CVS Repository Commit List
openssl-cvs openssl.org
Automated List Manager
majordomo openssl.org
|