Fix for bug 286642 . Don't export DER template from libnssutil3. r=nelson

git-svn-id: svn://10.0.0.236/trunk@238615 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
julien.pierre.boogz%sun.com
2007-11-07 02:37:22 +00:00
parent afa2c89c0d
commit bc77aebd64
5 changed files with 59 additions and 51 deletions

View File

@@ -37,7 +37,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* $Id: secsign.c,v 1.19 2007-10-12 01:44:43 julien.pierre.boogz%sun.com Exp $ */
/* $Id: secsign.c,v 1.20 2007-11-07 02:37:21 julien.pierre.boogz%sun.com Exp $ */
#include <stdio.h>
#include "cryptohi.h"
@@ -150,6 +150,32 @@ SGN_Update(SGNContext *cx, unsigned char *input, unsigned inputLen)
return SECSuccess;
}
/* XXX Old template; want to expunge it eventually. */
static DERTemplate SECAlgorithmIDTemplate[] = {
{ DER_SEQUENCE,
0, NULL, sizeof(SECAlgorithmID) },
{ DER_OBJECT_ID,
offsetof(SECAlgorithmID,algorithm), },
{ DER_OPTIONAL | DER_ANY,
offsetof(SECAlgorithmID,parameters), },
{ 0, }
};
/*
* XXX OLD Template. Once all uses have been switched over to new one,
* remove this.
*/
static DERTemplate SGNDigestInfoTemplate[] = {
{ DER_SEQUENCE,
0, NULL, sizeof(SGNDigestInfo) },
{ DER_INLINE,
offsetof(SGNDigestInfo,digestAlgorithm),
SECAlgorithmIDTemplate, },
{ DER_OCTET_STRING,
offsetof(SGNDigestInfo,digest), },
{ 0, }
};
SECStatus
SGN_End(SGNContext *cx, SECItem *result)
{
@@ -189,7 +215,7 @@ SGN_End(SGNContext *cx, SECItem *result)
}
/* Der encode the digest as a DigestInfo */
rv = DER_Encode(arena, &digder, SEC_ASN1_GET(SGNDigestInfoTemplate),
rv = DER_Encode(arena, &digder, SGNDigestInfoTemplate,
di);
if (rv != SECSuccess) {
goto loser;
@@ -280,16 +306,6 @@ SEC_SignData(SECItem *res, unsigned char *buf, int len,
/************************************************************************/
static DERTemplate SECAlgorithmIDTemplate[] = {
{ DER_SEQUENCE,
0, NULL, sizeof(SECAlgorithmID) },
{ DER_OBJECT_ID,
offsetof(SECAlgorithmID,algorithm), },
{ DER_OPTIONAL | DER_ANY,
offsetof(SECAlgorithmID,parameters), },
{ 0, }
};
DERTemplate CERTSignedDataTemplate[] =
{
{ DER_SEQUENCE,
@@ -304,7 +320,7 @@ DERTemplate CERTSignedDataTemplate[] =
{ 0, }
};
SEC_ASN1_MKSUB(SECOID_AlgorithmIDTemplate);
SEC_ASN1_MKSUB(SECOID_AlgorithmIDTemplate)
const SEC_ASN1Template CERT_SignedDataTemplate[] =
{
@@ -405,7 +421,7 @@ SGN_Digest(SECKEYPrivateKey *privKey,
}
/* Der encode the digest as a DigestInfo */
rv = DER_Encode(arena, &digder, SEC_ASN1_GET(SGNDigestInfoTemplate),
rv = DER_Encode(arena, &digder, SGNDigestInfoTemplate,
di);
if (rv != SECSuccess) {
goto loser;

View File

@@ -1638,6 +1638,32 @@ sftk_HashSign(SFTKHashSignInfo *info,unsigned char *sig,unsigned int *sigLen,
hash,hashLen);
}
/* XXX Old template; want to expunge it eventually. */
static DERTemplate SECAlgorithmIDTemplate[] = {
{ DER_SEQUENCE,
0, NULL, sizeof(SECAlgorithmID) },
{ DER_OBJECT_ID,
offsetof(SECAlgorithmID,algorithm), },
{ DER_OPTIONAL | DER_ANY,
offsetof(SECAlgorithmID,parameters), },
{ 0, }
};
/*
* XXX OLD Template. Once all uses have been switched over to new one,
* remove this.
*/
static DERTemplate SGNDigestInfoTemplate[] = {
{ DER_SEQUENCE,
0, NULL, sizeof(SGNDigestInfo) },
{ DER_INLINE,
offsetof(SGNDigestInfo,digestAlgorithm),
SECAlgorithmIDTemplate, },
{ DER_OCTET_STRING,
offsetof(SGNDigestInfo,digest), },
{ 0, }
};
SECStatus
RSA_HashSign(SECOidTag hashOid, NSSLOWKEYPrivateKey *key,
unsigned char *sig, unsigned int *sigLen, unsigned int maxLen,
@@ -1659,7 +1685,7 @@ RSA_HashSign(SECOidTag hashOid, NSSLOWKEYPrivateKey *key,
if (!di) { goto loser; }
/* Der encode the digest as a DigestInfo */
rv = DER_Encode(arena, &digder, SEC_ASN1_GET(SGNDigestInfoTemplate), di);
rv = DER_Encode(arena, &digder, SGNDigestInfoTemplate, di);
if (rv != SECSuccess) {
goto loser;
}

View File

@@ -219,7 +219,6 @@ SGN_DestroyDigestInfo_Util;
;;SEC_UTF8StringTemplate_Util DATA ;
;;SECOID_AlgorithmIDTemplate_Util DATA ;
;;sgn_DigestInfoTemplate_Util DATA ;
;;SGNDigestInfoTemplate DATA ;
NSS_Get_CERT_TimeChoiceTemplate_Util;
NSS_Get_SEC_AnyTemplate_Util;
NSS_Get_SEC_BitStringTemplate_Util;
@@ -246,7 +245,6 @@ NSS_Get_SEC_UniversalStringTemplate;
NSS_Get_SEC_UTF8StringTemplate_Util;
NSS_Get_SECOID_AlgorithmIDTemplate_Util;
NSS_Get_sgn_DigestInfoTemplate_Util;
NSS_Get_SGNDigestInfoTemplate;
;+ local:
;+ *;
;+};

View File

@@ -33,41 +33,13 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* $Id: secdig.c,v 1.8 2007-10-12 01:44:51 julien.pierre.boogz%sun.com Exp $ */
/* $Id: secdig.c,v 1.9 2007-11-07 02:37:22 julien.pierre.boogz%sun.com Exp $ */
#include "secdig.h"
#include "secoid.h"
#include "secasn1.h"
#include "secerr.h"
/* XXX Old template; want to expunge it eventually. */
static DERTemplate SECAlgorithmIDTemplate[] = {
{ DER_SEQUENCE,
0, NULL, sizeof(SECAlgorithmID) },
{ DER_OBJECT_ID,
offsetof(SECAlgorithmID,algorithm), },
{ DER_OPTIONAL | DER_ANY,
offsetof(SECAlgorithmID,parameters), },
{ 0, }
};
/*
* XXX OLD Template. Once all uses have been switched over to new one,
* remove this.
*/
DERTemplate SGNDigestInfoTemplate[] = {
{ DER_SEQUENCE,
0, NULL, sizeof(SGNDigestInfo) },
{ DER_INLINE,
offsetof(SGNDigestInfo,digestAlgorithm),
SECAlgorithmIDTemplate, },
{ DER_OCTET_STRING,
offsetof(SGNDigestInfo,digest), },
{ 0, }
};
SEC_ASN1_CHOOSER_IMPLEMENT(SGNDigestInfoTemplate)
/*
* XXX Want to have a SGN_DecodeDigestInfo, like:
* SGNDigestInfo *SGN_DecodeDigestInfo(SECItem *didata);

View File

@@ -36,7 +36,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/* $Id: secdig.h,v 1.6 2007-10-12 01:44:51 julien.pierre.boogz%sun.com Exp $ */
/* $Id: secdig.h,v 1.7 2007-11-07 02:37:22 julien.pierre.boogz%sun.com Exp $ */
#ifndef _SECDIG_H_
#define _SECDIG_H_
@@ -55,10 +55,6 @@ extern const SEC_ASN1Template sgn_DigestInfoTemplate[];
SEC_ASN1_CHOOSER_DECLARE(sgn_DigestInfoTemplate)
extern DERTemplate SGNDigestInfoTemplate[];
SEC_ASN1_CHOOSER_DECLARE(SGNDigestInfoTemplate)
/****************************************/
/*
** Digest-info functions