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 nel...@bolyard.me 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.

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-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

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 points

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 nel...@bolyard.me 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

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 ha...@hboeck.de 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

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 was

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,

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 already

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