[Botan-devel] Botan::Invalid_IV_Length segfault

John Proffer jproffer at vli-dc.com
Mon Jun 25 10:54:15 EDT 2007


Hi, I'm getting Botan::Invalid_IV_Length runtime errors.  My IV key is 
32 bytes in length, and I initialize it with the following code:

Botan::LibraryInitializer *botan_init = new 
Botan::LibraryInitializer(/*"secure_memory thread_safe"*/);
Botan::byte mykey[33] = {"9j&RgczP-%Y#z65zxp$~#U=-ftXzSHzz" };
Botan::byte mypass[33] = {"zfzgFsz7:zN#z2za98_a0!#:L=ozxz!z"};
Botan::InitializationVector iv(mypass,32);
Botan::SymmetricKey key(mykey,32);
Botan::Pipe pipe(get_cipher("AES-256/CFB/NoPadding", key, 
Botan::ENCRYPTION));

application crashes at Botan::Pipe 
pipe(get_cipher("AES-256/CFB/NoPadding", key, Botan::ENCRYPTION));

I tried a 16 byte key with the same result.  Am I forgetting something?

botan-devel-request at randombit.net wrote:
> Send botan-devel mailing list submissions to
> 	botan-devel at randombit.net
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://www.randombit.net/mailman/listinfo/botan-devel
> or, via email, send a message with subject or body 'help' to
> 	botan-devel-request at randombit.net
>
> You can reach the person managing the list at
> 	botan-devel-owner at randombit.net
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of botan-devel digest..."
>
>
> Today's Topics:
>
>    1. RE: Re: botan-devel Digest, Vol 30, Issue 6 (Joel Low)
>    2. Botan-1.6.2 build fail with vc2003 (Christophe Meessen)
>    3. Re: botan-devel Digest, Vol 30, Issue 6 (John Proffer)
>    4. Re: Botan-1.6.2 build fail with vc2003 (Christophe Meessen)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 20 Jun 2007 17:04:54 +0800
> From: "Joel Low" <joel at joelsplace.sg>
> Subject: RE: [Botan-devel] Re: botan-devel Digest, Vol 30, Issue 6
> To: "'Botan development list'" <botan-devel at randombit.net>
> Message-ID: <003301c7b31a$148e7330$0201a8c0 at joeld235zp4nc5>
> Content-Type: text/plain; charset="us-ascii"
>
> Same here, I think you've given me a fix as well.
>
> Joel
>
>   
>> -----Original Message-----
>> From: Erik Loman [mailto:erik at surfright.nl]
>> Sent: 20 June 2007 4:55 PM
>> To: 'Botan development list'
>> Subject: RE: [Botan-devel] Re: botan-devel Digest, Vol 30, Issue 6
>>
>> Isn't this the same problem you've fixed for me a while ago?
>>
>> On Wed, Dec 20, 2006 at 04:01:59PM -0500, Jack Lloyd wrote:
>>     
>>> I've attached new versions of mem_pool.*; all that should be needed is
>>> to copy them into include/ and src/ and rerun the configure script.
>>> Downside is, it seems the easiest way to avoid the problem is to use a
>>> linear search instead of lower_bound when searching through the blocks
>>> during deallocation. On the validation suite (which is very allocation
>>> heavy) that only slows things down by around 5%, so it shouldn't cause
>>> any major problems.
>>>
>>> -Jack
>>>
>>>       
>> See attachments.
>>
>> Regards,
>> Erik
>>
>> -----Original Message-----
>> From: botan-devel-bounces at randombit.net
>> [mailto:botan-devel-bounces at randombit.net] On Behalf Of Jack Lloyd
>> Sent: dinsdag 19 juni 2007 19:54
>> To: Botan development list
>> Subject: Re: [Botan-devel] Re: botan-devel Digest, Vol 30, Issue 6
>>
>>
>> OK, thanks. I'll try to fire up VMware tonight and take a further look
>> into this. -Jack
>>
>> On Tue, Jun 19, 2007 at 01:48:21PM -0400, John Proffer wrote:
>>     
>>> Didn't work - i applied your patch and recompiled with nmake, and got
>>> the following errors:
>>>
>>> C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE\xutility(267) :
>>> error C2679: binary '<' : no operator found which takes a right-hand
>>> operand of
>>> type 'Botan::Pooling_Allocator::Memory_Block' (or there is no acceptable
>>> conversion)
>>>       
>>>        could be 'built-in C++ operator<(void *, void
>>> *)'
>>>       
>>>        while trying to match the argument list '(void *const ,
>>> Botan::Pooling_Allocator::Memory_Block)'
>>>       
>>>        C:\Program Files\Microsoft Visual Studio
>>> 8\VC\INCLUDE\algorithm(2268) : see reference to function template
>>> instantiation 'bool std::_Debug_lt<
>>> Botan::Pooling_Allocator::Memory_Block,_Ty>(_Ty1 &,const _Ty2 &,const
>>> wchar_t *,unsigned int)' being
>>> compiled
>>>
>>> with
>>>       
>>> [
>>>       
>>>            _Ty=void
>>> *,
>>>       
>>> _Ty1=Botan::Pooling_Allocator::Memory_Block,
>>>       
>>>            _Ty2=void
>>> *
>>>       
>>> ]
>>>       
>>>        C:\Program Files\Microsoft Visual Studio
>>> 8\VC\INCLUDE\algorithm(2280) : see reference to function template
>>> instantiation '_FwdIt std::_Lower_b
>>> ound<std::_Vector_iterator<_Ty,_Alloc>,void,__w64
>>> int>(_FwdIt,_FwdIt,void &,_Diff *)' being
>>> compiled
>>>
>>> with
>>>       
>>> [
>>>       
>>>
>>>       
>> _FwdIt=std::_Vector_iterator<Botan::Pooling_Allocator::Memory_Block,std::a
>> ll
>> ocator<Botan::Pooling_Allocator::Memory_Block>>,
>>     
>>> _Ty=Botan::Pooling_Allocator::Memory_Block,
>>>       
>>> _Alloc=std::allocator<Botan::Pooling_Allocator::Memory_Block>,
>>>       
>>>            _Diff=__w64
>>> int
>>>       
>>> ]
>>>       
>>>        src\mem_pool.cpp(263) : see reference to function template
>>> instantiation '_FwdIt
>>> std::lower_bound<std::_Vector_iterator<_Ty,_Alloc>,void*>(_Fw
>>> dIt,_FwdIt,void &)' being
>>> compiled
>>>       
>>> with
>>>       
>>> [
>>>       
>>>
>>>       
>> _FwdIt=std::_Vector_iterator<Botan::Pooling_Allocator::Memory_Block,std::a
>> ll
>> ocator<Botan::Pooling_Allocator::Memory_Block>>,
>>     
>>> _Ty=Botan::Pooling_Allocator::Memory_Block,
>>>       
>>> _Alloc=std::allocator<Botan::Pooling_Allocator::Memory_Block>
>>>       
>>> ]
>>>       
>>> NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
>>> 8\VC\BIN\cl.EXE"' : return code
>>> '0x2'
>>> Stop.
>>>       
>>>       
>>> begin:vcard
>>> fn:Johnathan Proffer
>>> n:Proffer;Johnathan
>>> org:Visual Language Interpreting;Information Technology
>>> adr;dom:STE B1;;1330 New Hampshire Ave. NW;Washington;DC;20036
>>> email;internet:jproffer at vli-dc.com
>>> tel;work:202.464.6800
>>> tel;fax:202.464.6810
>>> note;quoted-printable:AIM: jprofferVLI=0D=0A=
>>> 	VP: proffer.vli-dc.com
>>> x-mozilla-html:TRUE
>>> url:https://www.aboutvli.com
>>> version:2.1
>>> end:vcard
>>>
>>>       
>>> _______________________________________________
>>> botan-devel mailing list
>>> botan-devel at randombit.net
>>> http://www.randombit.net/mailman/listinfo/botan-devel
>>>       
>> _______________________________________________
>> botan-devel mailing list
>> botan-devel at randombit.net
>> http://www.randombit.net/mailman/listinfo/botan-devel
>>     
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: mem_pool_fix.patch
> Type: application/octet-stream
> Size: 2421 bytes
> Desc: not available
> Url : http://www.randombit.net/pipermail/botan-devel/attachments/20070620/6894ceed/mem_pool_fix-0001.obj
>
> ------------------------------
>
> Message: 2
> Date: Wed, 20 Jun 2007 11:56:52 +0200
> From: Christophe Meessen <meessen at cppm.in2p3.fr>
> Subject: [Botan-devel] Botan-1.6.2 build fail with vc2003
> To: botan-devel at randombit.net
> Message-ID: <4678F9E4.7000906 at cppm.in2p3.fr>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hello,
>
> I have downloaded 1.6.2, configured it and tried to compile it. 
>
> Just for feedback, I had a little difficulty in determining what CPU
> value I should provide in the configure command. The one I gave was not
> correct, so it picked a default value i586.
>
> Unfortunately building fails with an error. Here is the list of build
> instructions with the error message.
>
> x509stat.cpp
> src\x509stat.cpp(53) : error C2326: 'Botan::Certificate_Extension
> *Botan::X509_GlobalState::__ctor::Key_Usage_Prototype::make(const
> Botan::OID &)' : function cannot access 'Botan::OIDS'
> src\x509stat.cpp(53) : error C2326: 'Botan::Certificate_Extension
> *Botan::X509_GlobalState::__ctor::Key_Usage_Prototype::make(const
> Botan::OID &)' : function cannot access 'Botan::Cert_Extension'
> src\x509stat.cpp(54) : error C2326: 'Botan::Certificate_Extension
> *Botan::X509_GlobalState::__ctor::Basic_Constraints_Prototype::mak
> e(const Botan::OID &)' : function cannot access 'Botan::OIDS'
> src\x509stat.cpp(54) : error C2326: 'Botan::Certificate_Extension
> *Botan::X509_GlobalState::__ctor::Basic_Constraints_Prototype::mak
> e(const Botan::OID &)' : function cannot access 'Botan::Cert_Extension'
> src\x509stat.cpp(55) : error C2326: 'Botan::Certificate_Extension
> *Botan::X509_GlobalState::__ctor::Subject_Key_ID_Prototype::make(c
> onst Botan::OID &)' : function cannot access 'Botan::OIDS'
> src\x509stat.cpp(55) : error C2326: 'Botan::Certificate_Extension
> *Botan::X509_GlobalState::__ctor::Subject_Key_ID_Prototype::make(c
> onst Botan::OID &)' : function cannot access 'Botan::Cert_Extension'
> src\x509stat.cpp(56) : error C2326: 'Botan::Certificate_Extension
> *Botan::X509_GlobalState::__ctor::Authority_Key_ID_Prototype::make
> (const Botan::OID &)' : function cannot access 'Botan::OIDS'
> src\x509stat.cpp(56) : error C2326: 'Botan::Certificate_Extension
> *Botan::X509_GlobalState::__ctor::Authority_Key_ID_Prototype::make
> (const Botan::OID &)' : function cannot access 'Botan::Cert_Extension'
> src\x509stat.cpp(57) : error C2326: 'Botan::Certificate_Extension
> *Botan::X509_GlobalState::__ctor::Extended_Key_Usage_Prototype::ma
> ke(const Botan::OID &)' : function cannot access 'Botan::OIDS'
> src\x509stat.cpp(57) : error C2326: 'Botan::Certificate_Extension
> *Botan::X509_GlobalState::__ctor::Extended_Key_Usage_Prototype::ma
> ke(const Botan::OID &)' : function cannot access 'Botan::Cert_Extension'
> src\x509stat.cpp(58) : error C2326: 'Botan::Certificate_Extension
> *Botan::X509_GlobalState::__ctor::Issuer_Alternative_Name_Prototyp
> e::make(const Botan::OID &)' : function cannot access 'Botan::OIDS'
> src\x509stat.cpp(58) : error C2326: 'Botan::Certificate_Extension
> *Botan::X509_GlobalState::__ctor::Issuer_Alternative_Name_Prototyp
> e::make(const Botan::OID &)' : function cannot access
> 'Botan::Cert_Extension'
> src\x509stat.cpp(59) : error C2326: 'Botan::Certificate_Extension
> *Botan::X509_GlobalState::__ctor::Subject_Alternative_Name_Prototy
> pe::make(const Botan::OID &)' : function cannot access 'Botan::OIDS'
> src\x509stat.cpp(59) : error C2326: 'Botan::Certificate_Extension
> *Botan::X509_GlobalState::__ctor::Subject_Alternative_Name_Prototy
> pe::make(const Botan::OID &)' : function cannot access
> 'Botan::Cert_Extension'
> src\x509stat.cpp(60) : error C2326: 'Botan::Certificate_Extension
> *Botan::X509_GlobalState::__ctor::CRL_Number_Prototype::make(const
>  Botan::OID &)' : function cannot access 'Botan::OIDS'
> src\x509stat.cpp(60) : error C2326: 'Botan::Certificate_Extension
> *Botan::X509_GlobalState::__ctor::CRL_Number_Prototype::make(const
>  Botan::OID &)' : function cannot access 'Botan::Cert_Extension'
> src\x509stat.cpp(61) : error C2326: 'Botan::Certificate_Extension
> *Botan::X509_GlobalState::__ctor::Certificate_Policies_Prototype::
> make(const Botan::OID &)' : function cannot access 'Botan::OIDS'
> src\x509stat.cpp(61) : error C2326: 'Botan::Certificate_Extension
> *Botan::X509_GlobalState::__ctor::Certificate_Policies_Prototype::
> make(const Botan::OID &)' : function cannot access 'Botan::Cert_Extension'
> NMAKE : fatal error U1077: 'cl' : return code '0x2'
> Stop.
>
> C:\Botan\Botan-1.6.2>
>
> It looks like there is a problem related to protected or private member
> access.
>
>
> ------------------------------
>
> Message: 3
> Date: Wed, 20 Jun 2007 06:41:56 -0400
> From: John Proffer <jproffer at vli-dc.com>
> Subject: [Botan-devel] Re: botan-devel Digest, Vol 30, Issue 6
> To: botan-devel at randombit.net
> Message-ID: <46790474.1050409 at vli-dc.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Erik's files worked perfectly for me - compiled without errors, and was 
> able to compile my project without any errors as well. 
>
> However, I'm not able to compile the non-debug version into my project - 
> Botan compiles the lib fine, but MSVC complains that std::basic_string 
> is already defined in libbotan?? 
>
> Are you able to compile release versions, Erik?
>
> Linking...
> msvcprt.lib(MSVCP80.dll) : error LNK2005: "public: class 
> std::basic_string<char,struct std::char_traits<char>,class 
> std::allocator<char> > & __thiscall std::basic_string<char,struct 
> std::char_traits<char>,class std::allocator<char> >::operator=(char 
> const *)" 
> (??4?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAEAAV01 at PBD@Z) 
> already defined in libbotan.lib(libstate.obj)
> msvcprt.lib(MSVCP80.dll) : error LNK2005: "public: class 
> std::basic_string<char,struct std::char_traits<char>,class 
> std::allocator<char> > & __thiscall std::basic_string<char,struct 
> std::char_traits<char>,class std::allocator<char> >::operator=(class 
> std::basic_string<char,struct std::char_traits<char>,class 
> std::allocator<char> > const &)" 
> (??4?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAEAAV01 at ABV01@@Z) 
> already defined in libbotan.lib(init_def.obj)
> msvcprt.lib(MSVCP80.dll) : error LNK2005: "public: __thiscall 
> std::basic_string<char,struct std::char_traits<char>,class 
> std::allocator<char> >::~basic_string<char,struct 
> std::char_traits<char>,class std::allocator<char> >(void)" 
> (??1?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAE at XZ) 
> already defined in libbotan.lib(init_def.obj)
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: jproffer.vcf
> Type: text/x-vcard
> Size: 392 bytes
> Desc: not available
> Url : http://www.randombit.net/pipermail/botan-devel/attachments/20070620/62283671/jproffer-0001.vcf
>
> ------------------------------
>
> Message: 4
> Date: Wed, 20 Jun 2007 17:30:17 +0200
> From: Christophe Meessen <meessen at cppm.in2p3.fr>
> Subject: Re: [Botan-devel] Botan-1.6.2 build fail with vc2003
> To: Botan development list <botan-devel at randombit.net>
> Message-ID: <46794809.10907 at cppm.in2p3.fr>
> Content-Type: text/plain; charset=ISO-8859-1
>
> reHello,
>
> I know I use the old VC2003 but I can't afford a more recent version for
> now.
>
> The compilation problem was finally solved by adding 'Botan::' in two
> locations in the file x509stat.cpp.
> In now compiled and the check ran perfectly. :] I hope this helps.
>
> Note that adding  Botan:: there doesn't change the semantic of the code.
> The problem results from a "feature" of VC2003 because the code was
> perfectly correct.
>
> #define CREATE_PROTOTYPE(NAME, TYPE)                         \
>    do {                                                      \
>       struct TYPE ## _Prototype : public Extension_Prototype \
>          {                                                   \
>          Certificate_Extension* make(const OID& oid)         \
>             {                                                \
>                         if(Botan::OIDS::name_of(oid,
> NAME))                     \ <-- add 'Botan::' here
>                         return new
> Botan::Cert_Extension::TYPE();            \ <-- and here
>             return 0;                                        \
>             }                                                \
>          };                                                  \
>                                                              \
>       add(new TYPE ## _Prototype);                           \
>    } while(0);
>
>
>
> ------------------------------
>
> _______________________________________________
> botan-devel mailing list
> botan-devel at randombit.net
> http://www.randombit.net/mailman/listinfo/botan-devel
>
>
> End of botan-devel Digest, Vol 30, Issue 8
> ******************************************
>   
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jproffer.vcf
Type: text/x-vcard
Size: 392 bytes
Desc: not available
URL: <http://lists.randombit.net/pipermail/botan-devel/attachments/20070625/515b2414/attachment.vcf>


More information about the botan-devel mailing list