diff options
Diffstat (limited to 'src/nss/bignum.c')
-rw-r--r-- | src/nss/bignum.c | 49 |
1 files changed, 18 insertions, 31 deletions
diff --git a/src/nss/bignum.c b/src/nss/bignum.c index 261155e6..761711ef 100644 --- a/src/nss/bignum.c +++ b/src/nss/bignum.c @@ -1,13 +1,19 @@ -/** - * XMLSec library +/* + * XML Security Library (http://www.aleksey.com/xmlsec). * - * Reading/writing bignum values * * This is free software; see Copyright file in the source * distribution for precise wording. * * Copyright (c) 2003 America Online, Inc. All rights reserved. */ +/** + * SECTION:bignum + * @Short_description: Big numbers support functions implementation for NSS. + * @Stability: Stable + * + */ + #include "globals.h" #include <stdlib.h> @@ -19,6 +25,7 @@ #include <libxml/tree.h> #include <xmlsec/xmlsec.h> +#include <xmlsec/xmltree.h> #include <xmlsec/buffer.h> #include <xmlsec/base64.h> #include <xmlsec/errors.h> @@ -29,7 +36,7 @@ /** * xmlSecNssNodeGetBigNumValue: * @arena: the arena from which to allocate memory - * @cur: the poitner to an XML node. + * @cur: the pointer to an XML node. * @a: a SECItem object to hold the BigNum value * * Converts the node content from CryptoBinary format @@ -53,21 +60,13 @@ xmlSecNssNodeGetBigNumValue(PRArenaPool *arena, const xmlNodePtr cur, ret = xmlSecBufferInitialize(&buf, 128); if(ret < 0) { - xmlSecError(XMLSEC_ERRORS_HERE, - NULL, - "xmlSecBufferInitialize", - XMLSEC_ERRORS_R_XMLSEC_FAILED, - XMLSEC_ERRORS_NO_MESSAGE); + xmlSecInternalError("xmlSecBufferInitialize", NULL); return(NULL); } ret = xmlSecBufferBase64NodeContentRead(&buf, cur); if(ret < 0) { - xmlSecError(XMLSEC_ERRORS_HERE, - NULL, - "xmlSecBufferBase64NodeContentRead", - XMLSEC_ERRORS_R_XMLSEC_FAILED, - XMLSEC_ERRORS_NO_MESSAGE); + xmlSecInternalError("xmlSecBufferBase64NodeContentRead", NULL); xmlSecBufferFinalize(&buf); return(NULL); } @@ -115,11 +114,7 @@ xmlSecNssNodeSetBigNumValue(xmlNodePtr cur, const SECItem *a, int addLineBreaks) ret = xmlSecBufferInitialize(&buf, a->len + 1); if(ret < 0) { - xmlSecError(XMLSEC_ERRORS_HERE, - NULL, - "xmlSecBufferInitialize", - XMLSEC_ERRORS_R_XMLSEC_FAILED, - "size=%d", a->len + 1); + xmlSecInternalError2("xmlSecBufferInitialize", NULL, "size=%d", a->len + 1); return(-1); } @@ -127,34 +122,26 @@ xmlSecNssNodeSetBigNumValue(xmlNodePtr cur, const SECItem *a, int addLineBreaks) ret = xmlSecBufferSetSize(&buf, a->len); if(ret < 0) { - xmlSecError(XMLSEC_ERRORS_HERE, - NULL, - "xmlSecBufferSetSize", - XMLSEC_ERRORS_R_XMLSEC_FAILED, - "size=%d", a->len); + xmlSecInternalError2("xmlSecBufferSetSize", NULL, "size=%d", a->len); xmlSecBufferFinalize(&buf); return(-1); } if(addLineBreaks) { - xmlNodeSetContent(cur, xmlSecStringCR); + xmlNodeSetContent(cur, xmlSecGetDefaultLineFeed()); } else { xmlNodeSetContent(cur, xmlSecStringEmpty); } ret = xmlSecBufferBase64NodeContentWrite(&buf, cur, xmlSecBase64GetDefaultLineSize()); if(ret < 0) { - xmlSecError(XMLSEC_ERRORS_HERE, - NULL, - "xmlSecBufferBase64NodeContentWrite", - XMLSEC_ERRORS_R_XMLSEC_FAILED, - XMLSEC_ERRORS_NO_MESSAGE); + xmlSecInternalError("xmlSecBufferBase64NodeContentWrite", NULL); xmlSecBufferFinalize(&buf); return(-1); } if(addLineBreaks) { - xmlNodeAddContent(cur, xmlSecStringCR); + xmlNodeAddContent(cur, xmlSecGetDefaultLineFeed()); } xmlSecBufferFinalize(&buf); |