Re: Assertion when using SEC_ASN1EncodeItem with subtemplate

2010-07-31 Thread Nelson B Bolyard
On 2010-07-31 14:23 PDT, Nelson B Bolyard wrote: > So, I moved the XTRN flag up to the PointerTo template, and that > didn't crash, but it failed. I'm debugging it now. My mistake. It succeeded. I interpreted the returned pointer to the output buffer as a non-zero result code indicating failur

Re: Assertion when using SEC_ASN1EncodeItem with subtemplate

2010-07-31 Thread Nelson B Bolyard
On 2010-07-30 20:53 PDT, Wan-Teh Chang wrote: > Here is Hanno's code modified to use a PointerTo template: > > SEC_ASN1_MKSUB(SECOID_AlgorithmIDTemplate) > > const SEC_ASN1Template MY_PointerToAlgorithmIDTemplate[] = { > { SEC_ASN1_POINTER, 0, SEC_ASN1_SUB(SECOID_AlgorithmIDTemplate) } > };

Re: Assertion when using SEC_ASN1EncodeItem with subtemplate

2010-07-31 Thread Nelson B Bolyard
On 2010-07-30 20:53 PDT, Wan-Teh Chang wrote: > On Fri, Jul 30, 2010 at 11:29 AM, Nelson B Bolyard wrote: >> I think you're right. I filed >> https://bugzilla.mozilla.org/show_bug.cgi?id=583308 >> with a patch to fix at least one problem. > > I ran Hanno's test program in a debugger. Why didn't

Re: Assertion when using SEC_ASN1EncodeItem with subtemplate

2010-07-30 Thread Wan-Teh Chang
On Fri, Jul 30, 2010 at 11:29 AM, Nelson B Bolyard wrote: > > I think you're right.  I filed > https://bugzilla.mozilla.org/show_bug.cgi?id=583308 > with a patch to fix at least one problem. I ran Hanno's test program in a debugger. I saw the problem that Hanno reported, that the ASN.1 encoder ca

Re: Assertion when using SEC_ASN1EncodeItem with subtemplate

2010-07-30 Thread Nelson B Bolyard
On 2010-07-29 15:14 PDT, Hanno Böck wrote: > After digging down deeper into the code, it seems it fails somewhere here: > http://mxr.mozilla.org/security/source/security/nss/lib/util/secasn1e.c#897 > > It gives state->theTemplate to the SEC_ASN1GetSubTemplate-function, while > state->theTemplate

Re: Assertion when using SEC_ASN1EncodeItem with subtemplate

2010-07-29 Thread Hanno Böck
After digging down deeper into the code, it seems it fails somewhere here: http://mxr.mozilla.org/security/source/security/nss/lib/util/secasn1e.c#897 It gives state->theTemplate to the SEC_ASN1GetSubTemplate-function, while state->theTemplate points to SECOID_AlgorithmIDTemplate, which is alread

Re: Assertion when using SEC_ASN1EncodeItem with subtemplate

2010-07-29 Thread Hanno Böck
Am Donnerstag 29 Juli 2010 schrieb Nelson B Bolyard: > That should be > pss_params = PORT_ZAlloc(sizeof(*pss_params)); > or, even better > pss_params = PORT_ArenaZAlloc(arena, sizeof(*pss_params)); > or, perhaps even better still > pss_params = PORT_ArenaZNew(arena, SECKEYRSAPSSPa

Re: Assertion when using SEC_ASN1EncodeItem with subtemplate

2010-07-29 Thread Nelson B Bolyard
On 2010-07-26 06:07 PDT, Hanno Böck wrote: > Hi, > > Just recently, the templates for decoding the RSA-PSS ASN1 parameters got > added to cvs head (in cryptohi/seckey.c). > > Currently I'm working on implementing the creation of PSS signatures, so I > need them also to encode. My naive thought

Re: Assertion when using SEC_ASN1EncodeItem with subtemplate

2010-07-29 Thread Wan-Teh Chang
On Mon, Jul 26, 2010 at 6:07 AM, Hanno Böck wrote: > > The code looks like this: > > > SEC_ASN1_MKSUB(SECOID_AlgorithmIDTemplate) > > const SEC_ASN1Template MY_RSAPSSParamsTemplate[] = > { >    { SEC_ASN1_SEQUENCE, 0, NULL, sizeof(SECKEYRSAPSSParams) }, >    { SEC_ASN1_OPTIONAL | SEC_ASN1_CONSTRUC

Re: Assertion when using SEC_ASN1EncodeItem with subtemplate

2010-07-28 Thread Wan-Teh Chang
On Mon, Jul 26, 2010 at 6:07 AM, Hanno Böck wrote: > Hi, > > Just recently, the templates for decoding the RSA-PSS ASN1 parameters got > added to cvs head (in cryptohi/seckey.c). > > Currently I'm working on implementing the creation of PSS signatures, so I > need them also to encode. My naive tho

Assertion when using SEC_ASN1EncodeItem with subtemplate

2010-07-26 Thread Hanno Böck
Hi, Just recently, the templates for decoding the RSA-PSS ASN1 parameters got added to cvs head (in cryptohi/seckey.c). Currently I'm working on implementing the creation of PSS signatures, so I need them also to encode. My naive thought was that SEC_ASN1EncodeItem is used pretty much the same