-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 09/06/2010 09:10 AM, Jakub Hrozek wrote:
On 09/03/2010 08:16 PM, Stephen Gallagher wrote:
>>>> [PATCH 3/7] Password obfuscation utility functions
>>> Your b64_encode function declaration is confusing. Please change the
>>> variable name "obufsize" to make it clear that it is the size of
the
>>> input buffer to the function, not the output size.
> You changed the wrong variable name. The ofbufsize argument is
> describing the size of the input buffer, not the size of the output
> buffer (which is allocated internally by BTOA_DataToAscii)
Ah, OK, I though you were referring to the buffer name as to indicate
whether the conversion is done in-place or not, I though that the size
variable was clear since its pass-by-value. Anyway, changed, hopefully
the declaration looks clear now.
>>> We probably want to include a NULL byte (or some other, more-complicated
>>> terminator like "\0\1\2\3") at the end of the buffer that we can
check
>>> before blindly reading memory in. This way we can tell if we have a
>>> corrupted or simply wrong obfuscated password.
> A good start, but I think you missed the point a little bit.
I did :-)
> I want us
> to read up to ctsize, then test that the four bytes p+ctsize are the
> sentinel.
> This way if the buffer is corrupt or malicious (e.g. the ctsize ==
> MAX_UINT16) we aren't suddenly allocating and copying 64MB of data.
Agreed, this is better, fixed now.
Sorry, I noticed two more things (warnings from gcc):
In file included from /home/bos/sgallagh/workspace/sssd/src/util/util.h:38,
from
/home/bos/sgallagh/workspace/sssd/src/util/crypto/nss/nss_obfuscate.c:30:
./config.h:91:1: warning: "HAVE_LONG_LONG" redefined
In file included from /usr/include/nspr4/prtypes.h:58,
from /usr/include/nspr4/prerror.h:41,
from
/home/bos/sgallagh/workspace/sssd/src/util/crypto/nss/nss_obfuscate.c:24:
/usr/include/nspr4/prcpucfg.h:807:1: warning: this is the location of
the previous definition
and also:
/home/bos/sgallagh/workspace/sssd/src/util/crypto/nss/nss_obfuscate.c:
In function ‘sss_password_encrypt’:
/home/bos/sgallagh/workspace/sssd/src/util/crypto/nss/nss_obfuscate.c:287:
warning: cast discards qualifiers from pointer target type
- --
Stephen Gallagher
RHCE 804006346421761
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora -
http://enigmail.mozdev.org/
iEYEARECAAYFAkyGSigACgkQeiVVYja6o6OBqwCgkuNzbMhrF7ldALi++/y+qLRv
locAnjodzU4OGsBB0vi6qHwbRTieNe+p
=MJV5
-----END PGP SIGNATURE-----