[xmlsec] convert tabs to spaces
- From: Aleksey Sanin <aleksey src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [xmlsec] convert tabs to spaces
- Date: Fri, 23 Apr 2010 04:28:48 +0000 (UTC)
commit 1231c58f8ab63449169e5442972fe35b25d151d2
Author: Aleksey Sanin <aleksey aleksey com>
Date: Thu Apr 22 21:30:32 2010 -0700
convert tabs to spaces
apps/cmdline.c | 308 ++--
apps/cmdline.h | 86 +-
apps/crypto.c | 356 ++--
apps/crypto.h | 62 +-
apps/xmlsec.c | 2092 +++++++++++-----------
examples/decrypt1.c | 84 +-
examples/decrypt2.c | 146 +-
examples/decrypt3.c | 164 +-
examples/encrypt1.c | 74 +-
examples/encrypt2.c | 82 +-
examples/encrypt3.c | 120 +-
examples/sign1.c | 66 +-
examples/sign2.c | 86 +-
examples/sign3.c | 90 +-
examples/verify1.c | 70 +-
examples/verify2.c | 132 +-
examples/verify3.c | 96 +-
examples/verify4.c | 108 +-
examples/xkms-server.c | 430 +++---
examples/xmldsigverify.c | 192 +-
include/xmlsec/app.h | 272 ++--
include/xmlsec/base64.h | 52 +-
include/xmlsec/bn.h | 112 +-
include/xmlsec/buffer.h | 100 +-
include/xmlsec/dl.h | 26 +-
include/xmlsec/errors.h | 214 ++--
include/xmlsec/gnutls/app.h | 94 +-
include/xmlsec/gnutls/crypto.h | 64 +-
include/xmlsec/gnutls/symbols.h | 86 +-
include/xmlsec/io.h | 24 +-
include/xmlsec/keyinfo.h | 172 +-
include/xmlsec/keys.h | 236 ++--
include/xmlsec/keysdata.h | 612 ++++----
include/xmlsec/keysmngr.h | 182 +-
include/xmlsec/list.h | 148 +-
include/xmlsec/membuf.h | 6 +-
include/xmlsec/mscrypto/app.h | 100 +-
include/xmlsec/mscrypto/certkeys.h | 12 +-
include/xmlsec/mscrypto/crypto.h | 88 +-
include/xmlsec/mscrypto/keysstore.h | 20 +-
include/xmlsec/mscrypto/symbols.h | 88 +-
include/xmlsec/mscrypto/x509.h | 94 +-
include/xmlsec/nodeset.h | 134 +-
include/xmlsec/nss/app.h | 130 +-
include/xmlsec/nss/bignum.h | 12 +-
include/xmlsec/nss/crypto.h | 108 +-
include/xmlsec/nss/keysstore.h | 20 +-
include/xmlsec/nss/pkikeys.h | 14 +-
include/xmlsec/nss/symbols.h | 86 +-
include/xmlsec/nss/x509.h | 62 +-
include/xmlsec/openssl/app.h | 138 +-
include/xmlsec/openssl/bn.h | 10 +-
include/xmlsec/openssl/crypto.h | 190 +-
include/xmlsec/openssl/evp.h | 10 +-
include/xmlsec/openssl/symbols.h | 118 +-
include/xmlsec/openssl/x509.h | 76 +-
include/xmlsec/parser.h | 24 +-
include/xmlsec/private.h | 436 +++---
include/xmlsec/private/xkms.h | 80 +-
include/xmlsec/skeleton/app.h | 94 +-
include/xmlsec/skeleton/crypto.h | 8 +-
include/xmlsec/skeleton/symbols.h | 112 +-
include/xmlsec/soap.h | 140 +-
include/xmlsec/templates.h | 174 +-
include/xmlsec/transforms.h | 824 +++++-----
include/xmlsec/version.h | 10 +-
include/xmlsec/x509.h | 26 +-
include/xmlsec/xkms.h | 364 ++--
include/xmlsec/xmldsig.h | 258 ++--
include/xmlsec/xmlenc.h | 184 +-
include/xmlsec/xmlsec.h | 50 +-
include/xmlsec/xmltree.h | 310 ++--
src/app.c | 786 +++++-----
src/base64.c | 756 ++++----
src/bn.c | 606 ++++----
src/buffer.c | 368 ++--
src/c14n.c | 848 +++++-----
src/dl.c | 886 +++++-----
src/enveloped.c | 100 +-
src/errors.c | 224 ++--
src/gnutls/app.c | 346 ++--
src/gnutls/ciphers.c | 854 +++++-----
src/gnutls/crypto.c | 96 +-
src/gnutls/digests.c | 264 ++--
src/gnutls/hmac.c | 478 +++---
src/gnutls/symkeys.c | 216 ++--
src/io.c | 290 ++--
src/keyinfo.c | 1304 +++++++-------
src/keys.c | 820 +++++-----
src/keysdata.c | 848 +++++-----
src/keysmngr.c | 562 +++---
src/list.c | 274 ++--
src/membuf.c | 166 +-
src/mscrypto/app.c | 1110 ++++++------
src/mscrypto/certkeys.c | 1932 +++++++++++-----------
src/mscrypto/ciphers.c | 1346 ++++++++--------
src/mscrypto/crypto.c | 228 ++--
src/mscrypto/csp_calg.h | 50 +-
src/mscrypto/csp_oid.h | 36 +-
src/mscrypto/digests.c | 390 +++---
src/mscrypto/keysstore.c | 766 ++++----
src/mscrypto/kt_rsa.c | 250 ++--
src/mscrypto/signatures.c | 624 ++++----
src/mscrypto/symkeys.c | 160 +-
src/mscrypto/x509.c | 2022 +++++++++++-----------
src/mscrypto/x509vfy.c | 166 +-
src/mscrypto/xmlsec-mingw.h | 102 +-
src/nodeset.c | 560 +++---
src/nss/app.c | 1388 ++++++++--------
src/nss/bignum.c | 86 +-
src/nss/ciphers.c | 790 +++++-----
src/nss/crypto.c | 190 +-
src/nss/digests.c | 292 ++--
src/nss/hmac.c | 516 +++---
src/nss/keysstore.c | 476 +++---
src/nss/keytrans.c | 1114 ++++++------
src/nss/kw_aes.c | 704 ++++----
src/nss/kw_des.c | 664 ++++----
src/nss/pkikeys.c | 1120 ++++++------
src/nss/signatures.c | 514 +++---
src/nss/symkeys.c | 216 ++--
src/nss/x509.c | 1822 ++++++++++----------
src/nss/x509vfy.c | 558 +++---
src/openssl/app.c | 1466 ++++++++--------
src/openssl/bn.c | 106 +-
src/openssl/ciphers.c | 778 +++++-----
src/openssl/crypto.c | 286 ++--
src/openssl/digests.c | 524 +++---
src/openssl/evp.c | 1246 +++++++-------
src/openssl/hmac.c | 636 ++++----
src/openssl/kt_rsa.c | 836 +++++-----
src/openssl/kw_aes.c | 532 +++---
src/openssl/kw_des.c | 560 +++---
src/openssl/signatures.c | 772 +++++-----
src/openssl/symkeys.c | 216 ++--
src/openssl/x509.c | 2218 ++++++++++++------------
src/openssl/x509vfy.c | 1336 +++++++-------
src/parser.c | 494 +++---
src/skeleton/app.c | 324 ++--
src/skeleton/crypto.c | 120 +-
src/soap.c | 610 ++++----
src/strings.c | 614 ++++----
src/templates.c | 1754 ++++++++++----------
src/transforms.c | 2322 +++++++++++++-------------
src/x509.c | 80 +-
src/xkms.c | 3250 +++++++++++++++++-----------------
src/xmldsig.c | 1476 ++++++++--------
src/xmlenc.c | 1162 +++++++-------
src/xmlsec.c | 142 +-
src/xmltree.c | 1056 ++++++------
src/xpath.c | 1012 ++++++------
src/xslt.c | 482 +++---
152 files changed, 34771 insertions(+), 34771 deletions(-)
---
diff --git a/apps/cmdline.c b/apps/cmdline.c
index fe09b7b..b9ecafb 100644
--- a/apps/cmdline.c
+++ b/apps/cmdline.c
@@ -19,18 +19,18 @@
#include "cmdline.h"
-static int xmlSecAppCmdLineMatchParam (const char* argvParam,
- const char* paramName,
- int canHaveNameString);
-static xmlSecAppCmdLineParamPtr xmlSecAppCmdLineParamsListFind (xmlSecAppCmdLineParamPtr* params,
- xmlSecAppCmdLineParamTopic topics,
- const char* name);
-static int xmlSecAppCmdLineParamRead (xmlSecAppCmdLineParamPtr param,
- const char** argv,
- int argc,
- int pos);
-static int xmlSecAppCmdLineTimeParamRead (const char* str,
- time_t* t);
+static int xmlSecAppCmdLineMatchParam (const char* argvParam,
+ const char* paramName,
+ int canHaveNameString);
+static xmlSecAppCmdLineParamPtr xmlSecAppCmdLineParamsListFind (xmlSecAppCmdLineParamPtr* params,
+ xmlSecAppCmdLineParamTopic topics,
+ const char* name);
+static int xmlSecAppCmdLineParamRead (xmlSecAppCmdLineParamPtr param,
+ const char** argv,
+ int argc,
+ int pos);
+static int xmlSecAppCmdLineTimeParamRead (const char* str,
+ time_t* t);
int
xmlSecAppCmdLineParamIsSet(xmlSecAppCmdLineParamPtr param) {
@@ -40,8 +40,8 @@ xmlSecAppCmdLineParamIsSet(xmlSecAppCmdLineParamPtr param) {
const char*
xmlSecAppCmdLineParamGetString(xmlSecAppCmdLineParamPtr param) {
if(param->type != xmlSecAppCmdLineParamTypeString) {
- fprintf(stderr, "Error: parameter \"%s\" is not string.\n", param->fullName);
- return(NULL);
+ fprintf(stderr, "Error: parameter \"%s\" is not string.\n", param->fullName);
+ return(NULL);
}
return((param->value != NULL) ? param->value->strValue : NULL);
}
@@ -49,8 +49,8 @@ xmlSecAppCmdLineParamGetString(xmlSecAppCmdLineParamPtr param) {
const char*
xmlSecAppCmdLineParamGetStringList(xmlSecAppCmdLineParamPtr param) {
if(param->type != xmlSecAppCmdLineParamTypeStringList) {
- fprintf(stderr, "Error: parameter \"%s\" is not string list.\n", param->fullName);
- return(NULL);
+ fprintf(stderr, "Error: parameter \"%s\" is not string list.\n", param->fullName);
+ return(NULL);
}
return((param->value != NULL) ? param->value->strListValue : NULL);
}
@@ -58,8 +58,8 @@ xmlSecAppCmdLineParamGetStringList(xmlSecAppCmdLineParamPtr param) {
int
xmlSecAppCmdLineParamGetInt(xmlSecAppCmdLineParamPtr param, int def) {
if(param->type != xmlSecAppCmdLineParamTypeNumber) {
- fprintf(stderr, "Error: parameter \"%s\" is not integer.\n", param->fullName);
- return(def);
+ fprintf(stderr, "Error: parameter \"%s\" is not integer.\n", param->fullName);
+ return(def);
}
return((param->value != NULL) ? param->value->intValue : def);
}
@@ -67,16 +67,16 @@ xmlSecAppCmdLineParamGetInt(xmlSecAppCmdLineParamPtr param, int def) {
time_t
xmlSecAppCmdLineParamGetTime(xmlSecAppCmdLineParamPtr param, time_t def) {
if(param->type != xmlSecAppCmdLineParamTypeTime) {
- fprintf(stderr, "Error: parameter \"%s\" is not time.\n", param->fullName);
- return(def);
+ fprintf(stderr, "Error: parameter \"%s\" is not time.\n", param->fullName);
+ return(def);
}
return((param->value != NULL) ? param->value->timeValue : def);
}
int
xmlSecAppCmdLineParamsListParse(xmlSecAppCmdLineParamPtr* params,
- xmlSecAppCmdLineParamTopic topics,
- const char** argv, int argc, int pos) {
+ xmlSecAppCmdLineParamTopic topics,
+ const char** argv, int argc, int pos) {
xmlSecAppCmdLineParamPtr param;
int ii;
int ret;
@@ -85,27 +85,27 @@ xmlSecAppCmdLineParamsListParse(xmlSecAppCmdLineParamPtr* params,
assert(argv != NULL);
while((pos < argc) && (argv[pos][0] == '-')) {
- param = xmlSecAppCmdLineParamsListFind(params, topics, argv[pos]);
- if(param == NULL) {
- fprintf(stderr, "Error: parameter \"%s\" is not supported or the requested\nfeature might have been disabled during compilation.\n", argv[pos]);
- return(-1);
- }
-
- ret = xmlSecAppCmdLineParamRead(param, argv, argc, pos);
- if(ret < pos) {
- fprintf(stderr, "Error: failed to parse parameter \"%s\".\n", argv[pos]);
- return(-1);
- }
- pos = ret + 1;
+ param = xmlSecAppCmdLineParamsListFind(params, topics, argv[pos]);
+ if(param == NULL) {
+ fprintf(stderr, "Error: parameter \"%s\" is not supported or the requested\nfeature might have been disabled during compilation.\n", argv[pos]);
+ return(-1);
+ }
+
+ ret = xmlSecAppCmdLineParamRead(param, argv, argc, pos);
+ if(ret < pos) {
+ fprintf(stderr, "Error: failed to parse parameter \"%s\".\n", argv[pos]);
+ return(-1);
+ }
+ pos = ret + 1;
}
/* check that all parameters at the end are filenames */
for(ii = pos; (ii < argc); ++ii) {
- if(argv[ii][0] == '-') {
- fprintf(stderr, "Error: filename is expected instead of parameter \"%s\".\n", argv[ii]);
- return(-1);
-
- }
+ if(argv[ii][0] == '-') {
+ fprintf(stderr, "Error: filename is expected instead of parameter \"%s\".\n", argv[ii]);
+ return(-1);
+
+ }
}
@@ -121,27 +121,27 @@ xmlSecAppCmdLineParamsListClean(xmlSecAppCmdLineParamPtr* params) {
assert(params != NULL);
for(i = 0; params[i] != NULL; ++i) {
- while(params[i]->value != NULL) {
- tmp = params[i]->value;
- params[i]->value = params[i]->value->next;
- xmlSecAppCmdLineValueDestroy(tmp);
- }
+ while(params[i]->value != NULL) {
+ tmp = params[i]->value;
+ params[i]->value = params[i]->value->next;
+ xmlSecAppCmdLineValueDestroy(tmp);
+ }
}
}
void
xmlSecAppCmdLineParamsListPrint(xmlSecAppCmdLineParamPtr* params,
- xmlSecAppCmdLineParamTopic topics,
- FILE* output) {
+ xmlSecAppCmdLineParamTopic topics,
+ FILE* output) {
size_t i;
assert(params != NULL);
assert(output != NULL);
for(i = 0; params[i] != NULL; ++i) {
- if(((params[i]->topics & topics) != 0) && (params[i]->help != NULL)) {
- fprintf(output, " %s\n", params[i]->help);
- }
+ if(((params[i]->topics & topics) != 0) && (params[i]->help != NULL)) {
+ fprintf(output, " %s\n", params[i]->help);
+ }
}
}
@@ -152,8 +152,8 @@ xmlSecAppCmdLineValueCreate(xmlSecAppCmdLineParamPtr param, int pos) {
assert(param != NULL);
value = (xmlSecAppCmdLineValuePtr) malloc(sizeof(xmlSecAppCmdLineValue));
if(value == NULL) {
- fprintf(stderr, "Error: malloc failed (%d bytes).\n", sizeof(xmlSecAppCmdLineValue));
- return(NULL);
+ fprintf(stderr, "Error: malloc failed (%d bytes).\n", sizeof(xmlSecAppCmdLineValue));
+ return(NULL);
}
memset(value, 0, sizeof(xmlSecAppCmdLineValue));
@@ -167,34 +167,34 @@ xmlSecAppCmdLineValueDestroy(xmlSecAppCmdLineValuePtr value) {
assert(value != NULL);
if(value->strListValue != NULL) {
- free((void*)value->strListValue);
+ free((void*)value->strListValue);
}
free(value);
}
static int
xmlSecAppCmdLineMatchParam(const char* argvParam, const char* paramName,
- int canHaveNameString) {
+ int canHaveNameString) {
assert(argvParam != NULL);
assert(paramName != NULL);
if(canHaveNameString != 0) {
- int len = strlen(paramName);
-
- if((strncmp(argvParam, paramName, len) == 0) &&
- ((argvParam[len] == '\0') || (argvParam[len] == ':'))) {
-
- return(1);
- }
+ int len = strlen(paramName);
+
+ if((strncmp(argvParam, paramName, len) == 0) &&
+ ((argvParam[len] == '\0') || (argvParam[len] == ':'))) {
+
+ return(1);
+ }
} else if(strcmp(argvParam, paramName) == 0) {
- return(1);
+ return(1);
}
return(0);
}
-static xmlSecAppCmdLineParamPtr
+static xmlSecAppCmdLineParamPtr
xmlSecAppCmdLineParamsListFind(xmlSecAppCmdLineParamPtr* params, xmlSecAppCmdLineParamTopic topics,
- const char* name) {
+ const char* name) {
size_t i;
int canHaveNameString;
@@ -202,22 +202,22 @@ xmlSecAppCmdLineParamsListFind(xmlSecAppCmdLineParamPtr* params, xmlSecAppCmdLin
assert(name != NULL);
for(i = 0; params[i] != NULL; ++i) {
- if((params[i]->topics & topics) == 0) {
- continue;
- }
+ if((params[i]->topics & topics) == 0) {
+ continue;
+ }
- canHaveNameString = ((params[i]->flags & xmlSecAppCmdLineParamFlagParamNameValue) != 0) ? 1 : 0;
- if((params[i]->fullName != NULL) &&
- (xmlSecAppCmdLineMatchParam(name, params[i]->fullName, canHaveNameString) == 1)) {
-
- return(params[i]);
- }
+ canHaveNameString = ((params[i]->flags & xmlSecAppCmdLineParamFlagParamNameValue) != 0) ? 1 : 0;
+ if((params[i]->fullName != NULL) &&
+ (xmlSecAppCmdLineMatchParam(name, params[i]->fullName, canHaveNameString) == 1)) {
+
+ return(params[i]);
+ }
- if((params[i]->shortName != NULL) &&
- (xmlSecAppCmdLineMatchParam(name, params[i]->shortName, canHaveNameString) == 1)) {
-
- return(params[i]);
- }
+ if((params[i]->shortName != NULL) &&
+ (xmlSecAppCmdLineMatchParam(name, params[i]->shortName, canHaveNameString) == 1)) {
+
+ return(params[i]);
+ }
}
return(NULL);
@@ -235,90 +235,90 @@ xmlSecAppCmdLineParamRead(xmlSecAppCmdLineParamPtr param, const char** argv, int
/* first find the previous value in the list */
if((param->flags & xmlSecAppCmdLineParamFlagMultipleValues) != 0) {
- prev = param->value;
- while((prev != NULL) && (prev->next != NULL)) {
- prev = prev->next;
- }
+ prev = param->value;
+ while((prev != NULL) && (prev->next != NULL)) {
+ prev = prev->next;
+ }
} else if(param->value != NULL) {
- fprintf(stderr, "Error: only one parameter \"%s\" is allowed.\n", argv[pos]);
- return(-1);
+ fprintf(stderr, "Error: only one parameter \"%s\" is allowed.\n", argv[pos]);
+ return(-1);
}
/* create new value and add to the list */
value = xmlSecAppCmdLineValueCreate(param, pos);
if(value == NULL) {
- fprintf(stderr, "Error: failed to create value for parameter \"%s\".\n", argv[pos]);
- return(-1);
+ fprintf(stderr, "Error: failed to create value for parameter \"%s\".\n", argv[pos]);
+ return(-1);
}
if(prev != NULL) {
- assert(prev->next == NULL);
- prev->next = value;
+ assert(prev->next == NULL);
+ prev->next = value;
} else {
- param->value = value;
+ param->value = value;
}
/* if we can have a string value after the name, parse it */
if((param->flags & xmlSecAppCmdLineParamFlagParamNameValue) != 0) {
- value->paramNameValue = strchr(argv[pos], ':');
- if(value->paramNameValue != NULL) {
- ++value->paramNameValue;
- }
+ value->paramNameValue = strchr(argv[pos], ':');
+ if(value->paramNameValue != NULL) {
+ ++value->paramNameValue;
+ }
}
switch(param->type) {
- case xmlSecAppCmdLineParamTypeFlag:
- /* do nothing */
- break;
- case xmlSecAppCmdLineParamTypeString:
- if(pos + 1 >= argc) {
- fprintf(stderr, "Error: string argument expected for parameter \"%s\".\n", argv[pos]);
- return(-1);
- }
- value->strValue = argv[++pos];
- break;
- case xmlSecAppCmdLineParamTypeStringList:
- if(pos + 1 >= argc) {
- fprintf(stderr, "Error: string list argument expected for parameter \"%s\".\n", argv[pos]);
- return(-1);
- }
- value->strValue = argv[++pos];
- buf = (char*)malloc(strlen(value->strValue) + 2);
- if(buf == NULL) {
- fprintf(stderr, "Error: failed to allocate memory (%d bytes).\n", strlen(value->strValue) + 2);
- return(-1);
- }
- memset(buf, 0, strlen(value->strValue) + 2);
- memcpy(buf, value->strValue, strlen(value->strValue));
- value->strListValue = buf;
- while((*buf) != '\0') {
- if((*buf) == ',') {
- (*buf) = '\0';
- }
- ++buf;
- }
- break;
- case xmlSecAppCmdLineParamTypeNumber:
- if(pos + 1 >= argc) {
- fprintf(stderr, "Error: integer argument expected for parameter \"%s\".\n", argv[pos]);
- return(-1);
- }
- value->strValue = argv[++pos];
- if(sscanf(value->strValue, "%d", &(value->intValue)) != 1) {
- fprintf(stderr, "Error: integer argument \"%s\" is invalid.\n", value->strValue);
- return(-1);
- }
- break;
- case xmlSecAppCmdLineParamTypeTime:
- if(pos + 1 >= argc) {
- fprintf(stderr, "Error: time argument expected for parameter \"%s\".\n", argv[pos]);
- return(-1);
- }
- value->strValue = argv[++pos];
- if(xmlSecAppCmdLineTimeParamRead(value->strValue, &(value->timeValue)) < 0) {
- fprintf(stderr, "Error: time argument \"%s\" is invalid, expected format is \"YYYY-MM-DD HH:MM:SS\").\n", value->strValue);
- return(-1);
- }
- break;
+ case xmlSecAppCmdLineParamTypeFlag:
+ /* do nothing */
+ break;
+ case xmlSecAppCmdLineParamTypeString:
+ if(pos + 1 >= argc) {
+ fprintf(stderr, "Error: string argument expected for parameter \"%s\".\n", argv[pos]);
+ return(-1);
+ }
+ value->strValue = argv[++pos];
+ break;
+ case xmlSecAppCmdLineParamTypeStringList:
+ if(pos + 1 >= argc) {
+ fprintf(stderr, "Error: string list argument expected for parameter \"%s\".\n", argv[pos]);
+ return(-1);
+ }
+ value->strValue = argv[++pos];
+ buf = (char*)malloc(strlen(value->strValue) + 2);
+ if(buf == NULL) {
+ fprintf(stderr, "Error: failed to allocate memory (%d bytes).\n", strlen(value->strValue) + 2);
+ return(-1);
+ }
+ memset(buf, 0, strlen(value->strValue) + 2);
+ memcpy(buf, value->strValue, strlen(value->strValue));
+ value->strListValue = buf;
+ while((*buf) != '\0') {
+ if((*buf) == ',') {
+ (*buf) = '\0';
+ }
+ ++buf;
+ }
+ break;
+ case xmlSecAppCmdLineParamTypeNumber:
+ if(pos + 1 >= argc) {
+ fprintf(stderr, "Error: integer argument expected for parameter \"%s\".\n", argv[pos]);
+ return(-1);
+ }
+ value->strValue = argv[++pos];
+ if(sscanf(value->strValue, "%d", &(value->intValue)) != 1) {
+ fprintf(stderr, "Error: integer argument \"%s\" is invalid.\n", value->strValue);
+ return(-1);
+ }
+ break;
+ case xmlSecAppCmdLineParamTypeTime:
+ if(pos + 1 >= argc) {
+ fprintf(stderr, "Error: time argument expected for parameter \"%s\".\n", argv[pos]);
+ return(-1);
+ }
+ value->strValue = argv[++pos];
+ if(xmlSecAppCmdLineTimeParamRead(value->strValue, &(value->timeValue)) < 0) {
+ fprintf(stderr, "Error: time argument \"%s\" is invalid, expected format is \"YYYY-MM-DD HH:MM:SS\").\n", value->strValue);
+ return(-1);
+ }
+ break;
}
return(pos);
}
@@ -329,21 +329,21 @@ xmlSecAppCmdLineTimeParamRead(const char* str, time_t* t) {
int n;
if((str == NULL) || (t == NULL)) {
- return(-1);
+ return(-1);
}
memset(&tm, 0, sizeof(tm));
tm.tm_isdst = -1;
n = sscanf(str, "%4d-%2d-%2d%*c%2d:%2d:%2d",
- &tm.tm_year, &tm.tm_mon, &tm.tm_mday,
- &tm.tm_hour, &tm.tm_min, &tm.tm_sec);
+ &tm.tm_year, &tm.tm_mon, &tm.tm_mday,
+ &tm.tm_hour, &tm.tm_min, &tm.tm_sec);
if((n != 6) || (tm.tm_year < 1900)
- || (tm.tm_mon < 1) || (tm.tm_mon > 12)
- || (tm.tm_mday < 1) || (tm.tm_mday > 31)
- || (tm.tm_hour < 0) || (tm.tm_hour > 23)
- || (tm.tm_min < 0) || (tm.tm_min > 59)
- || (tm.tm_sec < 0) || (tm.tm_sec > 61)) {
- return(-1);
+ || (tm.tm_mon < 1) || (tm.tm_mon > 12)
+ || (tm.tm_mday < 1) || (tm.tm_mday > 31)
+ || (tm.tm_hour < 0) || (tm.tm_hour > 23)
+ || (tm.tm_min < 0) || (tm.tm_min > 59)
+ || (tm.tm_sec < 0) || (tm.tm_sec > 61)) {
+ return(-1);
}
tm.tm_year -= 1900; /* tm relative format year */
diff --git a/apps/cmdline.h b/apps/cmdline.h
index 6039122..9466f97 100644
--- a/apps/cmdline.h
+++ b/apps/cmdline.h
@@ -16,15 +16,15 @@ extern "C" {
#include <time.h>
-typedef struct _xmlSecAppCmdLineParam xmlSecAppCmdLineParam,
- *xmlSecAppCmdLineParamPtr;
-typedef struct _xmlSecAppCmdLineValue xmlSecAppCmdLineValue,
- *xmlSecAppCmdLineValuePtr;
-typedef unsigned int xmlSecAppCmdLineParamTopic;
+typedef struct _xmlSecAppCmdLineParam xmlSecAppCmdLineParam,
+ *xmlSecAppCmdLineParamPtr;
+typedef struct _xmlSecAppCmdLineValue xmlSecAppCmdLineValue,
+ *xmlSecAppCmdLineValuePtr;
+typedef unsigned int xmlSecAppCmdLineParamTopic;
-#define xmlSecAppCmdLineParamFlagNone 0x0000
-#define xmlSecAppCmdLineParamFlagParamNameValue 0x0001
-#define xmlSecAppCmdLineParamFlagMultipleValues 0x0002
+#define xmlSecAppCmdLineParamFlagNone 0x0000
+#define xmlSecAppCmdLineParamFlagParamNameValue 0x0001
+#define xmlSecAppCmdLineParamFlagMultipleValues 0x0002
typedef enum {
xmlSecAppCmdLineParamTypeFlag,
@@ -35,48 +35,48 @@ typedef enum {
} xmlSecAppCmdLineParamType;
struct _xmlSecAppCmdLineParam {
- xmlSecAppCmdLineParamTopic topics;
- const char* fullName;
- const char* shortName;
- const char* help;
- xmlSecAppCmdLineParamType type;
- int flags;
- xmlSecAppCmdLineValuePtr value;
+ xmlSecAppCmdLineParamTopic topics;
+ const char* fullName;
+ const char* shortName;
+ const char* help;
+ xmlSecAppCmdLineParamType type;
+ int flags;
+ xmlSecAppCmdLineValuePtr value;
};
-int xmlSecAppCmdLineParamIsSet (xmlSecAppCmdLineParamPtr param);
-const char* xmlSecAppCmdLineParamGetString (xmlSecAppCmdLineParamPtr param);
-const char* xmlSecAppCmdLineParamGetStringList (xmlSecAppCmdLineParamPtr param);
-int xmlSecAppCmdLineParamGetInt (xmlSecAppCmdLineParamPtr param,
- int def);
-time_t xmlSecAppCmdLineParamGetTime (xmlSecAppCmdLineParamPtr param,
- time_t def);
-
-int xmlSecAppCmdLineParamsListParse (xmlSecAppCmdLineParamPtr* params,
- xmlSecAppCmdLineParamTopic topcis,
- const char** argv,
- int argc,
- int pos);
-void xmlSecAppCmdLineParamsListClean (xmlSecAppCmdLineParamPtr* params);
-void xmlSecAppCmdLineParamsListPrint (xmlSecAppCmdLineParamPtr* params,
- xmlSecAppCmdLineParamTopic topic,
- FILE* output);
+int xmlSecAppCmdLineParamIsSet (xmlSecAppCmdLineParamPtr param);
+const char* xmlSecAppCmdLineParamGetString (xmlSecAppCmdLineParamPtr param);
+const char* xmlSecAppCmdLineParamGetStringList (xmlSecAppCmdLineParamPtr param);
+int xmlSecAppCmdLineParamGetInt (xmlSecAppCmdLineParamPtr param,
+ int def);
+time_t xmlSecAppCmdLineParamGetTime (xmlSecAppCmdLineParamPtr param,
+ time_t def);
+
+int xmlSecAppCmdLineParamsListParse (xmlSecAppCmdLineParamPtr* params,
+ xmlSecAppCmdLineParamTopic topcis,
+ const char** argv,
+ int argc,
+ int pos);
+void xmlSecAppCmdLineParamsListClean (xmlSecAppCmdLineParamPtr* params);
+void xmlSecAppCmdLineParamsListPrint (xmlSecAppCmdLineParamPtr* params,
+ xmlSecAppCmdLineParamTopic topic,
+ FILE* output);
struct _xmlSecAppCmdLineValue {
- xmlSecAppCmdLineParamPtr param;
- int pos;
- const char* paramNameValue;
- const char* strValue;
- const char* strListValue;
- int intValue;
- time_t timeValue;
- xmlSecAppCmdLineValuePtr next;
+ xmlSecAppCmdLineParamPtr param;
+ int pos;
+ const char* paramNameValue;
+ const char* strValue;
+ const char* strListValue;
+ int intValue;
+ time_t timeValue;
+ xmlSecAppCmdLineValuePtr next;
};
-xmlSecAppCmdLineValuePtr xmlSecAppCmdLineValueCreate (xmlSecAppCmdLineParamPtr param,
- int pos);
-void xmlSecAppCmdLineValueDestroy (xmlSecAppCmdLineValuePtr value);
+xmlSecAppCmdLineValuePtr xmlSecAppCmdLineValueCreate (xmlSecAppCmdLineParamPtr param,
+ int pos);
+void xmlSecAppCmdLineValueDestroy (xmlSecAppCmdLineValuePtr value);
#ifdef __cplusplus
diff --git a/apps/crypto.c b/apps/crypto.c
index 5e3d5ca..49dd127 100644
--- a/apps/crypto.c
+++ b/apps/crypto.c
@@ -23,20 +23,20 @@
int
xmlSecAppCryptoInit(const char* config) {
if(xmlSecCryptoAppInit(config) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoAppInit",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCryptoAppInit",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if(xmlSecCryptoInit() < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoInit",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCryptoInit",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -45,21 +45,21 @@ xmlSecAppCryptoInit(const char* config) {
int
xmlSecAppCryptoShutdown(void) {
if(xmlSecCryptoShutdown() < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoShutdown",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCryptoShutdown",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if(xmlSecCryptoAppShutdown() < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoAppShutdown",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCryptoAppShutdown",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
@@ -89,11 +89,11 @@ xmlSecAppCryptoSimpleKeysMngrSave(xmlSecKeysMngrPtr mngr, const char *filename,
int
xmlSecAppCryptoSimpleKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
- xmlSecKeyDataFormat format, xmlSecKeyDataType type) {
+ xmlSecKeyDataFormat format, xmlSecKeyDataType type) {
xmlSecAssert2(mngr != NULL, -1);
xmlSecAssert2(filename != NULL, -1);
-#ifndef XMLSEC_NO_X509
+#ifndef XMLSEC_NO_X509
return(xmlSecCryptoAppKeysMngrCertLoad(mngr, filename, format, type));
#else /* XMLSEC_NO_X509 */
return(-1);
@@ -102,9 +102,9 @@ xmlSecAppCryptoSimpleKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filena
int
xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad(xmlSecKeysMngrPtr mngr,
- const char* files, const char* pwd,
- const char* name,
- xmlSecKeyDataFormat format) {
+ const char* files, const char* pwd,
+ const char* name,
+ xmlSecKeyDataFormat format) {
xmlSecKeyPtr key;
int ret;
@@ -113,66 +113,66 @@ xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad(xmlSecKeysMngrPtr mngr,
/* first is the key file */
key = xmlSecCryptoAppKeyLoad(files, format, pwd,
- xmlSecCryptoAppGetDefaultPwdCallback(), (void*)files);
+ xmlSecCryptoAppGetDefaultPwdCallback(), (void*)files);
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoAppKeyLoad",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "uri=%s",
- xmlSecErrorsSafeString(files));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCryptoAppKeyLoad",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "uri=%s",
+ xmlSecErrorsSafeString(files));
+ return(-1);
}
if(name != NULL) {
- ret = xmlSecKeySetName(key, BAD_CAST name);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeySetName",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(name));
- xmlSecKeyDestroy(key);
- return(-1);
- }
+ ret = xmlSecKeySetName(key, BAD_CAST name);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeySetName",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(name));
+ xmlSecKeyDestroy(key);
+ return(-1);
+ }
}
#ifndef XMLSEC_NO_X509
for(files += strlen(files) + 1; (files[0] != '\0'); files += strlen(files) + 1) {
- ret = xmlSecCryptoAppKeyCertLoad(key, files, format);
- if(ret < 0){
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoAppKeyCertLoad",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "uri=%s",
- xmlSecErrorsSafeString(files));
- xmlSecKeyDestroy(key);
- return(-1);
- }
+ ret = xmlSecCryptoAppKeyCertLoad(key, files, format);
+ if(ret < 0){
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCryptoAppKeyCertLoad",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "uri=%s",
+ xmlSecErrorsSafeString(files));
+ xmlSecKeyDestroy(key);
+ return(-1);
+ }
}
#else /* XMLSEC_NO_X509 */
files += strlen(files) + 1;
if(files[0] != '\0') {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "x509",
- XMLSEC_ERRORS_R_DISABLED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "x509",
+ XMLSEC_ERRORS_R_DISABLED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
#endif /* XMLSEC_NO_X509 */
ret = xmlSecCryptoAppDefaultKeysMngrAdoptKey(mngr, key);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoAppDefaultKeysMngrAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(key);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCryptoAppDefaultKeysMngrAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(key);
+ return(-1);
}
return(0);
@@ -189,49 +189,49 @@ xmlSecAppCryptoSimpleKeysMngrPkcs12KeyLoad(xmlSecKeysMngrPtr mngr, const char *f
#ifndef XMLSEC_NO_X509
key = xmlSecCryptoAppKeyLoad(filename, xmlSecKeyDataFormatPkcs12, pwd,
- xmlSecCryptoAppGetDefaultPwdCallback(), (void*)filename);
+ xmlSecCryptoAppGetDefaultPwdCallback(), (void*)filename);
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoAppKeyLoad",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "filename=%s",
- xmlSecErrorsSafeString(filename));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCryptoAppKeyLoad",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "filename=%s",
+ xmlSecErrorsSafeString(filename));
+ return(-1);
}
if(name != NULL) {
- ret = xmlSecKeySetName(key, BAD_CAST name);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeySetName",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(name));
- xmlSecKeyDestroy(key);
- return(-1);
- }
+ ret = xmlSecKeySetName(key, BAD_CAST name);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeySetName",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(name));
+ xmlSecKeyDestroy(key);
+ return(-1);
+ }
}
ret = xmlSecCryptoAppDefaultKeysMngrAdoptKey(mngr, key);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoAppDefaultKeysMngrAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(key);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCryptoAppDefaultKeysMngrAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(key);
+ return(-1);
}
return(0);
#else /* XMLSEC_NO_X509 */
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "x509",
- XMLSEC_ERRORS_R_DISABLED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "x509",
+ XMLSEC_ERRORS_R_DISABLED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
#endif /* XMLSEC_NO_X509 */
}
@@ -248,49 +248,49 @@ xmlSecAppCryptoSimpleKeysMngrBinaryKeyLoad(xmlSecKeysMngrPtr mngr, const char* k
/* find requested data */
dataId = xmlSecKeyDataIdListFindByName(xmlSecKeyDataIdsGet(), BAD_CAST keyKlass,
- xmlSecKeyDataUsageAny);
+ xmlSecKeyDataUsageAny);
if(dataId == xmlSecKeyDataIdUnknown) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataIdListFindByName",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(keyKlass));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataIdListFindByName",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(keyKlass));
+ return(-1);
}
key = xmlSecKeyReadBinaryFile(dataId, filename);
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyReadBinaryFile",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyReadBinaryFile",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecKeySetName(key, BAD_CAST name);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeySetName",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(name));
- xmlSecKeyDestroy(key);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeySetName",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(name));
+ xmlSecKeyDestroy(key);
+ return(-1);
}
/* finally add it to keys manager */
ret = xmlSecCryptoAppDefaultKeysMngrAdoptKey(mngr, key);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoAppDefaultKeysMngrAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(key);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCryptoAppDefaultKeysMngrAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(key);
+ return(-1);
}
return(0);
@@ -307,24 +307,24 @@ xmlSecAppCryptoSimpleKeysMngrKeyGenerate(xmlSecKeysMngrPtr mngr, const char* key
key = xmlSecAppCryptoKeyGenerate(keyKlassAndSize, name, xmlSecKeyDataTypePermanent);
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAppCryptoSimpleKeysMngrKeyGenerate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(name));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAppCryptoSimpleKeysMngrKeyGenerate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(name));
+ return(-1);
}
ret = xmlSecCryptoAppDefaultKeysMngrAdoptKey(mngr, key);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoAppDefaultKeysMngrAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(key);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCryptoAppDefaultKeysMngrAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(key);
+ return(-1);
}
return(0);
}
@@ -341,54 +341,54 @@ xmlSecAppCryptoKeyGenerate(const char* keyKlassAndSize, const char* name, xmlSec
buf = (char*) xmlStrdup(BAD_CAST keyKlassAndSize);
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_STRDUP_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(name));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_STRDUP_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(name));
+ return(NULL);
}
/* separate key klass and size */
p = strchr(buf, '-');
if(p == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "key size is not specified %s",
- xmlSecErrorsSafeString(buf));
- xmlFree(buf);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "key size is not specified %s",
+ xmlSecErrorsSafeString(buf));
+ xmlFree(buf);
+ return(NULL);
}
*(p++) = '\0';
size = atoi(p);
key = xmlSecKeyGenerateByName(BAD_CAST buf, size, type);
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyGenerate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "klass=%s;size=%d",
- xmlSecErrorsSafeString(buf),
- size);
- xmlFree(buf);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyGenerate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "klass=%s;size=%d",
+ xmlSecErrorsSafeString(buf),
+ size);
+ xmlFree(buf);
+ return(NULL);
}
ret = xmlSecKeySetName(key, BAD_CAST name);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeySetName",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=\"%s\"",
- xmlSecErrorsSafeString(name));
- xmlSecKeyDestroy(key);
- xmlFree(buf);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeySetName",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=\"%s\"",
+ xmlSecErrorsSafeString(name));
+ xmlSecKeyDestroy(key);
+ xmlFree(buf);
+ return(NULL);
}
xmlFree(buf);
diff --git a/apps/crypto.h b/apps/crypto.h
index 1ce2c3e..63a94a4 100644
--- a/apps/crypto.h
+++ b/apps/crypto.h
@@ -20,44 +20,44 @@ extern "C" {
#include <xmlsec/keysmngr.h>
#include <xmlsec/crypto.h>
-int xmlSecAppCryptoInit (const char* config);
-int xmlSecAppCryptoShutdown (void);
+int xmlSecAppCryptoInit (const char* config);
+int xmlSecAppCryptoShutdown (void);
-xmlSecKeyPtr xmlSecAppCryptoKeyGenerate (const char* keyKlassAndSize,
- const char* name,
- xmlSecKeyDataType type);
+xmlSecKeyPtr xmlSecAppCryptoKeyGenerate (const char* keyKlassAndSize,
+ const char* name,
+ xmlSecKeyDataType type);
/*****************************************************************************
*
* Simple keys manager
*
****************************************************************************/
-int xmlSecAppCryptoSimpleKeysMngrInit (xmlSecKeysMngrPtr mngr);
-int xmlSecAppCryptoSimpleKeysMngrLoad (xmlSecKeysMngrPtr mngr,
- const char *filename);
-int xmlSecAppCryptoSimpleKeysMngrSave (xmlSecKeysMngrPtr mngr,
- const char *filename,
- xmlSecKeyDataType type);
-int xmlSecAppCryptoSimpleKeysMngrCertLoad (xmlSecKeysMngrPtr mngr,
- const char *filename,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type);
-int xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad (xmlSecKeysMngrPtr mngr,
- const char *files,
- const char* pwd,
- const char* name,
- xmlSecKeyDataFormat format);
-int xmlSecAppCryptoSimpleKeysMngrPkcs12KeyLoad (xmlSecKeysMngrPtr mngr,
- const char *filename,
- const char* pwd,
- const char *name);
-int xmlSecAppCryptoSimpleKeysMngrBinaryKeyLoad (xmlSecKeysMngrPtr mngr,
- const char* keyKlass,
- const char* filename,
- const char *name);
-int xmlSecAppCryptoSimpleKeysMngrKeyGenerate (xmlSecKeysMngrPtr mngr,
- const char* keyKlassAndSize,
- const char* name);
+int xmlSecAppCryptoSimpleKeysMngrInit (xmlSecKeysMngrPtr mngr);
+int xmlSecAppCryptoSimpleKeysMngrLoad (xmlSecKeysMngrPtr mngr,
+ const char *filename);
+int xmlSecAppCryptoSimpleKeysMngrSave (xmlSecKeysMngrPtr mngr,
+ const char *filename,
+ xmlSecKeyDataType type);
+int xmlSecAppCryptoSimpleKeysMngrCertLoad (xmlSecKeysMngrPtr mngr,
+ const char *filename,
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type);
+int xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad (xmlSecKeysMngrPtr mngr,
+ const char *files,
+ const char* pwd,
+ const char* name,
+ xmlSecKeyDataFormat format);
+int xmlSecAppCryptoSimpleKeysMngrPkcs12KeyLoad (xmlSecKeysMngrPtr mngr,
+ const char *filename,
+ const char* pwd,
+ const char *name);
+int xmlSecAppCryptoSimpleKeysMngrBinaryKeyLoad (xmlSecKeysMngrPtr mngr,
+ const char* keyKlass,
+ const char* filename,
+ const char *name);
+int xmlSecAppCryptoSimpleKeysMngrKeyGenerate (xmlSecKeysMngrPtr mngr,
+ const char* keyKlassAndSize,
+ const char* name);
#ifdef __cplusplus
diff --git a/apps/xmlsec.c b/apps/xmlsec.c
index f2fa9f6..9c3b114 100644
--- a/apps/xmlsec.c
+++ b/apps/xmlsec.c
@@ -56,23 +56,23 @@ static const char helpCommands1[] =
"\n"
"xmlsec is a command line tool for signing, verifying, encrypting and\n"
"decrypting XML documents. The allowed <command> values are:\n"
- " --help " "\tdisplay this help information and exit\n"
- " --help-all " "\tdisplay help information for all commands/options and exit\n"
- " --help-<cmd>" "\tdisplay help information for command <cmd> and exit\n"
- " --version " "\tprint version information and exit\n"
- " --keys " "\tkeys XML file manipulation\n";
+ " --help " "\tdisplay this help information and exit\n"
+ " --help-all " "\tdisplay help information for all commands/options and exit\n"
+ " --help-<cmd>" "\tdisplay help information for command <cmd> and exit\n"
+ " --version " "\tprint version information and exit\n"
+ " --keys " "\tkeys XML file manipulation\n";
static const char helpCommands2[] =
#ifndef XMLSEC_NO_XMLDSIG
- " --sign " "\tsign data and output XML document\n"
- " --verify " "\tverify signed document\n"
+ " --sign " "\tsign data and output XML document\n"
+ " --verify " "\tverify signed document\n"
#ifndef XMLSEC_NO_TMPL_TEST
- " --sign-tmpl " "\tcreate and sign dynamicaly generated signature template\n"
+ " --sign-tmpl " "\tcreate and sign dynamicaly generated signature template\n"
#endif /* XMLSEC_NO_TMPL_TEST */
#endif /* XMLSEC_NO_XMLDSIG */
#ifndef XMLSEC_NO_XMLENC
- " --encrypt " "\tencrypt data and output XML document\n"
- " --decrypt " "\tdecrypt data from XML document\n"
+ " --encrypt " "\tencrypt data and output XML document\n"
+ " --decrypt " "\tdecrypt data from XML document\n"
#endif /* XMLSEC_NO_XMLENC */
#ifndef XMLSEC_NO_XKMS
" --xkms-server-request ""\tprocess data as XKMS server request\n"
@@ -132,18 +132,18 @@ static const char helpCheckTransforms[] =
"Usage: xmlsec check-transforms <transform-name> [<transform-name> ... ]\n"
"Checks the given transforms against the list of known transform klasses\n";
-#define xmlSecAppCmdLineTopicGeneral 0x0001
-#define xmlSecAppCmdLineTopicDSigCommon 0x0002
-#define xmlSecAppCmdLineTopicDSigSign 0x0004
-#define xmlSecAppCmdLineTopicDSigVerify 0x0008
-#define xmlSecAppCmdLineTopicEncCommon 0x0010
-#define xmlSecAppCmdLineTopicEncEncrypt 0x0020
-#define xmlSecAppCmdLineTopicEncDecrypt 0x0040
-#define xmlSecAppCmdLineTopicXkmsCommon 0x0080
-#define xmlSecAppCmdLineTopicKeysMngr 0x1000
-#define xmlSecAppCmdLineTopicX509Certs 0x2000
-#define xmlSecAppCmdLineTopicVersion 0x4000
-#define xmlSecAppCmdLineTopicAll 0xFFFF
+#define xmlSecAppCmdLineTopicGeneral 0x0001
+#define xmlSecAppCmdLineTopicDSigCommon 0x0002
+#define xmlSecAppCmdLineTopicDSigSign 0x0004
+#define xmlSecAppCmdLineTopicDSigVerify 0x0008
+#define xmlSecAppCmdLineTopicEncCommon 0x0010
+#define xmlSecAppCmdLineTopicEncEncrypt 0x0020
+#define xmlSecAppCmdLineTopicEncDecrypt 0x0040
+#define xmlSecAppCmdLineTopicXkmsCommon 0x0080
+#define xmlSecAppCmdLineTopicKeysMngr 0x1000
+#define xmlSecAppCmdLineTopicX509Certs 0x2000
+#define xmlSecAppCmdLineTopicVersion 0x4000
+#define xmlSecAppCmdLineTopicAll 0xFFFF
/****************************************************************
*
@@ -929,71 +929,71 @@ typedef enum {
xmlSecAppCommandXkmsServerRequest
} xmlSecAppCommand;
-typedef struct _xmlSecAppXmlData xmlSecAppXmlData,
- *xmlSecAppXmlDataPtr;
+typedef struct _xmlSecAppXmlData xmlSecAppXmlData,
+ *xmlSecAppXmlDataPtr;
struct _xmlSecAppXmlData {
- xmlDocPtr doc;
- xmlDtdPtr dtd;
- xmlNodePtr startNode;
+ xmlDocPtr doc;
+ xmlDtdPtr dtd;
+ xmlNodePtr startNode;
};
-static xmlSecAppXmlDataPtr xmlSecAppXmlDataCreate (const char* filename,
- const xmlChar* defStartNodeName,
- const xmlChar* defStartNodeNs);
-static void xmlSecAppXmlDataDestroy (xmlSecAppXmlDataPtr data);
+static xmlSecAppXmlDataPtr xmlSecAppXmlDataCreate (const char* filename,
+ const xmlChar* defStartNodeName,
+ const xmlChar* defStartNodeNs);
+static void xmlSecAppXmlDataDestroy (xmlSecAppXmlDataPtr data);
-static xmlSecAppCommand xmlSecAppParseCommand (const char* cmd,
- xmlSecAppCmdLineParamTopic* topics,
- xmlSecAppCommand* subCommand);
-static void xmlSecAppPrintHelp (xmlSecAppCommand command,
- xmlSecAppCmdLineParamTopic topics);
-#define xmlSecAppPrintUsage() xmlSecAppPrintHelp(xmlSecAppCommandUnknown, 0)
-static int xmlSecAppInit (void);
-static void xmlSecAppShutdown (void);
-static int xmlSecAppLoadKeys (void);
-static int xmlSecAppPrepareKeyInfoReadCtx (xmlSecKeyInfoCtxPtr ctx);
+static xmlSecAppCommand xmlSecAppParseCommand (const char* cmd,
+ xmlSecAppCmdLineParamTopic* topics,
+ xmlSecAppCommand* subCommand);
+static void xmlSecAppPrintHelp (xmlSecAppCommand command,
+ xmlSecAppCmdLineParamTopic topics);
+#define xmlSecAppPrintUsage() xmlSecAppPrintHelp(xmlSecAppCommandUnknown, 0)
+static int xmlSecAppInit (void);
+static void xmlSecAppShutdown (void);
+static int xmlSecAppLoadKeys (void);
+static int xmlSecAppPrepareKeyInfoReadCtx (xmlSecKeyInfoCtxPtr ctx);
#ifndef XMLSEC_NO_XMLDSIG
-static int xmlSecAppSignFile (const char* filename);
-static int xmlSecAppVerifyFile (const char* filename);
+static int xmlSecAppSignFile (const char* filename);
+static int xmlSecAppVerifyFile (const char* filename);
#ifndef XMLSEC_NO_TMPL_TEST
-static int xmlSecAppSignTmpl (void);
+static int xmlSecAppSignTmpl (void);
#endif /* XMLSEC_NO_TMPL_TEST */
-static int xmlSecAppPrepareDSigCtx (xmlSecDSigCtxPtr dsigCtx);
-static void xmlSecAppPrintDSigCtx (xmlSecDSigCtxPtr dsigCtx);
+static int xmlSecAppPrepareDSigCtx (xmlSecDSigCtxPtr dsigCtx);
+static void xmlSecAppPrintDSigCtx (xmlSecDSigCtxPtr dsigCtx);
#endif /* XMLSEC_NO_XMLDSIG */
#ifndef XMLSEC_NO_XMLENC
-static int xmlSecAppEncryptFile (const char* filename);
-static int xmlSecAppDecryptFile (const char* filename);
+static int xmlSecAppEncryptFile (const char* filename);
+static int xmlSecAppDecryptFile (const char* filename);
#ifndef XMLSEC_NO_TMPL_TEST
-static int xmlSecAppEncryptTmpl (void);
+static int xmlSecAppEncryptTmpl (void);
#endif /* XMLSEC_NO_TMPL_TEST */
-static int xmlSecAppPrepareEncCtx (xmlSecEncCtxPtr encCtx);
-static void xmlSecAppPrintEncCtx (xmlSecEncCtxPtr encCtx);
+static int xmlSecAppPrepareEncCtx (xmlSecEncCtxPtr encCtx);
+static void xmlSecAppPrintEncCtx (xmlSecEncCtxPtr encCtx);
#endif /* XMLSEC_NO_XMLENC */
#ifndef XMLSEC_NO_XKMS
-static int xmlSecAppXkmsServerProcess (const char* filename);
-static int xmlSecAppPrepareXkmsServerCtx (xmlSecXkmsServerCtxPtr xkmsServerCtx);
-static void xmlSecAppPrintXkmsServerCtx (xmlSecXkmsServerCtxPtr xkmsServerCtx);
+static int xmlSecAppXkmsServerProcess (const char* filename);
+static int xmlSecAppPrepareXkmsServerCtx (xmlSecXkmsServerCtxPtr xkmsServerCtx);
+static void xmlSecAppPrintXkmsServerCtx (xmlSecXkmsServerCtxPtr xkmsServerCtx);
#endif /* XMLSEC_NO_XKMS */
-static void xmlSecAppListKeyData (void);
-static int xmlSecAppCheckKeyData (const char * name);
-static void xmlSecAppListTransforms (void);
-static int xmlSecAppCheckTransform (const char * name);
-
-static xmlSecTransformUriType xmlSecAppGetUriType (const char* string);
-static FILE* xmlSecAppOpenFile (const char* filename);
-static void xmlSecAppCloseFile (FILE* file);
-static int xmlSecAppWriteResult (xmlDocPtr doc,
- xmlSecBufferPtr buffer);
-static int xmlSecAppAddIDAttr (xmlNodePtr cur,
- const xmlChar* attr,
- const xmlChar* node,
- const xmlChar* nsHref);
+static void xmlSecAppListKeyData (void);
+static int xmlSecAppCheckKeyData (const char * name);
+static void xmlSecAppListTransforms (void);
+static int xmlSecAppCheckTransform (const char * name);
+
+static xmlSecTransformUriType xmlSecAppGetUriType (const char* string);
+static FILE* xmlSecAppOpenFile (const char* filename);
+static void xmlSecAppCloseFile (FILE* file);
+static int xmlSecAppWriteResult (xmlDocPtr doc,
+ xmlSecBufferPtr buffer);
+static int xmlSecAppAddIDAttr (xmlNodePtr cur,
+ const xmlChar* attr,
+ const xmlChar* node,
+ const xmlChar* nsHref);
xmlSecKeysMngrPtr gKeysMngr = NULL;
int repeats = 1;
@@ -1010,198 +1010,198 @@ int main(int argc, const char **argv) {
/* read the command (first argument) */
if(argc < 2) {
- xmlSecAppPrintUsage();
- goto fail;
+ xmlSecAppPrintUsage();
+ goto fail;
}
command = xmlSecAppParseCommand(argv[1], &cmdLineTopics, &subCommand);
if(command == xmlSecAppCommandUnknown) {
- fprintf(stderr, "Error: unknown command \"%s\"\n", argv[1]);
- xmlSecAppPrintUsage();
- goto fail;
+ fprintf(stderr, "Error: unknown command \"%s\"\n", argv[1]);
+ xmlSecAppPrintUsage();
+ goto fail;
}
/* do as much as we can w/o initialization */
if(command == xmlSecAppCommandHelp) {
- xmlSecAppPrintHelp(subCommand, cmdLineTopics);
- goto success;
+ xmlSecAppPrintHelp(subCommand, cmdLineTopics);
+ goto success;
} else if(command == xmlSecAppCommandVersion) {
- fprintf(stdout, "%s %s (%s)\n", PACKAGE, XMLSEC_VERSION, xmlsec_crypto);
- goto success;
+ fprintf(stdout, "%s %s (%s)\n", PACKAGE, XMLSEC_VERSION, xmlsec_crypto);
+ goto success;
}
/* parse command line */
pos = xmlSecAppCmdLineParamsListParse(parameters, cmdLineTopics, argv, argc, 2);
if(pos < 0) {
- fprintf(stderr, "Error: invalid parameters\n");
- xmlSecAppPrintUsage();
- goto fail;
+ fprintf(stderr, "Error: invalid parameters\n");
+ xmlSecAppPrintUsage();
+ goto fail;
}
/* is it a help request? */
if(xmlSecAppCmdLineParamIsSet(&helpParam)) {
- xmlSecAppPrintHelp(command, cmdLineTopics);
- goto success;
+ xmlSecAppPrintHelp(command, cmdLineTopics);
+ goto success;
}
/* we need to have some files at the end */
switch(command) {
- case xmlSecAppCommandKeys:
- case xmlSecAppCommandSign:
- case xmlSecAppCommandVerify:
- case xmlSecAppCommandEncrypt:
- case xmlSecAppCommandDecrypt:
- case xmlSecAppCommandXkmsServerRequest:
- if(pos >= argc) {
- fprintf(stderr, "Error: <file> parameter is requried for this command\n");
- xmlSecAppPrintUsage();
- goto fail;
- }
- break;
- default:
- break;
+ case xmlSecAppCommandKeys:
+ case xmlSecAppCommandSign:
+ case xmlSecAppCommandVerify:
+ case xmlSecAppCommandEncrypt:
+ case xmlSecAppCommandDecrypt:
+ case xmlSecAppCommandXkmsServerRequest:
+ if(pos >= argc) {
+ fprintf(stderr, "Error: <file> parameter is requried for this command\n");
+ xmlSecAppPrintUsage();
+ goto fail;
+ }
+ break;
+ default:
+ break;
}
/* now init the xmlsec and all other libs */
#if !defined(XMLSEC_NO_CRYPTO_DYNAMIC_LOADING) && defined(XMLSEC_CRYPTO_DYNAMIC_LOADING)
tmp = xmlSecAppCmdLineParamGetString(&cryptoParam);
if((tmp != NULL) && (strcmp(tmp, "default") != 0)) {
- xmlsec_crypto = tmp;
+ xmlsec_crypto = tmp;
}
#endif /* !defined(XMLSEC_NO_CRYPTO_DYNAMIC_LOADING) && defined(XMLSEC_CRYPTO_DYNAMIC_LOADING) */
if(xmlSecAppInit() < 0) {
- fprintf(stderr, "Error: initialization failed\n");
- xmlSecAppPrintUsage();
- goto fail;
+ fprintf(stderr, "Error: initialization failed\n");
+ xmlSecAppPrintUsage();
+ goto fail;
}
/* load keys */
if(xmlSecAppLoadKeys() < 0) {
- fprintf(stderr, "Error: keys manager creation failed\n");
- xmlSecAppPrintUsage();
- goto fail;
+ fprintf(stderr, "Error: keys manager creation failed\n");
+ xmlSecAppPrintUsage();
+ goto fail;
}
/* get the "repeats" number */
if(xmlSecAppCmdLineParamIsSet(&repeatParam) &&
(xmlSecAppCmdLineParamGetInt(&repeatParam, 1) > 0)) {
- repeats = xmlSecAppCmdLineParamGetInt(&repeatParam, 1);
+ repeats = xmlSecAppCmdLineParamGetInt(&repeatParam, 1);
}
/* execute requested number of times */
for(; repeats > 0; --repeats) {
- switch(command) {
- case xmlSecAppCommandListKeyData:
- xmlSecAppListKeyData();
- break;
- case xmlSecAppCommandCheckKeyData:
- for(i = pos; i < argc; ++i) {
+ switch(command) {
+ case xmlSecAppCommandListKeyData:
+ xmlSecAppListKeyData();
+ break;
+ case xmlSecAppCommandCheckKeyData:
+ for(i = pos; i < argc; ++i) {
if(xmlSecAppCheckKeyData(argv[i]) < 0) {
fprintf(stderr, "Error: key data \"%s\" not found\n", argv[i]);
goto fail;
} else {
fprintf(stdout, "Key data \"%s\" found\n", argv[i]);
}
- }
- break;
- case xmlSecAppCommandListTransforms:
- xmlSecAppListTransforms();
- break;
- case xmlSecAppCommandCheckTransforms:
- for(i = pos; i < argc; ++i) {
+ }
+ break;
+ case xmlSecAppCommandListTransforms:
+ xmlSecAppListTransforms();
+ break;
+ case xmlSecAppCommandCheckTransforms:
+ for(i = pos; i < argc; ++i) {
if(xmlSecAppCheckTransform(argv[i]) < 0) {
fprintf(stderr, "Error: transform \"%s\" not found\n", argv[i]);
goto fail;
} else {
fprintf(stdout, "Transforms \"%s\" found\n", argv[i]);
}
- }
- break;
- case xmlSecAppCommandKeys:
- for(i = pos; i < argc; ++i) {
- if(xmlSecAppCryptoSimpleKeysMngrSave(gKeysMngr, argv[i], xmlSecKeyDataTypeAny) < 0) {
- fprintf(stderr, "Error: failed to save keys to file \"%s\"\n", argv[i]);
- goto fail;
- }
- }
- break;
+ }
+ break;
+ case xmlSecAppCommandKeys:
+ for(i = pos; i < argc; ++i) {
+ if(xmlSecAppCryptoSimpleKeysMngrSave(gKeysMngr, argv[i], xmlSecKeyDataTypeAny) < 0) {
+ fprintf(stderr, "Error: failed to save keys to file \"%s\"\n", argv[i]);
+ goto fail;
+ }
+ }
+ break;
#ifndef XMLSEC_NO_XMLDSIG
- case xmlSecAppCommandSign:
- for(i = pos; i < argc; ++i) {
- if(xmlSecAppSignFile(argv[i]) < 0) {
- fprintf(stderr, "Error: failed to sign file \"%s\"\n", argv[i]);
- goto fail;
- }
- }
- break;
- case xmlSecAppCommandVerify:
- for(i = pos; i < argc; ++i) {
- if(xmlSecAppVerifyFile(argv[i]) < 0) {
- fprintf(stderr, "Error: failed to verify file \"%s\"\n", argv[i]);
- goto fail;
- }
- }
- break;
+ case xmlSecAppCommandSign:
+ for(i = pos; i < argc; ++i) {
+ if(xmlSecAppSignFile(argv[i]) < 0) {
+ fprintf(stderr, "Error: failed to sign file \"%s\"\n", argv[i]);
+ goto fail;
+ }
+ }
+ break;
+ case xmlSecAppCommandVerify:
+ for(i = pos; i < argc; ++i) {
+ if(xmlSecAppVerifyFile(argv[i]) < 0) {
+ fprintf(stderr, "Error: failed to verify file \"%s\"\n", argv[i]);
+ goto fail;
+ }
+ }
+ break;
#ifndef XMLSEC_NO_TMPL_TEST
- case xmlSecAppCommandSignTmpl:
- if(xmlSecAppSignTmpl() < 0) {
- fprintf(stderr, "Error: failed to create and sign template\n");
- goto fail;
- }
- break;
+ case xmlSecAppCommandSignTmpl:
+ if(xmlSecAppSignTmpl() < 0) {
+ fprintf(stderr, "Error: failed to create and sign template\n");
+ goto fail;
+ }
+ break;
#endif /* XMLSEC_NO_TMPL_TEST */
#endif /* XMLSEC_NO_XMLDSIG */
#ifndef XMLSEC_NO_XMLENC
- case xmlSecAppCommandEncrypt:
- for(i = pos; i < argc; ++i) {
- if(xmlSecAppEncryptFile(argv[i]) < 0) {
- fprintf(stderr, "Error: failed to encrypt file with template \"%s\"\n", argv[i]);
- goto fail;
- }
- }
- break;
- case xmlSecAppCommandDecrypt:
- for(i = pos; i < argc; ++i) {
- if(xmlSecAppDecryptFile(argv[i]) < 0) {
- fprintf(stderr, "Error: failed to decrypt file \"%s\"\n", argv[i]);
- goto fail;
- }
- }
- break;
+ case xmlSecAppCommandEncrypt:
+ for(i = pos; i < argc; ++i) {
+ if(xmlSecAppEncryptFile(argv[i]) < 0) {
+ fprintf(stderr, "Error: failed to encrypt file with template \"%s\"\n", argv[i]);
+ goto fail;
+ }
+ }
+ break;
+ case xmlSecAppCommandDecrypt:
+ for(i = pos; i < argc; ++i) {
+ if(xmlSecAppDecryptFile(argv[i]) < 0) {
+ fprintf(stderr, "Error: failed to decrypt file \"%s\"\n", argv[i]);
+ goto fail;
+ }
+ }
+ break;
#ifndef XMLSEC_NO_TMPL_TEST
- case xmlSecAppCommandEncryptTmpl:
- if(xmlSecAppEncryptTmpl() < 0) {
- fprintf(stderr, "Error: failed to create and encrypt template\n");
- goto fail;
- }
- break;
+ case xmlSecAppCommandEncryptTmpl:
+ if(xmlSecAppEncryptTmpl() < 0) {
+ fprintf(stderr, "Error: failed to create and encrypt template\n");
+ goto fail;
+ }
+ break;
#endif /* XMLSEC_NO_TMPL_TEST */
#endif /* XMLSEC_NO_XMLENC */
#ifndef XMLSEC_NO_XKMS
- case xmlSecAppCommandXkmsServerRequest:
- for(i = pos; i < argc; ++i) {
- if(xmlSecAppXkmsServerProcess(argv[i]) < 0) {
- fprintf(stderr, "Error: failed to process XKMS server request from file \"%s\"\n", argv[i]);
- goto fail;
- }
- }
- break;
+ case xmlSecAppCommandXkmsServerRequest:
+ for(i = pos; i < argc; ++i) {
+ if(xmlSecAppXkmsServerProcess(argv[i]) < 0) {
+ fprintf(stderr, "Error: failed to process XKMS server request from file \"%s\"\n", argv[i]);
+ goto fail;
+ }
+ }
+ break;
#endif /* XMLSEC_NO_XKMS */
- default:
- fprintf(stderr, "Error: invalid command %d\n", command);
- xmlSecAppPrintUsage();
- goto fail;
- }
+ default:
+ fprintf(stderr, "Error: invalid command %d\n", command);
+ xmlSecAppPrintUsage();
+ goto fail;
+ }
}
/* print perf stats results */
if(xmlSecAppCmdLineParamIsSet(&repeatParam) &&
(xmlSecAppCmdLineParamGetInt(&repeatParam, 1) > 0)) {
- repeats = xmlSecAppCmdLineParamGetInt(&repeatParam, 1);
+ repeats = xmlSecAppCmdLineParamGetInt(&repeatParam, 1);
fprintf(stderr, "Executed %d tests in %ld msec\n", repeats, (1000 * total_time) / CLOCKS_PER_SEC);
}
@@ -1210,8 +1210,8 @@ success:
res = 0;
fail:
if(gKeysMngr != NULL) {
- xmlSecKeysMngrDestroy(gKeysMngr);
- gKeysMngr = NULL;
+ xmlSecKeysMngrDestroy(gKeysMngr);
+ gKeysMngr = NULL;
}
xmlSecAppShutdown();
xmlSecAppCmdLineParamsListClean(parameters);
@@ -1228,24 +1228,24 @@ xmlSecAppSignFile(const char* filename) {
int res = -1;
if(filename == NULL) {
- return(-1);
+ return(-1);
}
if(xmlSecDSigCtxInitialize(&dsigCtx, gKeysMngr) < 0) {
- fprintf(stderr, "Error: dsig context initialization failed\n");
- return(-1);
+ fprintf(stderr, "Error: dsig context initialization failed\n");
+ return(-1);
}
if(xmlSecAppPrepareDSigCtx(&dsigCtx) < 0) {
- fprintf(stderr, "Error: dsig context preparation failed\n");
- goto done;
+ fprintf(stderr, "Error: dsig context preparation failed\n");
+ goto done;
}
/* parse template and select start node */
data = xmlSecAppXmlDataCreate(filename, xmlSecNodeSignature, xmlSecDSigNs);
if(data == NULL) {
- fprintf(stderr, "Error: failed to load template \"%s\"\n", filename);
- goto done;
+ fprintf(stderr, "Error: failed to load template \"%s\"\n", filename);
+ goto done;
}
@@ -1253,32 +1253,32 @@ xmlSecAppSignFile(const char* filename) {
start_time = clock();
if(xmlSecDSigCtxSign(&dsigCtx, data->startNode) < 0) {
fprintf(stderr,"Error: signature failed \n");
- goto done;
+ goto done;
}
total_time += clock() - start_time;
if(repeats <= 1) {
- FILE* f;
+ FILE* f;
- f = xmlSecAppOpenFile(xmlSecAppCmdLineParamGetString(&outputParam));
- if(f == NULL) {
- fprintf(stderr,"Error: failed to open output file \"%s\"\n",
- xmlSecAppCmdLineParamGetString(&outputParam));
- goto done;
- }
- xmlDocDump(f, data->doc);
- xmlSecAppCloseFile(f);
+ f = xmlSecAppOpenFile(xmlSecAppCmdLineParamGetString(&outputParam));
+ if(f == NULL) {
+ fprintf(stderr,"Error: failed to open output file \"%s\"\n",
+ xmlSecAppCmdLineParamGetString(&outputParam));
+ goto done;
+ }
+ xmlDocDump(f, data->doc);
+ xmlSecAppCloseFile(f);
}
res = 0;
done:
/* print debug info if requested */
if(repeats <= 1) {
- xmlSecAppPrintDSigCtx(&dsigCtx);
+ xmlSecAppPrintDSigCtx(&dsigCtx);
}
xmlSecDSigCtxFinalize(&dsigCtx);
if(data != NULL) {
- xmlSecAppXmlDataDestroy(data);
+ xmlSecAppXmlDataDestroy(data);
}
return(res);
}
@@ -1291,98 +1291,98 @@ xmlSecAppVerifyFile(const char* filename) {
int res = -1;
if(filename == NULL) {
- return(-1);
+ return(-1);
}
if(xmlSecDSigCtxInitialize(&dsigCtx, gKeysMngr) < 0) {
- fprintf(stderr, "Error: dsig context initialization failed\n");
- return(-1);
+ fprintf(stderr, "Error: dsig context initialization failed\n");
+ return(-1);
}
if(xmlSecAppPrepareDSigCtx(&dsigCtx) < 0) {
- fprintf(stderr, "Error: dsig context preparation failed\n");
- goto done;
+ fprintf(stderr, "Error: dsig context preparation failed\n");
+ goto done;
}
/* parse template and select start node */
data = xmlSecAppXmlDataCreate(filename, xmlSecNodeSignature, xmlSecDSigNs);
if(data == NULL) {
- fprintf(stderr, "Error: failed to load document \"%s\"\n", filename);
- goto done;
+ fprintf(stderr, "Error: failed to load document \"%s\"\n", filename);
+ goto done;
}
/* sign */
start_time = clock();
if(xmlSecDSigCtxVerify(&dsigCtx, data->startNode) < 0) {
fprintf(stderr,"Error: signature failed \n");
- goto done;
+ goto done;
}
total_time += clock() - start_time;
if((repeats <= 1) && (dsigCtx.status != xmlSecDSigStatusSucceeded)){
- /* return an error if signature does not match */
- goto done;
+ /* return an error if signature does not match */
+ goto done;
}
res = 0;
done:
/* print debug info if requested */
if(repeats <= 1) {
- xmlSecDSigReferenceCtxPtr dsigRefCtx;
- xmlSecSize good, i, size;
- FILE* f;
+ xmlSecDSigReferenceCtxPtr dsigRefCtx;
+ xmlSecSize good, i, size;
+ FILE* f;
- f = xmlSecAppOpenFile(xmlSecAppCmdLineParamGetString(&outputParam));
- if(f == NULL) {
- fprintf(stderr,"Error: failed to open output file \"%s\"\n",
- xmlSecAppCmdLineParamGetString(&outputParam));
- goto done;
- }
- xmlSecAppCloseFile(f);
-
- switch(dsigCtx.status) {
- case xmlSecDSigStatusUnknown:
- fprintf(stderr, "ERROR\n");
- break;
- case xmlSecDSigStatusSucceeded:
- fprintf(stderr, "OK\n");
- break;
- case xmlSecDSigStatusInvalid:
- fprintf(stderr, "FAIL\n");
- break;
- }
-
- /* print stats about # of good/bad references/manifests */
- size = xmlSecPtrListGetSize(&(dsigCtx.signedInfoReferences));
- for(i = good = 0; i < size; ++i) {
- dsigRefCtx = (xmlSecDSigReferenceCtxPtr)xmlSecPtrListGetItem(&(dsigCtx.signedInfoReferences), i);
- if(dsigRefCtx == NULL) {
- fprintf(stderr,"Error: reference ctx is null\n");
- goto done;
- }
- if(dsigRefCtx->status == xmlSecDSigStatusSucceeded) {
- ++good;
- }
- }
- fprintf(stderr, "SignedInfo References (ok/all): %d/%d\n", good, size);
-
- size = xmlSecPtrListGetSize(&(dsigCtx.manifestReferences));
- for(i = good = 0; i < size; ++i) {
- dsigRefCtx = (xmlSecDSigReferenceCtxPtr)xmlSecPtrListGetItem(&(dsigCtx.manifestReferences), i);
- if(dsigRefCtx == NULL) {
- fprintf(stderr,"Error: reference ctx is null\n");
- goto done;
- }
- if(dsigRefCtx->status == xmlSecDSigStatusSucceeded) {
- ++good;
- }
- }
- fprintf(stderr, "Manifests References (ok/all): %d/%d\n", good, size);
-
- xmlSecAppPrintDSigCtx(&dsigCtx);
+ f = xmlSecAppOpenFile(xmlSecAppCmdLineParamGetString(&outputParam));
+ if(f == NULL) {
+ fprintf(stderr,"Error: failed to open output file \"%s\"\n",
+ xmlSecAppCmdLineParamGetString(&outputParam));
+ goto done;
+ }
+ xmlSecAppCloseFile(f);
+
+ switch(dsigCtx.status) {
+ case xmlSecDSigStatusUnknown:
+ fprintf(stderr, "ERROR\n");
+ break;
+ case xmlSecDSigStatusSucceeded:
+ fprintf(stderr, "OK\n");
+ break;
+ case xmlSecDSigStatusInvalid:
+ fprintf(stderr, "FAIL\n");
+ break;
+ }
+
+ /* print stats about # of good/bad references/manifests */
+ size = xmlSecPtrListGetSize(&(dsigCtx.signedInfoReferences));
+ for(i = good = 0; i < size; ++i) {
+ dsigRefCtx = (xmlSecDSigReferenceCtxPtr)xmlSecPtrListGetItem(&(dsigCtx.signedInfoReferences), i);
+ if(dsigRefCtx == NULL) {
+ fprintf(stderr,"Error: reference ctx is null\n");
+ goto done;
+ }
+ if(dsigRefCtx->status == xmlSecDSigStatusSucceeded) {
+ ++good;
+ }
+ }
+ fprintf(stderr, "SignedInfo References (ok/all): %d/%d\n", good, size);
+
+ size = xmlSecPtrListGetSize(&(dsigCtx.manifestReferences));
+ for(i = good = 0; i < size; ++i) {
+ dsigRefCtx = (xmlSecDSigReferenceCtxPtr)xmlSecPtrListGetItem(&(dsigCtx.manifestReferences), i);
+ if(dsigRefCtx == NULL) {
+ fprintf(stderr,"Error: reference ctx is null\n");
+ goto done;
+ }
+ if(dsigRefCtx->status == xmlSecDSigStatusSucceeded) {
+ ++good;
+ }
+ }
+ fprintf(stderr, "Manifests References (ok/all): %d/%d\n", good, size);
+
+ xmlSecAppPrintDSigCtx(&dsigCtx);
}
xmlSecDSigCtxFinalize(&dsigCtx);
if(data != NULL) {
- xmlSecAppXmlDataDestroy(data);
+ xmlSecAppXmlDataDestroy(data);
}
return(res);
}
@@ -1397,109 +1397,109 @@ xmlSecAppSignTmpl(void) {
int res = -1;
if(xmlSecDSigCtxInitialize(&dsigCtx, gKeysMngr) < 0) {
- fprintf(stderr, "Error: dsig context initialization failed\n");
- return(-1);
+ fprintf(stderr, "Error: dsig context initialization failed\n");
+ return(-1);
}
if(xmlSecAppPrepareDSigCtx(&dsigCtx) < 0) {
- fprintf(stderr, "Error: dsig context preparation failed\n");
- goto done;
+ fprintf(stderr, "Error: dsig context preparation failed\n");
+ goto done;
}
/* prepare template */
doc = xmlNewDoc(BAD_CAST "1.0");
if(doc == NULL) {
- fprintf(stderr, "Error: failed to create doc\n");
- goto done;
+ fprintf(stderr, "Error: failed to create doc\n");
+ goto done;
}
cur = xmlSecTmplSignatureCreate(doc, xmlSecTransformInclC14NId,
- xmlSecTransformHmacSha1Id, NULL);
+ xmlSecTransformHmacSha1Id, NULL);
if(cur == NULL) {
- fprintf(stderr, "Error: failed to create Signature node\n");
- goto done;
+ fprintf(stderr, "Error: failed to create Signature node\n");
+ goto done;
}
xmlDocSetRootElement(doc, cur);
/* set hmac signature length */
cur = xmlSecTmplSignatureGetSignMethodNode(xmlDocGetRootElement(doc));
if(cur == NULL) {
- fprintf(stderr, "Error: failed to find SignatureMethod node\n");
- goto done;
+ fprintf(stderr, "Error: failed to find SignatureMethod node\n");
+ goto done;
}
if(xmlSecTmplTransformAddHmacOutputLength(cur, 93) < 0) {
- fprintf(stderr, "Error: failed to set hmac length\n");
- goto done;
+ fprintf(stderr, "Error: failed to set hmac length\n");
+ goto done;
}
cur = xmlSecTmplSignatureAddReference(xmlDocGetRootElement(doc),
- xmlSecTransformSha1Id,
- BAD_CAST "ref1", NULL, NULL);
+ xmlSecTransformSha1Id,
+ BAD_CAST "ref1", NULL, NULL);
if(cur == NULL) {
- fprintf(stderr, "Error: failed to add Reference node\n");
- goto done;
+ fprintf(stderr, "Error: failed to add Reference node\n");
+ goto done;
}
cur = xmlSecTmplReferenceAddTransform(cur, xmlSecTransformXPath2Id);
if(cur == NULL) {
- fprintf(stderr, "Error: failed to add XPath transform\n");
- goto done;
+ fprintf(stderr, "Error: failed to add XPath transform\n");
+ goto done;
}
if(xmlSecTmplTransformAddXPath2(cur, BAD_CAST "intersect",
- BAD_CAST "//*[ Id='object1']", NULL) < 0) {
- fprintf(stderr, "Error: failed to set XPath expression\n");
- goto done;
+ BAD_CAST "//*[ Id='object1']", NULL) < 0) {
+ fprintf(stderr, "Error: failed to set XPath expression\n");
+ goto done;
}
cur = xmlSecTmplSignatureAddObject(xmlDocGetRootElement(doc),
- BAD_CAST "object1", NULL, NULL);
+ BAD_CAST "object1", NULL, NULL);
if(cur == NULL) {
- fprintf(stderr, "Error: failed to add Object node\n");
- goto done;
+ fprintf(stderr, "Error: failed to add Object node\n");
+ goto done;
}
xmlNodeSetContent(cur, BAD_CAST "This is signed data");
/* add key information */
cur = xmlSecTmplSignatureEnsureKeyInfo(xmlDocGetRootElement(doc), NULL);
if(cur == NULL) {
- fprintf(stderr, "Error: failed to add KeyInfo node\n");
- goto done;
+ fprintf(stderr, "Error: failed to add KeyInfo node\n");
+ goto done;
}
if(xmlSecTmplKeyInfoAddKeyName(cur, NULL) == NULL) {
- fprintf(stderr, "Error: failed to add KeyName node\n");
- goto done;
+ fprintf(stderr, "Error: failed to add KeyName node\n");
+ goto done;
}
/* sign */
start_time = clock();
if(xmlSecDSigCtxSign(&dsigCtx, xmlDocGetRootElement(doc)) < 0) {
fprintf(stderr,"Error: signature failed \n");
- goto done;
+ goto done;
}
total_time += clock() - start_time;
if(repeats <= 1) {
- FILE* f;
+ FILE* f;
- f = xmlSecAppOpenFile(xmlSecAppCmdLineParamGetString(&outputParam));
- if(f == NULL) {
- fprintf(stderr,"Error: failed to open output file \"%s\"\n",
- xmlSecAppCmdLineParamGetString(&outputParam));
- goto done;
- }
- xmlDocDump(f, doc);
- xmlSecAppCloseFile(f);
+ f = xmlSecAppOpenFile(xmlSecAppCmdLineParamGetString(&outputParam));
+ if(f == NULL) {
+ fprintf(stderr,"Error: failed to open output file \"%s\"\n",
+ xmlSecAppCmdLineParamGetString(&outputParam));
+ goto done;
+ }
+ xmlDocDump(f, doc);
+ xmlSecAppCloseFile(f);
}
res = 0;
done:
/* print debug info if requested */
if(repeats <= 1) {
- xmlSecAppPrintDSigCtx(&dsigCtx);
+ xmlSecAppPrintDSigCtx(&dsigCtx);
}
xmlSecDSigCtxFinalize(&dsigCtx);
if(doc != NULL) {
- xmlFreeDoc(doc);
+ xmlFreeDoc(doc);
}
return(res);
}
@@ -1508,51 +1508,51 @@ done:
static int
xmlSecAppPrepareDSigCtx(xmlSecDSigCtxPtr dsigCtx) {
if(dsigCtx == NULL) {
- fprintf(stderr, "Error: dsig context is null\n");
- return(-1);
+ fprintf(stderr, "Error: dsig context is null\n");
+ return(-1);
}
/* set key info params */
if(xmlSecAppPrepareKeyInfoReadCtx(&(dsigCtx->keyInfoReadCtx)) < 0) {
- fprintf(stderr, "Error: failed to prepare key info context\n");
- return(-1);
+ fprintf(stderr, "Error: failed to prepare key info context\n");
+ return(-1);
}
if(xmlSecAppCmdLineParamGetString(&sessionKeyParam) != NULL) {
- dsigCtx->signKey = xmlSecAppCryptoKeyGenerate(xmlSecAppCmdLineParamGetString(&sessionKeyParam),
- NULL, xmlSecKeyDataTypeSession);
- if(dsigCtx->signKey == NULL) {
- fprintf(stderr, "Error: failed to generate a session key \"%s\"\n",
- xmlSecAppCmdLineParamGetString(&sessionKeyParam));
- return(-1);
- }
+ dsigCtx->signKey = xmlSecAppCryptoKeyGenerate(xmlSecAppCmdLineParamGetString(&sessionKeyParam),
+ NULL, xmlSecKeyDataTypeSession);
+ if(dsigCtx->signKey == NULL) {
+ fprintf(stderr, "Error: failed to generate a session key \"%s\"\n",
+ xmlSecAppCmdLineParamGetString(&sessionKeyParam));
+ return(-1);
+ }
}
/* set dsig params */
if(xmlSecAppCmdLineParamIsSet(&ignoreManifestsParam)) {
- dsigCtx->flags |= XMLSEC_DSIG_FLAGS_IGNORE_MANIFESTS;
+ dsigCtx->flags |= XMLSEC_DSIG_FLAGS_IGNORE_MANIFESTS;
}
if(xmlSecAppCmdLineParamIsSet(&storeReferencesParam)) {
- dsigCtx->flags |= XMLSEC_DSIG_FLAGS_STORE_SIGNEDINFO_REFERENCES |
- XMLSEC_DSIG_FLAGS_STORE_MANIFEST_REFERENCES;
- print_debug = 1;
+ dsigCtx->flags |= XMLSEC_DSIG_FLAGS_STORE_SIGNEDINFO_REFERENCES |
+ XMLSEC_DSIG_FLAGS_STORE_MANIFEST_REFERENCES;
+ print_debug = 1;
}
if(xmlSecAppCmdLineParamIsSet(&storeSignaturesParam)) {
- dsigCtx->flags |= XMLSEC_DSIG_FLAGS_STORE_SIGNATURE;
- print_debug = 1;
+ dsigCtx->flags |= XMLSEC_DSIG_FLAGS_STORE_SIGNATURE;
+ print_debug = 1;
}
if(xmlSecAppCmdLineParamIsSet(&enableVisa3DHackParam)) {
- dsigCtx->flags |= XMLSEC_DSIG_FLAGS_USE_VISA3D_HACK;
+ dsigCtx->flags |= XMLSEC_DSIG_FLAGS_USE_VISA3D_HACK;
}
if(xmlSecAppCmdLineParamGetStringList(&enabledRefUrisParam) != NULL) {
- dsigCtx->enabledReferenceUris = xmlSecAppGetUriType(
- xmlSecAppCmdLineParamGetStringList(&enabledRefUrisParam));
- if(dsigCtx->enabledReferenceUris == xmlSecTransformUriTypeNone) {
- fprintf(stderr, "Error: failed to parse \"%s\"\n",
- xmlSecAppCmdLineParamGetStringList(&enabledRefUrisParam));
- return(-1);
- }
+ dsigCtx->enabledReferenceUris = xmlSecAppGetUriType(
+ xmlSecAppCmdLineParamGetStringList(&enabledRefUrisParam));
+ if(dsigCtx->enabledReferenceUris == xmlSecTransformUriTypeNone) {
+ fprintf(stderr, "Error: failed to parse \"%s\"\n",
+ xmlSecAppCmdLineParamGetStringList(&enabledRefUrisParam));
+ return(-1);
+ }
}
return(0);
@@ -1561,20 +1561,20 @@ xmlSecAppPrepareDSigCtx(xmlSecDSigCtxPtr dsigCtx) {
static void
xmlSecAppPrintDSigCtx(xmlSecDSigCtxPtr dsigCtx) {
if(dsigCtx == NULL) {
- return;
+ return;
}
if(xmlSecAppCmdLineParamIsSet(&printDebugParam) || xmlSecAppCmdLineParamIsSet(&printXmlDebugParam)) {
- print_debug = 0;
+ print_debug = 0;
}
/* print debug info if requested */
if((print_debug != 0) || xmlSecAppCmdLineParamIsSet(&printDebugParam)) {
- xmlSecDSigCtxDebugDump(dsigCtx, stdout);
+ xmlSecDSigCtxDebugDump(dsigCtx, stdout);
}
- if(xmlSecAppCmdLineParamIsSet(&printXmlDebugParam)) {
- xmlSecDSigCtxDebugXmlDump(dsigCtx, stdout);
+ if(xmlSecAppCmdLineParamIsSet(&printXmlDebugParam)) {
+ xmlSecDSigCtxDebugXmlDump(dsigCtx, stdout);
}
}
@@ -1591,89 +1591,89 @@ xmlSecAppEncryptFile(const char* filename) {
int res = -1;
if(filename == NULL) {
- return(-1);
+ return(-1);
}
if(xmlSecEncCtxInitialize(&encCtx, gKeysMngr) < 0) {
- fprintf(stderr, "Error: enc context initialization failed\n");
- return(-1);
+ fprintf(stderr, "Error: enc context initialization failed\n");
+ return(-1);
}
if(xmlSecAppPrepareEncCtx(&encCtx) < 0) {
- fprintf(stderr, "Error: enc context preparation failed\n");
- goto done;
+ fprintf(stderr, "Error: enc context preparation failed\n");
+ goto done;
}
/* parse doc and find template node */
doc = xmlSecParseFile(filename);
if(doc == NULL) {
- fprintf(stderr, "Error: failed to parse xml file \"%s\"\n",
- filename);
- goto done;
+ fprintf(stderr, "Error: failed to parse xml file \"%s\"\n",
+ filename);
+ goto done;
}
startTmplNode = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeEncryptedData, xmlSecEncNs);
if(startTmplNode == NULL) {
- fprintf(stderr, "Error: failed to find default node with name=\"%s\"\n",
- xmlSecNodeEncryptedData);
- goto done;
+ fprintf(stderr, "Error: failed to find default node with name=\"%s\"\n",
+ xmlSecNodeEncryptedData);
+ goto done;
}
if(xmlSecAppCmdLineParamGetString(&binaryDataParam) != NULL) {
- /* encrypt */
- start_time = clock();
- if(xmlSecEncCtxUriEncrypt(&encCtx, startTmplNode, BAD_CAST xmlSecAppCmdLineParamGetString(&binaryDataParam)) < 0) {
- fprintf(stderr, "Error: failed to encrypt file \"%s\"\n",
- xmlSecAppCmdLineParamGetString(&binaryDataParam));
- goto done;
- }
- total_time += clock() - start_time;
+ /* encrypt */
+ start_time = clock();
+ if(xmlSecEncCtxUriEncrypt(&encCtx, startTmplNode, BAD_CAST xmlSecAppCmdLineParamGetString(&binaryDataParam)) < 0) {
+ fprintf(stderr, "Error: failed to encrypt file \"%s\"\n",
+ xmlSecAppCmdLineParamGetString(&binaryDataParam));
+ goto done;
+ }
+ total_time += clock() - start_time;
} else if(xmlSecAppCmdLineParamGetString(&xmlDataParam) != NULL) {
- /* parse file and select node for encryption */
+ /* parse file and select node for encryption */
data = xmlSecAppXmlDataCreate(xmlSecAppCmdLineParamGetString(&xmlDataParam), NULL, NULL);
- if(data == NULL) {
- fprintf(stderr, "Error: failed to load file \"%s\"\n",
- xmlSecAppCmdLineParamGetString(&xmlDataParam));
- goto done;
- }
-
- /* encrypt */
- start_time = clock();
- if(xmlSecEncCtxXmlEncrypt(&encCtx, startTmplNode, data->startNode) < 0) {
- fprintf(stderr, "Error: failed to encrypt xml file \"%s\"\n",
- xmlSecAppCmdLineParamGetString(&xmlDataParam));
- goto done;
- }
- total_time += clock() - start_time;
+ if(data == NULL) {
+ fprintf(stderr, "Error: failed to load file \"%s\"\n",
+ xmlSecAppCmdLineParamGetString(&xmlDataParam));
+ goto done;
+ }
+
+ /* encrypt */
+ start_time = clock();
+ if(xmlSecEncCtxXmlEncrypt(&encCtx, startTmplNode, data->startNode) < 0) {
+ fprintf(stderr, "Error: failed to encrypt xml file \"%s\"\n",
+ xmlSecAppCmdLineParamGetString(&xmlDataParam));
+ goto done;
+ }
+ total_time += clock() - start_time;
} else {
- fprintf(stderr, "Error: encryption data not specified (use \"--xml\" or \"--binary\" options)\n");
- goto done;
+ fprintf(stderr, "Error: encryption data not specified (use \"--xml\" or \"--binary\" options)\n");
+ goto done;
}
/* print out result only once per execution */
if(repeats <= 1) {
- if(encCtx.resultReplaced) {
- if(xmlSecAppWriteResult((data != NULL) ? data->doc : doc, NULL) < 0) {
- goto done;
- }
- } else {
- if(xmlSecAppWriteResult(NULL, encCtx.result) < 0) {
- goto done;
- }
- }
+ if(encCtx.resultReplaced) {
+ if(xmlSecAppWriteResult((data != NULL) ? data->doc : doc, NULL) < 0) {
+ goto done;
+ }
+ } else {
+ if(xmlSecAppWriteResult(NULL, encCtx.result) < 0) {
+ goto done;
+ }
+ }
}
res = 0;
done:
/* print debug info if requested */
if(repeats <= 1) {
- xmlSecAppPrintEncCtx(&encCtx);
+ xmlSecAppPrintEncCtx(&encCtx);
}
xmlSecEncCtxFinalize(&encCtx);
if(data != NULL) {
- xmlSecAppXmlDataDestroy(data);
+ xmlSecAppXmlDataDestroy(data);
}
if(doc != NULL) {
- xmlFreeDoc(doc);
+ xmlFreeDoc(doc);
}
return(res);
}
@@ -1686,43 +1686,43 @@ xmlSecAppDecryptFile(const char* filename) {
int res = -1;
if(filename == NULL) {
- return(-1);
+ return(-1);
}
if(xmlSecEncCtxInitialize(&encCtx, gKeysMngr) < 0) {
- fprintf(stderr, "Error: enc context initialization failed\n");
- return(-1);
+ fprintf(stderr, "Error: enc context initialization failed\n");
+ return(-1);
}
if(xmlSecAppPrepareEncCtx(&encCtx) < 0) {
- fprintf(stderr, "Error: enc context preparation failed\n");
- goto done;
+ fprintf(stderr, "Error: enc context preparation failed\n");
+ goto done;
}
/* parse template and select start node */
data = xmlSecAppXmlDataCreate(filename, xmlSecNodeEncryptedData, xmlSecEncNs);
if(data == NULL) {
- fprintf(stderr, "Error: failed to load template \"%s\"\n", filename);
- goto done;
+ fprintf(stderr, "Error: failed to load template \"%s\"\n", filename);
+ goto done;
}
start_time = clock();
if(xmlSecEncCtxDecrypt(&encCtx, data->startNode) < 0) {
- fprintf(stderr, "Error: failed to decrypt file\n");
- goto done;
+ fprintf(stderr, "Error: failed to decrypt file\n");
+ goto done;
}
total_time += clock() - start_time;
/* print out result only once per execution */
if(repeats <= 1) {
- if(encCtx.resultReplaced) {
- if(xmlSecAppWriteResult(data->doc, NULL) < 0) {
- goto done;
- }
- } else {
- if(xmlSecAppWriteResult(NULL, encCtx.result) < 0) {
- goto done;
- }
- }
+ if(encCtx.resultReplaced) {
+ if(xmlSecAppWriteResult(data->doc, NULL) < 0) {
+ goto done;
+ }
+ } else {
+ if(xmlSecAppWriteResult(NULL, encCtx.result) < 0) {
+ goto done;
+ }
+ }
}
res = 0;
@@ -1734,7 +1734,7 @@ done:
xmlSecEncCtxFinalize(&encCtx);
if(data != NULL) {
- xmlSecAppXmlDataDestroy(data);
+ xmlSecAppXmlDataDestroy(data);
}
return(res);
}
@@ -1750,76 +1750,76 @@ xmlSecAppEncryptTmpl(void) {
int res = -1;
if(xmlSecEncCtxInitialize(&encCtx, gKeysMngr) < 0) {
- fprintf(stderr, "Error: enc context initialization failed\n");
- return(-1);
+ fprintf(stderr, "Error: enc context initialization failed\n");
+ return(-1);
}
if(xmlSecAppPrepareEncCtx(&encCtx) < 0) {
- fprintf(stderr, "Error: enc context preparation failed\n");
- goto done;
+ fprintf(stderr, "Error: enc context preparation failed\n");
+ goto done;
}
/* prepare template */
doc = xmlNewDoc(BAD_CAST "1.0");
if(doc == NULL) {
- fprintf(stderr, "Error: failed to create doc\n");
- goto done;
+ fprintf(stderr, "Error: failed to create doc\n");
+ goto done;
}
cur = xmlSecTmplEncDataCreate(doc, xmlSecTransformDes3CbcId,
- NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL);
if(cur == NULL) {
- fprintf(stderr, "Error: failed to encryption template\n");
- goto done;
+ fprintf(stderr, "Error: failed to encryption template\n");
+ goto done;
}
xmlDocSetRootElement(doc, cur);
if(xmlSecTmplEncDataEnsureCipherValue(xmlDocGetRootElement(doc)) == NULL) {
- fprintf(stderr, "Error: failed to add CipherValue node\n");
- goto done;
+ fprintf(stderr, "Error: failed to add CipherValue node\n");
+ goto done;
}
/* add key information */
cur = xmlSecTmplEncDataEnsureKeyInfo(xmlDocGetRootElement(doc), NULL);
if(cur == NULL) {
- fprintf(stderr, "Error: failed to add KeyInfo node\n");
- goto done;
+ fprintf(stderr, "Error: failed to add KeyInfo node\n");
+ goto done;
}
if(xmlSecTmplKeyInfoAddKeyName(cur, NULL) == NULL) {
- fprintf(stderr, "Error: failed to add KeyName node\n");
- goto done;
+ fprintf(stderr, "Error: failed to add KeyName node\n");
+ goto done;
}
/* encrypt */
start_time = clock();
if(xmlSecEncCtxBinaryEncrypt(&encCtx, xmlDocGetRootElement(doc),
- (const xmlSecByte*)data, strlen(data)) < 0) {
- fprintf(stderr, "Error: failed to encrypt data\n");
- goto done;
+ (const xmlSecByte*)data, strlen(data)) < 0) {
+ fprintf(stderr, "Error: failed to encrypt data\n");
+ goto done;
}
total_time += clock() - start_time;
/* print out result only once per execution */
if(repeats <= 1) {
- if(encCtx.resultReplaced) {
- if(xmlSecAppWriteResult(doc, NULL) < 0) {
- goto done;
- }
- } else {
- if(xmlSecAppWriteResult(NULL, encCtx.result) < 0) {
- goto done;
- }
- }
+ if(encCtx.resultReplaced) {
+ if(xmlSecAppWriteResult(doc, NULL) < 0) {
+ goto done;
+ }
+ } else {
+ if(xmlSecAppWriteResult(NULL, encCtx.result) < 0) {
+ goto done;
+ }
+ }
}
res = 0;
done:
/* print debug info if requested */
if(repeats <= 1) {
- xmlSecAppPrintEncCtx(&encCtx);
+ xmlSecAppPrintEncCtx(&encCtx);
}
xmlSecEncCtxFinalize(&encCtx);
if(doc != NULL) {
- xmlFreeDoc(doc);
+ xmlFreeDoc(doc);
}
return(res);
}
@@ -1828,34 +1828,34 @@ done:
static int
xmlSecAppPrepareEncCtx(xmlSecEncCtxPtr encCtx) {
if(encCtx == NULL) {
- fprintf(stderr, "Error: enc context is null\n");
- return(-1);
+ fprintf(stderr, "Error: enc context is null\n");
+ return(-1);
}
/* set key info params */
if(xmlSecAppPrepareKeyInfoReadCtx(&(encCtx->keyInfoReadCtx)) < 0) {
- fprintf(stderr, "Error: failed to prepare key info context\n");
- return(-1);
+ fprintf(stderr, "Error: failed to prepare key info context\n");
+ return(-1);
}
if(xmlSecAppCmdLineParamGetString(&sessionKeyParam) != NULL) {
- encCtx->encKey = xmlSecAppCryptoKeyGenerate(xmlSecAppCmdLineParamGetString(&sessionKeyParam),
- NULL, xmlSecKeyDataTypeSession);
- if(encCtx->encKey == NULL) {
- fprintf(stderr, "Error: failed to generate a session key \"%s\"\n",
- xmlSecAppCmdLineParamGetString(&sessionKeyParam));
- return(-1);
- }
+ encCtx->encKey = xmlSecAppCryptoKeyGenerate(xmlSecAppCmdLineParamGetString(&sessionKeyParam),
+ NULL, xmlSecKeyDataTypeSession);
+ if(encCtx->encKey == NULL) {
+ fprintf(stderr, "Error: failed to generate a session key \"%s\"\n",
+ xmlSecAppCmdLineParamGetString(&sessionKeyParam));
+ return(-1);
+ }
}
if(xmlSecAppCmdLineParamGetStringList(&enabledCipherRefUrisParam) != NULL) {
- encCtx->transformCtx.enabledUris = xmlSecAppGetUriType(
- xmlSecAppCmdLineParamGetStringList(&enabledCipherRefUrisParam));
- if(encCtx->transformCtx.enabledUris == xmlSecTransformUriTypeNone) {
- fprintf(stderr, "Error: failed to parse \"%s\"\n",
- xmlSecAppCmdLineParamGetStringList(&enabledCipherRefUrisParam));
- return(-1);
- }
+ encCtx->transformCtx.enabledUris = xmlSecAppGetUriType(
+ xmlSecAppCmdLineParamGetStringList(&enabledCipherRefUrisParam));
+ if(encCtx->transformCtx.enabledUris == xmlSecTransformUriTypeNone) {
+ fprintf(stderr, "Error: failed to parse \"%s\"\n",
+ xmlSecAppCmdLineParamGetStringList(&enabledCipherRefUrisParam));
+ return(-1);
+ }
}
return(0);
}
@@ -1863,16 +1863,16 @@ xmlSecAppPrepareEncCtx(xmlSecEncCtxPtr encCtx) {
static void
xmlSecAppPrintEncCtx(xmlSecEncCtxPtr encCtx) {
if(encCtx == NULL) {
- return;
+ return;
}
/* print debug info if requested */
if((print_debug != 0) || xmlSecAppCmdLineParamIsSet(&printDebugParam)) {
- xmlSecEncCtxDebugDump(encCtx, stdout);
+ xmlSecEncCtxDebugDump(encCtx, stdout);
}
- if(xmlSecAppCmdLineParamIsSet(&printXmlDebugParam)) {
- xmlSecEncCtxDebugXmlDump(encCtx, stdout);
+ if(xmlSecAppCmdLineParamIsSet(&printXmlDebugParam)) {
+ xmlSecEncCtxDebugXmlDump(encCtx, stdout);
}
}
@@ -1890,48 +1890,48 @@ xmlSecAppXkmsServerProcess(const char* filename) {
int res = -1;
if(filename == NULL) {
- return(-1);
+ return(-1);
}
if(xmlSecXkmsServerCtxInitialize(&xkmsServerCtx, gKeysMngr) < 0) {
- fprintf(stderr, "Error: XKMS server context initialization failed\n");
- return(-1);
+ fprintf(stderr, "Error: XKMS server context initialization failed\n");
+ return(-1);
}
if(xmlSecAppPrepareXkmsServerCtx(&xkmsServerCtx) < 0) {
- fprintf(stderr, "Error: XKMS server context preparation failed\n");
- goto done;
+ fprintf(stderr, "Error: XKMS server context preparation failed\n");
+ goto done;
}
/* get the input format */
if(xmlSecAppCmdLineParamGetString(&xkmsFormatParam) != NULL) {
- format = xmlSecXkmsServerFormatFromString(BAD_CAST xmlSecAppCmdLineParamGetString(&xkmsFormatParam));
- if(format == xmlSecXkmsServerFormatUnknown) {
- fprintf(stderr, "Error: unknown format \"%s\"\n",
- xmlSecAppCmdLineParamGetString(&xkmsFormatParam));
- return(-1);
- }
+ format = xmlSecXkmsServerFormatFromString(BAD_CAST xmlSecAppCmdLineParamGetString(&xkmsFormatParam));
+ if(format == xmlSecXkmsServerFormatUnknown) {
+ fprintf(stderr, "Error: unknown format \"%s\"\n",
+ xmlSecAppCmdLineParamGetString(&xkmsFormatParam));
+ return(-1);
+ }
}
/* parse template and select start node, there are multiple options
* for start node thus we don't provide the default start node name */
data = xmlSecAppXmlDataCreate(filename, NULL, NULL);
if(data == NULL) {
- fprintf(stderr, "Error: failed to load request from file \"%s\"\n", filename);
- goto done;
+ fprintf(stderr, "Error: failed to load request from file \"%s\"\n", filename);
+ goto done;
}
/* prepare result document */
doc = xmlNewDoc(BAD_CAST "1.0");
if(doc == NULL) {
- fprintf(stderr, "Error: failed to create doc\n");
- goto done;
+ fprintf(stderr, "Error: failed to create doc\n");
+ goto done;
}
start_time = clock();
result = xmlSecXkmsServerCtxProcess(&xkmsServerCtx, data->startNode, format, doc);
if(result == NULL) {
- fprintf(stderr, "Error: failed to process xkms server request\n");
- goto done;
+ fprintf(stderr, "Error: failed to process xkms server request\n");
+ goto done;
}
total_time += clock() - start_time;
@@ -1939,9 +1939,9 @@ xmlSecAppXkmsServerProcess(const char* filename) {
/* print out result only once per execution */
xmlDocSetRootElement(doc, result);
if(repeats <= 1) {
- if(xmlSecAppWriteResult(doc, NULL) < 0) {
- goto done;
- }
+ if(xmlSecAppWriteResult(doc, NULL) < 0) {
+ goto done;
+ }
}
res = 0;
@@ -1954,10 +1954,10 @@ done:
xmlSecXkmsServerCtxFinalize(&xkmsServerCtx);
if(doc != NULL) {
- xmlFreeDoc(doc);
+ xmlFreeDoc(doc);
}
if(data != NULL) {
- xmlSecAppXmlDataDestroy(data);
+ xmlSecAppXmlDataDestroy(data);
}
return(res);
}
@@ -1965,33 +1965,33 @@ done:
static int
xmlSecAppPrepareXkmsServerCtx(xmlSecXkmsServerCtxPtr xkmsServerCtx) {
if(xkmsServerCtx == NULL) {
- fprintf(stderr, "Error: XKMS context is null\n");
- return(-1);
+ fprintf(stderr, "Error: XKMS context is null\n");
+ return(-1);
}
/* set key info params */
if(xmlSecAppPrepareKeyInfoReadCtx(&(xkmsServerCtx->keyInfoReadCtx)) < 0) {
- fprintf(stderr, "Error: failed to prepare key info context\n");
- return(-1);
+ fprintf(stderr, "Error: failed to prepare key info context\n");
+ return(-1);
}
if(xmlSecAppCmdLineParamGetString(&xkmsServiceParam) != NULL) {
- xkmsServerCtx->expectedService = xmlStrdup(BAD_CAST xmlSecAppCmdLineParamGetString(&xkmsServiceParam));
- if(xkmsServerCtx->expectedService == NULL) {
- fprintf(stderr, "Error: failed to duplicate string \"%s\"\n",
- xmlSecAppCmdLineParamGetString(&xkmsServiceParam));
- return(-1);
- }
+ xkmsServerCtx->expectedService = xmlStrdup(BAD_CAST xmlSecAppCmdLineParamGetString(&xkmsServiceParam));
+ if(xkmsServerCtx->expectedService == NULL) {
+ fprintf(stderr, "Error: failed to duplicate string \"%s\"\n",
+ xmlSecAppCmdLineParamGetString(&xkmsServiceParam));
+ return(-1);
+ }
}
if(xmlSecAppCmdLineParamIsSet(&xkmsStopUnknownResponseMechanismParam)) {
- xkmsServerCtx->flags |= XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPONSE_MECHANISM;
+ xkmsServerCtx->flags |= XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPONSE_MECHANISM;
}
if(xmlSecAppCmdLineParamIsSet(&xkmsStopUnknownRespondWithParam)) {
- xkmsServerCtx->flags |= XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPOND_WITH;
+ xkmsServerCtx->flags |= XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPOND_WITH;
}
if(xmlSecAppCmdLineParamIsSet(&xkmsStopUnknownKeyUsageParam)) {
- xkmsServerCtx->flags |= XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_KEY_USAGE;
+ xkmsServerCtx->flags |= XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_KEY_USAGE;
}
return(0);
}
@@ -1999,16 +1999,16 @@ xmlSecAppPrepareXkmsServerCtx(xmlSecXkmsServerCtxPtr xkmsServerCtx) {
static void
xmlSecAppPrintXkmsServerCtx(xmlSecXkmsServerCtxPtr xkmsServerCtx) {
if(xkmsServerCtx == NULL) {
- return;
+ return;
}
/* print debug info if requested */
if((print_debug != 0) || xmlSecAppCmdLineParamIsSet(&printDebugParam)) {
- xmlSecXkmsServerCtxDebugDump(xkmsServerCtx, stdout);
+ xmlSecXkmsServerCtxDebugDump(xkmsServerCtx, stdout);
}
- if(xmlSecAppCmdLineParamIsSet(&printXmlDebugParam)) {
- xmlSecXkmsServerCtxDebugXmlDump(xkmsServerCtx, stdout);
+ if(xmlSecAppCmdLineParamIsSet(&printXmlDebugParam)) {
+ xmlSecXkmsServerCtxDebugXmlDump(xkmsServerCtx, stdout);
}
}
@@ -2048,56 +2048,56 @@ xmlSecAppPrepareKeyInfoReadCtx(xmlSecKeyInfoCtxPtr keyInfoCtx) {
int ret;
if(keyInfoCtx == NULL) {
- fprintf(stderr, "Error: key info context is null\n");
- return(-1);
+ fprintf(stderr, "Error: key info context is null\n");
+ return(-1);
}
#ifndef XMLSEC_NO_X509
if(xmlSecAppCmdLineParamIsSet(&verificationTimeParam)) {
- keyInfoCtx->certsVerificationTime = xmlSecAppCmdLineParamGetTime(&verificationTimeParam, 0);
+ keyInfoCtx->certsVerificationTime = xmlSecAppCmdLineParamGetTime(&verificationTimeParam, 0);
}
if(xmlSecAppCmdLineParamIsSet(&depthParam)) {
- keyInfoCtx->certsVerificationDepth = xmlSecAppCmdLineParamGetInt(&depthParam, 0);
+ keyInfoCtx->certsVerificationDepth = xmlSecAppCmdLineParamGetInt(&depthParam, 0);
}
if(xmlSecAppCmdLineParamIsSet(&X509SkipStrictChecksParam)) {
- keyInfoCtx->flags |= XMLSEC_KEYINFO_FLAGS_X509DATA_SKIP_STRICT_CHECKS;
+ keyInfoCtx->flags |= XMLSEC_KEYINFO_FLAGS_X509DATA_SKIP_STRICT_CHECKS;
}
#endif /* XMLSEC_NO_X509 */
/* read enabled key data list */
for(value = enabledKeyDataParam.value; value != NULL; value = value->next) {
- if(value->strListValue == NULL) {
- fprintf(stderr, "Error: invalid value for option \"%s\".\n",
- enabledKeyDataParam.fullName);
- return(-1);
- } else {
- xmlSecKeyDataId dataId;
- const char* p;
-
- for(p = value->strListValue; (p != NULL) && ((*p) != '\0'); p += strlen(p)) {
- dataId = xmlSecKeyDataIdListFindByName(xmlSecKeyDataIdsGet(), BAD_CAST p, xmlSecKeyDataUsageAny);
- if(dataId == xmlSecKeyDataIdUnknown) {
- fprintf(stderr, "Error: key data \"%s\" is unknown.\n", p);
- return(-1);
- }
- ret = xmlSecPtrListAdd(&(keyInfoCtx->enabledKeyData), (const xmlSecPtr)dataId);
- if(ret < 0) {
- fprintf(stderr, "Error: failed to enable key data \"%s\".\n", p);
- return(-1);
- }
- }
- }
+ if(value->strListValue == NULL) {
+ fprintf(stderr, "Error: invalid value for option \"%s\".\n",
+ enabledKeyDataParam.fullName);
+ return(-1);
+ } else {
+ xmlSecKeyDataId dataId;
+ const char* p;
+
+ for(p = value->strListValue; (p != NULL) && ((*p) != '\0'); p += strlen(p)) {
+ dataId = xmlSecKeyDataIdListFindByName(xmlSecKeyDataIdsGet(), BAD_CAST p, xmlSecKeyDataUsageAny);
+ if(dataId == xmlSecKeyDataIdUnknown) {
+ fprintf(stderr, "Error: key data \"%s\" is unknown.\n", p);
+ return(-1);
+ }
+ ret = xmlSecPtrListAdd(&(keyInfoCtx->enabledKeyData), (const xmlSecPtr)dataId);
+ if(ret < 0) {
+ fprintf(stderr, "Error: failed to enable key data \"%s\".\n", p);
+ return(-1);
+ }
+ }
+ }
}
/* read enabled RetrievalMethod uris */
if(xmlSecAppCmdLineParamGetStringList(&enabledRetrievalMethodUrisParam) != NULL) {
- keyInfoCtx->retrievalMethodCtx.enabledUris = xmlSecAppGetUriType(
- xmlSecAppCmdLineParamGetStringList(&enabledRetrievalMethodUrisParam));
- if(keyInfoCtx->retrievalMethodCtx.enabledUris == xmlSecTransformUriTypeNone) {
- fprintf(stderr, "Error: failed to parse \"%s\"\n",
- xmlSecAppCmdLineParamGetStringList(&enabledRetrievalMethodUrisParam));
- return(-1);
- }
+ keyInfoCtx->retrievalMethodCtx.enabledUris = xmlSecAppGetUriType(
+ xmlSecAppCmdLineParamGetStringList(&enabledRetrievalMethodUrisParam));
+ if(keyInfoCtx->retrievalMethodCtx.enabledUris == xmlSecTransformUriTypeNone) {
+ fprintf(stderr, "Error: failed to parse \"%s\"\n",
+ xmlSecAppCmdLineParamGetStringList(&enabledRetrievalMethodUrisParam));
+ return(-1);
+ }
}
return(0);
@@ -2108,290 +2108,290 @@ xmlSecAppLoadKeys(void) {
xmlSecAppCmdLineValuePtr value;
if(gKeysMngr != NULL) {
- fprintf(stderr, "Error: keys manager already initialized.\n");
- return(-1);
+ fprintf(stderr, "Error: keys manager already initialized.\n");
+ return(-1);
}
/* create and initialize keys manager */
gKeysMngr = xmlSecKeysMngrCreate();
if(gKeysMngr == NULL) {
- fprintf(stderr, "Error: failed to create keys manager.\n");
- return(-1);
+ fprintf(stderr, "Error: failed to create keys manager.\n");
+ return(-1);
}
if(xmlSecAppCryptoSimpleKeysMngrInit(gKeysMngr) < 0) {
- fprintf(stderr, "Error: failed to initialize keys manager.\n");
- return(-1);
+ fprintf(stderr, "Error: failed to initialize keys manager.\n");
+ return(-1);
}
/* generate new key file */
for(value = genKeyParam.value; value != NULL; value = value->next) {
- if(value->strValue == NULL) {
- fprintf(stderr, "Error: invalid value for option \"%s\".\n", genKeyParam.fullName);
- return(-1);
- } else if(xmlSecAppCryptoSimpleKeysMngrKeyGenerate(gKeysMngr, value->strValue, value->paramNameValue) < 0) {
- fprintf(stderr, "Error: failed to generate key \"%s\".\n", value->strValue);
- return(-1);
- }
+ if(value->strValue == NULL) {
+ fprintf(stderr, "Error: invalid value for option \"%s\".\n", genKeyParam.fullName);
+ return(-1);
+ } else if(xmlSecAppCryptoSimpleKeysMngrKeyGenerate(gKeysMngr, value->strValue, value->paramNameValue) < 0) {
+ fprintf(stderr, "Error: failed to generate key \"%s\".\n", value->strValue);
+ return(-1);
+ }
}
/* read all xml key files */
for(value = keysFileParam.value; value != NULL; value = value->next) {
- if(value->strValue == NULL) {
- fprintf(stderr, "Error: invalid value for option \"%s\".\n", keysFileParam.fullName);
- return(-1);
- } else if(xmlSecAppCryptoSimpleKeysMngrLoad(gKeysMngr, value->strValue) < 0) {
- fprintf(stderr, "Error: failed to load xml keys file \"%s\".\n", value->strValue);
- return(-1);
- }
+ if(value->strValue == NULL) {
+ fprintf(stderr, "Error: invalid value for option \"%s\".\n", keysFileParam.fullName);
+ return(-1);
+ } else if(xmlSecAppCryptoSimpleKeysMngrLoad(gKeysMngr, value->strValue) < 0) {
+ fprintf(stderr, "Error: failed to load xml keys file \"%s\".\n", value->strValue);
+ return(-1);
+ }
}
/* read all private keys */
for(value = privkeyParam.value; value != NULL; value = value->next) {
- if(value->strValue == NULL) {
- fprintf(stderr, "Error: invalid value for option \"%s\".\n",
- privkeyParam.fullName);
- return(-1);
- } else if(xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad(gKeysMngr,
- value->strListValue,
- xmlSecAppCmdLineParamGetString(&pwdParam),
- value->paramNameValue,
- xmlSecKeyDataFormatPem) < 0) {
- fprintf(stderr, "Error: failed to load private key from \"%s\".\n",
- value->strListValue);
- return(-1);
- }
+ if(value->strValue == NULL) {
+ fprintf(stderr, "Error: invalid value for option \"%s\".\n",
+ privkeyParam.fullName);
+ return(-1);
+ } else if(xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad(gKeysMngr,
+ value->strListValue,
+ xmlSecAppCmdLineParamGetString(&pwdParam),
+ value->paramNameValue,
+ xmlSecKeyDataFormatPem) < 0) {
+ fprintf(stderr, "Error: failed to load private key from \"%s\".\n",
+ value->strListValue);
+ return(-1);
+ }
}
for(value = privkeyDerParam.value; value != NULL; value = value->next) {
- if(value->strValue == NULL) {
- fprintf(stderr, "Error: invalid value for option \"%s\".\n",
- privkeyDerParam.fullName);
- return(-1);
- } else if(xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad(gKeysMngr,
- value->strListValue,
- xmlSecAppCmdLineParamGetString(&pwdParam),
- value->paramNameValue,
- xmlSecKeyDataFormatDer) < 0) {
- fprintf(stderr, "Error: failed to load private key from \"%s\".\n",
- value->strListValue);
- return(-1);
- }
+ if(value->strValue == NULL) {
+ fprintf(stderr, "Error: invalid value for option \"%s\".\n",
+ privkeyDerParam.fullName);
+ return(-1);
+ } else if(xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad(gKeysMngr,
+ value->strListValue,
+ xmlSecAppCmdLineParamGetString(&pwdParam),
+ value->paramNameValue,
+ xmlSecKeyDataFormatDer) < 0) {
+ fprintf(stderr, "Error: failed to load private key from \"%s\".\n",
+ value->strListValue);
+ return(-1);
+ }
}
for(value = pkcs8PemParam.value; value != NULL; value = value->next) {
- if(value->strValue == NULL) {
- fprintf(stderr, "Error: invalid value for option \"%s\".\n",
- pkcs8PemParam.fullName);
- return(-1);
- } else if(xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad(gKeysMngr,
- value->strListValue,
- xmlSecAppCmdLineParamGetString(&pwdParam),
- value->paramNameValue,
- xmlSecKeyDataFormatPkcs8Pem) < 0) {
- fprintf(stderr, "Error: failed to load private key from \"%s\".\n",
- value->strListValue);
- return(-1);
- }
+ if(value->strValue == NULL) {
+ fprintf(stderr, "Error: invalid value for option \"%s\".\n",
+ pkcs8PemParam.fullName);
+ return(-1);
+ } else if(xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad(gKeysMngr,
+ value->strListValue,
+ xmlSecAppCmdLineParamGetString(&pwdParam),
+ value->paramNameValue,
+ xmlSecKeyDataFormatPkcs8Pem) < 0) {
+ fprintf(stderr, "Error: failed to load private key from \"%s\".\n",
+ value->strListValue);
+ return(-1);
+ }
}
for(value = pkcs8DerParam.value; value != NULL; value = value->next) {
- if(value->strValue == NULL) {
- fprintf(stderr, "Error: invalid value for option \"%s\".\n",
- pkcs8DerParam.fullName);
- return(-1);
- } else if(xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad(gKeysMngr,
- value->strListValue,
- xmlSecAppCmdLineParamGetString(&pwdParam),
- value->paramNameValue,
- xmlSecKeyDataFormatPkcs8Der) < 0) {
- fprintf(stderr, "Error: failed to load private key from \"%s\".\n",
- value->strListValue);
- return(-1);
- }
+ if(value->strValue == NULL) {
+ fprintf(stderr, "Error: invalid value for option \"%s\".\n",
+ pkcs8DerParam.fullName);
+ return(-1);
+ } else if(xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad(gKeysMngr,
+ value->strListValue,
+ xmlSecAppCmdLineParamGetString(&pwdParam),
+ value->paramNameValue,
+ xmlSecKeyDataFormatPkcs8Der) < 0) {
+ fprintf(stderr, "Error: failed to load private key from \"%s\".\n",
+ value->strListValue);
+ return(-1);
+ }
}
/* read all public keys */
for(value = pubkeyParam.value; value != NULL; value = value->next) {
- if(value->strValue == NULL) {
- fprintf(stderr, "Error: invalid value for option \"%s\".\n",
- pubkeyParam.fullName);
- return(-1);
- } else if(xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad(gKeysMngr,
- value->strListValue,
- xmlSecAppCmdLineParamGetString(&pwdParam),
- value->paramNameValue,
- xmlSecKeyDataFormatPem) < 0) {
- fprintf(stderr, "Error: failed to load public key from \"%s\".\n",
- value->strListValue);
- return(-1);
- }
+ if(value->strValue == NULL) {
+ fprintf(stderr, "Error: invalid value for option \"%s\".\n",
+ pubkeyParam.fullName);
+ return(-1);
+ } else if(xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad(gKeysMngr,
+ value->strListValue,
+ xmlSecAppCmdLineParamGetString(&pwdParam),
+ value->paramNameValue,
+ xmlSecKeyDataFormatPem) < 0) {
+ fprintf(stderr, "Error: failed to load public key from \"%s\".\n",
+ value->strListValue);
+ return(-1);
+ }
}
for(value = pubkeyDerParam.value; value != NULL; value = value->next) {
- if(value->strValue == NULL) {
- fprintf(stderr, "Error: invalid value for option \"%s\".\n",
- pubkeyDerParam.fullName);
- return(-1);
- } else if(xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad(gKeysMngr,
- value->strListValue,
- xmlSecAppCmdLineParamGetString(&pwdParam),
- value->paramNameValue,
- xmlSecKeyDataFormatDer) < 0) {
- fprintf(stderr, "Error: failed to load public key from \"%s\".\n",
- value->strListValue);
- return(-1);
- }
+ if(value->strValue == NULL) {
+ fprintf(stderr, "Error: invalid value for option \"%s\".\n",
+ pubkeyDerParam.fullName);
+ return(-1);
+ } else if(xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad(gKeysMngr,
+ value->strListValue,
+ xmlSecAppCmdLineParamGetString(&pwdParam),
+ value->paramNameValue,
+ xmlSecKeyDataFormatDer) < 0) {
+ fprintf(stderr, "Error: failed to load public key from \"%s\".\n",
+ value->strListValue);
+ return(-1);
+ }
}
#ifndef XMLSEC_NO_AES
/* read all AES keys */
for(value = aeskeyParam.value; value != NULL; value = value->next) {
- if(value->strValue == NULL) {
- fprintf(stderr, "Error: invalid value for option \"%s\".\n",
- aeskeyParam.fullName);
- return(-1);
- } else if(xmlSecAppCryptoSimpleKeysMngrBinaryKeyLoad(gKeysMngr,
- "aes", value->strValue, value->paramNameValue) < 0) {
- fprintf(stderr, "Error: failed to load aes key from \"%s\".\n",
- value->strValue);
- return(-1);
- }
+ if(value->strValue == NULL) {
+ fprintf(stderr, "Error: invalid value for option \"%s\".\n",
+ aeskeyParam.fullName);
+ return(-1);
+ } else if(xmlSecAppCryptoSimpleKeysMngrBinaryKeyLoad(gKeysMngr,
+ "aes", value->strValue, value->paramNameValue) < 0) {
+ fprintf(stderr, "Error: failed to load aes key from \"%s\".\n",
+ value->strValue);
+ return(-1);
+ }
}
#endif /* XMLSEC_NO_AES */
#ifndef XMLSEC_NO_DES
/* read all des keys */
for(value = deskeyParam.value; value != NULL; value = value->next) {
- if(value->strValue == NULL) {
- fprintf(stderr, "Error: invalid value for option \"%s\".\n",
- deskeyParam.fullName);
- return(-1);
- } else if(xmlSecAppCryptoSimpleKeysMngrBinaryKeyLoad(gKeysMngr,
- "des", value->strValue, value->paramNameValue) < 0) {
- fprintf(stderr, "Error: failed to load des key from \"%s\".\n",
- value->strValue);
- return(-1);
- }
+ if(value->strValue == NULL) {
+ fprintf(stderr, "Error: invalid value for option \"%s\".\n",
+ deskeyParam.fullName);
+ return(-1);
+ } else if(xmlSecAppCryptoSimpleKeysMngrBinaryKeyLoad(gKeysMngr,
+ "des", value->strValue, value->paramNameValue) < 0) {
+ fprintf(stderr, "Error: failed to load des key from \"%s\".\n",
+ value->strValue);
+ return(-1);
+ }
}
#endif /* XMLSEC_NO_DES */
#ifndef XMLSEC_NO_HMAC
/* read all hmac keys */
for(value = hmackeyParam.value; value != NULL; value = value->next) {
- if(value->strValue == NULL) {
- fprintf(stderr, "Error: invalid value for option \"%s\".\n",
- hmackeyParam.fullName);
- return(-1);
- } else if(xmlSecAppCryptoSimpleKeysMngrBinaryKeyLoad(gKeysMngr,
- "hmac", value->strValue, value->paramNameValue) < 0) {
- fprintf(stderr, "Error: failed to load hmac key from \"%s\".\n",
- value->strValue);
- return(-1);
- }
+ if(value->strValue == NULL) {
+ fprintf(stderr, "Error: invalid value for option \"%s\".\n",
+ hmackeyParam.fullName);
+ return(-1);
+ } else if(xmlSecAppCryptoSimpleKeysMngrBinaryKeyLoad(gKeysMngr,
+ "hmac", value->strValue, value->paramNameValue) < 0) {
+ fprintf(stderr, "Error: failed to load hmac key from \"%s\".\n",
+ value->strValue);
+ return(-1);
+ }
}
#endif /* XMLSEC_NO_HMAC */
#ifndef XMLSEC_NO_X509
/* read all pkcs12 files */
for(value = pkcs12Param.value; value != NULL; value = value->next) {
- if(value->strValue == NULL) {
- fprintf(stderr, "Error: invalid value for option \"%s\".\n", pkcs12Param.fullName);
- return(-1);
- } else if(xmlSecAppCryptoSimpleKeysMngrPkcs12KeyLoad(gKeysMngr,
- value->strValue,
- xmlSecAppCmdLineParamGetString(&pwdParam),
- value->paramNameValue) < 0) {
- fprintf(stderr, "Error: failed to load pkcs12 key from \"%s\".\n",
- value->strValue);
- return(-1);
- }
+ if(value->strValue == NULL) {
+ fprintf(stderr, "Error: invalid value for option \"%s\".\n", pkcs12Param.fullName);
+ return(-1);
+ } else if(xmlSecAppCryptoSimpleKeysMngrPkcs12KeyLoad(gKeysMngr,
+ value->strValue,
+ xmlSecAppCmdLineParamGetString(&pwdParam),
+ value->paramNameValue) < 0) {
+ fprintf(stderr, "Error: failed to load pkcs12 key from \"%s\".\n",
+ value->strValue);
+ return(-1);
+ }
}
/* read all trusted certs */
for(value = trustedParam.value; value != NULL; value = value->next) {
- if(value->strValue == NULL) {
- fprintf(stderr, "Error: invalid value for option \"%s\".\n", trustedParam.fullName);
- return(-1);
- } else if(xmlSecAppCryptoSimpleKeysMngrCertLoad(gKeysMngr,
- value->strValue, xmlSecKeyDataFormatPem,
- xmlSecKeyDataTypeTrusted) < 0) {
- fprintf(stderr, "Error: failed to load trusted cert from \"%s\".\n",
- value->strValue);
- return(-1);
- }
+ if(value->strValue == NULL) {
+ fprintf(stderr, "Error: invalid value for option \"%s\".\n", trustedParam.fullName);
+ return(-1);
+ } else if(xmlSecAppCryptoSimpleKeysMngrCertLoad(gKeysMngr,
+ value->strValue, xmlSecKeyDataFormatPem,
+ xmlSecKeyDataTypeTrusted) < 0) {
+ fprintf(stderr, "Error: failed to load trusted cert from \"%s\".\n",
+ value->strValue);
+ return(-1);
+ }
}
for(value = trustedDerParam.value; value != NULL; value = value->next) {
- if(value->strValue == NULL) {
- fprintf(stderr, "Error: invalid value for option \"%s\".\n", trustedDerParam.fullName);
- return(-1);
- } else if(xmlSecAppCryptoSimpleKeysMngrCertLoad(gKeysMngr,
- value->strValue, xmlSecKeyDataFormatDer,
- xmlSecKeyDataTypeTrusted) < 0) {
- fprintf(stderr, "Error: failed to load trusted cert from \"%s\".\n",
- value->strValue);
- return(-1);
- }
+ if(value->strValue == NULL) {
+ fprintf(stderr, "Error: invalid value for option \"%s\".\n", trustedDerParam.fullName);
+ return(-1);
+ } else if(xmlSecAppCryptoSimpleKeysMngrCertLoad(gKeysMngr,
+ value->strValue, xmlSecKeyDataFormatDer,
+ xmlSecKeyDataTypeTrusted) < 0) {
+ fprintf(stderr, "Error: failed to load trusted cert from \"%s\".\n",
+ value->strValue);
+ return(-1);
+ }
}
/* read all public keys in certs */
for(value = pubkeyCertParam.value; value != NULL; value = value->next) {
- if(value->strValue == NULL) {
- fprintf(stderr, "Error: invalid value for option \"%s\".\n",
- pubkeyCertParam.fullName);
- return(-1);
- } else if(xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad(gKeysMngr,
- value->strListValue,
- xmlSecAppCmdLineParamGetString(&pwdParam),
- value->paramNameValue,
- xmlSecKeyDataFormatCertPem) < 0) {
- fprintf(stderr, "Error: failed to load public key from \"%s\".\n",
- value->strListValue);
- return(-1);
- }
+ if(value->strValue == NULL) {
+ fprintf(stderr, "Error: invalid value for option \"%s\".\n",
+ pubkeyCertParam.fullName);
+ return(-1);
+ } else if(xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad(gKeysMngr,
+ value->strListValue,
+ xmlSecAppCmdLineParamGetString(&pwdParam),
+ value->paramNameValue,
+ xmlSecKeyDataFormatCertPem) < 0) {
+ fprintf(stderr, "Error: failed to load public key from \"%s\".\n",
+ value->strListValue);
+ return(-1);
+ }
}
for(value = pubkeyCertDerParam.value; value != NULL; value = value->next) {
- if(value->strValue == NULL) {
- fprintf(stderr, "Error: invalid value for option \"%s\".\n",
- pubkeyCertDerParam.fullName);
- return(-1);
- } else if(xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad(gKeysMngr,
- value->strListValue,
- xmlSecAppCmdLineParamGetString(&pwdParam),
- value->paramNameValue,
- xmlSecKeyDataFormatCertDer) < 0) {
- fprintf(stderr, "Error: failed to load public key from \"%s\".\n",
- value->strListValue);
- return(-1);
- }
+ if(value->strValue == NULL) {
+ fprintf(stderr, "Error: invalid value for option \"%s\".\n",
+ pubkeyCertDerParam.fullName);
+ return(-1);
+ } else if(xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad(gKeysMngr,
+ value->strListValue,
+ xmlSecAppCmdLineParamGetString(&pwdParam),
+ value->paramNameValue,
+ xmlSecKeyDataFormatCertDer) < 0) {
+ fprintf(stderr, "Error: failed to load public key from \"%s\".\n",
+ value->strListValue);
+ return(-1);
+ }
}
/* read all untrusted certs */
for(value = untrustedParam.value; value != NULL; value = value->next) {
- if(value->strValue == NULL) {
- fprintf(stderr, "Error: invalid value for option \"%s\".\n", untrustedParam.fullName);
- return(-1);
- } else if(xmlSecAppCryptoSimpleKeysMngrCertLoad(gKeysMngr,
- value->strValue, xmlSecKeyDataFormatPem,
- xmlSecKeyDataTypeNone) < 0) {
- fprintf(stderr, "Error: failed to load untrusted cert from \"%s\".\n",
- value->strValue);
- return(-1);
- }
+ if(value->strValue == NULL) {
+ fprintf(stderr, "Error: invalid value for option \"%s\".\n", untrustedParam.fullName);
+ return(-1);
+ } else if(xmlSecAppCryptoSimpleKeysMngrCertLoad(gKeysMngr,
+ value->strValue, xmlSecKeyDataFormatPem,
+ xmlSecKeyDataTypeNone) < 0) {
+ fprintf(stderr, "Error: failed to load untrusted cert from \"%s\".\n",
+ value->strValue);
+ return(-1);
+ }
}
for(value = untrustedDerParam.value; value != NULL; value = value->next) {
- if(value->strValue == NULL) {
- fprintf(stderr, "Error: invalid value for option \"%s\".\n", untrustedDerParam.fullName);
- return(-1);
- } else if(xmlSecAppCryptoSimpleKeysMngrCertLoad(gKeysMngr,
- value->strValue, xmlSecKeyDataFormatDer,
- xmlSecKeyDataTypeNone) < 0) {
- fprintf(stderr, "Error: failed to load untrusted cert from \"%s\".\n",
- value->strValue);
- return(-1);
- }
+ if(value->strValue == NULL) {
+ fprintf(stderr, "Error: invalid value for option \"%s\".\n", untrustedDerParam.fullName);
+ return(-1);
+ } else if(xmlSecAppCryptoSimpleKeysMngrCertLoad(gKeysMngr,
+ value->strValue, xmlSecKeyDataFormatDer,
+ xmlSecKeyDataTypeNone) < 0) {
+ fprintf(stderr, "Error: failed to load untrusted cert from \"%s\".\n",
+ value->strValue);
+ return(-1);
+ }
}
#endif /* XMLSEC_NO_X509 */
@@ -2403,7 +2403,7 @@ static int intialized = 0;
static int
xmlSecAppInit(void) {
if(intialized != 0) {
- return(0);
+ return(0);
}
intialized = 1;
@@ -2414,31 +2414,31 @@ xmlSecAppInit(void) {
#ifndef XMLSEC_NO_XSLT
xmlIndentTreeOutput = 1;
#endif /* XMLSEC_NO_XSLT */
-
+
/* Init xmlsec */
if(xmlSecInit() < 0) {
- fprintf(stderr, "Error: xmlsec intialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec intialization failed.\n");
+ return(-1);
}
if(xmlSecCheckVersion() != 1) {
- fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
- return(-1);
+ fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
+ return(-1);
}
#if !defined(XMLSEC_NO_CRYPTO_DYNAMIC_LOADING) && defined(XMLSEC_CRYPTO_DYNAMIC_LOADING)
if(xmlSecCryptoDLLoadLibrary(BAD_CAST xmlsec_crypto) < 0) {
- fprintf(stderr, "Error: unable to load xmlsec-%s library. Make sure that you have\n"
- "this it installed, check shared libraries path (LD_LIBRARY_PATH)\n"
- "envornment variable or use \"--crypto\" option to specify different\n"
- "crypto engine.\n", xmlsec_crypto);
- return(-1);
+ fprintf(stderr, "Error: unable to load xmlsec-%s library. Make sure that you have\n"
+ "this it installed, check shared libraries path (LD_LIBRARY_PATH)\n"
+ "envornment variable or use \"--crypto\" option to specify different\n"
+ "crypto engine.\n", xmlsec_crypto);
+ return(-1);
}
#endif /* !defined(XMLSEC_NO_CRYPTO_DYNAMIC_LOADING) && defined(XMLSEC_CRYPTO_DYNAMIC_LOADING) */
/* Init Crypto */
if(xmlSecAppCryptoInit(xmlSecAppCmdLineParamGetString(&cryptoConfigParam)) < 0) {
- fprintf(stderr, "Error: xmlsec crypto intialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec crypto intialization failed.\n");
+ return(-1);
}
return(0);
}
@@ -2446,17 +2446,17 @@ xmlSecAppInit(void) {
static void
xmlSecAppShutdown(void) {
if(intialized == 0) {
- return;
+ return;
}
/* Shutdown Crypto */
if(xmlSecAppCryptoShutdown() < 0) {
- fprintf(stderr, "Error: xmlsec crypto shutdown failed.\n");
+ fprintf(stderr, "Error: xmlsec crypto shutdown failed.\n");
}
/* Shutdown xmlsec */
if(xmlSecShutdown() < 0) {
- fprintf(stderr, "Error: xmlsec shutdown failed.\n");
+ fprintf(stderr, "Error: xmlsec shutdown failed.\n");
}
/* Shutdown libxslt/libxml */
@@ -2473,25 +2473,25 @@ xmlSecAppXmlDataCreate(const char* filename, const xmlChar* defStartNodeName, co
xmlNodePtr cur = NULL;
if(filename == NULL) {
- fprintf(stderr, "Error: xml filename is null\n");
- return(NULL);
+ fprintf(stderr, "Error: xml filename is null\n");
+ return(NULL);
}
/* create object */
data = (xmlSecAppXmlDataPtr) xmlMalloc(sizeof(xmlSecAppXmlData));
if(data == NULL) {
- fprintf(stderr, "Error: failed to create xml data\n");
- return(NULL);
+ fprintf(stderr, "Error: failed to create xml data\n");
+ return(NULL);
}
memset(data, 0, sizeof(xmlSecAppXmlData));
/* parse doc */
data->doc = xmlSecParseFile(filename);
if(data->doc == NULL) {
- fprintf(stderr, "Error: failed to parse xml file \"%s\"\n",
- filename);
- xmlSecAppXmlDataDestroy(data);
- return(NULL);
+ fprintf(stderr, "Error: failed to parse xml file \"%s\"\n",
+ filename);
+ xmlSecAppXmlDataDestroy(data);
+ return(NULL);
}
/* load dtd and set default attrs and ids */
@@ -2499,178 +2499,178 @@ xmlSecAppXmlDataCreate(const char* filename, const xmlChar* defStartNodeName, co
xmlValidCtxt ctx;
data->dtd = xmlParseDTD(NULL, BAD_CAST xmlSecAppCmdLineParamGetString(&dtdFileParam));
- if(data->dtd == NULL) {
- fprintf(stderr, "Error: failed to parse dtd file \"%s\"\n",
- xmlSecAppCmdLineParamGetString(&dtdFileParam));
- xmlSecAppXmlDataDestroy(data);
- return(NULL);
- }
+ if(data->dtd == NULL) {
+ fprintf(stderr, "Error: failed to parse dtd file \"%s\"\n",
+ xmlSecAppCmdLineParamGetString(&dtdFileParam));
+ xmlSecAppXmlDataDestroy(data);
+ return(NULL);
+ }
- memset(&ctx, 0, sizeof(ctx));
- /* we don't care is doc actually valid or not */
- xmlValidateDtd(&ctx, data->doc, data->dtd);
+ memset(&ctx, 0, sizeof(ctx));
+ /* we don't care is doc actually valid or not */
+ xmlValidateDtd(&ctx, data->doc, data->dtd);
}
/* set ID attributes from command line */
for(value = idAttrParam.value; value != NULL; value = value->next) {
- if(value->strValue == NULL) {
- fprintf(stderr, "Error: invalid value for option \"%s\".\n",
- idAttrParam.fullName);
- xmlSecAppXmlDataDestroy(data);
- return(NULL);
- } else {
- xmlChar* attrName = (value->paramNameValue != NULL) ? BAD_CAST value->paramNameValue : BAD_CAST "id";
- xmlChar* nodeName;
- xmlChar* nsHref;
- xmlChar* buf;
-
- buf = xmlStrdup(BAD_CAST value->strValue);
- if(buf == NULL) {
- fprintf(stderr, "Error: failed to duplicate string \"%s\"\n", value->strValue);
- xmlSecAppXmlDataDestroy(data);
- return(NULL);
- }
- nodeName = (xmlChar*)strrchr((char*)buf, ':');
- if(nodeName != NULL) {
- (*(nodeName++)) = '\0';
- nsHref = buf;
- } else {
- nodeName = buf;
- nsHref = NULL;
- }
-
- /* process children first because it does not matter much but does simplify code */
- cur = xmlSecGetNextElementNode(data->doc->children);
- while(cur != NULL) {
- if(xmlSecAppAddIDAttr(cur, attrName, nodeName, nsHref) < 0) {
- fprintf(stderr, "Error: failed to add ID attribute \"%s\" for node \"%s\"\n", attrName, value->strValue);
- xmlFree(buf);
- xmlSecAppXmlDataDestroy(data);
- return(NULL);
- }
- cur = xmlSecGetNextElementNode(cur->next);
- }
-
- xmlFree(buf);
- }
+ if(value->strValue == NULL) {
+ fprintf(stderr, "Error: invalid value for option \"%s\".\n",
+ idAttrParam.fullName);
+ xmlSecAppXmlDataDestroy(data);
+ return(NULL);
+ } else {
+ xmlChar* attrName = (value->paramNameValue != NULL) ? BAD_CAST value->paramNameValue : BAD_CAST "id";
+ xmlChar* nodeName;
+ xmlChar* nsHref;
+ xmlChar* buf;
+
+ buf = xmlStrdup(BAD_CAST value->strValue);
+ if(buf == NULL) {
+ fprintf(stderr, "Error: failed to duplicate string \"%s\"\n", value->strValue);
+ xmlSecAppXmlDataDestroy(data);
+ return(NULL);
+ }
+ nodeName = (xmlChar*)strrchr((char*)buf, ':');
+ if(nodeName != NULL) {
+ (*(nodeName++)) = '\0';
+ nsHref = buf;
+ } else {
+ nodeName = buf;
+ nsHref = NULL;
+ }
+
+ /* process children first because it does not matter much but does simplify code */
+ cur = xmlSecGetNextElementNode(data->doc->children);
+ while(cur != NULL) {
+ if(xmlSecAppAddIDAttr(cur, attrName, nodeName, nsHref) < 0) {
+ fprintf(stderr, "Error: failed to add ID attribute \"%s\" for node \"%s\"\n", attrName, value->strValue);
+ xmlFree(buf);
+ xmlSecAppXmlDataDestroy(data);
+ return(NULL);
+ }
+ cur = xmlSecGetNextElementNode(cur->next);
+ }
+
+ xmlFree(buf);
+ }
}
/* now find the start node */
if(xmlSecAppCmdLineParamGetString(&nodeIdParam) != NULL) {
- xmlAttrPtr attr;
-
- attr = xmlGetID(data->doc, BAD_CAST xmlSecAppCmdLineParamGetString(&nodeIdParam));
- if(attr == NULL) {
- fprintf(stderr, "Error: failed to find node with id=\"%s\"\n",
- xmlSecAppCmdLineParamGetString(&nodeIdParam));
- xmlSecAppXmlDataDestroy(data);
- return(NULL);
- }
- cur = attr->parent;
+ xmlAttrPtr attr;
+
+ attr = xmlGetID(data->doc, BAD_CAST xmlSecAppCmdLineParamGetString(&nodeIdParam));
+ if(attr == NULL) {
+ fprintf(stderr, "Error: failed to find node with id=\"%s\"\n",
+ xmlSecAppCmdLineParamGetString(&nodeIdParam));
+ xmlSecAppXmlDataDestroy(data);
+ return(NULL);
+ }
+ cur = attr->parent;
} else if(xmlSecAppCmdLineParamGetString(&nodeNameParam) != NULL) {
- xmlChar* buf;
- xmlChar* name;
- xmlChar* ns;
-
- buf = xmlStrdup(BAD_CAST xmlSecAppCmdLineParamGetString(&nodeNameParam));
- if(buf == NULL) {
- fprintf(stderr, "Error: failed to duplicate node \"%s\"\n",
- xmlSecAppCmdLineParamGetString(&nodeNameParam));
- xmlSecAppXmlDataDestroy(data);
- return(NULL);
- }
- name = (xmlChar*)strrchr((char*)buf, ':');
- if(name != NULL) {
- (*(name++)) = '\0';
- ns = buf;
- } else {
- name = buf;
- ns = NULL;
- }
-
- cur = xmlSecFindNode(xmlDocGetRootElement(data->doc), name, ns);
- if(cur == NULL) {
- fprintf(stderr, "Error: failed to find node with name=\"%s\"\n",
- name);
- xmlFree(buf);
- xmlSecAppXmlDataDestroy(data);
- return(NULL);
- }
- xmlFree(buf);
+ xmlChar* buf;
+ xmlChar* name;
+ xmlChar* ns;
+
+ buf = xmlStrdup(BAD_CAST xmlSecAppCmdLineParamGetString(&nodeNameParam));
+ if(buf == NULL) {
+ fprintf(stderr, "Error: failed to duplicate node \"%s\"\n",
+ xmlSecAppCmdLineParamGetString(&nodeNameParam));
+ xmlSecAppXmlDataDestroy(data);
+ return(NULL);
+ }
+ name = (xmlChar*)strrchr((char*)buf, ':');
+ if(name != NULL) {
+ (*(name++)) = '\0';
+ ns = buf;
+ } else {
+ name = buf;
+ ns = NULL;
+ }
+
+ cur = xmlSecFindNode(xmlDocGetRootElement(data->doc), name, ns);
+ if(cur == NULL) {
+ fprintf(stderr, "Error: failed to find node with name=\"%s\"\n",
+ name);
+ xmlFree(buf);
+ xmlSecAppXmlDataDestroy(data);
+ return(NULL);
+ }
+ xmlFree(buf);
} else if(xmlSecAppCmdLineParamGetString(&nodeXPathParam) != NULL) {
- xmlXPathContextPtr ctx = NULL;
- xmlXPathObjectPtr obj = NULL;
- xmlNodePtr rootNode;
- xmlNsPtr ns;
- int ret;
-
- rootNode = xmlDocGetRootElement(data->doc);
- if(rootNode == NULL) {
- fprintf(stderr, "Error: failed to find root node\n");
- xmlSecAppXmlDataDestroy(data);
- return(NULL);
- }
-
- ctx = xmlXPathNewContext(data->doc);
- if(ctx == NULL) {
- fprintf(stderr, "Error: failed to create xpath context\n");
- xmlSecAppXmlDataDestroy(data);
- return(NULL);
- }
-
- /* register namespaces from the root node */
- for(ns = rootNode->nsDef; ns != NULL; ns = ns->next) {
- if(ns->prefix != NULL){
- ret = xmlXPathRegisterNs(ctx, ns->prefix, ns->href);
- if(ret != 0) {
- fprintf(stderr, "Error: failed to register namespace \"%s\"\n", ns->prefix);
- xmlXPathFreeContext(ctx);
- xmlSecAppXmlDataDestroy(data);
- return(NULL);
- }
- }
- }
-
- obj = xmlXPathEval(BAD_CAST xmlSecAppCmdLineParamGetString(&nodeXPathParam), ctx);
- if(obj == NULL) {
- fprintf(stderr, "Error: failed to evaluate xpath expression\n");
- xmlXPathFreeContext(ctx);
- xmlSecAppXmlDataDestroy(data);
- return(NULL);
- }
-
- if((obj->nodesetval == NULL) || (obj->nodesetval->nodeNr != 1)) {
- fprintf(stderr, "Error: xpath expression evaluation does not return a single node as expected\n");
- xmlXPathFreeObject(obj);
- xmlXPathFreeContext(ctx);
- xmlSecAppXmlDataDestroy(data);
- return(NULL);
- }
-
- cur = obj->nodesetval->nodeTab[0];
- xmlXPathFreeContext(ctx);
- xmlXPathFreeObject(obj);
-
+ xmlXPathContextPtr ctx = NULL;
+ xmlXPathObjectPtr obj = NULL;
+ xmlNodePtr rootNode;
+ xmlNsPtr ns;
+ int ret;
+
+ rootNode = xmlDocGetRootElement(data->doc);
+ if(rootNode == NULL) {
+ fprintf(stderr, "Error: failed to find root node\n");
+ xmlSecAppXmlDataDestroy(data);
+ return(NULL);
+ }
+
+ ctx = xmlXPathNewContext(data->doc);
+ if(ctx == NULL) {
+ fprintf(stderr, "Error: failed to create xpath context\n");
+ xmlSecAppXmlDataDestroy(data);
+ return(NULL);
+ }
+
+ /* register namespaces from the root node */
+ for(ns = rootNode->nsDef; ns != NULL; ns = ns->next) {
+ if(ns->prefix != NULL){
+ ret = xmlXPathRegisterNs(ctx, ns->prefix, ns->href);
+ if(ret != 0) {
+ fprintf(stderr, "Error: failed to register namespace \"%s\"\n", ns->prefix);
+ xmlXPathFreeContext(ctx);
+ xmlSecAppXmlDataDestroy(data);
+ return(NULL);
+ }
+ }
+ }
+
+ obj = xmlXPathEval(BAD_CAST xmlSecAppCmdLineParamGetString(&nodeXPathParam), ctx);
+ if(obj == NULL) {
+ fprintf(stderr, "Error: failed to evaluate xpath expression\n");
+ xmlXPathFreeContext(ctx);
+ xmlSecAppXmlDataDestroy(data);
+ return(NULL);
+ }
+
+ if((obj->nodesetval == NULL) || (obj->nodesetval->nodeNr != 1)) {
+ fprintf(stderr, "Error: xpath expression evaluation does not return a single node as expected\n");
+ xmlXPathFreeObject(obj);
+ xmlXPathFreeContext(ctx);
+ xmlSecAppXmlDataDestroy(data);
+ return(NULL);
+ }
+
+ cur = obj->nodesetval->nodeTab[0];
+ xmlXPathFreeContext(ctx);
+ xmlXPathFreeObject(obj);
+
} else {
- cur = xmlDocGetRootElement(data->doc);
- if(cur == NULL) {
- fprintf(stderr, "Error: failed to get root element\n");
- xmlSecAppXmlDataDestroy(data);
- return(NULL);
- }
+ cur = xmlDocGetRootElement(data->doc);
+ if(cur == NULL) {
+ fprintf(stderr, "Error: failed to get root element\n");
+ xmlSecAppXmlDataDestroy(data);
+ return(NULL);
+ }
}
if(defStartNodeName != NULL) {
- data->startNode = xmlSecFindNode(cur, defStartNodeName, defStartNodeNs);
- if(data->startNode == NULL) {
- fprintf(stderr, "Error: failed to find default node with name=\"%s\"\n",
- defStartNodeName);
- xmlSecAppXmlDataDestroy(data);
- return(NULL);
- }
+ data->startNode = xmlSecFindNode(cur, defStartNodeName, defStartNodeNs);
+ if(data->startNode == NULL) {
+ fprintf(stderr, "Error: failed to find default node with name=\"%s\"\n",
+ defStartNodeName);
+ xmlSecAppXmlDataDestroy(data);
+ return(NULL);
+ }
} else {
- data->startNode = cur;
+ data->startNode = cur;
}
return(data);
@@ -2679,14 +2679,14 @@ xmlSecAppXmlDataCreate(const char* filename, const xmlChar* defStartNodeName, co
static void
xmlSecAppXmlDataDestroy(xmlSecAppXmlDataPtr data) {
if(data == NULL) {
- fprintf(stderr, "Error: xml data is null\n");
- return;
+ fprintf(stderr, "Error: xml data is null\n");
+ return;
}
if(data->dtd != NULL) {
- xmlFreeDtd(data->dtd);
+ xmlFreeDtd(data->dtd);
}
if(data->doc != NULL) {
- xmlFreeDoc(data->doc);
+ xmlFreeDoc(data->doc);
}
memset(data, 0, sizeof(xmlSecAppXmlData));
xmlFree(data);
@@ -2695,91 +2695,91 @@ xmlSecAppXmlDataDestroy(xmlSecAppXmlDataPtr data) {
static xmlSecAppCommand
xmlSecAppParseCommand(const char* cmd, xmlSecAppCmdLineParamTopic* cmdLineTopics, xmlSecAppCommand* subCommand) {
if(subCommand != NULL) {
- (*subCommand) = xmlSecAppCommandUnknown;
+ (*subCommand) = xmlSecAppCommandUnknown;
}
if((cmd == NULL) || (cmdLineTopics == NULL)) {
- return(xmlSecAppCommandUnknown);
+ return(xmlSecAppCommandUnknown);
} else
if((strcmp(cmd, "help") == 0) || (strcmp(cmd, "--help") == 0)) {
- (*cmdLineTopics) = 0;
- return(xmlSecAppCommandHelp);
+ (*cmdLineTopics) = 0;
+ return(xmlSecAppCommandHelp);
} else
if((strcmp(cmd, "help-all") == 0) || (strcmp(cmd, "--help-all") == 0)) {
- (*cmdLineTopics) = xmlSecAppCmdLineTopicAll;
- return(xmlSecAppCommandHelp);
+ (*cmdLineTopics) = xmlSecAppCmdLineTopicAll;
+ return(xmlSecAppCommandHelp);
} else
- if((strncmp(cmd, "help-", 5) == 0) || (strncmp(cmd, "--help-", 7) == 0)) {
- cmd = (cmd[0] == '-') ? cmd + 7 : cmd + 5;
- if(subCommand) {
- (*subCommand) = xmlSecAppParseCommand(cmd, cmdLineTopics, NULL);
- } else {
- (*cmdLineTopics) = 0;
- }
- return(xmlSecAppCommandHelp);
+ if((strncmp(cmd, "help-", 5) == 0) || (strncmp(cmd, "--help-", 7) == 0)) {
+ cmd = (cmd[0] == '-') ? cmd + 7 : cmd + 5;
+ if(subCommand) {
+ (*subCommand) = xmlSecAppParseCommand(cmd, cmdLineTopics, NULL);
+ } else {
+ (*cmdLineTopics) = 0;
+ }
+ return(xmlSecAppCommandHelp);
} else
if((strcmp(cmd, "version") == 0) || (strcmp(cmd, "--version") == 0)) {
- (*cmdLineTopics) = xmlSecAppCmdLineTopicVersion;
- return(xmlSecAppCommandVersion);
+ (*cmdLineTopics) = xmlSecAppCmdLineTopicVersion;
+ return(xmlSecAppCommandVersion);
} else
if((strcmp(cmd, "list-key-data") == 0) || (strcmp(cmd, "--list-key-data") == 0)) {
- (*cmdLineTopics) = 0;
- return(xmlSecAppCommandListKeyData);
+ (*cmdLineTopics) = 0;
+ return(xmlSecAppCommandListKeyData);
} else
if((strcmp(cmd, "check-key-data") == 0) || (strcmp(cmd, "--check-key-data") == 0)) {
- (*cmdLineTopics) = 0;
- return(xmlSecAppCommandCheckKeyData);
+ (*cmdLineTopics) = 0;
+ return(xmlSecAppCommandCheckKeyData);
} else
if((strcmp(cmd, "list-transforms") == 0) || (strcmp(cmd, "--list-transforms") == 0)) {
- (*cmdLineTopics) = 0;
- return(xmlSecAppCommandListTransforms);
+ (*cmdLineTopics) = 0;
+ return(xmlSecAppCommandListTransforms);
} else
if((strcmp(cmd, "check-transforms") == 0) || (strcmp(cmd, "--check-transforms") == 0)) {
- (*cmdLineTopics) = 0;
- return(xmlSecAppCommandCheckTransforms);
+ (*cmdLineTopics) = 0;
+ return(xmlSecAppCommandCheckTransforms);
} else
if((strcmp(cmd, "keys") == 0) || (strcmp(cmd, "--keys") == 0)) {
- (*cmdLineTopics) = xmlSecAppCmdLineTopicGeneral |
- xmlSecAppCmdLineTopicKeysMngr |
- xmlSecAppCmdLineTopicX509Certs;
- return(xmlSecAppCommandKeys);
+ (*cmdLineTopics) = xmlSecAppCmdLineTopicGeneral |
+ xmlSecAppCmdLineTopicKeysMngr |
+ xmlSecAppCmdLineTopicX509Certs;
+ return(xmlSecAppCommandKeys);
} else
#ifndef XMLSEC_NO_XMLDSIG
if((strcmp(cmd, "sign") == 0) || (strcmp(cmd, "--sign") == 0)) {
- (*cmdLineTopics) = xmlSecAppCmdLineTopicGeneral |
- xmlSecAppCmdLineTopicDSigCommon |
- xmlSecAppCmdLineTopicDSigSign |
- xmlSecAppCmdLineTopicKeysMngr |
- xmlSecAppCmdLineTopicX509Certs;
- return(xmlSecAppCommandSign);
+ (*cmdLineTopics) = xmlSecAppCmdLineTopicGeneral |
+ xmlSecAppCmdLineTopicDSigCommon |
+ xmlSecAppCmdLineTopicDSigSign |
+ xmlSecAppCmdLineTopicKeysMngr |
+ xmlSecAppCmdLineTopicX509Certs;
+ return(xmlSecAppCommandSign);
} else
if((strcmp(cmd, "verify") == 0) || (strcmp(cmd, "--verify") == 0)) {
- (*cmdLineTopics) = xmlSecAppCmdLineTopicGeneral |
- xmlSecAppCmdLineTopicDSigCommon |
- xmlSecAppCmdLineTopicDSigVerify |
- xmlSecAppCmdLineTopicKeysMngr |
- xmlSecAppCmdLineTopicX509Certs;
- return(xmlSecAppCommandVerify);
+ (*cmdLineTopics) = xmlSecAppCmdLineTopicGeneral |
+ xmlSecAppCmdLineTopicDSigCommon |
+ xmlSecAppCmdLineTopicDSigVerify |
+ xmlSecAppCmdLineTopicKeysMngr |
+ xmlSecAppCmdLineTopicX509Certs;
+ return(xmlSecAppCommandVerify);
} else
#ifndef XMLSEC_NO_TMPL_TEST
if((strcmp(cmd, "sign-tmpl") == 0) || (strcmp(cmd, "--sign-tmpl") == 0)) {
- (*cmdLineTopics) = xmlSecAppCmdLineTopicGeneral |
- xmlSecAppCmdLineTopicDSigCommon |
- xmlSecAppCmdLineTopicDSigSign |
- xmlSecAppCmdLineTopicKeysMngr |
- xmlSecAppCmdLineTopicX509Certs;
- return(xmlSecAppCommandSignTmpl);
+ (*cmdLineTopics) = xmlSecAppCmdLineTopicGeneral |
+ xmlSecAppCmdLineTopicDSigCommon |
+ xmlSecAppCmdLineTopicDSigSign |
+ xmlSecAppCmdLineTopicKeysMngr |
+ xmlSecAppCmdLineTopicX509Certs;
+ return(xmlSecAppCommandSignTmpl);
} else
#endif /* XMLSEC_NO_TMPL_TEST */
@@ -2787,102 +2787,102 @@ xmlSecAppParseCommand(const char* cmd, xmlSecAppCmdLineParamTopic* cmdLineTopics
#ifndef XMLSEC_NO_XMLENC
if((strcmp(cmd, "encrypt") == 0) || (strcmp(cmd, "--encrypt") == 0)) {
- (*cmdLineTopics) = xmlSecAppCmdLineTopicGeneral |
- xmlSecAppCmdLineTopicEncCommon |
- xmlSecAppCmdLineTopicEncEncrypt |
- xmlSecAppCmdLineTopicKeysMngr |
- xmlSecAppCmdLineTopicX509Certs;
- return(xmlSecAppCommandEncrypt);
+ (*cmdLineTopics) = xmlSecAppCmdLineTopicGeneral |
+ xmlSecAppCmdLineTopicEncCommon |
+ xmlSecAppCmdLineTopicEncEncrypt |
+ xmlSecAppCmdLineTopicKeysMngr |
+ xmlSecAppCmdLineTopicX509Certs;
+ return(xmlSecAppCommandEncrypt);
} else
if((strcmp(cmd, "decrypt") == 0) || (strcmp(cmd, "--decrypt") == 0)) {
- (*cmdLineTopics) = xmlSecAppCmdLineTopicGeneral |
- xmlSecAppCmdLineTopicEncCommon |
- xmlSecAppCmdLineTopicEncDecrypt |
- xmlSecAppCmdLineTopicKeysMngr |
- xmlSecAppCmdLineTopicX509Certs;
- return(xmlSecAppCommandDecrypt);
+ (*cmdLineTopics) = xmlSecAppCmdLineTopicGeneral |
+ xmlSecAppCmdLineTopicEncCommon |
+ xmlSecAppCmdLineTopicEncDecrypt |
+ xmlSecAppCmdLineTopicKeysMngr |
+ xmlSecAppCmdLineTopicX509Certs;
+ return(xmlSecAppCommandDecrypt);
} else
#ifndef XMLSEC_NO_TMPL_TEST
if((strcmp(cmd, "encrypt-tmpl") == 0) || (strcmp(cmd, "--encrypt-tmpl") == 0)) {
- (*cmdLineTopics) = xmlSecAppCmdLineTopicGeneral |
- xmlSecAppCmdLineTopicEncCommon |
- xmlSecAppCmdLineTopicEncEncrypt |
- xmlSecAppCmdLineTopicKeysMngr |
- xmlSecAppCmdLineTopicX509Certs;
- return(xmlSecAppCommandEncryptTmpl);
+ (*cmdLineTopics) = xmlSecAppCmdLineTopicGeneral |
+ xmlSecAppCmdLineTopicEncCommon |
+ xmlSecAppCmdLineTopicEncEncrypt |
+ xmlSecAppCmdLineTopicKeysMngr |
+ xmlSecAppCmdLineTopicX509Certs;
+ return(xmlSecAppCommandEncryptTmpl);
} else
#endif /* XMLSEC_NO_TMPL_TEST */
#endif /* XMLSEC_NO_XMLENC */
#ifndef XMLSEC_NO_XKMS
if(strcmp(cmd, "--xkms-server-request") == 0) {
- (*cmdLineTopics) = xmlSecAppCmdLineTopicGeneral |
- xmlSecAppCmdLineTopicXkmsCommon |
- xmlSecAppCmdLineTopicKeysMngr |
- xmlSecAppCmdLineTopicX509Certs;
- return(xmlSecAppCommandXkmsServerRequest);
+ (*cmdLineTopics) = xmlSecAppCmdLineTopicGeneral |
+ xmlSecAppCmdLineTopicXkmsCommon |
+ xmlSecAppCmdLineTopicKeysMngr |
+ xmlSecAppCmdLineTopicX509Certs;
+ return(xmlSecAppCommandXkmsServerRequest);
} else
#endif /* XMLSEC_NO_XKMS */
if(1) {
- (*cmdLineTopics) = 0;
- return(xmlSecAppCommandUnknown);
+ (*cmdLineTopics) = 0;
+ return(xmlSecAppCommandUnknown);
}
}
-
+
static void
xmlSecAppPrintHelp(xmlSecAppCommand command, xmlSecAppCmdLineParamTopic topics) {
switch(command) {
case xmlSecAppCommandUnknown:
case xmlSecAppCommandHelp:
- fprintf(stdout, "%s%s\n", helpCommands1, helpCommands2);
+ fprintf(stdout, "%s%s\n", helpCommands1, helpCommands2);
break;
case xmlSecAppCommandVersion:
- fprintf(stdout, "%s\n", helpVersion);
+ fprintf(stdout, "%s\n", helpVersion);
break;
case xmlSecAppCommandListKeyData:
- fprintf(stdout, "%s\n", helpListKeyData);
+ fprintf(stdout, "%s\n", helpListKeyData);
break;
case xmlSecAppCommandCheckKeyData:
- fprintf(stdout, "%s\n", helpCheckKeyData);
+ fprintf(stdout, "%s\n", helpCheckKeyData);
break;
case xmlSecAppCommandListTransforms:
- fprintf(stdout, "%s\n", helpListTransforms);
+ fprintf(stdout, "%s\n", helpListTransforms);
break;
case xmlSecAppCommandCheckTransforms:
- fprintf(stdout, "%s\n", helpCheckTransforms);
+ fprintf(stdout, "%s\n", helpCheckTransforms);
break;
case xmlSecAppCommandKeys:
- fprintf(stdout, "%s\n", helpKeys);
+ fprintf(stdout, "%s\n", helpKeys);
break;
case xmlSecAppCommandSign:
- fprintf(stdout, "%s\n", helpSign);
+ fprintf(stdout, "%s\n", helpSign);
break;
case xmlSecAppCommandVerify:
- fprintf(stdout, "%s\n", helpVerify);
+ fprintf(stdout, "%s\n", helpVerify);
break;
case xmlSecAppCommandEncrypt:
- fprintf(stdout, "%s\n", helpEncrypt);
+ fprintf(stdout, "%s\n", helpEncrypt);
break;
case xmlSecAppCommandDecrypt:
- fprintf(stdout, "%s\n", helpDecrypt);
+ fprintf(stdout, "%s\n", helpDecrypt);
break;
case xmlSecAppCommandSignTmpl:
- fprintf(stdout, "%s\n", helpSignTmpl);
+ fprintf(stdout, "%s\n", helpSignTmpl);
break;
case xmlSecAppCommandEncryptTmpl:
- fprintf(stdout, "%s\n", helpEncryptTmpl);
+ fprintf(stdout, "%s\n", helpEncryptTmpl);
break;
case xmlSecAppCommandXkmsServerRequest:
- fprintf(stdout, "%s\n", helpXkmsServerRequest);
+ fprintf(stdout, "%s\n", helpXkmsServerRequest);
break;
}
if(topics != 0) {
- fprintf(stdout, "Options:\n");
- xmlSecAppCmdLineParamsListPrint(parameters, topics, stdout);
- fprintf(stdout, "\n");
+ fprintf(stdout, "Options:\n");
+ xmlSecAppCmdLineParamsListPrint(parameters, topics, stdout);
+ fprintf(stdout, "\n");
}
fprintf(stdout, "\n%s\n", bugs);
fprintf(stdout, "%s\n", copyright);
@@ -2893,19 +2893,19 @@ xmlSecAppGetUriType(const char* string) {
xmlSecTransformUriType type = xmlSecTransformUriTypeNone;
while((string != NULL) && (string[0] != '\0')) {
- if(strcmp(string, "empty") == 0) {
- type |= xmlSecTransformUriTypeEmpty;
- } else if(strcmp(string, "same-doc") == 0) {
- type |= xmlSecTransformUriTypeSameDocument;
- } else if(strcmp(string, "local") == 0) {
- type |= xmlSecTransformUriTypeLocal;
- } else if(strcmp(string, "remote") == 0) {
- type |= xmlSecTransformUriTypeRemote;
- } else {
- fprintf(stderr, "Error: invalid uri type: \"%s\"\n", string);
- return(xmlSecTransformUriTypeNone);
- }
- string += strlen(string) + 1;
+ if(strcmp(string, "empty") == 0) {
+ type |= xmlSecTransformUriTypeEmpty;
+ } else if(strcmp(string, "same-doc") == 0) {
+ type |= xmlSecTransformUriTypeSameDocument;
+ } else if(strcmp(string, "local") == 0) {
+ type |= xmlSecTransformUriTypeLocal;
+ } else if(strcmp(string, "remote") == 0) {
+ type |= xmlSecTransformUriTypeRemote;
+ } else {
+ fprintf(stderr, "Error: invalid uri type: \"%s\"\n", string);
+ return(xmlSecTransformUriTypeNone);
+ }
+ string += strlen(string) + 1;
}
return(type);
}
@@ -2915,12 +2915,12 @@ xmlSecAppOpenFile(const char* filename) {
FILE* file;
if((filename == NULL) || (strcmp(filename, "-") == 0)) {
- return(stdout);
+ return(stdout);
}
file = fopen(filename, "wb");
if(file == NULL) {
- fprintf(stderr, "Error: failed to open file \"%s\"\n", filename);
- return(NULL);
+ fprintf(stderr, "Error: failed to open file \"%s\"\n", filename);
+ return(NULL);
}
return(file);
@@ -2929,7 +2929,7 @@ xmlSecAppOpenFile(const char* filename) {
static void
xmlSecAppCloseFile(FILE* file) {
if((file == NULL) || (file == stdout) || (file == stderr)) {
- return;
+ return;
}
fclose(file);
@@ -2941,16 +2941,16 @@ xmlSecAppWriteResult(xmlDocPtr doc, xmlSecBufferPtr buffer) {
f = xmlSecAppOpenFile(xmlSecAppCmdLineParamGetString(&outputParam));
if(f == NULL) {
- return(-1);
+ return(-1);
}
if(doc != NULL) {
- xmlDocDump(f, doc);
+ xmlDocDump(f, doc);
} else if((buffer != NULL) && (xmlSecBufferGetData(buffer) != NULL)) {
- fwrite(xmlSecBufferGetData(buffer), xmlSecBufferGetSize(buffer), 1, f);
+ fwrite(xmlSecBufferGetData(buffer), xmlSecBufferGetSize(buffer), 1, f);
} else {
- fprintf(stderr, "Error: both result doc and result buffer are null\n");
- xmlSecAppCloseFile(f);
- return(-1);
+ fprintf(stderr, "Error: both result doc and result buffer are null\n");
+ xmlSecAppCloseFile(f);
+ return(-1);
}
xmlSecAppCloseFile(f);
return(0);
@@ -2963,52 +2963,52 @@ xmlSecAppAddIDAttr(xmlNodePtr node, const xmlChar* attrName, const xmlChar* node
xmlChar* id;
if((node == NULL) || (attrName == NULL) || (nodeName == NULL)) {
- return(-1);
+ return(-1);
}
/* process children first because it does not matter much but does simplify code */
cur = xmlSecGetNextElementNode(node->children);
while(cur != NULL) {
- if(xmlSecAppAddIDAttr(cur, attrName, nodeName, nsHref) < 0) {
- return(-1);
- }
- cur = xmlSecGetNextElementNode(cur->next);
+ if(xmlSecAppAddIDAttr(cur, attrName, nodeName, nsHref) < 0) {
+ return(-1);
+ }
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* node name must match */
if(!xmlStrEqual(node->name, nodeName)) {
- return(0);
+ return(0);
}
-
+
/* if nsHref is set then it also should match */
if((nsHref != NULL) && (node->ns != NULL) && (!xmlStrEqual(nsHref, node->ns->href))) {
- return(0);
+ return(0);
}
/* the attribute with name equal to attrName should exist */
for(attr = node->properties; attr != NULL; attr = attr->next) {
- if(xmlStrEqual(attr->name, attrName)) {
- break;
- }
+ if(xmlStrEqual(attr->name, attrName)) {
+ break;
+ }
}
if(attr == NULL) {
- return(0);
+ return(0);
}
/* and this attr should have a value */
id = xmlNodeListGetString(node->doc, attr->children, 1);
if(id == NULL) {
- return(0);
+ return(0);
}
/* check that we don't have same ID already */
tmpAttr = xmlGetID(node->doc, id);
if(tmpAttr == NULL) {
- xmlAddID(NULL, node->doc, id, attr);
+ xmlAddID(NULL, node->doc, id, attr);
} else if(tmpAttr != attr) {
- fprintf(stderr, "Error: duplicate ID attribute \"%s\"\n", id);
- xmlFree(id);
- return(-1);
+ fprintf(stderr, "Error: duplicate ID attribute \"%s\"\n", id);
+ xmlFree(id);
+ return(-1);
}
xmlFree(id);
return(0);
diff --git a/examples/decrypt1.c b/examples/decrypt1.c
index bfc1dd0..4cd089c 100644
--- a/examples/decrypt1.c
+++ b/examples/decrypt1.c
@@ -4,11 +4,11 @@
* Decrypts encrypted XML file using a single DES key from a binary file
*
* Usage:
- * ./decrypt1 <xml-enc> <des-key-file>
+ * ./decrypt1 <xml-enc> <des-key-file>
*
* Example:
- * ./decrypt1 encrypt1-res.xml deskey.bin
- * ./decrypt1 encrypt2-res.xml deskey.bin
+ * ./decrypt1 encrypt1-res.xml deskey.bin
+ * ./decrypt1 encrypt2-res.xml deskey.bin
*
* This is free software; see Copyright file in the source
* distribution for preciese wording.
@@ -39,9 +39,9 @@ main(int argc, char **argv) {
assert(argv);
if(argc != 3) {
- fprintf(stderr, "Error: wrong number of arguments.\n");
- fprintf(stderr, "Usage: %s <enc-file> <key-file>\n", argv[0]);
- return(1);
+ fprintf(stderr, "Error: wrong number of arguments.\n");
+ fprintf(stderr, "Usage: %s <enc-file> <key-file>\n", argv[0]);
+ return(1);
}
/* Init libxml and libxslt libraries */
@@ -52,17 +52,17 @@ main(int argc, char **argv) {
#ifndef XMLSEC_NO_XSLT
xmlIndentTreeOutput = 1;
#endif /* XMLSEC_NO_XSLT */
-
+
/* Init xmlsec library */
if(xmlSecInit() < 0) {
- fprintf(stderr, "Error: xmlsec initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec initialization failed.\n");
+ return(-1);
}
/* Check loaded library version */
if(xmlSecCheckVersion() != 1) {
- fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
- return(-1);
+ fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
+ return(-1);
}
/* Load default crypto engine if we are supporting dynamic
@@ -72,27 +72,27 @@ main(int argc, char **argv) {
*/
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {
- fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
- "that you have it installed and check shared libraries path\n"
- "(LD_LIBRARY_PATH) envornment variable.\n");
- return(-1);
+ fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
+ "that you have it installed and check shared libraries path\n"
+ "(LD_LIBRARY_PATH) envornment variable.\n");
+ return(-1);
}
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
/* Init crypto library */
if(xmlSecCryptoAppInit(NULL) < 0) {
- fprintf(stderr, "Error: crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: crypto initialization failed.\n");
+ return(-1);
}
/* Init xmlsec-crypto library */
if(xmlSecCryptoInit() < 0) {
- fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
+ return(-1);
}
if(decrypt_file(argv[1], argv[2]) < 0) {
- return(-1);
+ return(-1);
}
/* Shutdown xmlsec-crypto library */
@@ -115,8 +115,8 @@ main(int argc, char **argv) {
/**
* decrypt_file:
- * @enc_file: the encrypted XML file name.
- * @key_file: the Triple DES key file.
+ * @enc_file: the encrypted XML file name.
+ * @key_file: the Triple DES key file.
*
* Decrypts the XML file #enc_file using DES key from #key_file and
* prints results to stdout.
@@ -136,55 +136,55 @@ decrypt_file(const char* enc_file, const char* key_file) {
/* load template */
doc = xmlParseFile(enc_file);
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
- fprintf(stderr, "Error: unable to parse file \"%s\"\n", enc_file);
- goto done;
+ fprintf(stderr, "Error: unable to parse file \"%s\"\n", enc_file);
+ goto done;
}
/* find start node */
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeEncryptedData, xmlSecEncNs);
if(node == NULL) {
- fprintf(stderr, "Error: start node not found in \"%s\"\n", enc_file);
- goto done;
+ fprintf(stderr, "Error: start node not found in \"%s\"\n", enc_file);
+ goto done;
}
/* create encryption context, we don't need keys manager in this example */
encCtx = xmlSecEncCtxCreate(NULL);
if(encCtx == NULL) {
fprintf(stderr,"Error: failed to create encryption context\n");
- goto done;
+ goto done;
}
/* load DES key */
encCtx->encKey = xmlSecKeyReadBinaryFile(xmlSecKeyDataDesId, key_file);
if(encCtx->encKey == NULL) {
fprintf(stderr,"Error: failed to load des key from binary file \"%s\"\n", key_file);
- goto done;
+ goto done;
}
/* set key name to the file name, this is just an example! */
if(xmlSecKeySetName(encCtx->encKey, key_file) < 0) {
- fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
- goto done;
+ fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
+ goto done;
}
/* decrypt the data */
if((xmlSecEncCtxDecrypt(encCtx, node) < 0) || (encCtx->result == NULL)) {
fprintf(stderr,"Error: decryption failed\n");
- goto done;
+ goto done;
}
/* print decrypted data to stdout */
if(encCtx->resultReplaced != 0) {
- fprintf(stdout, "Decrypted XML data:\n");
- xmlDocDump(stdout, doc);
+ fprintf(stdout, "Decrypted XML data:\n");
+ xmlDocDump(stdout, doc);
} else {
- fprintf(stdout, "Decrypted binary data (%d bytes):\n", xmlSecBufferGetSize(encCtx->result));
- if(xmlSecBufferGetData(encCtx->result) != NULL) {
- fwrite(xmlSecBufferGetData(encCtx->result),
- 1,
- xmlSecBufferGetSize(encCtx->result),
- stdout);
- }
+ fprintf(stdout, "Decrypted binary data (%d bytes):\n", xmlSecBufferGetSize(encCtx->result));
+ if(xmlSecBufferGetData(encCtx->result) != NULL) {
+ fwrite(xmlSecBufferGetData(encCtx->result),
+ 1,
+ xmlSecBufferGetSize(encCtx->result),
+ stdout);
+ }
}
fprintf(stdout, "\n");
@@ -194,11 +194,11 @@ decrypt_file(const char* enc_file, const char* key_file) {
done:
/* cleanup */
if(encCtx != NULL) {
- xmlSecEncCtxDestroy(encCtx);
+ xmlSecEncCtxDestroy(encCtx);
}
if(doc != NULL) {
- xmlFreeDoc(doc);
+ xmlFreeDoc(doc);
}
return(res);
}
diff --git a/examples/decrypt2.c b/examples/decrypt2.c
index 051cbf9..7727a03 100644
--- a/examples/decrypt2.c
+++ b/examples/decrypt2.c
@@ -5,11 +5,11 @@
* DES key from a binary file
*
* Usage:
- * ./decrypt2 <xml-enc> <des-key-file1> [<des-key-file2> [...]]
+ * ./decrypt2 <xml-enc> <des-key-file1> [<des-key-file2> [...]]
*
* Example:
- * ./decrypt2 encrypt1-res.xml deskey.bin
- * ./decrypt2 encrypt2-res.xml deskey.bin
+ * ./decrypt2 encrypt1-res.xml deskey.bin
+ * ./decrypt2 encrypt2-res.xml deskey.bin
*
* This is free software; see Copyright file in the source
* distribution for preciese wording.
@@ -43,9 +43,9 @@ main(int argc, char **argv) {
assert(argv);
if(argc != 3) {
- fprintf(stderr, "Error: wrong number of arguments.\n");
- fprintf(stderr, "Usage: %s <enc-file> <key-file1> [<key-file2> [...]]\n", argv[0]);
- return(1);
+ fprintf(stderr, "Error: wrong number of arguments.\n");
+ fprintf(stderr, "Usage: %s <enc-file> <key-file1> [<key-file2> [...]]\n", argv[0]);
+ return(1);
}
/* Init libxml and libxslt libraries */
@@ -56,17 +56,17 @@ main(int argc, char **argv) {
#ifndef XMLSEC_NO_XSLT
xmlIndentTreeOutput = 1;
#endif /* XMLSEC_NO_XSLT */
-
+
/* Init xmlsec library */
if(xmlSecInit() < 0) {
- fprintf(stderr, "Error: xmlsec initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec initialization failed.\n");
+ return(-1);
}
/* Check loaded library version */
if(xmlSecCheckVersion() != 1) {
- fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
- return(-1);
+ fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
+ return(-1);
}
/* Load default crypto engine if we are supporting dynamic
@@ -76,34 +76,34 @@ main(int argc, char **argv) {
*/
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {
- fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
- "that you have it installed and check shared libraries path\n"
- "(LD_LIBRARY_PATH) envornment variable.\n");
- return(-1);
+ fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
+ "that you have it installed and check shared libraries path\n"
+ "(LD_LIBRARY_PATH) envornment variable.\n");
+ return(-1);
}
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
/* Init crypto library */
if(xmlSecCryptoAppInit(NULL) < 0) {
- fprintf(stderr, "Error: crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: crypto initialization failed.\n");
+ return(-1);
}
/* Init xmlsec-crypto library */
if(xmlSecCryptoInit() < 0) {
- fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
+ return(-1);
}
/* create keys manager and load keys */
mngr = load_des_keys(&(argv[2]), argc - 2);
if(mngr == NULL) {
- return(-1);
+ return(-1);
}
if(decrypt_file(mngr, argv[1]) < 0) {
- xmlSecKeysMngrDestroy(mngr);
- return(-1);
+ xmlSecKeysMngrDestroy(mngr);
+ return(-1);
}
/* destroy keys manager */
@@ -129,8 +129,8 @@ main(int argc, char **argv) {
/**
* load_des_keys:
- * @files: the list of filenames.
- * @files_size: the number of filenames in #files.
+ * @files: the list of filenames.
+ * @files_size: the number of filenames in #files.
*
* Creates simple keys manager and load DES keys from #files in it.
* The caller is responsible for destroing returned keys manager using
@@ -154,43 +154,43 @@ load_des_keys(char** files, int files_size) {
*/
mngr = xmlSecKeysMngrCreate();
if(mngr == NULL) {
- fprintf(stderr, "Error: failed to create keys manager.\n");
- return(NULL);
+ fprintf(stderr, "Error: failed to create keys manager.\n");
+ return(NULL);
}
if(xmlSecCryptoAppDefaultKeysMngrInit(mngr) < 0) {
- fprintf(stderr, "Error: failed to initialize keys manager.\n");
- xmlSecKeysMngrDestroy(mngr);
- return(NULL);
+ fprintf(stderr, "Error: failed to initialize keys manager.\n");
+ xmlSecKeysMngrDestroy(mngr);
+ return(NULL);
}
for(i = 0; i < files_size; ++i) {
- assert(files[i]);
+ assert(files[i]);
- /* load DES key */
- key = xmlSecKeyReadBinaryFile(xmlSecKeyDataDesId, files[i]);
- if(key == NULL) {
- fprintf(stderr,"Error: failed to load des key from binary file \"%s\"\n", files[i]);
- xmlSecKeysMngrDestroy(mngr);
- return(NULL);
- }
+ /* load DES key */
+ key = xmlSecKeyReadBinaryFile(xmlSecKeyDataDesId, files[i]);
+ if(key == NULL) {
+ fprintf(stderr,"Error: failed to load des key from binary file \"%s\"\n", files[i]);
+ xmlSecKeysMngrDestroy(mngr);
+ return(NULL);
+ }
- /* set key name to the file name, this is just an example! */
- if(xmlSecKeySetName(key, BAD_CAST files[i]) < 0) {
- fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", files[i]);
- xmlSecKeyDestroy(key);
- xmlSecKeysMngrDestroy(mngr);
- return(NULL);
- }
-
- /* add key to keys manager, from now on keys manager is responsible
- * for destroying key
- */
- if(xmlSecCryptoAppDefaultKeysMngrAdoptKey(mngr, key) < 0) {
- fprintf(stderr,"Error: failed to add key from \"%s\" to keys manager\n", files[i]);
- xmlSecKeyDestroy(key);
- xmlSecKeysMngrDestroy(mngr);
- return(NULL);
- }
+ /* set key name to the file name, this is just an example! */
+ if(xmlSecKeySetName(key, BAD_CAST files[i]) < 0) {
+ fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", files[i]);
+ xmlSecKeyDestroy(key);
+ xmlSecKeysMngrDestroy(mngr);
+ return(NULL);
+ }
+
+ /* add key to keys manager, from now on keys manager is responsible
+ * for destroying key
+ */
+ if(xmlSecCryptoAppDefaultKeysMngrAdoptKey(mngr, key) < 0) {
+ fprintf(stderr,"Error: failed to add key from \"%s\" to keys manager\n", files[i]);
+ xmlSecKeyDestroy(key);
+ xmlSecKeysMngrDestroy(mngr);
+ return(NULL);
+ }
}
return(mngr);
@@ -198,8 +198,8 @@ load_des_keys(char** files, int files_size) {
/**
* decrypt_file:
- * @mngr: the pointer to keys manager.
- * @enc_file: the encrypted XML file name.
+ * @mngr: the pointer to keys manager.
+ * @enc_file: the encrypted XML file name.
*
* Decrypts the XML file #enc_file using DES key from #key_file and
* prints results to stdout.
@@ -219,42 +219,42 @@ decrypt_file(xmlSecKeysMngrPtr mngr, const char* enc_file) {
/* load template */
doc = xmlParseFile(enc_file);
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
- fprintf(stderr, "Error: unable to parse file \"%s\"\n", enc_file);
- goto done;
+ fprintf(stderr, "Error: unable to parse file \"%s\"\n", enc_file);
+ goto done;
}
/* find start node */
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeEncryptedData, xmlSecEncNs);
if(node == NULL) {
- fprintf(stderr, "Error: start node not found in \"%s\"\n", enc_file);
- goto done;
+ fprintf(stderr, "Error: start node not found in \"%s\"\n", enc_file);
+ goto done;
}
/* create encryption context */
encCtx = xmlSecEncCtxCreate(mngr);
if(encCtx == NULL) {
fprintf(stderr,"Error: failed to create encryption context\n");
- goto done;
+ goto done;
}
/* decrypt the data */
if((xmlSecEncCtxDecrypt(encCtx, node) < 0) || (encCtx->result == NULL)) {
fprintf(stderr,"Error: decryption failed\n");
- goto done;
+ goto done;
}
/* print decrypted data to stdout */
if(encCtx->resultReplaced != 0) {
- fprintf(stdout, "Decrypted XML data:\n");
- xmlDocDump(stdout, doc);
+ fprintf(stdout, "Decrypted XML data:\n");
+ xmlDocDump(stdout, doc);
} else {
- fprintf(stdout, "Decrypted binary data (%d bytes):\n", xmlSecBufferGetSize(encCtx->result));
- if(xmlSecBufferGetData(encCtx->result) != NULL) {
- fwrite(xmlSecBufferGetData(encCtx->result),
- 1,
- xmlSecBufferGetSize(encCtx->result),
- stdout);
- }
+ fprintf(stdout, "Decrypted binary data (%d bytes):\n", xmlSecBufferGetSize(encCtx->result));
+ if(xmlSecBufferGetData(encCtx->result) != NULL) {
+ fwrite(xmlSecBufferGetData(encCtx->result),
+ 1,
+ xmlSecBufferGetSize(encCtx->result),
+ stdout);
+ }
}
fprintf(stdout, "\n");
@@ -264,11 +264,11 @@ decrypt_file(xmlSecKeysMngrPtr mngr, const char* enc_file) {
done:
/* cleanup */
if(encCtx != NULL) {
- xmlSecEncCtxDestroy(encCtx);
+ xmlSecEncCtxDestroy(encCtx);
}
if(doc != NULL) {
- xmlFreeDoc(doc);
+ xmlFreeDoc(doc);
}
return(res);
}
diff --git a/examples/decrypt3.c b/examples/decrypt3.c
index eb0d581..2c450d2 100644
--- a/examples/decrypt3.c
+++ b/examples/decrypt3.c
@@ -6,11 +6,11 @@
* key's file name in the current folder.
*
* Usage:
- * ./decrypt3 <xml-enc>
+ * ./decrypt3 <xml-enc>
*
* Example:
- * ./decrypt3 encrypt1-res.xml
- * ./decrypt3 encrypt2-res.xml
+ * ./decrypt3 encrypt1-res.xml
+ * ./decrypt3 encrypt2-res.xml
*
* This is free software; see Copyright file in the source
* distribution for preciese wording.
@@ -46,9 +46,9 @@ main(int argc, char **argv) {
assert(argv);
if(argc != 2) {
- fprintf(stderr, "Error: wrong number of arguments.\n");
- fprintf(stderr, "Usage: %s <enc-file>\n", argv[0]);
- return(1);
+ fprintf(stderr, "Error: wrong number of arguments.\n");
+ fprintf(stderr, "Usage: %s <enc-file>\n", argv[0]);
+ return(1);
}
/* Init libxml and libxslt libraries */
@@ -59,17 +59,17 @@ main(int argc, char **argv) {
#ifndef XMLSEC_NO_XSLT
xmlIndentTreeOutput = 1;
#endif /* XMLSEC_NO_XSLT */
-
+
/* Init xmlsec library */
if(xmlSecInit() < 0) {
- fprintf(stderr, "Error: xmlsec initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec initialization failed.\n");
+ return(-1);
}
/* Check loaded library version */
if(xmlSecCheckVersion() != 1) {
- fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
- return(-1);
+ fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
+ return(-1);
}
/* Load default crypto engine if we are supporting dynamic
@@ -79,34 +79,34 @@ main(int argc, char **argv) {
*/
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {
- fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
- "that you have it installed and check shared libraries path\n"
- "(LD_LIBRARY_PATH) envornment variable.\n");
- return(-1);
+ fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
+ "that you have it installed and check shared libraries path\n"
+ "(LD_LIBRARY_PATH) envornment variable.\n");
+ return(-1);
}
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
/* Init crypto library */
if(xmlSecCryptoAppInit(NULL) < 0) {
- fprintf(stderr, "Error: crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: crypto initialization failed.\n");
+ return(-1);
}
/* Init xmlsec-crypto library */
if(xmlSecCryptoInit() < 0) {
- fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
+ return(-1);
}
/* create keys manager and load keys */
mngr = create_files_keys_mngr();
if(mngr == NULL) {
- return(-1);
+ return(-1);
}
if(decrypt_file(mngr, argv[1]) < 0) {
- xmlSecKeysMngrDestroy(mngr);
- return(-1);
+ xmlSecKeysMngrDestroy(mngr);
+ return(-1);
}
/* destroy keys manager */
@@ -132,8 +132,8 @@ main(int argc, char **argv) {
/**
* decrypt_file:
- * @mngr: the pointer to keys manager.
- * @enc_file: the encrypted XML file name.
+ * @mngr: the pointer to keys manager.
+ * @enc_file: the encrypted XML file name.
*
* Decrypts the XML file #enc_file using DES key from #key_file and
* prints results to stdout.
@@ -153,42 +153,42 @@ decrypt_file(xmlSecKeysMngrPtr mngr, const char* enc_file) {
/* load template */
doc = xmlParseFile(enc_file);
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
- fprintf(stderr, "Error: unable to parse file \"%s\"\n", enc_file);
- goto done;
+ fprintf(stderr, "Error: unable to parse file \"%s\"\n", enc_file);
+ goto done;
}
/* find start node */
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeEncryptedData, xmlSecEncNs);
if(node == NULL) {
- fprintf(stderr, "Error: start node not found in \"%s\"\n", enc_file);
- goto done;
+ fprintf(stderr, "Error: start node not found in \"%s\"\n", enc_file);
+ goto done;
}
/* create encryption context */
encCtx = xmlSecEncCtxCreate(mngr);
if(encCtx == NULL) {
fprintf(stderr,"Error: failed to create encryption context\n");
- goto done;
+ goto done;
}
/* decrypt the data */
if((xmlSecEncCtxDecrypt(encCtx, node) < 0) || (encCtx->result == NULL)) {
fprintf(stderr,"Error: decryption failed\n");
- goto done;
+ goto done;
}
/* print decrypted data to stdout */
if(encCtx->resultReplaced != 0) {
- fprintf(stdout, "Decrypted XML data:\n");
- xmlDocDump(stdout, doc);
+ fprintf(stdout, "Decrypted XML data:\n");
+ xmlDocDump(stdout, doc);
} else {
- fprintf(stdout, "Decrypted binary data (%d bytes):\n", xmlSecBufferGetSize(encCtx->result));
- if(xmlSecBufferGetData(encCtx->result) != NULL) {
- fwrite(xmlSecBufferGetData(encCtx->result),
- 1,
- xmlSecBufferGetSize(encCtx->result),
- stdout);
- }
+ fprintf(stdout, "Decrypted binary data (%d bytes):\n", xmlSecBufferGetSize(encCtx->result));
+ if(xmlSecBufferGetData(encCtx->result) != NULL) {
+ fwrite(xmlSecBufferGetData(encCtx->result),
+ 1,
+ xmlSecBufferGetSize(encCtx->result),
+ stdout);
+ }
}
fprintf(stdout, "\n");
@@ -198,11 +198,11 @@ decrypt_file(xmlSecKeysMngrPtr mngr, const char* enc_file) {
done:
/* cleanup */
if(encCtx != NULL) {
- xmlSecEncCtxDestroy(encCtx);
+ xmlSecEncCtxDestroy(encCtx);
}
if(doc != NULL) {
- xmlFreeDoc(doc);
+ xmlFreeDoc(doc);
}
return(res);
}
@@ -223,31 +223,31 @@ create_files_keys_mngr(void) {
/* create files based keys store */
keysStore = xmlSecKeyStoreCreate(files_keys_store_get_klass());
if(keysStore == NULL) {
- fprintf(stderr, "Error: failed to create keys store.\n");
- return(NULL);
+ fprintf(stderr, "Error: failed to create keys store.\n");
+ return(NULL);
}
/* create keys manager */
mngr = xmlSecKeysMngrCreate();
if(mngr == NULL) {
- fprintf(stderr, "Error: failed to create keys manager.\n");
- xmlSecKeyStoreDestroy(keysStore);
- return(NULL);
+ fprintf(stderr, "Error: failed to create keys manager.\n");
+ xmlSecKeyStoreDestroy(keysStore);
+ return(NULL);
}
/* add store to keys manager, from now on keys manager destroys the store if needed */
if(xmlSecKeysMngrAdoptKeysStore(mngr, keysStore) < 0) {
- fprintf(stderr, "Error: failed to add keys store to keys manager.\n");
- xmlSecKeyStoreDestroy(keysStore);
- xmlSecKeysMngrDestroy(mngr);
- return(NULL);
+ fprintf(stderr, "Error: failed to add keys store to keys manager.\n");
+ xmlSecKeyStoreDestroy(keysStore);
+ xmlSecKeysMngrDestroy(mngr);
+ return(NULL);
}
/* initialize crypto library specific data in keys manager */
if(xmlSecCryptoKeysMngrInit(mngr) < 0) {
- fprintf(stderr, "Error: failed to initialize crypto data in keys manager.\n");
- xmlSecKeysMngrDestroy(mngr);
- return(NULL);
+ fprintf(stderr, "Error: failed to initialize crypto data in keys manager.\n");
+ xmlSecKeysMngrDestroy(mngr);
+ return(NULL);
}
/* set the get key callback */
@@ -263,20 +263,20 @@ create_files_keys_mngr(void) {
* Attention: this probably not a good solution for high traffic systems.
*
***************************************************************************/
-static xmlSecKeyPtr files_keys_store_find_key (xmlSecKeyStorePtr store,
- const xmlChar* name,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+static xmlSecKeyPtr files_keys_store_find_key (xmlSecKeyStorePtr store,
+ const xmlChar* name,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
static xmlSecKeyStoreKlass files_keys_store_klass = {
sizeof(xmlSecKeyStoreKlass),
sizeof(xmlSecKeyStore),
- BAD_CAST "files-based-keys-store", /* const xmlChar* name; */
- NULL, /* xmlSecKeyStoreInitializeMethod initialize; */
- NULL, /* xmlSecKeyStoreFinalizeMethod finalize; */
- files_keys_store_find_key, /* xmlSecKeyStoreFindKeyMethod findKey; */
+ BAD_CAST "files-based-keys-store", /* const xmlChar* name; */
+ NULL, /* xmlSecKeyStoreInitializeMethod initialize; */
+ NULL, /* xmlSecKeyStoreFinalizeMethod finalize; */
+ files_keys_store_find_key, /* xmlSecKeyStoreFindKeyMethod findKey; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -294,9 +294,9 @@ files_keys_store_get_klass(void) {
/**
* files_keys_store_find_key:
- * @store: the pointer to simple keys store.
- * @name: the desired key name.
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> node processing context.
+ * @store: the pointer to simple keys store.
+ * @name: the desired key name.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> node processing context.
*
* Lookups key in the @store. The caller is responsible for destroying
* returned key with #xmlSecKeyDestroy function.
@@ -314,7 +314,7 @@ files_keys_store_find_key(xmlSecKeyStorePtr store, const xmlChar* name, xmlSecKe
/* it's possible to do not have the key name or desired key type
* but we could do nothing in this case */
if((name == NULL) || (keyInfoCtx->keyReq.keyId == xmlSecKeyDataIdUnknown)){
- return(NULL);
+ return(NULL);
}
/* we don't want to open files in a folder other than "current";
@@ -322,32 +322,32 @@ files_keys_store_find_key(xmlSecKeyStorePtr store, const xmlChar* name, xmlSecKe
* '.', '-' or '_'.
*/
for(p = name; (*p) != '\0'; ++p) {
- if(!isalnum((*p)) && ((*p) != '.') && ((*p) != '-') && ((*p) != '_')) {
- return(NULL);
- }
+ if(!isalnum((*p)) && ((*p) != '.') && ((*p) != '-') && ((*p) != '_')) {
+ return(NULL);
+ }
}
if((keyInfoCtx->keyReq.keyId == xmlSecKeyDataDsaId) || (keyInfoCtx->keyReq.keyId == xmlSecKeyDataRsaId)) {
- /* load key from a pem file, if key is not found then it's an error (is it?) */
- key = xmlSecCryptoAppKeyLoad(name, xmlSecKeyDataFormatPem, NULL, NULL, NULL);
- if(key == NULL) {
- fprintf(stderr,"Error: failed to load public pem key from \"%s\"\n", name);
- return(NULL);
- }
+ /* load key from a pem file, if key is not found then it's an error (is it?) */
+ key = xmlSecCryptoAppKeyLoad(name, xmlSecKeyDataFormatPem, NULL, NULL, NULL);
+ if(key == NULL) {
+ fprintf(stderr,"Error: failed to load public pem key from \"%s\"\n", name);
+ return(NULL);
+ }
} else {
- /* otherwise it's a binary key, if key is not found then it's an error (is it?) */
- key = xmlSecKeyReadBinaryFile(keyInfoCtx->keyReq.keyId, name);
- if(key == NULL) {
- fprintf(stderr,"Error: failed to load key from binary file \"%s\"\n", name);
- return(NULL);
- }
+ /* otherwise it's a binary key, if key is not found then it's an error (is it?) */
+ key = xmlSecKeyReadBinaryFile(keyInfoCtx->keyReq.keyId, name);
+ if(key == NULL) {
+ fprintf(stderr,"Error: failed to load key from binary file \"%s\"\n", name);
+ return(NULL);
+ }
}
/* set key name */
if(xmlSecKeySetName(key, name) < 0) {
fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", name);
xmlSecKeyDestroy(key);
- return(NULL);
+ return(NULL);
}
return(key);
diff --git a/examples/encrypt1.c b/examples/encrypt1.c
index bdd16b1..170ab90 100644
--- a/examples/encrypt1.c
+++ b/examples/encrypt1.c
@@ -4,13 +4,13 @@
* Encrypts binary data using a template file and a DES key from a binary file
*
* Usage:
- * ./encrypt1 <xml-tmpl> <des-key-file>
+ * ./encrypt1 <xml-tmpl> <des-key-file>
*
* Example:
- * ./encrypt1 encrypt1-tmpl.xml deskey.bin > encrypt1-res.xml
+ * ./encrypt1 encrypt1-tmpl.xml deskey.bin > encrypt1-res.xml
*
* The result could be decrypted with decrypt1 example:
- * ./decrypt1 encrypt1-res.xml deskey.bin
+ * ./decrypt1 encrypt1-res.xml deskey.bin
*
* This is free software; see Copyright file in the source
* distribution for preciese wording.
@@ -35,7 +35,7 @@
#include <xmlsec/crypto.h>
int encrypt_file(const char* tmpl_file, const char* key_file,
- const unsigned char* data, size_t dataSize);
+ const unsigned char* data, size_t dataSize);
int
main(int argc, char **argv) {
static const char secret_data[] = "Big secret";
@@ -43,9 +43,9 @@ main(int argc, char **argv) {
assert(argv);
if(argc != 3) {
- fprintf(stderr, "Error: wrong number of arguments.\n");
- fprintf(stderr, "Usage: %s <tmpl-file> <key-file>\n", argv[0]);
- return(1);
+ fprintf(stderr, "Error: wrong number of arguments.\n");
+ fprintf(stderr, "Usage: %s <tmpl-file> <key-file>\n", argv[0]);
+ return(1);
}
/* Init libxml and libxslt libraries */
@@ -56,17 +56,17 @@ main(int argc, char **argv) {
#ifndef XMLSEC_NO_XSLT
xmlIndentTreeOutput = 1;
#endif /* XMLSEC_NO_XSLT */
-
+
/* Init xmlsec library */
if(xmlSecInit() < 0) {
- fprintf(stderr, "Error: xmlsec initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec initialization failed.\n");
+ return(-1);
}
/* Check loaded library version */
if(xmlSecCheckVersion() != 1) {
- fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
- return(-1);
+ fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
+ return(-1);
}
/* Load default crypto engine if we are supporting dynamic
@@ -76,27 +76,27 @@ main(int argc, char **argv) {
*/
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {
- fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
- "that you have it installed and check shared libraries path\n"
- "(LD_LIBRARY_PATH) envornment variable.\n");
- return(-1);
+ fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
+ "that you have it installed and check shared libraries path\n"
+ "(LD_LIBRARY_PATH) envornment variable.\n");
+ return(-1);
}
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
/* Init crypto library */
if(xmlSecCryptoAppInit(NULL) < 0) {
- fprintf(stderr, "Error: crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: crypto initialization failed.\n");
+ return(-1);
}
/* Init xmlsec-crypto library */
if(xmlSecCryptoInit() < 0) {
- fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
+ return(-1);
}
if(encrypt_file(argv[1], argv[2], secret_data, strlen(secret_data)) < 0) {
- return(-1);
+ return(-1);
}
/* Shutdown xmlsec-crypto library */
@@ -119,10 +119,10 @@ main(int argc, char **argv) {
/**
* encrypt_file:
- * @tmpl_file: the encryption template file name.
- * @key_file: the Triple DES key file.
- * @data: the binary data to encrypt.
- * @dataSize: the binary data size.
+ * @tmpl_file: the encryption template file name.
+ * @key_file: the Triple DES key file.
+ * @data: the binary data to encrypt.
+ * @dataSize: the binary data size.
*
* Encrypts binary #data using template from #tmpl_file and DES key from
* #key_file.
@@ -131,7 +131,7 @@ main(int argc, char **argv) {
*/
int
encrypt_file(const char* tmpl_file, const char* key_file,
- const unsigned char* data, size_t dataSize) {
+ const unsigned char* data, size_t dataSize) {
xmlDocPtr doc = NULL;
xmlNodePtr node = NULL;
xmlSecEncCtxPtr encCtx = NULL;
@@ -144,41 +144,41 @@ encrypt_file(const char* tmpl_file, const char* key_file,
/* load template */
doc = xmlParseFile(tmpl_file);
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
- fprintf(stderr, "Error: unable to parse file \"%s\"\n", tmpl_file);
- goto done;
+ fprintf(stderr, "Error: unable to parse file \"%s\"\n", tmpl_file);
+ goto done;
}
/* find start node */
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeEncryptedData, xmlSecEncNs);
if(node == NULL) {
- fprintf(stderr, "Error: start node not found in \"%s\"\n", tmpl_file);
- goto done;
+ fprintf(stderr, "Error: start node not found in \"%s\"\n", tmpl_file);
+ goto done;
}
/* create encryption context, we don't need keys manager in this example */
encCtx = xmlSecEncCtxCreate(NULL);
if(encCtx == NULL) {
fprintf(stderr,"Error: failed to create encryption context\n");
- goto done;
+ goto done;
}
/* load DES key, assuming that there is not password */
encCtx->encKey = xmlSecKeyReadBinaryFile(xmlSecKeyDataDesId, key_file);
if(encCtx->encKey == NULL) {
fprintf(stderr,"Error: failed to load des key from binary file \"%s\"\n", key_file);
- goto done;
+ goto done;
}
/* set key name to the file name, this is just an example! */
if(xmlSecKeySetName(encCtx->encKey, key_file) < 0) {
- fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
- goto done;
+ fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
+ goto done;
}
/* encrypt the data */
if(xmlSecEncCtxBinaryEncrypt(encCtx, node, data, dataSize) < 0) {
fprintf(stderr,"Error: encryption failed\n");
- goto done;
+ goto done;
}
/* print encrypted data with document to stdout */
@@ -191,11 +191,11 @@ done:
/* cleanup */
if(encCtx != NULL) {
- xmlSecEncCtxDestroy(encCtx);
+ xmlSecEncCtxDestroy(encCtx);
}
if(doc != NULL) {
- xmlFreeDoc(doc);
+ xmlFreeDoc(doc);
}
return(res);
}
diff --git a/examples/encrypt2.c b/examples/encrypt2.c
index 9bbd52f..4535236 100644
--- a/examples/encrypt2.c
+++ b/examples/encrypt2.c
@@ -5,13 +5,13 @@
* from a binary file
*
* Usage:
- * ./encrypt2 <xml-doc> <des-key-file>
+ * ./encrypt2 <xml-doc> <des-key-file>
*
* Example:
- * ./encrypt2 encrypt2-doc.xml deskey.bin > encrypt2-res.xml
+ * ./encrypt2 encrypt2-doc.xml deskey.bin > encrypt2-res.xml
*
* The result could be decrypted with decrypt1 example:
- * ./decrypt1 encrypt2-res.xml deskey.bin
+ * ./decrypt1 encrypt2-res.xml deskey.bin
*
* This is free software; see Copyright file in the source
* distribution for preciese wording.
@@ -43,9 +43,9 @@ main(int argc, char **argv) {
assert(argv);
if(argc != 3) {
- fprintf(stderr, "Error: wrong number of arguments.\n");
- fprintf(stderr, "Usage: %s <xml-file> <key-file>\n", argv[0]);
- return(1);
+ fprintf(stderr, "Error: wrong number of arguments.\n");
+ fprintf(stderr, "Usage: %s <xml-file> <key-file>\n", argv[0]);
+ return(1);
}
/* Init libxml and libxslt libraries */
@@ -56,17 +56,17 @@ main(int argc, char **argv) {
#ifndef XMLSEC_NO_XSLT
xmlIndentTreeOutput = 1;
#endif /* XMLSEC_NO_XSLT */
-
+
/* Init xmlsec library */
if(xmlSecInit() < 0) {
- fprintf(stderr, "Error: xmlsec initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec initialization failed.\n");
+ return(-1);
}
/* Check loaded library version */
if(xmlSecCheckVersion() != 1) {
- fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
- return(-1);
+ fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
+ return(-1);
}
/* Load default crypto engine if we are supporting dynamic
@@ -76,27 +76,27 @@ main(int argc, char **argv) {
*/
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {
- fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
- "that you have it installed and check shared libraries path\n"
- "(LD_LIBRARY_PATH) envornment variable.\n");
- return(-1);
+ fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
+ "that you have it installed and check shared libraries path\n"
+ "(LD_LIBRARY_PATH) envornment variable.\n");
+ return(-1);
}
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
/* Init crypto library */
if(xmlSecCryptoAppInit(NULL) < 0) {
- fprintf(stderr, "Error: crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: crypto initialization failed.\n");
+ return(-1);
}
/* Init xmlsec-crypto library */
if(xmlSecCryptoInit() < 0) {
- fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
+ return(-1);
}
if(encrypt_file(argv[1], argv[2]) < 0) {
- return(-1);
+ return(-1);
}
/* Shutdown xmlsec-crypto library */
@@ -119,8 +119,8 @@ main(int argc, char **argv) {
/**
* encrypt_file:
- * @xml_file: the encryption template file name.
- * @key_file: the Triple DES key file.
+ * @xml_file: the encryption template file name.
+ * @key_file: the Triple DES key file.
*
* Encrypts #xml_file using a dynamicaly created template and DES key from
* #key_file.
@@ -141,61 +141,61 @@ encrypt_file(const char* xml_file, const char* key_file) {
/* load template */
doc = xmlParseFile(xml_file);
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
- fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
- goto done;
+ fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
+ goto done;
}
/* create encryption template to encrypt XML file and replace
* its content with encryption result */
encDataNode = xmlSecTmplEncDataCreate(doc, xmlSecTransformDes3CbcId,
- NULL, xmlSecTypeEncElement, NULL, NULL);
+ NULL, xmlSecTypeEncElement, NULL, NULL);
if(encDataNode == NULL) {
- fprintf(stderr, "Error: failed to create encryption template\n");
- goto done;
+ fprintf(stderr, "Error: failed to create encryption template\n");
+ goto done;
}
/* we want to put encrypted data in the <enc:CipherValue/> node */
if(xmlSecTmplEncDataEnsureCipherValue(encDataNode) == NULL) {
- fprintf(stderr, "Error: failed to add CipherValue node\n");
- goto done;
+ fprintf(stderr, "Error: failed to add CipherValue node\n");
+ goto done;
}
/* add <dsig:KeyInfo/> and <dsig:KeyName/> nodes to put key name in the signed document */
keyInfoNode = xmlSecTmplEncDataEnsureKeyInfo(encDataNode, NULL);
if(keyInfoNode == NULL) {
- fprintf(stderr, "Error: failed to add key info\n");
- goto done;
+ fprintf(stderr, "Error: failed to add key info\n");
+ goto done;
}
if(xmlSecTmplKeyInfoAddKeyName(keyInfoNode, NULL) == NULL) {
- fprintf(stderr, "Error: failed to add key name\n");
- goto done;
+ fprintf(stderr, "Error: failed to add key name\n");
+ goto done;
}
/* create encryption context, we don't need keys manager in this example */
encCtx = xmlSecEncCtxCreate(NULL);
if(encCtx == NULL) {
fprintf(stderr,"Error: failed to create encryption context\n");
- goto done;
+ goto done;
}
/* load DES key, assuming that there is not password */
encCtx->encKey = xmlSecKeyReadBinaryFile(xmlSecKeyDataDesId, key_file);
if(encCtx->encKey == NULL) {
fprintf(stderr,"Error: failed to load des key from binary file \"%s\"\n", key_file);
- goto done;
+ goto done;
}
/* set key name to the file name, this is just an example! */
if(xmlSecKeySetName(encCtx->encKey, key_file) < 0) {
- fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
- goto done;
+ fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
+ goto done;
}
/* encrypt the data */
if(xmlSecEncCtxXmlEncrypt(encCtx, encDataNode, xmlDocGetRootElement(doc)) < 0) {
fprintf(stderr,"Error: encryption failed\n");
- goto done;
+ goto done;
}
/* we template is inserted in the doc */
@@ -211,15 +211,15 @@ done:
/* cleanup */
if(encCtx != NULL) {
- xmlSecEncCtxDestroy(encCtx);
+ xmlSecEncCtxDestroy(encCtx);
}
if(encDataNode != NULL) {
- xmlFreeNode(encDataNode);
+ xmlFreeNode(encDataNode);
}
if(doc != NULL) {
- xmlFreeDoc(doc);
+ xmlFreeDoc(doc);
}
return(res);
}
diff --git a/examples/encrypt3.c b/examples/encrypt3.c
index 788c964..27f4c3d 100644
--- a/examples/encrypt3.c
+++ b/examples/encrypt3.c
@@ -5,13 +5,13 @@
* DES key (encrypted with an RSA key).
*
* Usage:
- * ./encrypt3 <xml-doc> <rsa-pem-key-file>
+ * ./encrypt3 <xml-doc> <rsa-pem-key-file>
*
* Example:
- * ./encrypt3 encrypt3-doc.xml rsakey.pem > encrypt3-res.xml
+ * ./encrypt3 encrypt3-doc.xml rsakey.pem > encrypt3-res.xml
*
* The result could be decrypted with decrypt3 example:
- * ./decrypt3 encrypt3-res.xml
+ * ./decrypt3 encrypt3-res.xml
*
* This is free software; see Copyright file in the source
* distribution for preciese wording.
@@ -46,9 +46,9 @@ main(int argc, char **argv) {
assert(argv);
if(argc != 3) {
- fprintf(stderr, "Error: wrong number of arguments.\n");
- fprintf(stderr, "Usage: %s <xml-file> <key-file>\n", argv[0]);
- return(1);
+ fprintf(stderr, "Error: wrong number of arguments.\n");
+ fprintf(stderr, "Usage: %s <xml-file> <key-file>\n", argv[0]);
+ return(1);
}
/* Init libxml and libxslt libraries */
@@ -59,17 +59,17 @@ main(int argc, char **argv) {
#ifndef XMLSEC_NO_XSLT
xmlIndentTreeOutput = 1;
#endif /* XMLSEC_NO_XSLT */
-
+
/* Init xmlsec library */
if(xmlSecInit() < 0) {
- fprintf(stderr, "Error: xmlsec initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec initialization failed.\n");
+ return(-1);
}
/* Check loaded library version */
if(xmlSecCheckVersion() != 1) {
- fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
- return(-1);
+ fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
+ return(-1);
}
/* Load default crypto engine if we are supporting dynamic
@@ -79,35 +79,35 @@ main(int argc, char **argv) {
*/
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {
- fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
- "that you have it installed and check shared libraries path\n"
- "(LD_LIBRARY_PATH) envornment variable.\n");
- return(-1);
+ fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
+ "that you have it installed and check shared libraries path\n"
+ "(LD_LIBRARY_PATH) envornment variable.\n");
+ return(-1);
}
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
/* Init crypto library */
if(xmlSecCryptoAppInit(NULL) < 0) {
- fprintf(stderr, "Error: crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: crypto initialization failed.\n");
+ return(-1);
}
/* Init xmlsec-crypto library */
if(xmlSecCryptoInit() < 0) {
- fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
+ return(-1);
}
/* create keys manager and load keys */
mngr = load_rsa_keys(argv[2]);
if(mngr == NULL) {
- return(-1);
+ return(-1);
}
/* we use key filename as key name here */
if(encrypt_file(mngr, argv[1], argv[2]) < 0) {
- xmlSecKeysMngrDestroy(mngr);
- return(-1);
+ xmlSecKeysMngrDestroy(mngr);
+ return(-1);
}
/* destroy keys manager */
@@ -133,7 +133,7 @@ main(int argc, char **argv) {
/**
* load_rsa_keys:
- * @key_file: the key filename.
+ * @key_file: the key filename.
*
* Creates simple keys manager and load RSA key from #key_file in it.
* The caller is responsible for destroing returned keys manager using
@@ -155,13 +155,13 @@ load_rsa_keys(char* key_file) {
*/
mngr = xmlSecKeysMngrCreate();
if(mngr == NULL) {
- fprintf(stderr, "Error: failed to create keys manager.\n");
- return(NULL);
+ fprintf(stderr, "Error: failed to create keys manager.\n");
+ return(NULL);
}
if(xmlSecCryptoAppDefaultKeysMngrInit(mngr) < 0) {
- fprintf(stderr, "Error: failed to initialize keys manager.\n");
- xmlSecKeysMngrDestroy(mngr);
- return(NULL);
+ fprintf(stderr, "Error: failed to initialize keys manager.\n");
+ xmlSecKeysMngrDestroy(mngr);
+ return(NULL);
}
/* load private RSA key */
@@ -175,11 +175,11 @@ load_rsa_keys(char* key_file) {
/* set key name to the file name, this is just an example! */
if(xmlSecKeySetName(key, BAD_CAST key_file) < 0) {
fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
- xmlSecKeyDestroy(key);
- xmlSecKeysMngrDestroy(mngr);
- return(NULL);
+ xmlSecKeyDestroy(key);
+ xmlSecKeysMngrDestroy(mngr);
+ return(NULL);
}
-
+
/* add key to keys manager, from now on keys manager is responsible
* for destroying key
*/
@@ -195,9 +195,9 @@ load_rsa_keys(char* key_file) {
/**
* encrypt_file:
- * @mngr: the pointer to keys manager.
- * @xml_file: the encryption template file name.
- * @key_name: the RSA key name.
+ * @mngr: the pointer to keys manager.
+ * @xml_file: the encryption template file name.
+ * @key_name: the RSA key name.
*
* Encrypts #xml_file using a dynamicaly created template, a session DES key
* and an RSA key from keys manager.
@@ -221,78 +221,78 @@ encrypt_file(xmlSecKeysMngrPtr mngr, const char* xml_file, const char* key_name)
/* load template */
doc = xmlParseFile(xml_file);
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
- fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
- goto done;
+ fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
+ goto done;
}
/* create encryption template to encrypt XML file and replace
* its content with encryption result */
encDataNode = xmlSecTmplEncDataCreate(doc, xmlSecTransformDes3CbcId,
- NULL, xmlSecTypeEncElement, NULL, NULL);
+ NULL, xmlSecTypeEncElement, NULL, NULL);
if(encDataNode == NULL) {
- fprintf(stderr, "Error: failed to create encryption template\n");
- goto done;
+ fprintf(stderr, "Error: failed to create encryption template\n");
+ goto done;
}
/* we want to put encrypted data in the <enc:CipherValue/> node */
if(xmlSecTmplEncDataEnsureCipherValue(encDataNode) == NULL) {
- fprintf(stderr, "Error: failed to add CipherValue node\n");
- goto done;
+ fprintf(stderr, "Error: failed to add CipherValue node\n");
+ goto done;
}
/* add <dsig:KeyInfo/> */
keyInfoNode = xmlSecTmplEncDataEnsureKeyInfo(encDataNode, NULL);
if(keyInfoNode == NULL) {
- fprintf(stderr, "Error: failed to add key info\n");
- goto done;
+ fprintf(stderr, "Error: failed to add key info\n");
+ goto done;
}
/* add <enc:EncryptedKey/> to store the encrypted session key */
encKeyNode = xmlSecTmplKeyInfoAddEncryptedKey(keyInfoNode,
- xmlSecTransformRsaPkcs1Id,
- NULL, NULL, NULL);
+ xmlSecTransformRsaPkcs1Id,
+ NULL, NULL, NULL);
if(encKeyNode == NULL) {
- fprintf(stderr, "Error: failed to add key info\n");
- goto done;
+ fprintf(stderr, "Error: failed to add key info\n");
+ goto done;
}
/* we want to put encrypted key in the <enc:CipherValue/> node */
if(xmlSecTmplEncDataEnsureCipherValue(encKeyNode) == NULL) {
- fprintf(stderr, "Error: failed to add CipherValue node\n");
- goto done;
+ fprintf(stderr, "Error: failed to add CipherValue node\n");
+ goto done;
}
/* add <dsig:KeyInfo/> and <dsig:KeyName/> nodes to <enc:EncryptedKey/> */
keyInfoNode2 = xmlSecTmplEncDataEnsureKeyInfo(encKeyNode, NULL);
if(keyInfoNode2 == NULL) {
- fprintf(stderr, "Error: failed to add key info\n");
- goto done;
+ fprintf(stderr, "Error: failed to add key info\n");
+ goto done;
}
/* set key name so we can lookup key when needed */
if(xmlSecTmplKeyInfoAddKeyName(keyInfoNode2, key_name) == NULL) {
- fprintf(stderr, "Error: failed to add key name\n");
- goto done;
+ fprintf(stderr, "Error: failed to add key name\n");
+ goto done;
}
/* create encryption context */
encCtx = xmlSecEncCtxCreate(mngr);
if(encCtx == NULL) {
fprintf(stderr,"Error: failed to create encryption context\n");
- goto done;
+ goto done;
}
/* generate a Triple DES key */
encCtx->encKey = xmlSecKeyGenerate(xmlSecKeyDataDesId, 192, xmlSecKeyDataTypeSession);
if(encCtx->encKey == NULL) {
fprintf(stderr,"Error: failed to generate session des key\n");
- goto done;
+ goto done;
}
/* encrypt the data */
if(xmlSecEncCtxXmlEncrypt(encCtx, encDataNode, xmlDocGetRootElement(doc)) < 0) {
fprintf(stderr,"Error: encryption failed\n");
- goto done;
+ goto done;
}
/* we template is inserted in the doc */
@@ -308,15 +308,15 @@ done:
/* cleanup */
if(encCtx != NULL) {
- xmlSecEncCtxDestroy(encCtx);
+ xmlSecEncCtxDestroy(encCtx);
}
if(encDataNode != NULL) {
- xmlFreeNode(encDataNode);
+ xmlFreeNode(encDataNode);
}
if(doc != NULL) {
- xmlFreeDoc(doc);
+ xmlFreeDoc(doc);
}
return(res);
}
diff --git a/examples/sign1.c b/examples/sign1.c
index f17bf96..2e772d8 100644
--- a/examples/sign1.c
+++ b/examples/sign1.c
@@ -4,13 +4,13 @@
* Signs a template file using a key from PEM file
*
* Usage:
- * ./sign1 <xml-tmpl> <pem-key>
+ * ./sign1 <xml-tmpl> <pem-key>
*
* Example:
- * ./sign1 sign1-tmpl.xml rsakey.pem > sign1-res.xml
+ * ./sign1 sign1-tmpl.xml rsakey.pem > sign1-res.xml
*
* The result signature could be validated using verify1 example:
- * ./verify1 sign1-res.xml rsapub.pem
+ * ./verify1 sign1-res.xml rsapub.pem
*
* This is free software; see Copyright file in the source
* distribution for preciese wording.
@@ -41,9 +41,9 @@ main(int argc, char **argv) {
assert(argv);
if(argc != 3) {
- fprintf(stderr, "Error: wrong number of arguments.\n");
- fprintf(stderr, "Usage: %s <tmpl-file> <key-file>\n", argv[0]);
- return(1);
+ fprintf(stderr, "Error: wrong number of arguments.\n");
+ fprintf(stderr, "Usage: %s <tmpl-file> <key-file>\n", argv[0]);
+ return(1);
}
/* Init libxml and libxslt libraries */
@@ -54,17 +54,17 @@ main(int argc, char **argv) {
#ifndef XMLSEC_NO_XSLT
xmlIndentTreeOutput = 1;
#endif /* XMLSEC_NO_XSLT */
-
+
/* Init xmlsec library */
if(xmlSecInit() < 0) {
- fprintf(stderr, "Error: xmlsec initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec initialization failed.\n");
+ return(-1);
}
/* Check loaded library version */
if(xmlSecCheckVersion() != 1) {
- fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
- return(-1);
+ fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
+ return(-1);
}
/* Load default crypto engine if we are supporting dynamic
@@ -74,27 +74,27 @@ main(int argc, char **argv) {
*/
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {
- fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
- "that you have it installed and check shared libraries path\n"
- "(LD_LIBRARY_PATH) envornment variable.\n");
- return(-1);
+ fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
+ "that you have it installed and check shared libraries path\n"
+ "(LD_LIBRARY_PATH) envornment variable.\n");
+ return(-1);
}
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
/* Init crypto library */
if(xmlSecCryptoAppInit(NULL) < 0) {
- fprintf(stderr, "Error: crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: crypto initialization failed.\n");
+ return(-1);
}
/* Init xmlsec-crypto library */
if(xmlSecCryptoInit() < 0) {
- fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
+ return(-1);
}
if(sign_file(argv[1], argv[2]) < 0) {
- return(-1);
+ return(-1);
}
/* Shutdown xmlsec-crypto library */
@@ -117,8 +117,8 @@ main(int argc, char **argv) {
/**
* sign_file:
- * @tmpl_file: the signature template file name.
- * @key_file: the PEM private key file name.
+ * @tmpl_file: the signature template file name.
+ * @key_file: the PEM private key file name.
*
* Signs the #tmpl_file using private key from #key_file.
*
@@ -137,41 +137,41 @@ sign_file(const char* tmpl_file, const char* key_file) {
/* load template */
doc = xmlParseFile(tmpl_file);
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
- fprintf(stderr, "Error: unable to parse file \"%s\"\n", tmpl_file);
- goto done;
+ fprintf(stderr, "Error: unable to parse file \"%s\"\n", tmpl_file);
+ goto done;
}
/* find start node */
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeSignature, xmlSecDSigNs);
if(node == NULL) {
- fprintf(stderr, "Error: start node not found in \"%s\"\n", tmpl_file);
- goto done;
+ fprintf(stderr, "Error: start node not found in \"%s\"\n", tmpl_file);
+ goto done;
}
/* create signature context, we don't need keys manager in this example */
dsigCtx = xmlSecDSigCtxCreate(NULL);
if(dsigCtx == NULL) {
fprintf(stderr,"Error: failed to create signature context\n");
- goto done;
+ goto done;
}
/* load private key, assuming that there is not password */
dsigCtx->signKey = xmlSecCryptoAppKeyLoad(key_file, xmlSecKeyDataFormatPem, NULL, NULL, NULL);
if(dsigCtx->signKey == NULL) {
fprintf(stderr,"Error: failed to load private pem key from \"%s\"\n", key_file);
- goto done;
+ goto done;
}
/* set key name to the file name, this is just an example! */
if(xmlSecKeySetName(dsigCtx->signKey, key_file) < 0) {
- fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
- goto done;
+ fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
+ goto done;
}
/* sign the template */
if(xmlSecDSigCtxSign(dsigCtx, node) < 0) {
fprintf(stderr,"Error: signature failed\n");
- goto done;
+ goto done;
}
/* print signed document to stdout */
@@ -183,11 +183,11 @@ sign_file(const char* tmpl_file, const char* key_file) {
done:
/* cleanup */
if(dsigCtx != NULL) {
- xmlSecDSigCtxDestroy(dsigCtx);
+ xmlSecDSigCtxDestroy(dsigCtx);
}
if(doc != NULL) {
- xmlFreeDoc(doc);
+ xmlFreeDoc(doc);
}
return(res);
}
diff --git a/examples/sign2.c b/examples/sign2.c
index 3bb858c..25e0937 100644
--- a/examples/sign2.c
+++ b/examples/sign2.c
@@ -6,13 +6,13 @@
* the whole document except the <dsig:Signature/> node itself.
*
* Usage:
- * sign2 <xml-doc> <pem-key>
+ * sign2 <xml-doc> <pem-key>
*
* Example:
- * ./sign2 sign2-doc.xml rsakey.pem > sign2-res.xml
+ * ./sign2 sign2-doc.xml rsakey.pem > sign2-res.xml
*
* The result signature could be validated using verify1 example:
- * ./verify1 sign2-res.xml rsapub.pem
+ * ./verify1 sign2-res.xml rsapub.pem
*
* This is free software; see Copyright file in the source
* distribution for preciese wording.
@@ -44,9 +44,9 @@ main(int argc, char **argv) {
assert(argv);
if(argc != 3) {
- fprintf(stderr, "Error: wrong number of arguments.\n");
- fprintf(stderr, "Usage: %s <xml-file> <key-file>\n", argv[0]);
- return(1);
+ fprintf(stderr, "Error: wrong number of arguments.\n");
+ fprintf(stderr, "Usage: %s <xml-file> <key-file>\n", argv[0]);
+ return(1);
}
/* Init libxml and libxslt libraries */
@@ -57,17 +57,17 @@ main(int argc, char **argv) {
#ifndef XMLSEC_NO_XSLT
xmlIndentTreeOutput = 1;
#endif /* XMLSEC_NO_XSLT */
-
+
/* Init xmlsec library */
if(xmlSecInit() < 0) {
- fprintf(stderr, "Error: xmlsec initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec initialization failed.\n");
+ return(-1);
}
/* Check loaded library version */
if(xmlSecCheckVersion() != 1) {
- fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
- return(-1);
+ fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
+ return(-1);
}
/* Load default crypto engine if we are supporting dynamic
@@ -77,27 +77,27 @@ main(int argc, char **argv) {
*/
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {
- fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
- "that you have it installed and check shared libraries path\n"
- "(LD_LIBRARY_PATH) envornment variable.\n");
- return(-1);
+ fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
+ "that you have it installed and check shared libraries path\n"
+ "(LD_LIBRARY_PATH) envornment variable.\n");
+ return(-1);
}
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
/* Init crypto library */
if(xmlSecCryptoAppInit(NULL) < 0) {
- fprintf(stderr, "Error: crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: crypto initialization failed.\n");
+ return(-1);
}
/* Init xmlsec-crypto library */
if(xmlSecCryptoInit() < 0) {
- fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
+ return(-1);
}
if(sign_file(argv[1], argv[2]) < 0) {
- return(-1);
+ return(-1);
}
/* Shutdown xmlsec-crypto library */
@@ -120,8 +120,8 @@ main(int argc, char **argv) {
/**
* sign_file:
- * @xml_file: the XML file name.
- * @key_file: the PEM private key file name.
+ * @xml_file: the XML file name.
+ * @key_file: the PEM private key file name.
*
* Signs the #xml_file using private key from #key_file and dynamicaly
* created enveloped signature template.
@@ -143,16 +143,16 @@ sign_file(const char* xml_file, const char* key_file) {
/* load doc file */
doc = xmlParseFile(xml_file);
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
- fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
- goto done;
+ fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
+ goto done;
}
/* create signature template for RSA-SHA1 enveloped signature */
signNode = xmlSecTmplSignatureCreate(doc, xmlSecTransformExclC14NId,
- xmlSecTransformRsaSha1Id, NULL);
+ xmlSecTransformRsaSha1Id, NULL);
if(signNode == NULL) {
- fprintf(stderr, "Error: failed to create signature template\n");
- goto done;
+ fprintf(stderr, "Error: failed to create signature template\n");
+ goto done;
}
/* add <dsig:Signature/> node to the doc */
@@ -160,54 +160,54 @@ sign_file(const char* xml_file, const char* key_file) {
/* add reference */
refNode = xmlSecTmplSignatureAddReference(signNode, xmlSecTransformSha1Id,
- NULL, NULL, NULL);
+ NULL, NULL, NULL);
if(refNode == NULL) {
- fprintf(stderr, "Error: failed to add reference to signature template\n");
- goto done;
+ fprintf(stderr, "Error: failed to add reference to signature template\n");
+ goto done;
}
/* add enveloped transform */
if(xmlSecTmplReferenceAddTransform(refNode, xmlSecTransformEnvelopedId) == NULL) {
- fprintf(stderr, "Error: failed to add enveloped transform to reference\n");
- goto done;
+ fprintf(stderr, "Error: failed to add enveloped transform to reference\n");
+ goto done;
}
/* add <dsig:KeyInfo/> and <dsig:KeyName/> nodes to put key name in the signed document */
keyInfoNode = xmlSecTmplSignatureEnsureKeyInfo(signNode, NULL);
if(keyInfoNode == NULL) {
- fprintf(stderr, "Error: failed to add key info\n");
- goto done;
+ fprintf(stderr, "Error: failed to add key info\n");
+ goto done;
}
if(xmlSecTmplKeyInfoAddKeyName(keyInfoNode, NULL) == NULL) {
- fprintf(stderr, "Error: failed to add key name\n");
- goto done;
+ fprintf(stderr, "Error: failed to add key name\n");
+ goto done;
}
/* create signature context, we don't need keys manager in this example */
dsigCtx = xmlSecDSigCtxCreate(NULL);
if(dsigCtx == NULL) {
fprintf(stderr,"Error: failed to create signature context\n");
- goto done;
+ goto done;
}
/* load private key, assuming that there is not password */
dsigCtx->signKey = xmlSecCryptoAppKeyLoad(key_file, xmlSecKeyDataFormatPem, NULL, NULL, NULL);
if(dsigCtx->signKey == NULL) {
fprintf(stderr,"Error: failed to load private pem key from \"%s\"\n", key_file);
- goto done;
+ goto done;
}
/* set key name to the file name, this is just an example! */
if(xmlSecKeySetName(dsigCtx->signKey, key_file) < 0) {
- fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
- goto done;
+ fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
+ goto done;
}
/* sign the template */
if(xmlSecDSigCtxSign(dsigCtx, signNode) < 0) {
fprintf(stderr,"Error: signature failed\n");
- goto done;
+ goto done;
}
/* print signed document to stdout */
@@ -219,11 +219,11 @@ sign_file(const char* xml_file, const char* key_file) {
done:
/* cleanup */
if(dsigCtx != NULL) {
- xmlSecDSigCtxDestroy(dsigCtx);
+ xmlSecDSigCtxDestroy(dsigCtx);
}
if(doc != NULL) {
- xmlFreeDoc(doc);
+ xmlFreeDoc(doc);
}
return(res);
}
diff --git a/examples/sign3.c b/examples/sign3.c
index 8a36708..a9436ef 100644
--- a/examples/sign3.c
+++ b/examples/sign3.c
@@ -10,13 +10,13 @@
* certificates management policies for another crypto library may break it.
*
* Usage:
- * sign3 <xml-doc> <pem-key>
+ * sign3 <xml-doc> <pem-key>
*
* Example:
- * ./sign3 sign3-doc.xml rsakey.pem rsacert.pem > sign3-res.xml
+ * ./sign3 sign3-doc.xml rsakey.pem rsacert.pem > sign3-res.xml
*
* The result signature could be validated using verify3 example:
- * ./verify3 sign3-res.xml rootcert.pem
+ * ./verify3 sign3-res.xml rootcert.pem
*
* This is free software; see Copyright file in the source
* distribution for preciese wording.
@@ -48,9 +48,9 @@ main(int argc, char **argv) {
assert(argv);
if(argc != 4) {
- fprintf(stderr, "Error: wrong number of arguments.\n");
- fprintf(stderr, "Usage: %s <xml-file> <key-file> <cert-file>\n", argv[0]);
- return(1);
+ fprintf(stderr, "Error: wrong number of arguments.\n");
+ fprintf(stderr, "Usage: %s <xml-file> <key-file> <cert-file>\n", argv[0]);
+ return(1);
}
/* Init libxml and libxslt libraries */
@@ -61,17 +61,17 @@ main(int argc, char **argv) {
#ifndef XMLSEC_NO_XSLT
xmlIndentTreeOutput = 1;
#endif /* XMLSEC_NO_XSLT */
-
+
/* Init xmlsec library */
if(xmlSecInit() < 0) {
- fprintf(stderr, "Error: xmlsec initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec initialization failed.\n");
+ return(-1);
}
/* Check loaded library version */
if(xmlSecCheckVersion() != 1) {
- fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
- return(-1);
+ fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
+ return(-1);
}
/* Load default crypto engine if we are supporting dynamic
@@ -81,27 +81,27 @@ main(int argc, char **argv) {
*/
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {
- fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
- "that you have it installed and check shared libraries path\n"
- "(LD_LIBRARY_PATH) envornment variable.\n");
- return(-1);
+ fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
+ "that you have it installed and check shared libraries path\n"
+ "(LD_LIBRARY_PATH) envornment variable.\n");
+ return(-1);
}
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
/* Init crypto library */
if(xmlSecCryptoAppInit(NULL) < 0) {
- fprintf(stderr, "Error: crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: crypto initialization failed.\n");
+ return(-1);
}
/* Init xmlsec-crypto library */
if(xmlSecCryptoInit() < 0) {
- fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
+ return(-1);
}
if(sign_file(argv[1], argv[2], argv[3]) < 0) {
- return(-1);
+ return(-1);
}
/* Shutdown xmlsec-crypto library */
@@ -124,9 +124,9 @@ main(int argc, char **argv) {
/**
* sign_file:
- * @xml_file: the XML file name.
- * @key_file: the PEM private key file name.
- * @cert_file: the x509 certificate PEM file.
+ * @xml_file: the XML file name.
+ * @key_file: the PEM private key file name.
+ * @cert_file: the x509 certificate PEM file.
*
* Signs the @xml_file using private key from @key_file and dynamicaly
* created enveloped signature template. The certificate from @cert_file
@@ -150,16 +150,16 @@ sign_file(const char* xml_file, const char* key_file, const char* cert_file) {
/* load doc file */
doc = xmlParseFile(xml_file);
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
- fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
- goto done;
+ fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
+ goto done;
}
/* create signature template for RSA-SHA1 enveloped signature */
signNode = xmlSecTmplSignatureCreate(doc, xmlSecTransformExclC14NId,
- xmlSecTransformRsaSha1Id, NULL);
+ xmlSecTransformRsaSha1Id, NULL);
if(signNode == NULL) {
- fprintf(stderr, "Error: failed to create signature template\n");
- goto done;
+ fprintf(stderr, "Error: failed to create signature template\n");
+ goto done;
}
/* add <dsig:Signature/> node to the doc */
@@ -167,60 +167,60 @@ sign_file(const char* xml_file, const char* key_file, const char* cert_file) {
/* add reference */
refNode = xmlSecTmplSignatureAddReference(signNode, xmlSecTransformSha1Id,
- NULL, NULL, NULL);
+ NULL, NULL, NULL);
if(refNode == NULL) {
- fprintf(stderr, "Error: failed to add reference to signature template\n");
- goto done;
+ fprintf(stderr, "Error: failed to add reference to signature template\n");
+ goto done;
}
/* add enveloped transform */
if(xmlSecTmplReferenceAddTransform(refNode, xmlSecTransformEnvelopedId) == NULL) {
- fprintf(stderr, "Error: failed to add enveloped transform to reference\n");
- goto done;
+ fprintf(stderr, "Error: failed to add enveloped transform to reference\n");
+ goto done;
}
/* add <dsig:KeyInfo/> and <dsig:X509Data/> */
keyInfoNode = xmlSecTmplSignatureEnsureKeyInfo(signNode, NULL);
if(keyInfoNode == NULL) {
- fprintf(stderr, "Error: failed to add key info\n");
- goto done;
+ fprintf(stderr, "Error: failed to add key info\n");
+ goto done;
}
if(xmlSecTmplKeyInfoAddX509Data(keyInfoNode) == NULL) {
- fprintf(stderr, "Error: failed to add X509Data node\n");
- goto done;
+ fprintf(stderr, "Error: failed to add X509Data node\n");
+ goto done;
}
/* create signature context, we don't need keys manager in this example */
dsigCtx = xmlSecDSigCtxCreate(NULL);
if(dsigCtx == NULL) {
fprintf(stderr,"Error: failed to create signature context\n");
- goto done;
+ goto done;
}
/* load private key, assuming that there is not password */
dsigCtx->signKey = xmlSecCryptoAppKeyLoad(key_file, xmlSecKeyDataFormatPem, NULL, NULL, NULL);
if(dsigCtx->signKey == NULL) {
fprintf(stderr,"Error: failed to load private pem key from \"%s\"\n", key_file);
- goto done;
+ goto done;
}
/* load certificate and add to the key */
if(xmlSecCryptoAppKeyCertLoad(dsigCtx->signKey, cert_file, xmlSecKeyDataFormatPem) < 0) {
fprintf(stderr,"Error: failed to load pem certificate \"%s\"\n", cert_file);
- goto done;
+ goto done;
}
/* set key name to the file name, this is just an example! */
if(xmlSecKeySetName(dsigCtx->signKey, key_file) < 0) {
- fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
- goto done;
+ fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
+ goto done;
}
/* sign the template */
if(xmlSecDSigCtxSign(dsigCtx, signNode) < 0) {
fprintf(stderr,"Error: signature failed\n");
- goto done;
+ goto done;
}
/* print signed document to stdout */
@@ -232,11 +232,11 @@ sign_file(const char* xml_file, const char* key_file, const char* cert_file) {
done:
/* cleanup */
if(dsigCtx != NULL) {
- xmlSecDSigCtxDestroy(dsigCtx);
+ xmlSecDSigCtxDestroy(dsigCtx);
}
if(doc != NULL) {
- xmlFreeDoc(doc);
+ xmlFreeDoc(doc);
}
return(res);
}
diff --git a/examples/verify1.c b/examples/verify1.c
index 9f2eff5..25d128f 100644
--- a/examples/verify1.c
+++ b/examples/verify1.c
@@ -4,11 +4,11 @@
* Verifies a file using a key from PEM file.
*
* Usage:
- * verify1 <signed-file> <pem-key>
+ * verify1 <signed-file> <pem-key>
*
* Example:
- * ./verify1 sign1-res.xml rsapub.pem
- * ./verify1 sign2-res.xml rsapub.pem
+ * ./verify1 sign1-res.xml rsapub.pem
+ * ./verify1 sign2-res.xml rsapub.pem
*
* This is free software; see Copyright file in the source
* distribution for preciese wording.
@@ -39,9 +39,9 @@ main(int argc, char **argv) {
assert(argv);
if(argc != 3) {
- fprintf(stderr, "Error: wrong number of arguments.\n");
- fprintf(stderr, "Usage: %s <xml-file> <key-file>\n", argv[0]);
- return(1);
+ fprintf(stderr, "Error: wrong number of arguments.\n");
+ fprintf(stderr, "Usage: %s <xml-file> <key-file>\n", argv[0]);
+ return(1);
}
/* Init libxml and libxslt libraries */
@@ -52,17 +52,17 @@ main(int argc, char **argv) {
#ifndef XMLSEC_NO_XSLT
xmlIndentTreeOutput = 1;
#endif /* XMLSEC_NO_XSLT */
-
+
/* Init xmlsec library */
if(xmlSecInit() < 0) {
- fprintf(stderr, "Error: xmlsec initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec initialization failed.\n");
+ return(-1);
}
/* Check loaded library version */
if(xmlSecCheckVersion() != 1) {
- fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
- return(-1);
+ fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
+ return(-1);
}
/* Load default crypto engine if we are supporting dynamic
@@ -72,27 +72,27 @@ main(int argc, char **argv) {
*/
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {
- fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
- "that you have it installed and check shared libraries path\n"
- "(LD_LIBRARY_PATH) envornment variable.\n");
- return(-1);
+ fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
+ "that you have it installed and check shared libraries path\n"
+ "(LD_LIBRARY_PATH) envornment variable.\n");
+ return(-1);
}
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
/* Init crypto library */
if(xmlSecCryptoAppInit(NULL) < 0) {
- fprintf(stderr, "Error: crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: crypto initialization failed.\n");
+ return(-1);
}
/* Init xmlsec-crypto library */
if(xmlSecCryptoInit() < 0) {
- fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
+ return(-1);
}
if(verify_file(argv[1], argv[2]) < 0) {
- return(-1);
+ return(-1);
}
/* Shutdown xmlsec-crypto library */
@@ -115,8 +115,8 @@ main(int argc, char **argv) {
/**
* verify_file:
- * @xml_file: the signed XML file name.
- * @key_file: the PEM public key file name.
+ * @xml_file: the signed XML file name.
+ * @key_file: the PEM public key file name.
*
* Verifies XML signature in #xml_file using public key from #key_file.
*
@@ -135,48 +135,48 @@ verify_file(const char* xml_file, const char* key_file) {
/* load file */
doc = xmlParseFile(xml_file);
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
- fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
- goto done;
+ fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
+ goto done;
}
/* find start node */
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeSignature, xmlSecDSigNs);
if(node == NULL) {
- fprintf(stderr, "Error: start node not found in \"%s\"\n", xml_file);
- goto done;
+ fprintf(stderr, "Error: start node not found in \"%s\"\n", xml_file);
+ goto done;
}
/* create signature context, we don't need keys manager in this example */
dsigCtx = xmlSecDSigCtxCreate(NULL);
if(dsigCtx == NULL) {
fprintf(stderr,"Error: failed to create signature context\n");
- goto done;
+ goto done;
}
/* load public key */
dsigCtx->signKey = xmlSecCryptoAppKeyLoad(key_file, xmlSecKeyDataFormatPem, NULL, NULL, NULL);
if(dsigCtx->signKey == NULL) {
fprintf(stderr,"Error: failed to load public pem key from \"%s\"\n", key_file);
- goto done;
+ goto done;
}
/* set key name to the file name, this is just an example! */
if(xmlSecKeySetName(dsigCtx->signKey, key_file) < 0) {
- fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
- goto done;
+ fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
+ goto done;
}
/* Verify signature */
if(xmlSecDSigCtxVerify(dsigCtx, node) < 0) {
fprintf(stderr,"Error: signature verify\n");
- goto done;
+ goto done;
}
/* print verification result to stdout */
if(dsigCtx->status == xmlSecDSigStatusSucceeded) {
- fprintf(stdout, "Signature is OK\n");
+ fprintf(stdout, "Signature is OK\n");
} else {
- fprintf(stdout, "Signature is INVALID\n");
+ fprintf(stdout, "Signature is INVALID\n");
}
/* success */
@@ -185,11 +185,11 @@ verify_file(const char* xml_file, const char* key_file) {
done:
/* cleanup */
if(dsigCtx != NULL) {
- xmlSecDSigCtxDestroy(dsigCtx);
+ xmlSecDSigCtxDestroy(dsigCtx);
}
if(doc != NULL) {
- xmlFreeDoc(doc);
+ xmlFreeDoc(doc);
}
return(res);
}
diff --git a/examples/verify2.c b/examples/verify2.c
index a56bb55..399f8f6 100644
--- a/examples/verify2.c
+++ b/examples/verify2.c
@@ -4,11 +4,11 @@
* Verifies a file using keys manager
*
* Usage:
- * verify2 <signed-file> <public-pem-key1> [<public-pem-key2> [...]]
+ * verify2 <signed-file> <public-pem-key1> [<public-pem-key2> [...]]
*
* Example:
- * ./verify2 sign1-res.xml rsapub.pem
- * ./verify2 sign2-res.xml rsapub.pem
+ * ./verify2 sign1-res.xml rsapub.pem
+ * ./verify2 sign2-res.xml rsapub.pem
*
* This is free software; see Copyright file in the source
* distribution for preciese wording.
@@ -42,9 +42,9 @@ main(int argc, char **argv) {
assert(argv);
if(argc < 3) {
- fprintf(stderr, "Error: wrong number of arguments.\n");
- fprintf(stderr, "Usage: %s <xml-file> <key-file1> [<key-file2> [...]]\n", argv[0]);
- return(1);
+ fprintf(stderr, "Error: wrong number of arguments.\n");
+ fprintf(stderr, "Usage: %s <xml-file> <key-file1> [<key-file2> [...]]\n", argv[0]);
+ return(1);
}
/* Init libxml and libxslt libraries */
@@ -55,17 +55,17 @@ main(int argc, char **argv) {
#ifndef XMLSEC_NO_XSLT
xmlIndentTreeOutput = 1;
#endif /* XMLSEC_NO_XSLT */
-
+
/* Init xmlsec library */
if(xmlSecInit() < 0) {
- fprintf(stderr, "Error: xmlsec initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec initialization failed.\n");
+ return(-1);
}
/* Check loaded library version */
if(xmlSecCheckVersion() != 1) {
- fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
- return(-1);
+ fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
+ return(-1);
}
/* Load default crypto engine if we are supporting dynamic
@@ -75,35 +75,35 @@ main(int argc, char **argv) {
*/
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {
- fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
- "that you have it installed and check shared libraries path\n"
- "(LD_LIBRARY_PATH) envornment variable.\n");
- return(-1);
+ fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
+ "that you have it installed and check shared libraries path\n"
+ "(LD_LIBRARY_PATH) envornment variable.\n");
+ return(-1);
}
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
/* Init crypto library */
if(xmlSecCryptoAppInit(NULL) < 0) {
- fprintf(stderr, "Error: crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: crypto initialization failed.\n");
+ return(-1);
}
/* Init xmlsec-crypto library */
if(xmlSecCryptoInit() < 0) {
- fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
+ return(-1);
}
/* create keys manager and load keys */
mngr = load_keys(&(argv[2]), argc - 2);
if(mngr == NULL) {
- return(-1);
+ return(-1);
}
/* verify file */
if(verify_file(mngr, argv[1]) < 0) {
- xmlSecKeysMngrDestroy(mngr);
- return(-1);
+ xmlSecKeysMngrDestroy(mngr);
+ return(-1);
}
/* destroy keys manager */
@@ -129,8 +129,8 @@ main(int argc, char **argv) {
/**
* load_keys:
- * @files: the list of filenames.
- * @files_size: the number of filenames in #files.
+ * @files: the list of filenames.
+ * @files_size: the number of filenames in #files.
*
* Creates simple keys manager and load PEM keys from #files in it.
* The caller is responsible for destroing returned keys manager using
@@ -154,43 +154,43 @@ load_keys(char** files, int files_size) {
*/
mngr = xmlSecKeysMngrCreate();
if(mngr == NULL) {
- fprintf(stderr, "Error: failed to create keys manager.\n");
- return(NULL);
+ fprintf(stderr, "Error: failed to create keys manager.\n");
+ return(NULL);
}
if(xmlSecCryptoAppDefaultKeysMngrInit(mngr) < 0) {
- fprintf(stderr, "Error: failed to initialize keys manager.\n");
- xmlSecKeysMngrDestroy(mngr);
- return(NULL);
+ fprintf(stderr, "Error: failed to initialize keys manager.\n");
+ xmlSecKeysMngrDestroy(mngr);
+ return(NULL);
}
for(i = 0; i < files_size; ++i) {
- assert(files[i]);
+ assert(files[i]);
- /* load key */
- key = xmlSecCryptoAppKeyLoad(files[i], xmlSecKeyDataFormatPem, NULL, NULL, NULL);
- if(key == NULL) {
- fprintf(stderr,"Error: failed to load pem key from \"%s\"\n", files[i]);
- xmlSecKeysMngrDestroy(mngr);
- return(NULL);
- }
+ /* load key */
+ key = xmlSecCryptoAppKeyLoad(files[i], xmlSecKeyDataFormatPem, NULL, NULL, NULL);
+ if(key == NULL) {
+ fprintf(stderr,"Error: failed to load pem key from \"%s\"\n", files[i]);
+ xmlSecKeysMngrDestroy(mngr);
+ return(NULL);
+ }
- /* set key name to the file name, this is just an example! */
- if(xmlSecKeySetName(key, BAD_CAST files[i]) < 0) {
- fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", files[i]);
- xmlSecKeyDestroy(key);
- xmlSecKeysMngrDestroy(mngr);
- return(NULL);
- }
-
- /* add key to keys manager, from now on keys manager is responsible
- * for destroying key
- */
- if(xmlSecCryptoAppDefaultKeysMngrAdoptKey(mngr, key) < 0) {
- fprintf(stderr,"Error: failed to add key from \"%s\" to keys manager\n", files[i]);
- xmlSecKeyDestroy(key);
- xmlSecKeysMngrDestroy(mngr);
- return(NULL);
- }
+ /* set key name to the file name, this is just an example! */
+ if(xmlSecKeySetName(key, BAD_CAST files[i]) < 0) {
+ fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", files[i]);
+ xmlSecKeyDestroy(key);
+ xmlSecKeysMngrDestroy(mngr);
+ return(NULL);
+ }
+
+ /* add key to keys manager, from now on keys manager is responsible
+ * for destroying key
+ */
+ if(xmlSecCryptoAppDefaultKeysMngrAdoptKey(mngr, key) < 0) {
+ fprintf(stderr,"Error: failed to add key from \"%s\" to keys manager\n", files[i]);
+ xmlSecKeyDestroy(key);
+ xmlSecKeysMngrDestroy(mngr);
+ return(NULL);
+ }
}
return(mngr);
@@ -198,8 +198,8 @@ load_keys(char** files, int files_size) {
/**
* verify_file:
- * @mngr: the pointer to keys manager.
- * @xml_file: the signed XML file name.
+ * @mngr: the pointer to keys manager.
+ * @xml_file: the signed XML file name.
*
* Verifies XML signature in #xml_file.
*
@@ -218,35 +218,35 @@ verify_file(xmlSecKeysMngrPtr mngr, const char* xml_file) {
/* load file */
doc = xmlParseFile(xml_file);
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
- fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
- goto done;
+ fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
+ goto done;
}
/* find start node */
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeSignature, xmlSecDSigNs);
if(node == NULL) {
- fprintf(stderr, "Error: start node not found in \"%s\"\n", xml_file);
- goto done;
+ fprintf(stderr, "Error: start node not found in \"%s\"\n", xml_file);
+ goto done;
}
/* create signature context */
dsigCtx = xmlSecDSigCtxCreate(mngr);
if(dsigCtx == NULL) {
fprintf(stderr,"Error: failed to create signature context\n");
- goto done;
+ goto done;
}
/* Verify signature */
if(xmlSecDSigCtxVerify(dsigCtx, node) < 0) {
fprintf(stderr,"Error: signature verify\n");
- goto done;
+ goto done;
}
/* print verification result to stdout */
if(dsigCtx->status == xmlSecDSigStatusSucceeded) {
- fprintf(stdout, "Signature is OK\n");
+ fprintf(stdout, "Signature is OK\n");
} else {
- fprintf(stdout, "Signature is INVALID\n");
+ fprintf(stdout, "Signature is INVALID\n");
}
/* success */
@@ -255,11 +255,11 @@ verify_file(xmlSecKeysMngrPtr mngr, const char* xml_file) {
done:
/* cleanup */
if(dsigCtx != NULL) {
- xmlSecDSigCtxDestroy(dsigCtx);
+ xmlSecDSigCtxDestroy(dsigCtx);
}
if(doc != NULL) {
- xmlFreeDoc(doc);
+ xmlFreeDoc(doc);
}
return(res);
}
diff --git a/examples/verify3.c b/examples/verify3.c
index b7746a0..68baa76 100644
--- a/examples/verify3.c
+++ b/examples/verify3.c
@@ -7,10 +7,10 @@
* certificates management policies for another crypto library may break it.
*
* Usage:
- * verify3 <signed-file> <trusted-cert-pem-file1> [<trusted-cert-pem-file2> [...]]
+ * verify3 <signed-file> <trusted-cert-pem-file1> [<trusted-cert-pem-file2> [...]]
*
* Example:
- * ./verify3 sign3-res.xml rootcert.pem
+ * ./verify3 sign3-res.xml rootcert.pem
*
* This is free software; see Copyright file in the source
* distribution for preciese wording.
@@ -44,9 +44,9 @@ main(int argc, char **argv) {
assert(argv);
if(argc < 3) {
- fprintf(stderr, "Error: wrong number of arguments.\n");
- fprintf(stderr, "Usage: %s <xml-file> <cert-file1> [<cert-file2> [...]]\n", argv[0]);
- return(1);
+ fprintf(stderr, "Error: wrong number of arguments.\n");
+ fprintf(stderr, "Usage: %s <xml-file> <cert-file1> [<cert-file2> [...]]\n", argv[0]);
+ return(1);
}
/* Init libxml and libxslt libraries */
@@ -57,17 +57,17 @@ main(int argc, char **argv) {
#ifndef XMLSEC_NO_XSLT
xmlIndentTreeOutput = 1;
#endif /* XMLSEC_NO_XSLT */
-
+
/* Init xmlsec library */
if(xmlSecInit() < 0) {
- fprintf(stderr, "Error: xmlsec initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec initialization failed.\n");
+ return(-1);
}
/* Check loaded library version */
if(xmlSecCheckVersion() != 1) {
- fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
- return(-1);
+ fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
+ return(-1);
}
/* Load default crypto engine if we are supporting dynamic
@@ -77,35 +77,35 @@ main(int argc, char **argv) {
*/
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {
- fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
- "that you have it installed and check shared libraries path\n"
- "(LD_LIBRARY_PATH) envornment variable.\n");
- return(-1);
+ fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
+ "that you have it installed and check shared libraries path\n"
+ "(LD_LIBRARY_PATH) envornment variable.\n");
+ return(-1);
}
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
/* Init crypto library */
if(xmlSecCryptoAppInit(NULL) < 0) {
- fprintf(stderr, "Error: crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: crypto initialization failed.\n");
+ return(-1);
}
/* Init xmlsec-crypto library */
if(xmlSecCryptoInit() < 0) {
- fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
+ return(-1);
}
/* create keys manager and load trusted certificates */
mngr = load_trusted_certs(&(argv[2]), argc - 2);
if(mngr == NULL) {
- return(-1);
+ return(-1);
}
/* verify file */
if(verify_file(mngr, argv[1]) < 0) {
- xmlSecKeysMngrDestroy(mngr);
- return(-1);
+ xmlSecKeysMngrDestroy(mngr);
+ return(-1);
}
/* destroy keys manager */
@@ -131,8 +131,8 @@ main(int argc, char **argv) {
/**
* load_trusted_certs:
- * @files: the list of filenames.
- * @files_size: the number of filenames in #files.
+ * @files: the list of filenames.
+ * @files_size: the number of filenames in #files.
*
* Creates simple keys manager and load trusted certificates from PEM #files.
* The caller is responsible for destroing returned keys manager using
@@ -155,24 +155,24 @@ load_trusted_certs(char** files, int files_size) {
*/
mngr = xmlSecKeysMngrCreate();
if(mngr == NULL) {
- fprintf(stderr, "Error: failed to create keys manager.\n");
- return(NULL);
+ fprintf(stderr, "Error: failed to create keys manager.\n");
+ return(NULL);
}
if(xmlSecCryptoAppDefaultKeysMngrInit(mngr) < 0) {
- fprintf(stderr, "Error: failed to initialize keys manager.\n");
- xmlSecKeysMngrDestroy(mngr);
- return(NULL);
+ fprintf(stderr, "Error: failed to initialize keys manager.\n");
+ xmlSecKeysMngrDestroy(mngr);
+ return(NULL);
}
for(i = 0; i < files_size; ++i) {
- assert(files[i]);
-
- /* load trusted cert */
- if(xmlSecCryptoAppKeysMngrCertLoad(mngr, files[i], xmlSecKeyDataFormatPem, xmlSecKeyDataTypeTrusted) < 0) {
- fprintf(stderr,"Error: failed to load pem certificate from \"%s\"\n", files[i]);
- xmlSecKeysMngrDestroy(mngr);
- return(NULL);
- }
+ assert(files[i]);
+
+ /* load trusted cert */
+ if(xmlSecCryptoAppKeysMngrCertLoad(mngr, files[i], xmlSecKeyDataFormatPem, xmlSecKeyDataTypeTrusted) < 0) {
+ fprintf(stderr,"Error: failed to load pem certificate from \"%s\"\n", files[i]);
+ xmlSecKeysMngrDestroy(mngr);
+ return(NULL);
+ }
}
return(mngr);
@@ -180,8 +180,8 @@ load_trusted_certs(char** files, int files_size) {
/**
* verify_file:
- * @mngr: the pointer to keys manager.
- * @xml_file: the signed XML file name.
+ * @mngr: the pointer to keys manager.
+ * @xml_file: the signed XML file name.
*
* Verifies XML signature in #xml_file.
*
@@ -200,35 +200,35 @@ verify_file(xmlSecKeysMngrPtr mngr, const char* xml_file) {
/* load file */
doc = xmlParseFile(xml_file);
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
- fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
- goto done;
+ fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
+ goto done;
}
/* find start node */
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeSignature, xmlSecDSigNs);
if(node == NULL) {
- fprintf(stderr, "Error: start node not found in \"%s\"\n", xml_file);
- goto done;
+ fprintf(stderr, "Error: start node not found in \"%s\"\n", xml_file);
+ goto done;
}
/* create signature context */
dsigCtx = xmlSecDSigCtxCreate(mngr);
if(dsigCtx == NULL) {
fprintf(stderr,"Error: failed to create signature context\n");
- goto done;
+ goto done;
}
/* Verify signature */
if(xmlSecDSigCtxVerify(dsigCtx, node) < 0) {
fprintf(stderr,"Error: signature verify\n");
- goto done;
+ goto done;
}
/* print verification result to stdout */
if(dsigCtx->status == xmlSecDSigStatusSucceeded) {
- fprintf(stdout, "Signature is OK\n");
+ fprintf(stdout, "Signature is OK\n");
} else {
- fprintf(stdout, "Signature is INVALID\n");
+ fprintf(stdout, "Signature is INVALID\n");
}
/* success */
@@ -237,11 +237,11 @@ verify_file(xmlSecKeysMngrPtr mngr, const char* xml_file) {
done:
/* cleanup */
if(dsigCtx != NULL) {
- xmlSecDSigCtxDestroy(dsigCtx);
+ xmlSecDSigCtxDestroy(dsigCtx);
}
if(doc != NULL) {
- xmlFreeDoc(doc);
+ xmlFreeDoc(doc);
}
return(res);
}
diff --git a/examples/verify4.c b/examples/verify4.c
index 3d82af6..e6d653f 100644
--- a/examples/verify4.c
+++ b/examples/verify4.c
@@ -10,15 +10,15 @@
* certificates management policies for another crypto library may break it.
*
* Usage:
- * verify4 <signed-file> <trusted-cert-pem-file1> [<trusted-cert-pem-file2> [...]]
+ * verify4 <signed-file> <trusted-cert-pem-file1> [<trusted-cert-pem-file2> [...]]
*
* Example (sucecess):
- * ./verify4 verify4-res.xml rootcert.pem
+ * ./verify4 verify4-res.xml rootcert.pem
*
* Example (failure):
- * ./verify4 verify4-bad-res.xml rootcert.pem
+ * ./verify4 verify4-bad-res.xml rootcert.pem
* In the same time, verify3 example successfuly verifies this signature:
- * ./verify3 verify4-bad-res.xml rootcert.pem
+ * ./verify3 verify4-bad-res.xml rootcert.pem
*
* This is free software; see Copyright file in the source
* distribution for preciese wording.
@@ -52,9 +52,9 @@ main(int argc, char **argv) {
assert(argv);
if(argc < 3) {
- fprintf(stderr, "Error: wrong number of arguments.\n");
- fprintf(stderr, "Usage: %s <xml-file> <cert-file1> [<cert-file2> [...]]\n", argv[0]);
- return(1);
+ fprintf(stderr, "Error: wrong number of arguments.\n");
+ fprintf(stderr, "Usage: %s <xml-file> <cert-file1> [<cert-file2> [...]]\n", argv[0]);
+ return(1);
}
/* Init libxml and libxslt libraries */
@@ -65,17 +65,17 @@ main(int argc, char **argv) {
#ifndef XMLSEC_NO_XSLT
xmlIndentTreeOutput = 1;
#endif /* XMLSEC_NO_XSLT */
-
+
/* Init xmlsec library */
if(xmlSecInit() < 0) {
- fprintf(stderr, "Error: xmlsec initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec initialization failed.\n");
+ return(-1);
}
/* Check loaded library version */
if(xmlSecCheckVersion() != 1) {
- fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
- return(-1);
+ fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
+ return(-1);
}
/* Load default crypto engine if we are supporting dynamic
@@ -85,35 +85,35 @@ main(int argc, char **argv) {
*/
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {
- fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
- "that you have it installed and check shared libraries path\n"
- "(LD_LIBRARY_PATH) envornment variable.\n");
- return(-1);
+ fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
+ "that you have it installed and check shared libraries path\n"
+ "(LD_LIBRARY_PATH) envornment variable.\n");
+ return(-1);
}
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
/* Init crypto library */
if(xmlSecCryptoAppInit(NULL) < 0) {
- fprintf(stderr, "Error: crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: crypto initialization failed.\n");
+ return(-1);
}
/* Init xmlsec-crypto library */
if(xmlSecCryptoInit() < 0) {
- fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
- return(-1);
+ fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
+ return(-1);
}
/* create keys manager and load trusted certificates */
mngr = load_trusted_certs(&(argv[2]), argc - 2);
if(mngr == NULL) {
- return(-1);
+ return(-1);
}
/* verify file */
if(verify_file(mngr, argv[1]) < 0) {
- xmlSecKeysMngrDestroy(mngr);
- return(-1);
+ xmlSecKeysMngrDestroy(mngr);
+ return(-1);
}
/* destroy keys manager */
@@ -139,8 +139,8 @@ main(int argc, char **argv) {
/**
* load_trusted_certs:
- * @files: the list of filenames.
- * @files_size: the number of filenames in #files.
+ * @files: the list of filenames.
+ * @files_size: the number of filenames in #files.
*
* Creates simple keys manager and load trusted certificates from PEM #files.
* The caller is responsible for destroing returned keys manager using
@@ -163,24 +163,24 @@ load_trusted_certs(char** files, int files_size) {
*/
mngr = xmlSecKeysMngrCreate();
if(mngr == NULL) {
- fprintf(stderr, "Error: failed to create keys manager.\n");
- return(NULL);
+ fprintf(stderr, "Error: failed to create keys manager.\n");
+ return(NULL);
}
if(xmlSecCryptoAppDefaultKeysMngrInit(mngr) < 0) {
- fprintf(stderr, "Error: failed to initialize keys manager.\n");
- xmlSecKeysMngrDestroy(mngr);
- return(NULL);
+ fprintf(stderr, "Error: failed to initialize keys manager.\n");
+ xmlSecKeysMngrDestroy(mngr);
+ return(NULL);
}
for(i = 0; i < files_size; ++i) {
- assert(files[i]);
+ assert(files[i]);
- /* load trusted cert */
- if(xmlSecCryptoAppKeysMngrCertLoad(mngr, files[i], xmlSecKeyDataFormatPem, xmlSecKeyDataTypeTrusted) < 0) {
- fprintf(stderr,"Error: failed to load pem certificate from \"%s\"\n", files[i]);
- xmlSecKeysMngrDestroy(mngr);
- return(NULL);
- }
+ /* load trusted cert */
+ if(xmlSecCryptoAppKeysMngrCertLoad(mngr, files[i], xmlSecKeyDataFormatPem, xmlSecKeyDataTypeTrusted) < 0) {
+ fprintf(stderr,"Error: failed to load pem certificate from \"%s\"\n", files[i]);
+ xmlSecKeysMngrDestroy(mngr);
+ return(NULL);
+ }
}
return(mngr);
@@ -188,8 +188,8 @@ load_trusted_certs(char** files, int files_size) {
/**
* verify_file:
- * @mngr: the pointer to keys manager.
- * @xml_file: the signed XML file name.
+ * @mngr: the pointer to keys manager.
+ * @xml_file: the signed XML file name.
*
* Verifies XML signature in #xml_file.
*
@@ -208,22 +208,22 @@ verify_file(xmlSecKeysMngrPtr mngr, const char* xml_file) {
/* load file */
doc = xmlParseFile(xml_file);
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
- fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
- goto done;
+ fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
+ goto done;
}
/* find start node */
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeSignature, xmlSecDSigNs);
if(node == NULL) {
- fprintf(stderr, "Error: start node not found in \"%s\"\n", xml_file);
- goto done;
+ fprintf(stderr, "Error: start node not found in \"%s\"\n", xml_file);
+ goto done;
}
/* create signature context */
dsigCtx = xmlSecDSigCtxCreate(mngr);
if(dsigCtx == NULL) {
fprintf(stderr,"Error: failed to create signature context\n");
- goto done;
+ goto done;
}
/* limit the Reference URI attributes to empty or NULL */
@@ -236,7 +236,7 @@ verify_file(xmlSecKeysMngrPtr mngr, const char* xml_file) {
(xmlSecDSigCtxEnableSignatureTransform(dsigCtx, xmlSecTransformRsaSha1Id) < 0)) {
fprintf(stderr,"Error: failed to limit allowed siganture transforms\n");
- goto done;
+ goto done;
}
if((xmlSecDSigCtxEnableReferenceTransform(dsigCtx, xmlSecTransformInclC14NId) < 0) ||
(xmlSecDSigCtxEnableReferenceTransform(dsigCtx, xmlSecTransformExclC14NId) < 0) ||
@@ -244,34 +244,34 @@ verify_file(xmlSecKeysMngrPtr mngr, const char* xml_file) {
(xmlSecDSigCtxEnableReferenceTransform(dsigCtx, xmlSecTransformEnvelopedId) < 0)) {
fprintf(stderr,"Error: failed to limit allowed reference transforms\n");
- goto done;
+ goto done;
}
/* in addition, limit possible key data to valid X509 certificates only */
if(xmlSecPtrListAdd(&(dsigCtx->keyInfoReadCtx.enabledKeyData), BAD_CAST xmlSecKeyDataX509Id) < 0) {
fprintf(stderr,"Error: failed to limit allowed key data\n");
- goto done;
+ goto done;
}
/* Verify signature */
if(xmlSecDSigCtxVerify(dsigCtx, node) < 0) {
fprintf(stderr,"Error: signature verify\n");
- goto done;
+ goto done;
}
/* check that we have only one Reference */
if((dsigCtx->status == xmlSecDSigStatusSucceeded) &&
(xmlSecPtrListGetSize(&(dsigCtx->signedInfoReferences)) != 1)) {
-
+
fprintf(stderr,"Error: only one reference is allowed\n");
- goto done;
+ goto done;
}
/* print verification result to stdout */
if(dsigCtx->status == xmlSecDSigStatusSucceeded) {
- fprintf(stdout, "Signature is OK\n");
+ fprintf(stdout, "Signature is OK\n");
} else {
- fprintf(stdout, "Signature is INVALID\n");
+ fprintf(stdout, "Signature is INVALID\n");
}
/* success */
@@ -280,11 +280,11 @@ verify_file(xmlSecKeysMngrPtr mngr, const char* xml_file) {
done:
/* cleanup */
if(dsigCtx != NULL) {
- xmlSecDSigCtxDestroy(dsigCtx);
+ xmlSecDSigCtxDestroy(dsigCtx);
}
if(doc != NULL) {
- xmlFreeDoc(doc);
+ xmlFreeDoc(doc);
}
return(res);
}
diff --git a/examples/xkms-server.c b/examples/xkms-server.c
index 1021b18..9471081 100644
--- a/examples/xkms-server.c
+++ b/examples/xkms-server.c
@@ -4,10 +4,10 @@
* Starts XKMS server on specified port.
*
* Usage:
- * ./xkms-server [--port <port>] [--format plain|soap-1.1|soap-1.2] <keys-file>
+ * ./xkms-server [--port <port>] [--format plain|soap-1.1|soap-1.2] <keys-file>
*
* Example:
- * ./xkms-server --port 8080 --format soap-1.1 keys.xml
+ * ./xkms-server --port 8080 --format soap-1.1 keys.xml
*
* This is free software; see Copyright file in the source
* distribution for preciese wording.
@@ -23,8 +23,8 @@
#ifdef XMLSEC_NO_XKMS
int main(int argc, char** argv) {
- fprintf(stderr, "ERROR: XKMS is disabled.\n");
- return 1;
+ fprintf(stderr, "ERROR: XKMS is disabled.\n");
+ return 1;
}
#else /* XMLSEC_NO_XKMS */
@@ -64,13 +64,13 @@ int main(int argc, char** argv) {
#endif /* WIN32_SOCKETS */
#endif /* UNIX_SOCKETS */
-#define DEFAULT_PORT 1234
-#define PENDING_QUEUE_SIZE 100
+#define DEFAULT_PORT 1234
+#define PENDING_QUEUE_SIZE 100
-#define LOG_LEVEL_SILENT 0
-#define LOG_LEVEL_INFO 1
-#define LOG_LEVEL_DATA 2
-#define LOG_LEVEL_DEBUG 3
+#define LOG_LEVEL_SILENT 0
+#define LOG_LEVEL_INFO 1
+#define LOG_LEVEL_DATA 2
+#define LOG_LEVEL_DEBUG 3
#ifdef UNIX_SOCKETS
static int sockfd = -1;
@@ -91,7 +91,7 @@ static const xmlChar* my_strnstr(const xmlChar* str, xmlSecSize strLen, const xm
static int handle_connection(int fd, xmlSecXkmsServerCtxPtr xkmsCtx, xmlSecXkmsServerFormat format);
static int read_request(int fd, const char* in_ip, xmlSecBufferPtr buffer);
static int send_response(int fd, const char* in_ip, int resp_code,
- const char* body, int body_size);
+ const char* body, int body_size);
static char usage[] = "[--port <port>] [--format plain|soap-1.1|soap-1.2] <keys-file>";
static char http_header[] =
@@ -120,17 +120,17 @@ int main(int argc, char** argv) {
#ifndef XMLSEC_NO_XSLT
xmlIndentTreeOutput = 1;
#endif /* XMLSEC_NO_XSLT */
-
+
/* Init xmlsec library */
if(xmlSecInit() < 0) {
- fprintf(stderr, "Error %d: xmlsec initialization failed.\n", errno);
- return(-1);
+ fprintf(stderr, "Error %d: xmlsec initialization failed.\n", errno);
+ return(-1);
}
/* Check loaded library version */
if(xmlSecCheckVersion() != 1) {
- fprintf(stderr, "Error %d: loaded xmlsec library version is not compatible.\n", errno);
- return(-1);
+ fprintf(stderr, "Error %d: loaded xmlsec library version is not compatible.\n", errno);
+ return(-1);
}
/* Load default crypto engine if we are supporting dynamic
@@ -140,115 +140,115 @@ int main(int argc, char** argv) {
*/
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {
- fprintf(stderr, "Error %d: unable to load default xmlsec-crypto library. Make sure\n"
- "that you have it installed and check shared libraries path\n"
- "(LD_LIBRARY_PATH) envornment variable.\n", errno);
- return(-1);
+ fprintf(stderr, "Error %d: unable to load default xmlsec-crypto library. Make sure\n"
+ "that you have it installed and check shared libraries path\n"
+ "(LD_LIBRARY_PATH) envornment variable.\n", errno);
+ return(-1);
}
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
/* Init crypto library */
if(xmlSecCryptoAppInit(NULL) < 0) {
- fprintf(stderr, "Error %d: crypto initialization failed.\n", errno);
- return(-1);
+ fprintf(stderr, "Error %d: crypto initialization failed.\n", errno);
+ return(-1);
}
/* Init xmlsec-crypto library */
if(xmlSecCryptoInit() < 0) {
- fprintf(stderr, "Error %d: xmlsec-crypto initialization failed.\n", errno);
- return(-1);
+ fprintf(stderr, "Error %d: xmlsec-crypto initialization failed.\n", errno);
+ return(-1);
}
/* Create and initialize keys manager */
mngr = xmlSecKeysMngrCreate();
if(mngr == NULL) {
- fprintf(stderr, "Error %d: failed to create keys manager.\n", errno);
- goto done;
+ fprintf(stderr, "Error %d: failed to create keys manager.\n", errno);
+ goto done;
}
if(xmlSecCryptoAppDefaultKeysMngrInit(mngr) < 0) {
- fprintf(stderr, "Error %d: failed to initialize keys manager.\n", errno);
- goto done;
+ fprintf(stderr, "Error %d: failed to initialize keys manager.\n", errno);
+ goto done;
}
/* Create XKMS server context */
xkmsCtx = xmlSecXkmsServerCtxCreate(mngr);
if(xkmsCtx == NULL) {
- fprintf(stderr, "Error %d: XKMS server context initialization failed\n", errno);
- goto done;
+ fprintf(stderr, "Error %d: XKMS server context initialization failed\n", errno);
+ goto done;
}
/* Process input parameters */
for(argpos = 1; (argpos < argc) && (argv[argpos][0] == '-'); argpos++) {
- if((strcmp(argv[argpos], "--port") == 0) || (strcmp(argv[argpos], "-p") == 0)) {
- argpos++;
- port = atoi(argv[argpos]);
- if(port == 0) {
- fprintf(stderr, "Error %d: invalid port number \"%s\".\nUsage: %s %s\n", errno, argv[argpos], argv[0], usage);
- goto done;
- }
- } else if((strcmp(argv[argpos], "--format") == 0) || (strcmp(argv[argpos], "-f") == 0)) {
- argpos++;
- format = xmlSecXkmsServerFormatFromString(BAD_CAST argv[argpos]);
- if(format == xmlSecXkmsServerFormatUnknown) {
- fprintf(stderr, "Error %d: invalid format \"%s\".\nUsage: %s %s\n", errno, argv[argpos], argv[0], usage);
- goto done;
- }
- } else if((strcmp(argv[argpos], "--log-level") == 0) || (strcmp(argv[argpos], "-l") == 0)) {
- argpos++;
- log_level = atoi(argv[argpos]);
- } else {
- fprintf(stderr, "Error %d: unknown parameter \"%s\".\nUsage: %s %s\n", errno, argv[argpos], argv[0], usage);
- goto done;
- }
+ if((strcmp(argv[argpos], "--port") == 0) || (strcmp(argv[argpos], "-p") == 0)) {
+ argpos++;
+ port = atoi(argv[argpos]);
+ if(port == 0) {
+ fprintf(stderr, "Error %d: invalid port number \"%s\".\nUsage: %s %s\n", errno, argv[argpos], argv[0], usage);
+ goto done;
+ }
+ } else if((strcmp(argv[argpos], "--format") == 0) || (strcmp(argv[argpos], "-f") == 0)) {
+ argpos++;
+ format = xmlSecXkmsServerFormatFromString(BAD_CAST argv[argpos]);
+ if(format == xmlSecXkmsServerFormatUnknown) {
+ fprintf(stderr, "Error %d: invalid format \"%s\".\nUsage: %s %s\n", errno, argv[argpos], argv[0], usage);
+ goto done;
+ }
+ } else if((strcmp(argv[argpos], "--log-level") == 0) || (strcmp(argv[argpos], "-l") == 0)) {
+ argpos++;
+ log_level = atoi(argv[argpos]);
+ } else {
+ fprintf(stderr, "Error %d: unknown parameter \"%s\".\nUsage: %s %s\n", errno, argv[argpos], argv[0], usage);
+ goto done;
+ }
}
if(argpos >= argc) {
- fprintf(stderr, "Error %d: keys file is not specified.\nUsage: %s %s\n", errno, argv[0], usage);
- goto done;
+ fprintf(stderr, "Error %d: keys file is not specified.\nUsage: %s %s\n", errno, argv[0], usage);
+ goto done;
}
/* Load keys */
for(; argpos < argc; argpos++) {
if(xmlSecCryptoAppDefaultKeysMngrLoad(mngr, argv[argpos]) < 0) {
- fprintf(stderr, "Error %d: failed to load xml keys file \"%s\".\nUsage: %s %s\n", errno, argv[argpos], argv[0], usage);
- goto done;
- }
- if(log_level >= LOG_LEVEL_INFO) {
- fprintf(stdout, "Log: loaded keys from \"%s\"\n", argv[argpos]);
- }
+ fprintf(stderr, "Error %d: failed to load xml keys file \"%s\".\nUsage: %s %s\n", errno, argv[argpos], argv[0], usage);
+ goto done;
+ }
+ if(log_level >= LOG_LEVEL_INFO) {
+ fprintf(stdout, "Log: loaded keys from \"%s\"\n", argv[argpos]);
+ }
}
/* Startup TCP server */
if(init_server(port) < 0) {
- fprintf(stderr, "Error, errno: server initialization failed\n", errno);
- goto done;
+ fprintf(stderr, "Error, errno: server initialization failed\n", errno);
+ goto done;
}
assert(sockfd != -1);
/* main loop: accept connections and process requests */
while(finished == 0) {
- fd_set fds;
+ fd_set fds;
struct timeval timeout;
-
- /* Set up polling using select() */
- FD_ZERO(&fds);
- FD_SET(sockfd, &fds);
- memset(&timeout, 0, sizeof(timeout));
- timeout.tv_sec = 1;
- ret = select(sockfd + 1, &fds, NULL, NULL, &timeout);
- if((ret <= 0) || !FD_ISSET(sockfd, &fds)) {
- /* error, timed out or not our socket: try again */
- continue;
- }
-
- if(handle_connection(sockfd, xkmsCtx, format) < 0) {
- fprintf(stderr, "Error %d: unable to accept incomming connection\n");
- goto done;
- }
+
+ /* Set up polling using select() */
+ FD_ZERO(&fds);
+ FD_SET(sockfd, &fds);
+ memset(&timeout, 0, sizeof(timeout));
+ timeout.tv_sec = 1;
+ ret = select(sockfd + 1, &fds, NULL, NULL, &timeout);
+ if((ret <= 0) || !FD_ISSET(sockfd, &fds)) {
+ /* error, timed out or not our socket: try again */
+ continue;
+ }
+
+ if(handle_connection(sockfd, xkmsCtx, format) < 0) {
+ fprintf(stderr, "Error %d: unable to accept incomming connection\n");
+ goto done;
+ }
}
done:
if(log_level >= LOG_LEVEL_INFO) {
- fprintf(stdout, "Log: server is shutting down\n");
+ fprintf(stdout, "Log: server is shutting down\n");
}
/* Shutdown TCP server */
@@ -256,14 +256,14 @@ done:
/* Destroy xkms server context */
if(xkmsCtx != NULL) {
- xmlSecXkmsServerCtxDestroy(xkmsCtx);
- xkmsCtx = NULL;
+ xmlSecXkmsServerCtxDestroy(xkmsCtx);
+ xkmsCtx = NULL;
}
/* Destroy keys manager */
if(mngr != NULL) {
xmlSecKeysMngrDestroy(mngr);
- mngr = NULL;
+ mngr = NULL;
}
/* Shutdown xmlsec-crypto library */
@@ -287,7 +287,7 @@ done:
/**
* init_server:
- * @port: the server'xmlSecBufferGetData(buffer) TCP port number.
+ * @port: the server'xmlSecBufferGetData(buffer) TCP port number.
*
* Starts up a TCP server listening on given @port.
*
@@ -303,8 +303,8 @@ init_server(unsigned short port) {
#ifdef WIN32_SOCKETS
if(WSAStartup(MAKEWORD(1,1), &data)) {
- fprintf(stderr, "Error %d: WSAStartup() failed\n", errno);
- return(-1);
+ fprintf(stderr, "Error %d: WSAStartup() failed\n", errno);
+ return(-1);
}
#endif /* WIN32_SOCKETS */
@@ -318,44 +318,44 @@ init_server(unsigned short port) {
if(sockfd == INVALID_SOCKET) {
#endif /* WIN32_SOCKETS */
- fprintf(stderr, "Error %d: socket() failed\n", errno);
- return(-1);
+ fprintf(stderr, "Error %d: socket() failed\n", errno);
+ return(-1);
}
/* enable reuse of address */
flags = 1;
if(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&flags, sizeof(flags)) != 0) {
- fprintf(stderr, "Error %d: setsockopt(SO_REUSEADDR) failed\n", errno);
- return(-1);
+ fprintf(stderr, "Error %d: setsockopt(SO_REUSEADDR) failed\n", errno);
+ return(-1);
}
#ifdef UNIX_SOCKETS
/* set non-blocking */
flags = fcntl(sockfd, F_GETFL);
if(flags < 0) {
- fprintf(stderr, "Error %d: fcntl(F_GETFL) failed\n", errno);
- return(-1);
+ fprintf(stderr, "Error %d: fcntl(F_GETFL) failed\n", errno);
+ return(-1);
}
if(fcntl(sockfd, F_SETFL, flags | O_NONBLOCK) < 0) {
- fprintf(stderr, "Error %d: fcntl(F_SETFL) failed\n", errno);
- return(-1);
+ fprintf(stderr, "Error %d: fcntl(F_SETFL) failed\n", errno);
+ return(-1);
}
#endif /* UNIX_SOCKETS */
/* preset socket structure for socket binding */
memset(&saddr, 0, sizeof(saddr));
- saddr.sin_family = AF_INET;
- saddr.sin_port = htons(port);
- saddr.sin_addr.s_addr = INADDR_ANY;
+ saddr.sin_family = AF_INET;
+ saddr.sin_port = htons(port);
+ saddr.sin_addr.s_addr = INADDR_ANY;
if(bind(sockfd, (struct sockaddr *)&saddr, sizeof(struct sockaddr)) != 0) {
- fprintf(stderr, "Error %d: bind() failed\n", errno);
- return(-1);
+ fprintf(stderr, "Error %d: bind() failed\n", errno);
+ return(-1);
}
/* prepare for listening */
if(listen(sockfd, PENDING_QUEUE_SIZE) != 0) {
- fprintf(stderr, "Error %d: listen() failed\n", errno);
- return(-1);
+ fprintf(stderr, "Error %d: listen() failed\n", errno);
+ return(-1);
}
#ifdef UNIX_SOCKETS
@@ -386,8 +386,8 @@ stop_server() {
#ifdef WIN32_SOCKETS
if(sockfd != -1) {
- close(sockfd);
- sockfd = -1;
+ close(sockfd);
+ sockfd = -1;
}
#endif /* WIN32_SOCKETS */
if(log_level >= LOG_LEVEL_INFO) {
@@ -397,7 +397,7 @@ stop_server() {
/**
* int_signal_handler:
- * @sig_num: the signal number.
+ * @sig_num: the signal number.
*
* Unix's Ctrl-C signal handler that stops the server.
*/
@@ -411,9 +411,9 @@ int_signal_handler(int sig_num) {
/**
* handle_connection:
- * @sockfd: the server's socket.
- * @xkmsCtx: the template XKMS server context.
- * @format: the expected format of XKMS requests.
+ * @sockfd: the server's socket.
+ * @xkmsCtx: the template XKMS server context.
+ * @format: the expected format of XKMS requests.
*
* Establishs a connection, forks a child process (onUnix), reads the request,
* processes it and writes back the response.
@@ -457,8 +457,8 @@ handle_connection(int sockfd, xmlSecXkmsServerCtxPtr xkmsCtx, xmlSecXkmsServerFo
if(sockfd == INVALID_SOCKET) {
#endif /* WIN32_SOCKETS */
- fprintf(stderr, "Error %d: accept() failed\n", errno);
- return(-1);
+ fprintf(stderr, "Error %d: accept() failed\n", errno);
+ return(-1);
}
if(log_level >= LOG_LEVEL_INFO) {
fprintf(stdout, "Log [%s]: got connection\n", inet_ntoa(saddr.sin_addr));
@@ -467,19 +467,19 @@ handle_connection(int sockfd, xmlSecXkmsServerCtxPtr xkmsCtx, xmlSecXkmsServerFo
/* Create a copy of XKMS server context */
xkmsCtx2 = xmlSecXkmsServerCtxCreate(NULL);
if(xkmsCtx2 == NULL) {
- fprintf(stderr, "Error %d [%s]: a copy of XKMS server context initialization failed\n", errno, inet_ntoa(saddr.sin_addr));
- goto done;
+ fprintf(stderr, "Error %d [%s]: a copy of XKMS server context initialization failed\n", errno, inet_ntoa(saddr.sin_addr));
+ goto done;
}
if(xmlSecXkmsServerCtxCopyUserPref(xkmsCtx2, xkmsCtx) < 0) {
- fprintf(stderr, "Error %d [%s]: XKMS server context copy failed\n", errno, inet_ntoa(saddr.sin_addr));
- goto done;
+ fprintf(stderr, "Error %d [%s]: XKMS server context copy failed\n", errno, inet_ntoa(saddr.sin_addr));
+ goto done;
}
#ifdef UNIX_SOCKETS
/* on Unix we use child process to process requests */
if(fork()) {
- /* parent process */
- return(0);
+ /* parent process */
+ return(0);
}
/* child process */
@@ -489,36 +489,36 @@ handle_connection(int sockfd, xmlSecXkmsServerCtxPtr xkmsCtx, xmlSecXkmsServerFo
buffer = xmlSecBufferCreate(0);
if(buffer == NULL) {
- fprintf(stderr, "Error %d [%s]: xmlSecBufferCreate() failed\n", errno, inet_ntoa(saddr.sin_addr));
- goto done;
+ fprintf(stderr, "Error %d [%s]: xmlSecBufferCreate() failed\n", errno, inet_ntoa(saddr.sin_addr));
+ goto done;
}
/* read input request */
ret = read_request(fd, inet_ntoa(saddr.sin_addr), buffer);
if(ret < 0) {
- fprintf(stderr, "Error %d [%s]: read_request() failed\n", errno, inet_ntoa(saddr.sin_addr));
- goto done;
+ fprintf(stderr, "Error %d [%s]: read_request() failed\n", errno, inet_ntoa(saddr.sin_addr));
+ goto done;
}
/* parse request */
inDoc = xmlParseMemory(xmlSecBufferGetData(buffer), xmlSecBufferGetSize(buffer) );
if((inDoc == NULL) || (xmlDocGetRootElement(inDoc) == NULL)) {
- fprintf(stderr, "Error %d [%s]: failed to parse request\n", errno, inet_ntoa(saddr.sin_addr));
- goto done;
+ fprintf(stderr, "Error %d [%s]: failed to parse request\n", errno, inet_ntoa(saddr.sin_addr));
+ goto done;
}
xmlSecBufferEmpty(buffer);
/* prepare result document */
outDoc = xmlNewDoc(BAD_CAST "1.0");
if(outDoc == NULL) {
- fprintf(stderr, "Error %d [%s]: failed to create result doc\n", errno, inet_ntoa(saddr.sin_addr));
- goto done;
+ fprintf(stderr, "Error %d [%s]: failed to create result doc\n", errno, inet_ntoa(saddr.sin_addr));
+ goto done;
}
result = xmlSecXkmsServerCtxProcess(xkmsCtx2, xmlDocGetRootElement(inDoc), format, outDoc);
if(result == NULL) {
- fprintf(stderr, "Error %d [%s]: failed to process xkms server request\n", errno, inet_ntoa(saddr.sin_addr));
- goto done;
+ fprintf(stderr, "Error %d [%s]: failed to process xkms server request\n", errno, inet_ntoa(saddr.sin_addr));
+ goto done;
}
/* apppend returned result node to the output document */
@@ -527,8 +527,8 @@ handle_connection(int sockfd, xmlSecXkmsServerCtxPtr xkmsCtx, xmlSecXkmsServerFo
/* create LibXML2 output buffer */
output = xmlSecBufferCreateOutputBuffer(buffer);
if(output == NULL) {
- fprintf(stderr, "Error %d [%s]: xmlSecBufferCreateOutputBuffer() failed\n", errno, inet_ntoa(saddr.sin_addr));
- goto done;
+ fprintf(stderr, "Error %d [%s]: xmlSecBufferCreateOutputBuffer() failed\n", errno, inet_ntoa(saddr.sin_addr));
+ goto done;
}
xmlNodeDumpOutput(output, result->doc, result, 0, 0, NULL);
@@ -537,72 +537,72 @@ handle_connection(int sockfd, xmlSecXkmsServerCtxPtr xkmsCtx, xmlSecXkmsServerFo
done:
/* send back response */
if((resp_ready == 1) && (xmlSecBufferGetData(buffer) != NULL)) {
- ret = send_response(fd, inet_ntoa(saddr.sin_addr), 200, xmlSecBufferGetData(buffer), xmlSecBufferGetSize(buffer));
- if(log_level >= LOG_LEVEL_INFO) {
- fprintf(stdout, "Log [%s]: processed request\n", inet_ntoa(saddr.sin_addr));
- }
+ ret = send_response(fd, inet_ntoa(saddr.sin_addr), 200, xmlSecBufferGetData(buffer), xmlSecBufferGetSize(buffer));
+ if(log_level >= LOG_LEVEL_INFO) {
+ fprintf(stdout, "Log [%s]: processed request\n", inet_ntoa(saddr.sin_addr));
+ }
} else if(fd >= 0) {
- ret = send_response(fd, inet_ntoa(saddr.sin_addr), 503, http_503, strlen(http_503));
+ ret = send_response(fd, inet_ntoa(saddr.sin_addr), 503, http_503, strlen(http_503));
if(log_level >= LOG_LEVEL_INFO) {
- fprintf(stdout, "Log [%s]: failed to process request\n", inet_ntoa(saddr.sin_addr));
- }
+ fprintf(stdout, "Log [%s]: failed to process request\n", inet_ntoa(saddr.sin_addr));
+ }
} else {
- ret = -1;
+ ret = -1;
}
if(ret < 0) {
- fprintf(stderr, "Error %d [%s]: send_response() failed\n", errno, inet_ntoa(saddr.sin_addr));
+ fprintf(stderr, "Error %d [%s]: send_response() failed\n", errno, inet_ntoa(saddr.sin_addr));
}
/* cleanup */
if(output != NULL) {
- xmlOutputBufferClose(output);
- output = NULL;
+ xmlOutputBufferClose(output);
+ output = NULL;
}
if(outDoc != NULL) {
- xmlFreeDoc(outDoc);
- outDoc = NULL;
+ xmlFreeDoc(outDoc);
+ outDoc = NULL;
}
if(inDoc != NULL) {
- xmlFreeDoc(inDoc);
- inDoc = NULL;
+ xmlFreeDoc(inDoc);
+ inDoc = NULL;
}
if(buffer != NULL) {
- xmlSecBufferDestroy(buffer);
- buffer = NULL;
+ xmlSecBufferDestroy(buffer);
+ buffer = NULL;
}
if(xkmsCtx2 != NULL) {
- xmlSecXkmsServerCtxDestroy(xkmsCtx2);
- xkmsCtx2 = NULL;
+ xmlSecXkmsServerCtxDestroy(xkmsCtx2);
+ xkmsCtx2 = NULL;
}
if(fd >= 0) {
#ifdef UNIX_SOCKETS
- shutdown(fd, SHUT_RDWR);
- close(fd);
+ shutdown(fd, SHUT_RDWR);
+ close(fd);
#endif /* UNIX_SCOKETS */
#ifdef WIN32_SOCKETS
- close(fd);
+ close(fd);
#endif /* WIN32_SCOKETS */
- fd = -1;
+ fd = -1;
}
if(in_child_process) {
- exit(0);
+ exit(0);
}
return(0);
}
/**
* read_request:
- * @fd: the request's socket.
- * @in_ip: the request's IP address (for logging).
- * @buffer: the output buffer.
+ * @fd: the request's socket.
+ * @in_ip: the request's IP address (for logging).
+ * @buffer: the output buffer.
*
* Reads the request from socket @fd and stores it in the @buffer.
*
@@ -625,16 +625,16 @@ read_request(int fd, const char* in_ip, xmlSecBufferPtr buffer) {
/* first read the http headers */
counter = 5;
while(my_strnstr(xmlSecBufferGetData(buffer), xmlSecBufferGetSize(buffer), BAD_CAST "\r\n\r\n", 4) == NULL) {
- nread = recv(fd, buf, sizeof(buf), 0);
- if(nread < 0) {
- fprintf(stderr, "Error %d [%s]: read() failed\n", errno, in_ip);
- return(-1);
- }
+ nread = recv(fd, buf, sizeof(buf), 0);
+ if(nread < 0) {
+ fprintf(stderr, "Error %d [%s]: read() failed\n", errno, in_ip);
+ return(-1);
+ }
- if((nread > 0) && (xmlSecBufferAppend(buffer, buf, nread) < 0)) {
- fprintf(stderr, "Error %d [%s]: xmlSecBufferAppend(%d) failed\n", errno, in_ip, nread);
- return(-1);
- }
+ if((nread > 0) && (xmlSecBufferAppend(buffer, buf, nread) < 0)) {
+ fprintf(stderr, "Error %d [%s]: xmlSecBufferAppend(%d) failed\n", errno, in_ip, nread);
+ return(-1);
+ }
if(nread < sizeof(buffer)) {
counter--;
@@ -646,13 +646,13 @@ read_request(int fd, const char* in_ip, xmlSecBufferPtr buffer) {
if(xmlSecBufferGetData(buffer) == NULL) {
fprintf(stderr, "Error %d [%s]: no bytes read\n", errno, in_ip);
- return(-1);
+ return(-1);
}
if(log_level >= LOG_LEVEL_DEBUG) {
- xmlSecBufferAppend(buffer, BAD_CAST "\0", 1);
+ xmlSecBufferAppend(buffer, BAD_CAST "\0", 1);
fprintf(stdout, "Debug [%s]: request headers:\n%s\n", in_ip, xmlSecBufferGetData(buffer));
- xmlSecBufferRemoveTail(buffer, 1);
+ xmlSecBufferRemoveTail(buffer, 1);
}
/* Parse the request and extract the body. We expect the request to look
@@ -660,37 +660,37 @@ read_request(int fd, const char* in_ip, xmlSecBufferPtr buffer) {
* POST <path> HTTP/1.x\r\n
* <header1>\r\n
* <header2>\r\n
- * ...
+ * ...
* <headerN>\r\n
- * \r\n
- * <body>
+ * \r\n
+ * <body>
*/
/* analyze the first line */
p = my_strnstr(xmlSecBufferGetData(buffer), xmlSecBufferGetSize(buffer), BAD_CAST "\r\n", 2);
if(p == NULL) {
- fprintf(stderr, "Error %d [%s]: there is no HTTP header\n", errno, in_ip);
- return(-1);
+ fprintf(stderr, "Error %d [%s]: there is no HTTP header\n", errno, in_ip);
+ return(-1);
}
if(xmlStrncasecmp(xmlSecBufferGetData(buffer), BAD_CAST "POST ", 5) != 0) {
- fprintf(stderr, "Error %d [%s]: not a POST request\n", errno, in_ip);
- return(-1);
+ fprintf(stderr, "Error %d [%s]: not a POST request\n", errno, in_ip);
+ return(-1);
}
/* "POST " + " HTTP/1.x" == 14 */
s = xmlSecBufferGetData(buffer);
if(p - s <= 14) {
- fprintf(stderr, "Error %d [%s]: first line has bad length\n", errno, in_ip);
- return(-1);
+ fprintf(stderr, "Error %d [%s]: first line has bad length\n", errno, in_ip);
+ return(-1);
}
if((xmlStrncasecmp(p - 9, BAD_CAST " HTTP/1.0", 9) != 0) &&
(xmlStrncasecmp(p - 9, BAD_CAST " HTTP/1.1", 9) != 0)) {
-
+
fprintf(stderr, "Error %d [%s]: first line does not end with \" HTTP/1.x\"\n", errno, in_ip);
- return(-1);
+ return(-1);
}
if(xmlSecBufferRemoveHead(buffer, p - xmlSecBufferGetData(buffer) + 2) < 0) {
- fprintf(stderr, "Error %d [%s]: failed to skip first line\n", errno, in_ip);
- return(-1);
+ fprintf(stderr, "Error %d [%s]: failed to skip first line\n", errno, in_ip);
+ return(-1);
}
/* now skip all the headers (i.e. everything until empty line) */
@@ -699,19 +699,19 @@ read_request(int fd, const char* in_ip, xmlSecBufferPtr buffer) {
p = my_strnstr(xmlSecBufferGetData(buffer), xmlSecBufferGetSize(buffer), BAD_CAST "\r\n", 2);
if(p == NULL) {
fprintf(stderr, "Error %d [%s]: there is no HTTP body\n", errno, in_ip);
- return(-1);
- }
-
- if(p == xmlSecBufferGetData(buffer)) {
- found = 1;
- } else if(xmlStrncasecmp(xmlSecBufferGetData(buffer), BAD_CAST "Content-length: ", 16) == 0) {
- length = atoi(xmlSecBufferGetData(buffer) + 16);
- }
-
- if(xmlSecBufferRemoveHead(buffer, p - xmlSecBufferGetData(buffer) + 2) < 0) {
- fprintf(stderr, "Error %d [%s]: failed to skip header line\n", errno, in_ip);
- return(-1);
- }
+ return(-1);
+ }
+
+ if(p == xmlSecBufferGetData(buffer)) {
+ found = 1;
+ } else if(xmlStrncasecmp(xmlSecBufferGetData(buffer), BAD_CAST "Content-length: ", 16) == 0) {
+ length = atoi(xmlSecBufferGetData(buffer) + 16);
+ }
+
+ if(xmlSecBufferRemoveHead(buffer, p - xmlSecBufferGetData(buffer) + 2) < 0) {
+ fprintf(stderr, "Error %d [%s]: failed to skip header line\n", errno, in_ip);
+ return(-1);
+ }
}
/* remove the trailing \0 we added */
@@ -720,16 +720,16 @@ read_request(int fd, const char* in_ip, xmlSecBufferPtr buffer) {
/* now read the body */
counter = 5;
while(xmlSecBufferGetSize(buffer) < length) {
- nread = recv(fd, buf, sizeof(buf), 0);
- if(nread < 0) {
- fprintf(stderr, "Error %d [%s]: read() failed\n", errno, in_ip);
- return(-1);
- }
-
- if((nread > 0) && (xmlSecBufferAppend(buffer, buf, nread) < 0)) {
- fprintf(stderr, "Error %d [%s]: xmlSecBufferAppend(%d) failed\n", errno, in_ip, nread);
- return(-1);
- }
+ nread = recv(fd, buf, sizeof(buf), 0);
+ if(nread < 0) {
+ fprintf(stderr, "Error %d [%s]: read() failed\n", errno, in_ip);
+ return(-1);
+ }
+
+ if((nread > 0) && (xmlSecBufferAppend(buffer, buf, nread) < 0)) {
+ fprintf(stderr, "Error %d [%s]: xmlSecBufferAppend(%d) failed\n", errno, in_ip, nread);
+ return(-1);
+ }
if(nread < sizeof(buffer)) {
counter--;
if(counter <= 0) {
@@ -738,23 +738,23 @@ read_request(int fd, const char* in_ip, xmlSecBufferPtr buffer) {
}
}
if(log_level >= LOG_LEVEL_INFO) {
- fprintf(stdout, "Log [%s]: body size is %d bytes\n", in_ip, xmlSecBufferGetSize(buffer));
+ fprintf(stdout, "Log [%s]: body size is %d bytes\n", in_ip, xmlSecBufferGetSize(buffer));
}
if(log_level >= LOG_LEVEL_DATA) {
- xmlSecBufferAppend(buffer, BAD_CAST "\0", 1);
+ xmlSecBufferAppend(buffer, BAD_CAST "\0", 1);
fprintf(stdout, "Log [%s]: request body:\n%s\n", in_ip, xmlSecBufferGetData(buffer));
- xmlSecBufferRemoveTail(buffer, 1);
+ xmlSecBufferRemoveTail(buffer, 1);
}
return(0);
}
/**
* send_response:
- * @fd: the request's socket.
- * @in_ip: the request's IP address (for logging).
- * @resp_code: the HTTP response code.
- * @body: the response body.
- * @body_len: the response body length.
+ * @fd: the request's socket.
+ * @in_ip: the request's IP address (for logging).
+ * @resp_code: the HTTP response code.
+ * @body: the response body.
+ * @body_len: the response body length.
*
* Writes HTTP response headers and @body to the @socket.
*
@@ -772,20 +772,20 @@ send_response(int fd, const char* in_ip, int resp_code, const char* body, int bo
/* prepare and send http header */
sprintf(header, http_header, resp_code, body_size);
if(send(fd, header, strlen(header), 0) == -1) {
- fprintf(stderr, "Error %d [%s]: send(header) failed\n", errno, in_ip);
- return(-1);
+ fprintf(stderr, "Error %d [%s]: send(header) failed\n", errno, in_ip);
+ return(-1);
}
if(log_level >= LOG_LEVEL_DATA) {
- xmlChar* tmp = xmlStrndup(body, body_size);
+ xmlChar* tmp = xmlStrndup(body, body_size);
fprintf(stdout, "Log [%s]: response is\n%s\n", in_ip, tmp);
- xmlFree(tmp);
+ xmlFree(tmp);
}
/* send body */
if(send(fd, body, body_size, 0) == -1) {
- fprintf(stderr, "Error %d [%s]: send(body) failed\n", errno, in_ip);
- return(-1);
+ fprintf(stderr, "Error %d [%s]: send(body) failed\n", errno, in_ip);
+ return(-1);
}
return(0);
diff --git a/examples/xmldsigverify.c b/examples/xmldsigverify.c
index a4c9f53..02839d2 100644
--- a/examples/xmldsigverify.c
+++ b/examples/xmldsigverify.c
@@ -24,9 +24,9 @@
#include <xmlsec/xmldsig.h>
#include <xmlsec/crypto.h>
-/* #define XMLDSIGVERIFY_DEFAULT_TRUSTED_CERTS_FOLDER "/etc/httpd/conf/ssl.crt" */
-#define XMLDSIGVERIFY_DEFAULT_TRUSTED_CERTS_FOLDER "/var/www/cgi-bin/keys-certs.def"
-#define XMLDSIGVERIFY_KEY_AND_CERTS_FOLDER "/var/www/cgi-bin/keys-certs"
+/* #define XMLDSIGVERIFY_DEFAULT_TRUSTED_CERTS_FOLDER "/etc/httpd/conf/ssl.crt" */
+#define XMLDSIGVERIFY_DEFAULT_TRUSTED_CERTS_FOLDER "/var/www/cgi-bin/keys-certs.def"
+#define XMLDSIGVERIFY_KEY_AND_CERTS_FOLDER "/var/www/cgi-bin/keys-certs"
int load_keys(xmlSecKeysMngrPtr mngr, const char* path, int report_loaded_keys);
@@ -53,17 +53,17 @@ main(int argc, char **argv) {
/* make sure that we print out everything to stdout */
xmlGenericErrorContext = stdout;
-
+
/* Init xmlsec library */
if(xmlSecInit() < 0) {
- fprintf(stdout, "Error: xmlsec initialization failed.\n");
- return(-1);
+ fprintf(stdout, "Error: xmlsec initialization failed.\n");
+ return(-1);
}
/* Check loaded library version */
if(xmlSecCheckVersion() != 1) {
- fprintf(stdout, "Error: loaded xmlsec library version is not compatible.\n");
- return(-1);
+ fprintf(stdout, "Error: loaded xmlsec library version is not compatible.\n");
+ return(-1);
}
/* Load default crypto engine if we are supporting dynamic
@@ -73,49 +73,49 @@ main(int argc, char **argv) {
*/
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {
- fprintf(stdout, "Error: unable to load default xmlsec-crypto library. Make sure\n"
- "that you have it installed and check shared libraries path\n"
- "(LD_LIBRARY_PATH) envornment variable.\n");
- return(-1);
+ fprintf(stdout, "Error: unable to load default xmlsec-crypto library. Make sure\n"
+ "that you have it installed and check shared libraries path\n"
+ "(LD_LIBRARY_PATH) envornment variable.\n");
+ return(-1);
}
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
/* Init crypto library */
if(xmlSecCryptoAppInit(XMLDSIGVERIFY_DEFAULT_TRUSTED_CERTS_FOLDER) < 0) {
- fprintf(stdout, "Error: crypto initialization failed.\n");
- return(-1);
+ fprintf(stdout, "Error: crypto initialization failed.\n");
+ return(-1);
}
/* Init xmlsec-crypto library */
if(xmlSecCryptoInit() < 0) {
- fprintf(stdout, "Error: xmlsec-crypto initialization failed.\n");
- return(-1);
+ fprintf(stdout, "Error: xmlsec-crypto initialization failed.\n");
+ return(-1);
}
/* create keys manager */
mngr = xmlSecKeysMngrCreate();
if(mngr == NULL) {
- fprintf(stdout, "Error: failed to create keys manager.\n");
- return(-1);
+ fprintf(stdout, "Error: failed to create keys manager.\n");
+ return(-1);
}
if(xmlSecCryptoAppDefaultKeysMngrInit(mngr) < 0) {
- fprintf(stdout, "Error: failed to initialize keys manager.\n");
- return(-1);
+ fprintf(stdout, "Error: failed to initialize keys manager.\n");
+ return(-1);
}
if(load_keys(mngr, XMLDSIGVERIFY_KEY_AND_CERTS_FOLDER, 0) < 0) {
- xmlSecKeysMngrDestroy(mngr);
- return(-1);
+ xmlSecKeysMngrDestroy(mngr);
+ return(-1);
}
if(load_trusted_certs(mngr, XMLDSIGVERIFY_KEY_AND_CERTS_FOLDER, 0) < 0) {
- xmlSecKeysMngrDestroy(mngr);
- return(-1);
+ xmlSecKeysMngrDestroy(mngr);
+ return(-1);
}
if(verify_request(mngr) < 0) {
- xmlSecKeysMngrDestroy(mngr);
- return(-1);
+ xmlSecKeysMngrDestroy(mngr);
+ return(-1);
}
/* Destroy keys manager */
@@ -141,8 +141,8 @@ main(int argc, char **argv) {
/**
* load_trusted_certs:
- * @mngr: the keys manager.
- * @path: the path to a folder that contains trusted certificates.
+ * @mngr: the keys manager.
+ * @path: the path to a folder that contains trusted certificates.
*
* Loads trusted certificates from @path.
*
@@ -159,33 +159,33 @@ int load_trusted_certs(xmlSecKeysMngrPtr mngr, const char* path, int report_load
dir = opendir(path);
if(dir == NULL) {
- fprintf(stdout, "Error: failed to open folder \"%s\".\n", path);
- return(-1);
+ fprintf(stdout, "Error: failed to open folder \"%s\".\n", path);
+ return(-1);
}
while((entry = readdir(dir)) != NULL) {
- assert(entry->d_name);
- len = strlen(entry->d_name);
- if((len > 4) && (strcmp(entry->d_name + len - 4, ".pem") == 0)) {
- snprintf(filename, sizeof(filename), "%s/%s", path, entry->d_name);
- if(xmlSecCryptoAppKeysMngrCertLoad(mngr, filename, xmlSecKeyDataFormatPem, xmlSecKeyDataTypeTrusted) < 0) {
- fprintf(stdout,"Error: failed to load pem certificate from \"%s\"\n", filename);
- closedir(dir);
- return(-1);
- }
- if(report_loaded_certs) {
- fprintf(stdout, "Loaded trusted certificate from \"%s\"...\n", filename);
- }
- } else if((len > 4) && (strcmp(entry->d_name + len - 4, ".der") == 0)) {
- snprintf(filename, sizeof(filename), "%s/%s", path, entry->d_name);
- if(xmlSecCryptoAppKeysMngrCertLoad(mngr, filename, xmlSecKeyDataFormatDer, xmlSecKeyDataTypeTrusted) < 0) {
- fprintf(stdout,"Error: failed to load der certificate from \"%s\"\n", filename);
- closedir(dir);
- return(-1);
- }
- if(report_loaded_certs) {
- fprintf(stdout, "Loaded trusted certificate from \"%s\"...\n", filename);
- }
- }
+ assert(entry->d_name);
+ len = strlen(entry->d_name);
+ if((len > 4) && (strcmp(entry->d_name + len - 4, ".pem") == 0)) {
+ snprintf(filename, sizeof(filename), "%s/%s", path, entry->d_name);
+ if(xmlSecCryptoAppKeysMngrCertLoad(mngr, filename, xmlSecKeyDataFormatPem, xmlSecKeyDataTypeTrusted) < 0) {
+ fprintf(stdout,"Error: failed to load pem certificate from \"%s\"\n", filename);
+ closedir(dir);
+ return(-1);
+ }
+ if(report_loaded_certs) {
+ fprintf(stdout, "Loaded trusted certificate from \"%s\"...\n", filename);
+ }
+ } else if((len > 4) && (strcmp(entry->d_name + len - 4, ".der") == 0)) {
+ snprintf(filename, sizeof(filename), "%s/%s", path, entry->d_name);
+ if(xmlSecCryptoAppKeysMngrCertLoad(mngr, filename, xmlSecKeyDataFormatDer, xmlSecKeyDataTypeTrusted) < 0) {
+ fprintf(stdout,"Error: failed to load der certificate from \"%s\"\n", filename);
+ closedir(dir);
+ return(-1);
+ }
+ if(report_loaded_certs) {
+ fprintf(stdout, "Loaded trusted certificate from \"%s\"...\n", filename);
+ }
+ }
}
closedir(dir);
return(0);
@@ -198,8 +198,8 @@ int load_keys(xmlSecKeysMngrPtr mngr, const char* path, int report_loaded_keys)
snprintf(filename, sizeof(filename), "%s/keys.xml", path);
if(xmlSecCryptoAppDefaultKeysMngrLoad(mngr, filename) < 0) {
- fprintf(stdout,"Error: failed to load keys from \"%s\"\n", filename);
- return(-1);
+ fprintf(stdout,"Error: failed to load keys from \"%s\"\n", filename);
+ return(-1);
}
if(report_loaded_keys) {
@@ -211,7 +211,7 @@ int load_keys(xmlSecKeysMngrPtr mngr, const char* path, int report_loaded_keys)
/**
* verify_request:
- * @mng: the keys manager
+ * @mng: the keys manager
*
* Verifies XML signature in the request (stdin).
*
@@ -232,35 +232,35 @@ verify_request(xmlSecKeysMngrPtr mngr) {
/* load request in the buffer */
buffer = xmlBufferCreate();
if(buffer == NULL) {
- fprintf(stdout,"Error: failed to create buffer\n");
- goto done;
+ fprintf(stdout,"Error: failed to create buffer\n");
+ goto done;
}
while(!feof(stdin)) {
- ret = fread(buf, 1, sizeof(buf), stdin);
- if(ret < 0) {
- fprintf(stdout,"Error: read failed\n");
- goto done;
- }
- xmlBufferAdd(buffer, buf, ret);
+ ret = fread(buf, 1, sizeof(buf), stdin);
+ if(ret < 0) {
+ fprintf(stdout,"Error: read failed\n");
+ goto done;
+ }
+ xmlBufferAdd(buffer, buf, ret);
}
/* is the document subbmitted from the form? */
if(strncmp((char*)xmlBufferContent(buffer), "_xmldoc=", 8) == 0) {
- xmlBufferShrink(buffer, 8);
- buffer->use = url_decode((char*)xmlBufferContent(buffer), xmlBufferLength(buffer));
+ xmlBufferShrink(buffer, 8);
+ buffer->use = url_decode((char*)xmlBufferContent(buffer), xmlBufferLength(buffer));
}
/**
* Load doc
*/
doc = xmlReadMemory(xmlBufferContent(buffer), xmlBufferLength(buffer),
- NULL, NULL,
- XML_PARSE_NOENT | XML_PARSE_NOCDATA |
- XML_PARSE_PEDANTIC | XML_PARSE_NOCDATA);
+ NULL, NULL,
+ XML_PARSE_NOENT | XML_PARSE_NOCDATA |
+ XML_PARSE_PEDANTIC | XML_PARSE_NOCDATA);
if (doc == NULL) {
- fprintf(stdout, "Error: unable to parse xml document (syntax error)\n");
- goto done;
+ fprintf(stdout, "Error: unable to parse xml document (syntax error)\n");
+ goto done;
}
/*
@@ -268,41 +268,41 @@ verify_request(xmlSecKeysMngrPtr mngr) {
*/
if(xmlDocGetRootElement(doc) == NULL) {
fprintf(stdout,"Error: empty document\n");
- goto done;
+ goto done;
}
/* find start node */
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeSignature, xmlSecDSigNs);
if(node == NULL) {
- fprintf(stdout, "Error: start <dsig:Signature/> node not found\n");
- goto done;
+ fprintf(stdout, "Error: start <dsig:Signature/> node not found\n");
+ goto done;
}
/* create signature context */
dsigCtx = xmlSecDSigCtxCreate(mngr);
if(dsigCtx == NULL) {
fprintf(stdout,"Error: failed to create signature context\n");
- goto done;
+ goto done;
}
/* we would like to store and print out everything */
/* actually we would not because it opens a security hole
dsigCtx->flags = XMLSEC_DSIG_FLAGS_STORE_SIGNEDINFO_REFERENCES |
- XMLSEC_DSIG_FLAGS_STORE_MANIFEST_REFERENCES |
- XMLSEC_DSIG_FLAGS_STORE_SIGNATURE;
+ XMLSEC_DSIG_FLAGS_STORE_MANIFEST_REFERENCES |
+ XMLSEC_DSIG_FLAGS_STORE_SIGNATURE;
*/
/* Verify signature */
if(xmlSecDSigCtxVerify(dsigCtx, node) < 0) {
fprintf(stdout,"Error: signature verification failed\n");
- goto done;
+ goto done;
}
/* print verification result to stdout */
if(dsigCtx->status == xmlSecDSigStatusSucceeded) {
- fprintf(stdout, "RESULT: Signature is OK\n");
+ fprintf(stdout, "RESULT: Signature is OK\n");
} else {
- fprintf(stdout, "RESULT: Signature is INVALID\n");
+ fprintf(stdout, "RESULT: Signature is INVALID\n");
}
fprintf(stdout, "---------------------------------------------------\n");
xmlSecDSigCtxDebugDump(dsigCtx, stdout);
@@ -313,30 +313,30 @@ verify_request(xmlSecKeysMngrPtr mngr) {
done:
/* cleanup */
if(dsigCtx != NULL) {
- xmlSecDSigCtxDestroy(dsigCtx);
+ xmlSecDSigCtxDestroy(dsigCtx);
}
if(doc != NULL) {
- xmlFreeDoc(doc);
+ xmlFreeDoc(doc);
}
if(buffer != NULL) {
- xmlBufferFree(buffer);
+ xmlBufferFree(buffer);
}
return(res);
}
/* not the best way to do it */
#define toHex(c) ( ( ('0' <= (c)) && ((c) <= '9') ) ? (c) - '0' : \
- ( ( ('A' <= (c)) && ((c) <= 'F') ) ? (c) - 'A' + 10 : 0 ) )
+ ( ( ('A' <= (c)) && ((c) <= 'F') ) ? (c) - 'A' + 10 : 0 ) )
/**
* url_decode:
- * @buf: the input buffer.
- * @size: the input buffer size.
+ * @buf: the input buffer.
+ * @size: the input buffer size.
*
* Does url decoding in-place.
- *
+ *
* Returns length of the decoded result on success or
* a negative value if an error occurs.
*/
@@ -347,15 +347,15 @@ int url_decode(char *buf, size_t size) {
p1 = p2 = buf;
while(p1 - buf < size) {
- if(((*p1) == '%') && ((p1 - buf) <= (size - 3))) {
- *(p2++) = (char)(toHex(p1[1]) * 16 + toHex(p1[2]));
- p1 += 3;
- } else if((*p1) == '+') {
- *(p2++) = ' ';
- p1++;
- } else {
- *(p2++) = *(p1++);
- }
+ if(((*p1) == '%') && ((p1 - buf) <= (size - 3))) {
+ *(p2++) = (char)(toHex(p1[1]) * 16 + toHex(p1[2]));
+ p1 += 3;
+ } else if((*p1) == '+') {
+ *(p2++) = ' ';
+ p1++;
+ } else {
+ *(p2++) = *(p1++);
+ }
}
return(p2 - buf);
}
diff --git a/include/xmlsec/app.h b/include/xmlsec/app.h
index d958392..59fe058 100644
--- a/include/xmlsec/app.h
+++ b/include/xmlsec/app.h
@@ -35,9 +35,9 @@ extern "C" {
* Crypto Init/shutdown
*
*********************************************************************/
-XMLSEC_EXPORT int xmlSecCryptoInit (void);
-XMLSEC_EXPORT int xmlSecCryptoShutdown (void);
-XMLSEC_EXPORT int xmlSecCryptoKeysMngrInit (xmlSecKeysMngrPtr mngr);
+XMLSEC_EXPORT int xmlSecCryptoInit (void);
+XMLSEC_EXPORT int xmlSecCryptoShutdown (void);
+XMLSEC_EXPORT int xmlSecCryptoKeysMngrInit (xmlSecKeysMngrPtr mngr);
/*********************************************************************
*
@@ -49,57 +49,57 @@ XMLSEC_EXPORT int xmlSecCryptoKeysMngrInit (xmlSecKeysMngrPtr mngr);
*
* The AES key klass.
*/
-#define xmlSecKeyDataAesId xmlSecKeyDataAesGetKlass()
-XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataAesGetKlass (void);
+#define xmlSecKeyDataAesId xmlSecKeyDataAesGetKlass()
+XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataAesGetKlass (void);
/**
* xmlSecKeyDataDesId:
*
* The DES key klass.
*/
-#define xmlSecKeyDataDesId xmlSecKeyDataDesGetKlass()
-XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataDesGetKlass (void);
+#define xmlSecKeyDataDesId xmlSecKeyDataDesGetKlass()
+XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataDesGetKlass (void);
/**
* xmlSecKeyDataDsaId:
*
* The DSA key klass.
*/
-#define xmlSecKeyDataDsaId xmlSecKeyDataDsaGetKlass()
-XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataDsaGetKlass (void);
+#define xmlSecKeyDataDsaId xmlSecKeyDataDsaGetKlass()
+XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataDsaGetKlass (void);
/**
* xmlSecKeyDataGost2001Id:
*
* The GOST2001 key klass.
*/
-#define xmlSecKeyDataGost2001Id xmlSecKeyDataGost2001GetKlass()
-XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataGost2001GetKlass (void);
+#define xmlSecKeyDataGost2001Id xmlSecKeyDataGost2001GetKlass()
+XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataGost2001GetKlass (void);
/**
* xmlSecKeyDataHmacId:
*
* The DHMAC key klass.
*/
-#define xmlSecKeyDataHmacId xmlSecKeyDataHmacGetKlass()
-XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataHmacGetKlass (void);
+#define xmlSecKeyDataHmacId xmlSecKeyDataHmacGetKlass()
+XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataHmacGetKlass (void);
/**
* xmlSecKeyDataRsaId:
*
* The RSA key klass.
*/
-#define xmlSecKeyDataRsaId xmlSecKeyDataRsaGetKlass()
-XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataRsaGetKlass (void);
+#define xmlSecKeyDataRsaId xmlSecKeyDataRsaGetKlass()
+XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataRsaGetKlass (void);
/**
* xmlSecKeyDataX509Id:
*
* The X509 data klass.
*/
-#define xmlSecKeyDataX509Id xmlSecKeyDataX509GetKlass()
-XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataX509GetKlass (void);
+#define xmlSecKeyDataX509Id xmlSecKeyDataX509GetKlass()
+XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataX509GetKlass (void);
/**
* xmlSecKeyDataRawX509CertId:
*
* The raw X509 certificate klass.
*/
-#define xmlSecKeyDataRawX509CertId xmlSecKeyDataRawX509CertGetKlass()
-XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataRawX509CertGetKlass(void);
+#define xmlSecKeyDataRawX509CertId xmlSecKeyDataRawX509CertGetKlass()
+XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataRawX509CertGetKlass(void);
/*********************************************************************
*
@@ -111,8 +111,8 @@ XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataRawX509CertGetKlass(void);
*
* The X509 store klass.
*/
-#define xmlSecX509StoreId xmlSecX509StoreGetKlass()
-XMLSEC_EXPORT xmlSecKeyDataStoreId xmlSecX509StoreGetKlass (void);
+#define xmlSecX509StoreId xmlSecX509StoreGetKlass()
+XMLSEC_EXPORT xmlSecKeyDataStoreId xmlSecX509StoreGetKlass (void);
/*********************************************************************
*
@@ -124,295 +124,295 @@ XMLSEC_EXPORT xmlSecKeyDataStoreId xmlSecX509StoreGetKlass (void);
*
* The AES128 CBC cipher transform klass.
*/
-#define xmlSecTransformAes128CbcId xmlSecTransformAes128CbcGetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformAes128CbcGetKlass(void);
+#define xmlSecTransformAes128CbcId xmlSecTransformAes128CbcGetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformAes128CbcGetKlass(void);
/**
* xmlSecTransformAes192CbcId:
*
* The AES192 CBC cipher transform klass.
*/
-#define xmlSecTransformAes192CbcId xmlSecTransformAes192CbcGetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformAes192CbcGetKlass(void);
+#define xmlSecTransformAes192CbcId xmlSecTransformAes192CbcGetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformAes192CbcGetKlass(void);
/**
* xmlSecTransformAes256CbcId:
*
* The AES256 CBC cipher transform klass.
*/
-#define xmlSecTransformAes256CbcId xmlSecTransformAes256CbcGetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformAes256CbcGetKlass(void);
+#define xmlSecTransformAes256CbcId xmlSecTransformAes256CbcGetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformAes256CbcGetKlass(void);
/**
* xmlSecTransformKWAes128Id:
*
* The AES 128 key wrap transform klass.
*/
-#define xmlSecTransformKWAes128Id xmlSecTransformKWAes128GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformKWAes128GetKlass (void);
+#define xmlSecTransformKWAes128Id xmlSecTransformKWAes128GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformKWAes128GetKlass (void);
/**
* xmlSecTransformKWAes192Id:
*
* The AES 192 key wrap transform klass.
*/
-#define xmlSecTransformKWAes192Id xmlSecTransformKWAes192GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformKWAes192GetKlass (void);
+#define xmlSecTransformKWAes192Id xmlSecTransformKWAes192GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformKWAes192GetKlass (void);
/**
* xmlSecTransformKWAes256Id:
*
* The AES 256 key wrap transform klass.
*/
-#define xmlSecTransformKWAes256Id xmlSecTransformKWAes256GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformKWAes256GetKlass (void);
+#define xmlSecTransformKWAes256Id xmlSecTransformKWAes256GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformKWAes256GetKlass (void);
/**
* xmlSecTransformDes3CbcId:
*
* The Triple DES encryption transform klass.
*/
-#define xmlSecTransformDes3CbcId xmlSecTransformDes3CbcGetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformDes3CbcGetKlass (void);
+#define xmlSecTransformDes3CbcId xmlSecTransformDes3CbcGetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformDes3CbcGetKlass (void);
/**
* xmlSecTransformKWDes3Id:
*
* The DES3 CBC cipher transform klass.
*/
-#define xmlSecTransformKWDes3Id xmlSecTransformKWDes3GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformKWDes3GetKlass (void);
+#define xmlSecTransformKWDes3Id xmlSecTransformKWDes3GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformKWDes3GetKlass (void);
/**
* xmlSecTransformDsaSha1Id:
*
* The DSA-SHA1 signature transform klass.
*/
-#define xmlSecTransformDsaSha1Id xmlSecTransformDsaSha1GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformDsaSha1GetKlass (void);
+#define xmlSecTransformDsaSha1Id xmlSecTransformDsaSha1GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformDsaSha1GetKlass (void);
/**
* xmlSecTransformGost2001GostR3411_94Id:
*
* The GOST2001-GOSTR3411_94 signature transform klass.
*/
-#define xmlSecTransformGost2001GostR3411_94Id xmlSecTransformGost2001GostR3411_94GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformGost2001GostR3411_94GetKlass (void);
+#define xmlSecTransformGost2001GostR3411_94Id xmlSecTransformGost2001GostR3411_94GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformGost2001GostR3411_94GetKlass (void);
/**
* xmlSecTransformHmacMd5Id:
*
* The HMAC with MD5 signature transform klass.
*/
-#define xmlSecTransformHmacMd5Id xmlSecTransformHmacMd5GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacMd5GetKlass (void);
+#define xmlSecTransformHmacMd5Id xmlSecTransformHmacMd5GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacMd5GetKlass (void);
/**
* xmlSecTransformHmacRipemd160Id:
*
* The HMAC with RipeMD160 signature transform klass.
*/
-#define xmlSecTransformHmacRipemd160Id xmlSecTransformHmacRipemd160GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacRipemd160GetKlass(void);
+#define xmlSecTransformHmacRipemd160Id xmlSecTransformHmacRipemd160GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacRipemd160GetKlass(void);
/**
* xmlSecTransformHmacSha1Id:
*
* The HMAC with SHA1 signature transform klass.
*/
-#define xmlSecTransformHmacSha1Id xmlSecTransformHmacSha1GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacSha1GetKlass (void);
+#define xmlSecTransformHmacSha1Id xmlSecTransformHmacSha1GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacSha1GetKlass (void);
/**
* xmlSecTransformHmacSha224Id:
*
* The HMAC with SHA224 signature transform klass.
*/
-#define xmlSecTransformHmacSha224Id xmlSecTransformHmacSha224GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacSha224GetKlass (void);
+#define xmlSecTransformHmacSha224Id xmlSecTransformHmacSha224GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacSha224GetKlass (void);
/**
* xmlSecTransformHmacSha256Id:
*
* The HMAC with SHA256 signature transform klass.
*/
-#define xmlSecTransformHmacSha256Id xmlSecTransformHmacSha256GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacSha256GetKlass (void);
+#define xmlSecTransformHmacSha256Id xmlSecTransformHmacSha256GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacSha256GetKlass (void);
/**
* xmlSecTransformHmacSha384Id:
*
* The HMAC with SHA384 signature transform klass.
*/
-#define xmlSecTransformHmacSha384Id xmlSecTransformHmacSha384GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacSha384GetKlass (void);
+#define xmlSecTransformHmacSha384Id xmlSecTransformHmacSha384GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacSha384GetKlass (void);
/**
* xmlSecTransformHmacSha512Id:
*
* The HMAC with SHA512 signature transform klass.
*/
-#define xmlSecTransformHmacSha512Id xmlSecTransformHmacSha512GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacSha512GetKlass (void);
+#define xmlSecTransformHmacSha512Id xmlSecTransformHmacSha512GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformHmacSha512GetKlass (void);
/**
* xmlSecTransformMd5Id:
*
* The MD5 digest transform klass.
*/
-#define xmlSecTransformMd5Id xmlSecTransformMd5GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformMd5GetKlass(void);
+#define xmlSecTransformMd5Id xmlSecTransformMd5GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformMd5GetKlass(void);
/**
* xmlSecTransformRipemd160Id:
*
* The RIPEMD160 digest transform klass.
*/
-#define xmlSecTransformRipemd160Id xmlSecTransformRipemd160GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRipemd160GetKlass(void);
+#define xmlSecTransformRipemd160Id xmlSecTransformRipemd160GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRipemd160GetKlass(void);
/**
* xmlSecTransformRsaMd5Id:
*
* The RSA-MD5 signature transform klass.
*/
-#define xmlSecTransformRsaMd5Id xmlSecTransformRsaMd5GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaMd5GetKlass (void);
+#define xmlSecTransformRsaMd5Id xmlSecTransformRsaMd5GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaMd5GetKlass (void);
/**
* xmlSecTransformRsaRipemd160Id:
*
* The RSA-RIPEMD160 signature transform klass.
*/
-#define xmlSecTransformRsaRipemd160Id xmlSecTransformRsaRipemd160GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaRipemd160GetKlass (void);
+#define xmlSecTransformRsaRipemd160Id xmlSecTransformRsaRipemd160GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaRipemd160GetKlass (void);
/**
* xmlSecTransformRsaSha1Id:
*
* The RSA-SHA1 signature transform klass.
*/
-#define xmlSecTransformRsaSha1Id xmlSecTransformRsaSha1GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaSha1GetKlass (void);
+#define xmlSecTransformRsaSha1Id xmlSecTransformRsaSha1GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaSha1GetKlass (void);
/**
* xmlSecTransformRsaSha224Id:
*
* The RSA-SHA224 signature transform klass.
*/
-#define xmlSecTransformRsaSha224Id xmlSecTransformRsaSha224GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaSha224GetKlass (void);
+#define xmlSecTransformRsaSha224Id xmlSecTransformRsaSha224GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaSha224GetKlass (void);
/**
* xmlSecTransformRsaSha256Id:
*
* The RSA-SHA256 signature transform klass.
*/
-#define xmlSecTransformRsaSha256Id xmlSecTransformRsaSha256GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaSha256GetKlass (void);
+#define xmlSecTransformRsaSha256Id xmlSecTransformRsaSha256GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaSha256GetKlass (void);
/**
* xmlSecTransformRsaSha384Id:
*
* The RSA-SHA384 signature transform klass.
*/
-#define xmlSecTransformRsaSha384Id xmlSecTransformRsaSha384GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaSha384GetKlass (void);
+#define xmlSecTransformRsaSha384Id xmlSecTransformRsaSha384GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaSha384GetKlass (void);
/**
* xmlSecTransformRsaSha512Id:
*
* The RSA-SHA512 signature transform klass.
*/
-#define xmlSecTransformRsaSha512Id xmlSecTransformRsaSha512GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaSha512GetKlass (void);
+#define xmlSecTransformRsaSha512Id xmlSecTransformRsaSha512GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaSha512GetKlass (void);
/**
* xmlSecTransformRsaPkcs1Id:
*
* The RSA PKCS1 key transport transform klass.
*/
-#define xmlSecTransformRsaPkcs1Id xmlSecTransformRsaPkcs1GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaPkcs1GetKlass (void);
+#define xmlSecTransformRsaPkcs1Id xmlSecTransformRsaPkcs1GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaPkcs1GetKlass (void);
/**
* xmlSecTransformRsaOaepId:
*
* The RSA PKCS1 key transport transform klass.
*/
-#define xmlSecTransformRsaOaepId xmlSecTransformRsaOaepGetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaOaepGetKlass (void);
+#define xmlSecTransformRsaOaepId xmlSecTransformRsaOaepGetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRsaOaepGetKlass (void);
/**
* xmlSecTransformGostR3411_94Id:
*
* The GOSTR3411_94 digest transform klass.
*/
-#define xmlSecTransformGostR3411_94Id xmlSecTransformGostR3411_94GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformGostR3411_94GetKlass (void);
+#define xmlSecTransformGostR3411_94Id xmlSecTransformGostR3411_94GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformGostR3411_94GetKlass (void);
/**
* xmlSecTransformSha1Id:
*
* The SHA1 digest transform klass.
*/
-#define xmlSecTransformSha1Id xmlSecTransformSha1GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformSha1GetKlass (void);
+#define xmlSecTransformSha1Id xmlSecTransformSha1GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformSha1GetKlass (void);
/**
* xmlSecTransformSha224Id:
*
* The SHA224 digest transform klass.
*/
-#define xmlSecTransformSha224Id xmlSecTransformSha224GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformSha224GetKlass (void);
+#define xmlSecTransformSha224Id xmlSecTransformSha224GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformSha224GetKlass (void);
/**
* xmlSecTransformSha256Id:
*
* The SHA256 digest transform klass.
*/
-#define xmlSecTransformSha256Id xmlSecTransformSha256GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformSha256GetKlass (void);
+#define xmlSecTransformSha256Id xmlSecTransformSha256GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformSha256GetKlass (void);
/**
* xmlSecTransformSha384Id:
*
* The SHA384 digest transform klass.
*/
-#define xmlSecTransformSha384Id xmlSecTransformSha384GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformSha384GetKlass (void);
+#define xmlSecTransformSha384Id xmlSecTransformSha384GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformSha384GetKlass (void);
/**
* xmlSecTransformSha512Id:
*
* The SHA512 digest transform klass.
*/
-#define xmlSecTransformSha512Id xmlSecTransformSha512GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformSha512GetKlass (void);
+#define xmlSecTransformSha512Id xmlSecTransformSha512GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformSha512GetKlass (void);
/*********************************************************************
*
* High level routines form xmlsec command line utility
*
********************************************************************/
-XMLSEC_EXPORT int xmlSecCryptoAppInit (const char* config);
-XMLSEC_EXPORT int xmlSecCryptoAppShutdown (void);
-XMLSEC_EXPORT int xmlSecCryptoAppDefaultKeysMngrInit (xmlSecKeysMngrPtr mngr);
-XMLSEC_EXPORT int xmlSecCryptoAppDefaultKeysMngrAdoptKey (xmlSecKeysMngrPtr mngr,
- xmlSecKeyPtr key);
-XMLSEC_EXPORT int xmlSecCryptoAppDefaultKeysMngrLoad (xmlSecKeysMngrPtr mngr,
- const char* uri);
-XMLSEC_EXPORT int xmlSecCryptoAppDefaultKeysMngrSave (xmlSecKeysMngrPtr mngr,
- const char* filename,
- xmlSecKeyDataType type);
-XMLSEC_EXPORT int xmlSecCryptoAppKeysMngrCertLoad (xmlSecKeysMngrPtr mngr,
- const char *filename,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type);
-XMLSEC_EXPORT int xmlSecCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type);
-XMLSEC_EXPORT xmlSecKeyPtr xmlSecCryptoAppKeyLoad (const char *filename,
- xmlSecKeyDataFormat format,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_EXPORT xmlSecKeyPtr xmlSecCryptoAppKeyLoadMemory (const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_EXPORT xmlSecKeyPtr xmlSecCryptoAppPkcs12Load (const char* filename,
- const char* pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_EXPORT xmlSecKeyPtr xmlSecCryptoAppPkcs12LoadMemory (const xmlSecByte* data,
- xmlSecSize dataSize,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_EXPORT int xmlSecCryptoAppKeyCertLoad (xmlSecKeyPtr key,
- const char* filename,
- xmlSecKeyDataFormat format);
-XMLSEC_EXPORT int xmlSecCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format);
-XMLSEC_EXPORT void* xmlSecCryptoAppGetDefaultPwdCallback(void);
+XMLSEC_EXPORT int xmlSecCryptoAppInit (const char* config);
+XMLSEC_EXPORT int xmlSecCryptoAppShutdown (void);
+XMLSEC_EXPORT int xmlSecCryptoAppDefaultKeysMngrInit (xmlSecKeysMngrPtr mngr);
+XMLSEC_EXPORT int xmlSecCryptoAppDefaultKeysMngrAdoptKey (xmlSecKeysMngrPtr mngr,
+ xmlSecKeyPtr key);
+XMLSEC_EXPORT int xmlSecCryptoAppDefaultKeysMngrLoad (xmlSecKeysMngrPtr mngr,
+ const char* uri);
+XMLSEC_EXPORT int xmlSecCryptoAppDefaultKeysMngrSave (xmlSecKeysMngrPtr mngr,
+ const char* filename,
+ xmlSecKeyDataType type);
+XMLSEC_EXPORT int xmlSecCryptoAppKeysMngrCertLoad (xmlSecKeysMngrPtr mngr,
+ const char *filename,
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type);
+XMLSEC_EXPORT int xmlSecCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type);
+XMLSEC_EXPORT xmlSecKeyPtr xmlSecCryptoAppKeyLoad (const char *filename,
+ xmlSecKeyDataFormat format,
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_EXPORT xmlSecKeyPtr xmlSecCryptoAppKeyLoadMemory (const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format,
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_EXPORT xmlSecKeyPtr xmlSecCryptoAppPkcs12Load (const char* filename,
+ const char* pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_EXPORT xmlSecKeyPtr xmlSecCryptoAppPkcs12LoadMemory (const xmlSecByte* data,
+ xmlSecSize dataSize,
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_EXPORT int xmlSecCryptoAppKeyCertLoad (xmlSecKeyPtr key,
+ const char* filename,
+ xmlSecKeyDataFormat format);
+XMLSEC_EXPORT int xmlSecCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format);
+XMLSEC_EXPORT void* xmlSecCryptoAppGetDefaultPwdCallback(void);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/base64.h b/include/xmlsec/base64.h
index 93c472a..91b4b09 100644
--- a/include/xmlsec/base64.h
+++ b/include/xmlsec/base64.h
@@ -25,39 +25,39 @@ extern "C" {
*
* The default maximum base64 encoded line size.
*/
-#define XMLSEC_BASE64_LINESIZE 64
+#define XMLSEC_BASE64_LINESIZE 64
-XMLSEC_EXPORT int xmlSecBase64GetDefaultLineSize (void);
-XMLSEC_EXPORT void xmlSecBase64SetDefaultLineSize (int columns);
+XMLSEC_EXPORT int xmlSecBase64GetDefaultLineSize (void);
+XMLSEC_EXPORT void xmlSecBase64SetDefaultLineSize (int columns);
/* Base64 Context */
-typedef struct _xmlSecBase64Ctx xmlSecBase64Ctx,
- *xmlSecBase64CtxPtr;
+typedef struct _xmlSecBase64Ctx xmlSecBase64Ctx,
+ *xmlSecBase64CtxPtr;
-XMLSEC_EXPORT xmlSecBase64CtxPtr xmlSecBase64CtxCreate (int encode,
- int columns);
-XMLSEC_EXPORT void xmlSecBase64CtxDestroy (xmlSecBase64CtxPtr ctx);
-XMLSEC_EXPORT int xmlSecBase64CtxInitialize (xmlSecBase64CtxPtr ctx,
- int encode,
- int columns);
-XMLSEC_EXPORT void xmlSecBase64CtxFinalize (xmlSecBase64CtxPtr ctx);
-XMLSEC_EXPORT int xmlSecBase64CtxUpdate (xmlSecBase64CtxPtr ctx,
- const xmlSecByte *in,
- xmlSecSize inSize,
- xmlSecByte *out,
- xmlSecSize outSize);
-XMLSEC_EXPORT int xmlSecBase64CtxFinal (xmlSecBase64CtxPtr ctx,
- xmlSecByte *out,
- xmlSecSize outSize);
+XMLSEC_EXPORT xmlSecBase64CtxPtr xmlSecBase64CtxCreate (int encode,
+ int columns);
+XMLSEC_EXPORT void xmlSecBase64CtxDestroy (xmlSecBase64CtxPtr ctx);
+XMLSEC_EXPORT int xmlSecBase64CtxInitialize (xmlSecBase64CtxPtr ctx,
+ int encode,
+ int columns);
+XMLSEC_EXPORT void xmlSecBase64CtxFinalize (xmlSecBase64CtxPtr ctx);
+XMLSEC_EXPORT int xmlSecBase64CtxUpdate (xmlSecBase64CtxPtr ctx,
+ const xmlSecByte *in,
+ xmlSecSize inSize,
+ xmlSecByte *out,
+ xmlSecSize outSize);
+XMLSEC_EXPORT int xmlSecBase64CtxFinal (xmlSecBase64CtxPtr ctx,
+ xmlSecByte *out,
+ xmlSecSize outSize);
/* Standalone routines to do base64 encode/decode "at once" */
-XMLSEC_EXPORT xmlChar* xmlSecBase64Encode (const xmlSecByte *buf,
- xmlSecSize len,
- int columns);
-XMLSEC_EXPORT int xmlSecBase64Decode (const xmlChar* str,
- xmlSecByte *buf,
- xmlSecSize len);
+XMLSEC_EXPORT xmlChar* xmlSecBase64Encode (const xmlSecByte *buf,
+ xmlSecSize len,
+ int columns);
+XMLSEC_EXPORT int xmlSecBase64Decode (const xmlChar* str,
+ xmlSecByte *buf,
+ xmlSecSize len);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/bn.h b/include/xmlsec/bn.h
index 418dc1f..2163be3 100644
--- a/include/xmlsec/bn.h
+++ b/include/xmlsec/bn.h
@@ -19,14 +19,14 @@ extern "C" {
#include <xmlsec/xmlsec.h>
#include <xmlsec/buffer.h>
-typedef xmlSecBuffer xmlSecBn,
- *xmlSecBnPtr;
+typedef xmlSecBuffer xmlSecBn,
+ *xmlSecBnPtr;
/**
* xmlSecBnFormat:
- * @xmlSecBnBase64: the base64 decoded binary blob.
- * @xmlSecBnHex: the hex number.
- * @xmlSecBnDec: the decimal number.
+ * @xmlSecBnBase64: the base64 decoded binary blob.
+ * @xmlSecBnHex: the hex number.
+ * @xmlSecBnDec: the decimal number.
*
* The big numbers formats.
*/
@@ -36,60 +36,60 @@ typedef enum {
xmlSecBnDec
} xmlSecBnFormat;
-XMLSEC_EXPORT xmlSecBnPtr xmlSecBnCreate (xmlSecSize size);
-XMLSEC_EXPORT void xmlSecBnDestroy (xmlSecBnPtr bn);
-XMLSEC_EXPORT int xmlSecBnInitialize (xmlSecBnPtr bn,
- xmlSecSize size);
-XMLSEC_EXPORT void xmlSecBnFinalize (xmlSecBnPtr bn);
-XMLSEC_EXPORT xmlSecByte* xmlSecBnGetData (xmlSecBnPtr bn);
-XMLSEC_EXPORT int xmlSecBnSetData (xmlSecBnPtr bn,
- const xmlSecByte* data,
- xmlSecSize size);
-XMLSEC_EXPORT xmlSecSize xmlSecBnGetSize (xmlSecBnPtr bn);
-XMLSEC_EXPORT void xmlSecBnZero (xmlSecBnPtr bn);
+XMLSEC_EXPORT xmlSecBnPtr xmlSecBnCreate (xmlSecSize size);
+XMLSEC_EXPORT void xmlSecBnDestroy (xmlSecBnPtr bn);
+XMLSEC_EXPORT int xmlSecBnInitialize (xmlSecBnPtr bn,
+ xmlSecSize size);
+XMLSEC_EXPORT void xmlSecBnFinalize (xmlSecBnPtr bn);
+XMLSEC_EXPORT xmlSecByte* xmlSecBnGetData (xmlSecBnPtr bn);
+XMLSEC_EXPORT int xmlSecBnSetData (xmlSecBnPtr bn,
+ const xmlSecByte* data,
+ xmlSecSize size);
+XMLSEC_EXPORT xmlSecSize xmlSecBnGetSize (xmlSecBnPtr bn);
+XMLSEC_EXPORT void xmlSecBnZero (xmlSecBnPtr bn);
-XMLSEC_EXPORT int xmlSecBnFromString (xmlSecBnPtr bn,
- const xmlChar* str,
- xmlSecSize base);
-XMLSEC_EXPORT xmlChar* xmlSecBnToString (xmlSecBnPtr bn,
- xmlSecSize base);
-XMLSEC_EXPORT int xmlSecBnFromHexString (xmlSecBnPtr bn,
- const xmlChar* str);
-XMLSEC_EXPORT xmlChar* xmlSecBnToHexString (xmlSecBnPtr bn);
+XMLSEC_EXPORT int xmlSecBnFromString (xmlSecBnPtr bn,
+ const xmlChar* str,
+ xmlSecSize base);
+XMLSEC_EXPORT xmlChar* xmlSecBnToString (xmlSecBnPtr bn,
+ xmlSecSize base);
+XMLSEC_EXPORT int xmlSecBnFromHexString (xmlSecBnPtr bn,
+ const xmlChar* str);
+XMLSEC_EXPORT xmlChar* xmlSecBnToHexString (xmlSecBnPtr bn);
-XMLSEC_EXPORT int xmlSecBnFromDecString (xmlSecBnPtr bn,
- const xmlChar* str);
-XMLSEC_EXPORT xmlChar* xmlSecBnToDecString (xmlSecBnPtr bn);
+XMLSEC_EXPORT int xmlSecBnFromDecString (xmlSecBnPtr bn,
+ const xmlChar* str);
+XMLSEC_EXPORT xmlChar* xmlSecBnToDecString (xmlSecBnPtr bn);
-XMLSEC_EXPORT int xmlSecBnMul (xmlSecBnPtr bn,
- int multiplier);
-XMLSEC_EXPORT int xmlSecBnDiv (xmlSecBnPtr bn,
- int divider,
- int* mod);
-XMLSEC_EXPORT int xmlSecBnAdd (xmlSecBnPtr bn,
- int delta);
-XMLSEC_EXPORT int xmlSecBnReverse (xmlSecBnPtr bn);
-XMLSEC_EXPORT int xmlSecBnCompare (xmlSecBnPtr bn,
- const xmlSecByte* data,
- xmlSecSize dataSize);
-XMLSEC_EXPORT int xmlSecBnCompareReverse (xmlSecBnPtr bn,
- const xmlSecByte* data,
- xmlSecSize dataSize);
-XMLSEC_EXPORT int xmlSecBnGetNodeValue (xmlSecBnPtr bn,
- xmlNodePtr cur,
- xmlSecBnFormat format,
- int reverse);
-XMLSEC_EXPORT int xmlSecBnSetNodeValue (xmlSecBnPtr bn,
- xmlNodePtr cur,
- xmlSecBnFormat format,
- int reverse,
- int addLineBreaks);
-XMLSEC_EXPORT int xmlSecBnBlobSetNodeValue (const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlNodePtr cur,
- xmlSecBnFormat format,
- int reverse,
- int addLineBreaks);
+XMLSEC_EXPORT int xmlSecBnMul (xmlSecBnPtr bn,
+ int multiplier);
+XMLSEC_EXPORT int xmlSecBnDiv (xmlSecBnPtr bn,
+ int divider,
+ int* mod);
+XMLSEC_EXPORT int xmlSecBnAdd (xmlSecBnPtr bn,
+ int delta);
+XMLSEC_EXPORT int xmlSecBnReverse (xmlSecBnPtr bn);
+XMLSEC_EXPORT int xmlSecBnCompare (xmlSecBnPtr bn,
+ const xmlSecByte* data,
+ xmlSecSize dataSize);
+XMLSEC_EXPORT int xmlSecBnCompareReverse (xmlSecBnPtr bn,
+ const xmlSecByte* data,
+ xmlSecSize dataSize);
+XMLSEC_EXPORT int xmlSecBnGetNodeValue (xmlSecBnPtr bn,
+ xmlNodePtr cur,
+ xmlSecBnFormat format,
+ int reverse);
+XMLSEC_EXPORT int xmlSecBnSetNodeValue (xmlSecBnPtr bn,
+ xmlNodePtr cur,
+ xmlSecBnFormat format,
+ int reverse,
+ int addLineBreaks);
+XMLSEC_EXPORT int xmlSecBnBlobSetNodeValue (const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlNodePtr cur,
+ xmlSecBnFormat format,
+ int reverse,
+ int addLineBreaks);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/buffer.h b/include/xmlsec/buffer.h
index 8495903..9401aed 100644
--- a/include/xmlsec/buffer.h
+++ b/include/xmlsec/buffer.h
@@ -18,16 +18,16 @@ extern "C" {
#include <libxml/tree.h>
#include <xmlsec/xmlsec.h>
-typedef struct _xmlSecBuffer xmlSecBuffer,
- *xmlSecBufferPtr;
+typedef struct _xmlSecBuffer xmlSecBuffer,
+ *xmlSecBufferPtr;
/**
* xmlSecAllocMode:
- * @xmlSecAllocModeExact: the memory allocation mode that minimizes total
- * allocated memory size.
- * @xmlSecAllocModeDouble: the memory allocation mode that tries to minimize
- * the number of malloc calls.
+ * @xmlSecAllocModeExact: the memory allocation mode that minimizes total
+ * allocated memory size.
+ * @xmlSecAllocModeDouble: the memory allocation mode that tries to minimize
+ * the number of malloc calls.
*
* The memory allocation mode (used by @xmlSecBuffer and @xmlSecList).
*/
@@ -52,52 +52,52 @@ typedef enum {
* Binary data buffer.
*/
struct _xmlSecBuffer {
- xmlSecByte* data;
- xmlSecSize size;
- xmlSecSize maxSize;
- xmlSecAllocMode allocMode;
+ xmlSecByte* data;
+ xmlSecSize size;
+ xmlSecSize maxSize;
+ xmlSecAllocMode allocMode;
};
-XMLSEC_EXPORT void xmlSecBufferSetDefaultAllocMode (xmlSecAllocMode defAllocMode,
- xmlSecSize defInitialSize);
-
-XMLSEC_EXPORT xmlSecBufferPtr xmlSecBufferCreate (xmlSecSize size);
-XMLSEC_EXPORT void xmlSecBufferDestroy (xmlSecBufferPtr buf);
-XMLSEC_EXPORT int xmlSecBufferInitialize (xmlSecBufferPtr buf,
- xmlSecSize size);
-XMLSEC_EXPORT void xmlSecBufferFinalize (xmlSecBufferPtr buf);
-XMLSEC_EXPORT xmlSecByte* xmlSecBufferGetData (xmlSecBufferPtr buf);
-XMLSEC_EXPORT int xmlSecBufferSetData (xmlSecBufferPtr buf,
- const xmlSecByte* data,
- xmlSecSize size);
-XMLSEC_EXPORT xmlSecSize xmlSecBufferGetSize (xmlSecBufferPtr buf);
-XMLSEC_EXPORT int xmlSecBufferSetSize (xmlSecBufferPtr buf,
- xmlSecSize size);
-XMLSEC_EXPORT xmlSecSize xmlSecBufferGetMaxSize (xmlSecBufferPtr buf);
-XMLSEC_EXPORT int xmlSecBufferSetMaxSize (xmlSecBufferPtr buf,
- xmlSecSize size);
-XMLSEC_EXPORT void xmlSecBufferEmpty (xmlSecBufferPtr buf);
-XMLSEC_EXPORT int xmlSecBufferAppend (xmlSecBufferPtr buf,
- const xmlSecByte* data,
- xmlSecSize size);
-XMLSEC_EXPORT int xmlSecBufferPrepend (xmlSecBufferPtr buf,
- const xmlSecByte* data,
- xmlSecSize size);
-XMLSEC_EXPORT int xmlSecBufferRemoveHead (xmlSecBufferPtr buf,
- xmlSecSize size);
-XMLSEC_EXPORT int xmlSecBufferRemoveTail (xmlSecBufferPtr buf,
- xmlSecSize size);
-
-XMLSEC_EXPORT int xmlSecBufferReadFile (xmlSecBufferPtr buf,
- const char* filename);
-
-XMLSEC_EXPORT int xmlSecBufferBase64NodeContentRead(xmlSecBufferPtr buf,
- xmlNodePtr node);
-XMLSEC_EXPORT int xmlSecBufferBase64NodeContentWrite(xmlSecBufferPtr buf,
- xmlNodePtr node,
- int columns);
-
-XMLSEC_EXPORT xmlOutputBufferPtr xmlSecBufferCreateOutputBuffer (xmlSecBufferPtr buf);
+XMLSEC_EXPORT void xmlSecBufferSetDefaultAllocMode (xmlSecAllocMode defAllocMode,
+ xmlSecSize defInitialSize);
+
+XMLSEC_EXPORT xmlSecBufferPtr xmlSecBufferCreate (xmlSecSize size);
+XMLSEC_EXPORT void xmlSecBufferDestroy (xmlSecBufferPtr buf);
+XMLSEC_EXPORT int xmlSecBufferInitialize (xmlSecBufferPtr buf,
+ xmlSecSize size);
+XMLSEC_EXPORT void xmlSecBufferFinalize (xmlSecBufferPtr buf);
+XMLSEC_EXPORT xmlSecByte* xmlSecBufferGetData (xmlSecBufferPtr buf);
+XMLSEC_EXPORT int xmlSecBufferSetData (xmlSecBufferPtr buf,
+ const xmlSecByte* data,
+ xmlSecSize size);
+XMLSEC_EXPORT xmlSecSize xmlSecBufferGetSize (xmlSecBufferPtr buf);
+XMLSEC_EXPORT int xmlSecBufferSetSize (xmlSecBufferPtr buf,
+ xmlSecSize size);
+XMLSEC_EXPORT xmlSecSize xmlSecBufferGetMaxSize (xmlSecBufferPtr buf);
+XMLSEC_EXPORT int xmlSecBufferSetMaxSize (xmlSecBufferPtr buf,
+ xmlSecSize size);
+XMLSEC_EXPORT void xmlSecBufferEmpty (xmlSecBufferPtr buf);
+XMLSEC_EXPORT int xmlSecBufferAppend (xmlSecBufferPtr buf,
+ const xmlSecByte* data,
+ xmlSecSize size);
+XMLSEC_EXPORT int xmlSecBufferPrepend (xmlSecBufferPtr buf,
+ const xmlSecByte* data,
+ xmlSecSize size);
+XMLSEC_EXPORT int xmlSecBufferRemoveHead (xmlSecBufferPtr buf,
+ xmlSecSize size);
+XMLSEC_EXPORT int xmlSecBufferRemoveTail (xmlSecBufferPtr buf,
+ xmlSecSize size);
+
+XMLSEC_EXPORT int xmlSecBufferReadFile (xmlSecBufferPtr buf,
+ const char* filename);
+
+XMLSEC_EXPORT int xmlSecBufferBase64NodeContentRead(xmlSecBufferPtr buf,
+ xmlNodePtr node);
+XMLSEC_EXPORT int xmlSecBufferBase64NodeContentWrite(xmlSecBufferPtr buf,
+ xmlNodePtr node,
+ int columns);
+
+XMLSEC_EXPORT xmlOutputBufferPtr xmlSecBufferCreateOutputBuffer (xmlSecBufferPtr buf);
#ifdef __cplusplus
diff --git a/include/xmlsec/dl.h b/include/xmlsec/dl.h
index 9dce850..ca9c1ff 100644
--- a/include/xmlsec/dl.h
+++ b/include/xmlsec/dl.h
@@ -14,12 +14,12 @@
extern "C" {
#endif /* __cplusplus */
-typedef struct _xmlSecCryptoDLFunctions xmlSecCryptoDLFunctions,
- *xmlSecCryptoDLFunctionsPtr;
+typedef struct _xmlSecCryptoDLFunctions xmlSecCryptoDLFunctions,
+ *xmlSecCryptoDLFunctionsPtr;
-XMLSEC_EXPORT int xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms
- (xmlSecCryptoDLFunctionsPtr functions);
-
+XMLSEC_EXPORT int xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms
+ (xmlSecCryptoDLFunctionsPtr functions);
+
#ifndef XMLSEC_NO_CRYPTO_DYNAMIC_LOADING
#include <libxml/tree.h>
@@ -34,16 +34,16 @@ XMLSEC_EXPORT int xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms
/**
* Dynamic load functions
*/
-XMLSEC_EXPORT int xmlSecCryptoDLInit (void);
-XMLSEC_EXPORT int xmlSecCryptoDLShutdown (void);
+XMLSEC_EXPORT int xmlSecCryptoDLInit (void);
+XMLSEC_EXPORT int xmlSecCryptoDLShutdown (void);
-XMLSEC_EXPORT int xmlSecCryptoDLLoadLibrary (const xmlChar* crypto);
-XMLSEC_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoDLGetLibraryFunctions(const xmlChar* crypto);
-XMLSEC_EXPORT int xmlSecCryptoDLUnloadLibrary (const xmlChar* crypto);
+XMLSEC_EXPORT int xmlSecCryptoDLLoadLibrary (const xmlChar* crypto);
+XMLSEC_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoDLGetLibraryFunctions(const xmlChar* crypto);
+XMLSEC_EXPORT int xmlSecCryptoDLUnloadLibrary (const xmlChar* crypto);
-XMLSEC_EXPORT int xmlSecCryptoDLSetFunctions (xmlSecCryptoDLFunctionsPtr functions);
-XMLSEC_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoDLGetFunctions (void);
-
+XMLSEC_EXPORT int xmlSecCryptoDLSetFunctions (xmlSecCryptoDLFunctionsPtr functions);
+XMLSEC_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoDLGetFunctions (void);
+
#endif /* XMLSEC_NO_CRYPTO_DYNAMIC_LOADING */
#ifdef __cplusplus
diff --git a/include/xmlsec/errors.h b/include/xmlsec/errors.h
index 42c6306..7cea675 100644
--- a/include/xmlsec/errors.h
+++ b/include/xmlsec/errors.h
@@ -25,49 +25,49 @@ extern "C" {
*
* An XMLSec function failed (error subject is the failed function).
*/
-#define XMLSEC_ERRORS_R_XMLSEC_FAILED 1
+#define XMLSEC_ERRORS_R_XMLSEC_FAILED 1
/**
* XMLSEC_ERRORS_R_MALLOC_FAILED:
*
* Failed to allocate memory error.
*/
-#define XMLSEC_ERRORS_R_MALLOC_FAILED 2
+#define XMLSEC_ERRORS_R_MALLOC_FAILED 2
/**
* XMLSEC_ERRORS_R_STRDUP_FAILED:
*
* Failed to duplicate string error.
*/
-#define XMLSEC_ERRORS_R_STRDUP_FAILED 3
+#define XMLSEC_ERRORS_R_STRDUP_FAILED 3
/**
* XMLSEC_ERRORS_R_CRYPTO_FAILED:
*
* Crypto (OpenSSL) function failed (error subject is the failed function).
*/
-#define XMLSEC_ERRORS_R_CRYPTO_FAILED 4
+#define XMLSEC_ERRORS_R_CRYPTO_FAILED 4
/**
* XMLSEC_ERRORS_R_XML_FAILED:
*
* LibXML function failed (error subject is the failed function).
*/
-#define XMLSEC_ERRORS_R_XML_FAILED 5
+#define XMLSEC_ERRORS_R_XML_FAILED 5
/**
* XMLSEC_ERRORS_R_XSLT_FAILED:
*
* LibXSLT function failed (error subject is the failed function).
*/
-#define XMLSEC_ERRORS_R_XSLT_FAILED 6
+#define XMLSEC_ERRORS_R_XSLT_FAILED 6
/**
* XMLSEC_ERRORS_R_IO_FAILED:
*
* IO operation failed.
*/
-#define XMLSEC_ERRORS_R_IO_FAILED 7
+#define XMLSEC_ERRORS_R_IO_FAILED 7
/**
* XMLSEC_ERRORS_R_DISABLED:
@@ -76,203 +76,203 @@ extern "C" {
* Check './configure --help' for details on how to
* enable it.
*/
-#define XMLSEC_ERRORS_R_DISABLED 8
+#define XMLSEC_ERRORS_R_DISABLED 8
/**
* XMLSEC_ERRORS_R_NOT_IMPLEMENTED:
*
* Feature is not implemented.
*/
-#define XMLSEC_ERRORS_R_NOT_IMPLEMENTED 9
+#define XMLSEC_ERRORS_R_NOT_IMPLEMENTED 9
/**
* XMLSEC_ERRORS_R_INVALID_SIZE:
*
* Invalid size.
*/
-#define XMLSEC_ERRORS_R_INVALID_SIZE 11
+#define XMLSEC_ERRORS_R_INVALID_SIZE 11
/**
* XMLSEC_ERRORS_R_INVALID_DATA:
*
* Invalid data.
*/
-#define XMLSEC_ERRORS_R_INVALID_DATA 12
+#define XMLSEC_ERRORS_R_INVALID_DATA 12
/**
* XMLSEC_ERRORS_R_INVALID_RESULT:
*
* Invalid result.
*/
-#define XMLSEC_ERRORS_R_INVALID_RESULT 13
+#define XMLSEC_ERRORS_R_INVALID_RESULT 13
/**
* XMLSEC_ERRORS_R_INVALID_TYPE:
*
* Invalid type.
*/
-#define XMLSEC_ERRORS_R_INVALID_TYPE 14
+#define XMLSEC_ERRORS_R_INVALID_TYPE 14
/**
* XMLSEC_ERRORS_R_INVALID_OPERATION:
*
* Invalid operation.
*/
-#define XMLSEC_ERRORS_R_INVALID_OPERATION 15
+#define XMLSEC_ERRORS_R_INVALID_OPERATION 15
/**
* XMLSEC_ERRORS_R_INVALID_STATUS:
*
* Invalid status.
*/
-#define XMLSEC_ERRORS_R_INVALID_STATUS 16
+#define XMLSEC_ERRORS_R_INVALID_STATUS 16
/**
* XMLSEC_ERRORS_R_INVALID_FORMAT:
*
* Invalid format.
*/
-#define XMLSEC_ERRORS_R_INVALID_FORMAT 17
+#define XMLSEC_ERRORS_R_INVALID_FORMAT 17
/**
* XMLSEC_ERRORS_R_DATA_NOT_MATCH:
*
* The data do not match our expectation.
*/
-#define XMLSEC_ERRORS_R_DATA_NOT_MATCH 18
+#define XMLSEC_ERRORS_R_DATA_NOT_MATCH 18
/**
* XMLSEC_ERRORS_R_INVALID_NODE:
*
* Invalid node (error subject is the node name).
*/
-#define XMLSEC_ERRORS_R_INVALID_NODE 21
+#define XMLSEC_ERRORS_R_INVALID_NODE 21
/**
* XMLSEC_ERRORS_R_INVALID_NODE_CONTENT:
*
* Invalid node content (error subject is the node name).
*/
-#define XMLSEC_ERRORS_R_INVALID_NODE_CONTENT 22
+#define XMLSEC_ERRORS_R_INVALID_NODE_CONTENT 22
/**
* XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE:
*
* Invalid node attribute (error subject is the node name).
*/
-#define XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE 23
+#define XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE 23
/**
* XMLSEC_ERRORS_R_MISSING_NODE_ATTRIBUTE:
*
* Missing node attribute (error subject is the node name).
*/
-#define XMLSEC_ERRORS_R_MISSING_NODE_ATTRIBUTE 25
+#define XMLSEC_ERRORS_R_MISSING_NODE_ATTRIBUTE 25
/**
* XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT:
*
* Node already present,
*/
-#define XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT 26
+#define XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT 26
/**
* XMLSEC_ERRORS_R_UNEXPECTED_NODE:
*
* Unexpected node (error subject is the node name).
*/
-#define XMLSEC_ERRORS_R_UNEXPECTED_NODE 27
+#define XMLSEC_ERRORS_R_UNEXPECTED_NODE 27
/**
* XMLSEC_ERRORS_R_NODE_NOT_FOUND:
*
* Node not found (error subject is the required node name).
*/
-#define XMLSEC_ERRORS_R_NODE_NOT_FOUND 28
+#define XMLSEC_ERRORS_R_NODE_NOT_FOUND 28
/**
* XMLSEC_ERRORS_R_INVALID_TRANSFORM:
*
* This transform is invlaid here.
*/
-#define XMLSEC_ERRORS_R_INVALID_TRANSFORM 31
+#define XMLSEC_ERRORS_R_INVALID_TRANSFORM 31
/**
* XMLSEC_ERRORS_R_INVALID_TRANSFORM_KEY:
*
* Key is invalid for this transform.
*/
-#define XMLSEC_ERRORS_R_INVALID_TRANSFORM_KEY 32
+#define XMLSEC_ERRORS_R_INVALID_TRANSFORM_KEY 32
/**
* XMLSEC_ERRORS_R_INVALID_URI_TYPE:
*
* Invalid URI type.
*/
-#define XMLSEC_ERRORS_R_INVALID_URI_TYPE 33
+#define XMLSEC_ERRORS_R_INVALID_URI_TYPE 33
/**
* XMLSEC_ERRORS_R_TRANSFORM_SAME_DOCUMENT_REQUIRED:
*
* The transform requires the input document to be the same as context.
*/
-#define XMLSEC_ERRORS_R_TRANSFORM_SAME_DOCUMENT_REQUIRED 34
+#define XMLSEC_ERRORS_R_TRANSFORM_SAME_DOCUMENT_REQUIRED 34
/**
* XMLSEC_ERRORS_R_TRANSFORM_DISABLED:
*
* The transform is disabled.
*/
-#define XMLSEC_ERRORS_R_TRANSFORM_DISABLED 35
+#define XMLSEC_ERRORS_R_TRANSFORM_DISABLED 35
/**
* XMLSEC_ERRORS_R_INVALID_KEY_DATA:
*
* Key data is invalid.
*/
-#define XMLSEC_ERRORS_R_INVALID_KEY_DATA 41
+#define XMLSEC_ERRORS_R_INVALID_KEY_DATA 41
/**
* XMLSEC_ERRORS_R_KEY_DATA_NOT_FOUND:
*
* Data is not found (error subject is the data name).
*/
-#define XMLSEC_ERRORS_R_KEY_DATA_NOT_FOUND 42
+#define XMLSEC_ERRORS_R_KEY_DATA_NOT_FOUND 42
/**
* XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST:
*
* The key data is already exist.
*/
-#define XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST 43
+#define XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST 43
/**
* XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE:
*
* Invalid key size.
*/
-#define XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE 44
+#define XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE 44
/**
* XMLSEC_ERRORS_R_KEY_NOT_FOUND:
*
* Key not found.
*/
-#define XMLSEC_ERRORS_R_KEY_NOT_FOUND 45
+#define XMLSEC_ERRORS_R_KEY_NOT_FOUND 45
/**
* XMLSEC_ERRORS_R_KEYDATA_DISABLED:
*
* The key data type disabled.
*/
-#define XMLSEC_ERRORS_R_KEYDATA_DISABLED 46
+#define XMLSEC_ERRORS_R_KEYDATA_DISABLED 46
/**
* XMLSEC_ERRORS_R_MAX_RETRIEVALS_LEVEL:
*
* Max allowed retrievals level reached.
*/
-#define XMLSEC_ERRORS_R_MAX_RETRIEVALS_LEVEL 51
+#define XMLSEC_ERRORS_R_MAX_RETRIEVALS_LEVEL 51
/**
* XMLSEC_ERRORS_R_MAX_RETRIEVAL_TYPE_MISMATCH:
@@ -280,84 +280,84 @@ extern "C" {
* The retrieved key data type does not match the one specified
* in the <dsig:RetrievalMethod/> node.
*/
-#define XMLSEC_ERRORS_R_MAX_RETRIEVAL_TYPE_MISMATCH 52
+#define XMLSEC_ERRORS_R_MAX_RETRIEVAL_TYPE_MISMATCH 52
/**
* XMLSEC_ERRORS_R_MAX_ENCKEY_LEVEL:
*
* Max EncryptedKey level reached.
*/
-#define XMLSEC_ERRORS_R_MAX_ENCKEY_LEVEL 61
+#define XMLSEC_ERRORS_R_MAX_ENCKEY_LEVEL 61
/**
* XMLSEC_ERRORS_R_CERT_VERIFY_FAILED:
*
* Certificate verification failed.
*/
-#define XMLSEC_ERRORS_R_CERT_VERIFY_FAILED 71
+#define XMLSEC_ERRORS_R_CERT_VERIFY_FAILED 71
/**
* XMLSEC_ERRORS_R_CERT_NOT_FOUND:
*
* Requested certificate is not found.
*/
-#define XMLSEC_ERRORS_R_CERT_NOT_FOUND 72
+#define XMLSEC_ERRORS_R_CERT_NOT_FOUND 72
/**
* XMLSEC_ERRORS_R_CERT_REVOKED:
*
* The certificate is revoked.
*/
-#define XMLSEC_ERRORS_R_CERT_REVOKED 73
+#define XMLSEC_ERRORS_R_CERT_REVOKED 73
/**
* XMLSEC_ERRORS_R_CERT_ISSUER_FAILED:
*
* Failed to get certificate issuer.
*/
-#define XMLSEC_ERRORS_R_CERT_ISSUER_FAILED 74
+#define XMLSEC_ERRORS_R_CERT_ISSUER_FAILED 74
/**
* XMLSEC_ERRORS_R_CERT_NOT_YET_VALID:
*
* "Not valid before" verification failed.
*/
-#define XMLSEC_ERRORS_R_CERT_NOT_YET_VALID 75
+#define XMLSEC_ERRORS_R_CERT_NOT_YET_VALID 75
/**
* XMLSEC_ERRORS_R_CERT_HAS_EXPIRED:
*
* "Not valid after" verification failed.
*/
-#define XMLSEC_ERRORS_R_CERT_HAS_EXPIRED 76
+#define XMLSEC_ERRORS_R_CERT_HAS_EXPIRED 76
/**
* XMLSEC_ERRORS_R_DSIG_NO_REFERENCES:
*
* The <dsig:Reference> nodes not found.
*/
-#define XMLSEC_ERRORS_R_DSIG_NO_REFERENCES 81
+#define XMLSEC_ERRORS_R_DSIG_NO_REFERENCES 81
/**
* XMLSEC_ERRORS_R_DSIG_INVALID_REFERENCE:
*
* The <dsig:Reference> validation failed.
*/
-#define XMLSEC_ERRORS_R_DSIG_INVALID_REFERENCE 82
+#define XMLSEC_ERRORS_R_DSIG_INVALID_REFERENCE 82
/**
* XMLSEC_ERRORS_R_ASSERTION:
*
* Invalid assertion.
*/
-#define XMLSEC_ERRORS_R_ASSERTION 100
+#define XMLSEC_ERRORS_R_ASSERTION 100
/**
* XMLSEC_ERRORS_MAX_NUMBER:
*
* The maximum xmlsec errors number.
*/
-#define XMLSEC_ERRORS_MAX_NUMBER 256
+#define XMLSEC_ERRORS_MAX_NUMBER 256
@@ -368,40 +368,40 @@ extern "C" {
*******************************************************************/
/**
* xmlSecErrorsCallback:
- * @file: the error location file name (__FILE__ macro).
- * @line: the error location line number (__LINE__ macro).
- * @func: the error location function name (__FUNCTION__ macro).
- * @errorObject: the error specific error object
- * @errorSubject: the error specific error subject.
- * @reason: the error code.
- * @msg: the additional error message.
+ * @file: the error location file name (__FILE__ macro).
+ * @line: the error location line number (__LINE__ macro).
+ * @func: the error location function name (__FUNCTION__ macro).
+ * @errorObject: the error specific error object
+ * @errorSubject: the error specific error subject.
+ * @reason: the error code.
+ * @msg: the additional error message.
*
* The errors reporting callback function.
*/
-typedef void (*xmlSecErrorsCallback) (const char* file,
- int line,
- const char* func,
- const char* errorObject,
- const char* errorSubject,
- int reason,
- const char* msg);
+typedef void (*xmlSecErrorsCallback) (const char* file,
+ int line,
+ const char* func,
+ const char* errorObject,
+ const char* errorSubject,
+ int reason,
+ const char* msg);
-XMLSEC_EXPORT void xmlSecErrorsInit (void);
-XMLSEC_EXPORT void xmlSecErrorsShutdown (void);
-XMLSEC_EXPORT void xmlSecErrorsSetCallback (xmlSecErrorsCallback callback);
-XMLSEC_EXPORT void xmlSecErrorsDefaultCallback (const char* file,
- int line,
- const char* func,
- const char* errorObject,
- const char* errorSubject,
- int reason,
- const char* msg);
-XMLSEC_EXPORT void xmlSecErrorsDefaultCallbackEnableOutput
- (int enabled);
+XMLSEC_EXPORT void xmlSecErrorsInit (void);
+XMLSEC_EXPORT void xmlSecErrorsShutdown (void);
+XMLSEC_EXPORT void xmlSecErrorsSetCallback (xmlSecErrorsCallback callback);
+XMLSEC_EXPORT void xmlSecErrorsDefaultCallback (const char* file,
+ int line,
+ const char* func,
+ const char* errorObject,
+ const char* errorSubject,
+ int reason,
+ const char* msg);
+XMLSEC_EXPORT void xmlSecErrorsDefaultCallbackEnableOutput
+ (int enabled);
-XMLSEC_EXPORT int xmlSecErrorsGetCode (xmlSecSize pos);
-XMLSEC_EXPORT const char* xmlSecErrorsGetMsg (xmlSecSize pos);
+XMLSEC_EXPORT int xmlSecErrorsGetCode (xmlSecSize pos);
+XMLSEC_EXPORT const char* xmlSecErrorsGetMsg (xmlSecSize pos);
@@ -421,39 +421,39 @@ XMLSEC_EXPORT const char* xmlSecErrorsGetMsg (xmlSecSize pos);
* The macro that specifies the location (file, line and function)
* for the xmlSecError() function.
*/
-#define XMLSEC_ERRORS_HERE __FILE__,__LINE__,__XMLSEC_FUNCTION__
+#define XMLSEC_ERRORS_HERE __FILE__,__LINE__,__XMLSEC_FUNCTION__
#ifdef __GNUC__
-#define XMLSEC_ERRORS_PRINTF_ATTRIBUTE __attribute__ ((format (printf, 7, 8)))
+#define XMLSEC_ERRORS_PRINTF_ATTRIBUTE __attribute__ ((format (printf, 7, 8)))
#else /* __GNUC__ */
-#define XMLSEC_ERRORS_PRINTF_ATTRIBUTE
+#define XMLSEC_ERRORS_PRINTF_ATTRIBUTE
#endif /* __GNUC__ */
/**
* xmlSecErrorsSafeString:
- * @str: the string.
+ * @str: the string.
*
* Macro. Returns @str if it is not NULL or pointer to "NULL" otherwise.
*/
#define xmlSecErrorsSafeString(str) \
- (((str) != NULL) ? ((char*)(str)) : (char*)"NULL")
+ (((str) != NULL) ? ((char*)(str)) : (char*)"NULL")
/**
* XMLSEC_ERRORS_NO_MESSAGE:
*
* Empty error message " ".
*/
-#define XMLSEC_ERRORS_NO_MESSAGE " "
+#define XMLSEC_ERRORS_NO_MESSAGE " "
-XMLSEC_EXPORT void xmlSecError (const char* file,
- int line,
- const char* func,
- const char* errorObject,
- const char* errorSubject,
- int reason,
- const char* msg, ...) XMLSEC_ERRORS_PRINTF_ATTRIBUTE;
-
-
+XMLSEC_EXPORT void xmlSecError (const char* file,
+ int line,
+ const char* func,
+ const char* errorObject,
+ const char* errorSubject,
+ int reason,
+ const char* msg, ...) XMLSEC_ERRORS_PRINTF_ATTRIBUTE;
+
+
/**********************************************************************
*
@@ -467,14 +467,14 @@ XMLSEC_EXPORT void xmlSecError (const char* file,
* Macro. Verifies that @p is true and calls return() otherwise.
*/
#define xmlSecAssert( p ) \
- if(!( p ) ) { \
- xmlSecError(XMLSEC_ERRORS_HERE, \
- NULL, \
- #p, \
- XMLSEC_ERRORS_R_ASSERTION, \
- XMLSEC_ERRORS_NO_MESSAGE); \
- return; \
- }
+ if(!( p ) ) { \
+ xmlSecError(XMLSEC_ERRORS_HERE, \
+ NULL, \
+ #p, \
+ XMLSEC_ERRORS_R_ASSERTION, \
+ XMLSEC_ERRORS_NO_MESSAGE); \
+ return; \
+ }
/**
* xmlSecAssert2:
@@ -484,14 +484,14 @@ XMLSEC_EXPORT void xmlSecError (const char* file,
* Macro. Verifies that @p is true and calls return(@ret) otherwise.
*/
#define xmlSecAssert2( p, ret ) \
- if(!( p ) ) { \
- xmlSecError(XMLSEC_ERRORS_HERE, \
- NULL, \
- #p, \
- XMLSEC_ERRORS_R_ASSERTION, \
- XMLSEC_ERRORS_NO_MESSAGE); \
- return(ret); \
- }
+ if(!( p ) ) { \
+ xmlSecError(XMLSEC_ERRORS_HERE, \
+ NULL, \
+ #p, \
+ XMLSEC_ERRORS_R_ASSERTION, \
+ XMLSEC_ERRORS_NO_MESSAGE); \
+ return(ret); \
+ }
diff --git a/include/xmlsec/gnutls/app.h b/include/xmlsec/gnutls/app.h
index 50ee97d..ede418c 100644
--- a/include/xmlsec/gnutls/app.h
+++ b/include/xmlsec/gnutls/app.h
@@ -21,66 +21,66 @@ extern "C" {
/**
* Init/shutdown
*/
-XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSAppInit (const char* config);
-XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSAppShutdown (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSAppInit (const char* config);
+XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSAppShutdown (void);
/**
* Keys Manager
*/
-XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSAppDefaultKeysMngrInit (xmlSecKeysMngrPtr mngr);
-XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSAppDefaultKeysMngrAdoptKey (xmlSecKeysMngrPtr mngr,
- xmlSecKeyPtr key);
-XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSAppDefaultKeysMngrLoad (xmlSecKeysMngrPtr mngr,
- const char* uri);
-XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSAppDefaultKeysMngrSave (xmlSecKeysMngrPtr mngr,
- const char* filename,
- xmlSecKeyDataType type);
+XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSAppDefaultKeysMngrInit (xmlSecKeysMngrPtr mngr);
+XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSAppDefaultKeysMngrAdoptKey (xmlSecKeysMngrPtr mngr,
+ xmlSecKeyPtr key);
+XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSAppDefaultKeysMngrLoad (xmlSecKeysMngrPtr mngr,
+ const char* uri);
+XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSAppDefaultKeysMngrSave (xmlSecKeysMngrPtr mngr,
+ const char* filename,
+ xmlSecKeyDataType type);
#ifndef XMLSEC_NO_X509
-XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSAppKeysMngrCertLoad (xmlSecKeysMngrPtr mngr,
- const char *filename,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type);
-XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSAppKeysMngrCertLoadMemory (xmlSecKeysMngrPtr mngr,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type);
+XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSAppKeysMngrCertLoad (xmlSecKeysMngrPtr mngr,
+ const char *filename,
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type);
+XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSAppKeysMngrCertLoadMemory (xmlSecKeysMngrPtr mngr,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type);
#endif /* XMLSEC_NO_X509 */
/**
* Keys
*/
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecGnuTLSAppKeyLoad (const char *filename,
- xmlSecKeyDataFormat format,
- const char *pwd,
- void *pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecGnuTLSAppKeyLoadMemory (const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecGnuTLSAppKeyLoad (const char *filename,
+ xmlSecKeyDataFormat format,
+ const char *pwd,
+ void *pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecGnuTLSAppKeyLoadMemory (const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format,
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
#ifndef XMLSEC_NO_X509
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecGnuTLSAppPkcs12Load (const char *filename,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecGnuTLSAppPkcs12LoadMemory (const xmlSecByte* data,
- xmlSecSize dataSize,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSAppKeyCertLoad (xmlSecKeyPtr key,
- const char* filename,
- xmlSecKeyDataFormat format);
-XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSAppKeyCertLoadMemory (xmlSecKeyPtr key,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecGnuTLSAppPkcs12Load (const char *filename,
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecGnuTLSAppPkcs12LoadMemory (const xmlSecByte* data,
+ xmlSecSize dataSize,
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSAppKeyCertLoad (xmlSecKeyPtr key,
+ const char* filename,
+ xmlSecKeyDataFormat format);
+XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSAppKeyCertLoadMemory (xmlSecKeyPtr key,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format);
#endif /* XMLSEC_NO_X509 */
-XMLSEC_CRYPTO_EXPORT void* xmlSecGnuTLSAppGetDefaultPwdCallback (void);
+XMLSEC_CRYPTO_EXPORT void* xmlSecGnuTLSAppGetDefaultPwdCallback (void);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/gnutls/crypto.h b/include/xmlsec/gnutls/crypto.h
index 7570831..125c8d9 100644
--- a/include/xmlsec/gnutls/crypto.h
+++ b/include/xmlsec/gnutls/crypto.h
@@ -18,17 +18,17 @@ extern "C" {
#include <xmlsec/transforms.h>
#include <xmlsec/dl.h>
-XMLSEC_CRYPTO_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoGetFunctions_gnutls(void);
+XMLSEC_CRYPTO_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoGetFunctions_gnutls(void);
/**
* Init shutdown
*/
-XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSInit (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSShutdown (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSInit (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSShutdown (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSKeysMngrInit (xmlSecKeysMngrPtr mngr);
-XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSGenerateRandom (xmlSecBufferPtr buffer,
- xmlSecSize size);
+XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSKeysMngrInit (xmlSecKeysMngrPtr mngr);
+XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSGenerateRandom (xmlSecBufferPtr buffer,
+ xmlSecSize size);
/********************************************************************
@@ -43,19 +43,19 @@ XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSGenerateRandom (xmlSecBufferPtr buffer,
* The AES key data klass.
*/
#define xmlSecGnuTLSKeyDataAesId \
- xmlSecGnuTLSKeyDataAesGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecGnuTLSKeyDataAesGetKlass (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSKeyDataAesSet (xmlSecKeyDataPtr data,
- const xmlSecByte* buf,
- xmlSecSize bufSize);
+ xmlSecGnuTLSKeyDataAesGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecGnuTLSKeyDataAesGetKlass (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSKeyDataAesSet (xmlSecKeyDataPtr data,
+ const xmlSecByte* buf,
+ xmlSecSize bufSize);
/**
* xmlSecGnuTLSTransformAes128CbcId:
*
* The AES128 CBC cipher transform klass.
*/
#define xmlSecGnuTLSTransformAes128CbcId \
- xmlSecGnuTLSTransformAes128CbcGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformAes128CbcGetKlass(void);
+ xmlSecGnuTLSTransformAes128CbcGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformAes128CbcGetKlass(void);
/**
* xmlSecGnuTLSTransformAes192CbcId:
@@ -63,8 +63,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformAes128CbcGetKlass(vo
* The AES192 CBC cipher transform klass.
*/
#define xmlSecGnuTLSTransformAes192CbcId \
- xmlSecGnuTLSTransformAes192CbcGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformAes192CbcGetKlass(void);
+ xmlSecGnuTLSTransformAes192CbcGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformAes192CbcGetKlass(void);
/**
* xmlSecGnuTLSTransformAes256CbcId:
@@ -72,8 +72,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformAes192CbcGetKlass(vo
* The AES256 CBC cipher transform klass.
*/
#define xmlSecGnuTLSTransformAes256CbcId \
- xmlSecGnuTLSTransformAes256CbcGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformAes256CbcGetKlass(void);
+ xmlSecGnuTLSTransformAes256CbcGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformAes256CbcGetKlass(void);
#endif /* XMLSEC_NO_AES */
@@ -89,11 +89,11 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformAes256CbcGetKlass(vo
* The DES key data klass.
*/
#define xmlSecGnuTLSKeyDataDesId \
- xmlSecGnuTLSKeyDataDesGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecGnuTLSKeyDataDesGetKlass (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSKeyDataDesSet (xmlSecKeyDataPtr data,
- const xmlSecByte* buf,
- xmlSecSize bufSize);
+ xmlSecGnuTLSKeyDataDesGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecGnuTLSKeyDataDesGetKlass (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSKeyDataDesSet (xmlSecKeyDataPtr data,
+ const xmlSecByte* buf,
+ xmlSecSize bufSize);
/**
* xmlSecGnuTLSTransformDes3CbcId:
@@ -101,7 +101,7 @@ XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSKeyDataDesSet (xmlSecKeyDataPtr data,
* The DES3 CBC cipher transform klass.
*/
#define xmlSecGnuTLSTransformDes3CbcId \
- xmlSecGnuTLSTransformDes3CbcGetKlass()
+ xmlSecGnuTLSTransformDes3CbcGetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformDes3CbcGetKlass(void);
#endif /* XMLSEC_NO_DES */
@@ -123,18 +123,18 @@ XMLSEC_CRYPTO_EXPORT void xmlSecGnuTLSHmacSetMinOutputLength(int mi
* The HMAC key klass.
*/
#define xmlSecGnuTLSKeyDataHmacId \
- xmlSecGnuTLSKeyDataHmacGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecGnuTLSKeyDataHmacGetKlass (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSKeyDataHmacSet (xmlSecKeyDataPtr data,
- const xmlSecByte* buf,
- xmlSecSize bufSize);
+ xmlSecGnuTLSKeyDataHmacGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecGnuTLSKeyDataHmacGetKlass (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecGnuTLSKeyDataHmacSet (xmlSecKeyDataPtr data,
+ const xmlSecByte* buf,
+ xmlSecSize bufSize);
/**
* xmlSecGnuTLSTransformHmacMd5Id:
*
* The HMAC with MD5 signature transform klass.
*/
#define xmlSecGnuTLSTransformHmacMd5Id \
- xmlSecGnuTLSTransformHmacMd5GetKlass()
+ xmlSecGnuTLSTransformHmacMd5GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformHmacMd5GetKlass(void);
#endif /* XMLSEC_NO_HMAC */
@@ -144,7 +144,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformHmacMd5GetKlass(void
* The HMAC with RipeMD160 signature transform klass.
*/
#define xmlSecGnuTLSTransformHmacRipemd160Id \
- xmlSecGnuTLSTransformHmacRipemd160GetKlass()
+ xmlSecGnuTLSTransformHmacRipemd160GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformHmacRipemd160GetKlass(void);
/**
@@ -153,7 +153,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformHmacRipemd160GetKlas
* The HMAC with SHA1 signature transform klass.
*/
#define xmlSecGnuTLSTransformHmacSha1Id \
- xmlSecGnuTLSTransformHmacSha1GetKlass()
+ xmlSecGnuTLSTransformHmacSha1GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformHmacSha1GetKlass(void);
@@ -170,7 +170,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformHmacSha1GetKlass(voi
* The SHA1 digest transform klass.
*/
#define xmlSecGnuTLSTransformSha1Id \
- xmlSecGnuTLSTransformSha1GetKlass()
+ xmlSecGnuTLSTransformSha1GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecGnuTLSTransformSha1GetKlass(void);
#endif /* XMLSEC_NO_SHA1 */
diff --git a/include/xmlsec/gnutls/symbols.h b/include/xmlsec/gnutls/symbols.h
index 0fcd861..d98d134 100644
--- a/include/xmlsec/gnutls/symbols.h
+++ b/include/xmlsec/gnutls/symbols.h
@@ -25,66 +25,66 @@ extern "C" {
/**
* Crypto Init/shutdown
*/
-#define xmlSecCryptoInit xmlSecGnuTLSInit
-#define xmlSecCryptoShutdown xmlSecGnuTLSShutdown
+#define xmlSecCryptoInit xmlSecGnuTLSInit
+#define xmlSecCryptoShutdown xmlSecGnuTLSShutdown
-#define xmlSecCryptoKeysMngrInit xmlSecGnuTLSKeysMngrInit
+#define xmlSecCryptoKeysMngrInit xmlSecGnuTLSKeysMngrInit
/**
* Key data ids
*/
-#define xmlSecKeyDataAesId xmlSecGnuTLSKeyDataAesId
-#define xmlSecKeyDataDesId xmlSecGnuTLSKeyDataDesId
-#define xmlSecKeyDataDsaId xmlSecGnuTLSKeyDataDsaId
-#define xmlSecKeyDataHmacId xmlSecGnuTLSKeyDataHmacId
-#define xmlSecKeyDataRsaId xmlSecGnuTLSKeyDataRsaId
-#define xmlSecKeyDataX509Id xmlSecGnuTLSKeyDataX509Id
-#define xmlSecKeyDataRawX509CertId xmlSecGnuTLSKeyDataRawX509CertId
+#define xmlSecKeyDataAesId xmlSecGnuTLSKeyDataAesId
+#define xmlSecKeyDataDesId xmlSecGnuTLSKeyDataDesId
+#define xmlSecKeyDataDsaId xmlSecGnuTLSKeyDataDsaId
+#define xmlSecKeyDataHmacId xmlSecGnuTLSKeyDataHmacId
+#define xmlSecKeyDataRsaId xmlSecGnuTLSKeyDataRsaId
+#define xmlSecKeyDataX509Id xmlSecGnuTLSKeyDataX509Id
+#define xmlSecKeyDataRawX509CertId xmlSecGnuTLSKeyDataRawX509CertId
/**
* Key data store ids
*/
-#define xmlSecX509StoreId xmlSecGnuTLSX509StoreId
+#define xmlSecX509StoreId xmlSecGnuTLSX509StoreId
/**
* Crypto transforms ids
*/
-#define xmlSecTransformAes128CbcId xmlSecGnuTLSTransformAes128CbcId
-#define xmlSecTransformAes192CbcId xmlSecGnuTLSTransformAes192CbcId
-#define xmlSecTransformAes256CbcId xmlSecGnuTLSTransformAes256CbcId
-#define xmlSecTransformKWAes128Id xmlSecGnuTLSTransformKWAes128Id
-#define xmlSecTransformKWAes192Id xmlSecGnuTLSTransformKWAes192Id
-#define xmlSecTransformKWAes256Id xmlSecGnuTLSTransformKWAes256Id
-#define xmlSecTransformDes3CbcId xmlSecGnuTLSTransformDes3CbcId
-#define xmlSecTransformKWDes3Id xmlSecGnuTLSTransformKWDes3Id
-#define xmlSecTransformDsaSha1Id xmlSecGnuTLSTransformDsaSha1Id
-#define xmlSecTransformHmacMd5Id xmlSecGnuTLSTransformHmacMd5Id
-#define xmlSecTransformHmacRipemd160Id xmlSecGnuTLSTransformHmacRipemd160Id
-#define xmlSecTransformHmacSha1Id xmlSecGnuTLSTransformHmacSha1Id
-#define xmlSecTransformRipemd160Id xmlSecGnuTLSTransformRipemd160Id
-#define xmlSecTransformRsaSha1Id xmlSecGnuTLSTransformRsaSha1Id
-#define xmlSecTransformRsaPkcs1Id xmlSecGnuTLSTransformRsaPkcs1Id
-#define xmlSecTransformRsaOaepId xmlSecGnuTLSTransformRsaOaepId
-#define xmlSecTransformSha1Id xmlSecGnuTLSTransformSha1Id
+#define xmlSecTransformAes128CbcId xmlSecGnuTLSTransformAes128CbcId
+#define xmlSecTransformAes192CbcId xmlSecGnuTLSTransformAes192CbcId
+#define xmlSecTransformAes256CbcId xmlSecGnuTLSTransformAes256CbcId
+#define xmlSecTransformKWAes128Id xmlSecGnuTLSTransformKWAes128Id
+#define xmlSecTransformKWAes192Id xmlSecGnuTLSTransformKWAes192Id
+#define xmlSecTransformKWAes256Id xmlSecGnuTLSTransformKWAes256Id
+#define xmlSecTransformDes3CbcId xmlSecGnuTLSTransformDes3CbcId
+#define xmlSecTransformKWDes3Id xmlSecGnuTLSTransformKWDes3Id
+#define xmlSecTransformDsaSha1Id xmlSecGnuTLSTransformDsaSha1Id
+#define xmlSecTransformHmacMd5Id xmlSecGnuTLSTransformHmacMd5Id
+#define xmlSecTransformHmacRipemd160Id xmlSecGnuTLSTransformHmacRipemd160Id
+#define xmlSecTransformHmacSha1Id xmlSecGnuTLSTransformHmacSha1Id
+#define xmlSecTransformRipemd160Id xmlSecGnuTLSTransformRipemd160Id
+#define xmlSecTransformRsaSha1Id xmlSecGnuTLSTransformRsaSha1Id
+#define xmlSecTransformRsaPkcs1Id xmlSecGnuTLSTransformRsaPkcs1Id
+#define xmlSecTransformRsaOaepId xmlSecGnuTLSTransformRsaOaepId
+#define xmlSecTransformSha1Id xmlSecGnuTLSTransformSha1Id
/**
* High level routines form xmlsec command line utility
*/
-#define xmlSecCryptoAppInit xmlSecGnuTLSAppInit
-#define xmlSecCryptoAppShutdown xmlSecGnuTLSAppShutdown
-#define xmlSecCryptoAppDefaultKeysMngrInit xmlSecGnuTLSAppDefaultKeysMngrInit
-#define xmlSecCryptoAppDefaultKeysMngrAdoptKey xmlSecGnuTLSAppDefaultKeysMngrAdoptKey
-#define xmlSecCryptoAppDefaultKeysMngrLoad xmlSecGnuTLSAppDefaultKeysMngrLoad
-#define xmlSecCryptoAppDefaultKeysMngrSave xmlSecGnuTLSAppDefaultKeysMngrSave
-#define xmlSecCryptoAppKeysMngrCertLoad xmlSecGnuTLSAppKeysMngrCertLoad
-#define xmlSecCryptoAppKeysMngrCertLoadMemory xmlSecGnuTLSAppKeysMngrCertLoadMemory
-#define xmlSecCryptoAppKeyLoad xmlSecGnuTLSAppKeyLoad
-#define xmlSecCryptoAppPkcs12Load xmlSecGnuTLSAppPkcs12Load
-#define xmlSecCryptoAppKeyCertLoad xmlSecGnuTLSAppKeyCertLoad
-#define xmlSecCryptoAppKeyLoadMemory xmlSecGnuTLSAppKeyLoadMemory
-#define xmlSecCryptoAppPkcs12LoadMemory xmlSecGnuTLSAppPkcs12LoadMemory
-#define xmlSecCryptoAppKeyCertLoadMemory xmlSecGnuTLSAppKeyCertLoadMemory
-#define xmlSecCryptoAppGetDefaultPwdCallback xmlSecGnuTLSAppGetDefaultPwdCallback
+#define xmlSecCryptoAppInit xmlSecGnuTLSAppInit
+#define xmlSecCryptoAppShutdown xmlSecGnuTLSAppShutdown
+#define xmlSecCryptoAppDefaultKeysMngrInit xmlSecGnuTLSAppDefaultKeysMngrInit
+#define xmlSecCryptoAppDefaultKeysMngrAdoptKey xmlSecGnuTLSAppDefaultKeysMngrAdoptKey
+#define xmlSecCryptoAppDefaultKeysMngrLoad xmlSecGnuTLSAppDefaultKeysMngrLoad
+#define xmlSecCryptoAppDefaultKeysMngrSave xmlSecGnuTLSAppDefaultKeysMngrSave
+#define xmlSecCryptoAppKeysMngrCertLoad xmlSecGnuTLSAppKeysMngrCertLoad
+#define xmlSecCryptoAppKeysMngrCertLoadMemory xmlSecGnuTLSAppKeysMngrCertLoadMemory
+#define xmlSecCryptoAppKeyLoad xmlSecGnuTLSAppKeyLoad
+#define xmlSecCryptoAppPkcs12Load xmlSecGnuTLSAppPkcs12Load
+#define xmlSecCryptoAppKeyCertLoad xmlSecGnuTLSAppKeyCertLoad
+#define xmlSecCryptoAppKeyLoadMemory xmlSecGnuTLSAppKeyLoadMemory
+#define xmlSecCryptoAppPkcs12LoadMemory xmlSecGnuTLSAppPkcs12LoadMemory
+#define xmlSecCryptoAppKeyCertLoadMemory xmlSecGnuTLSAppKeyCertLoadMemory
+#define xmlSecCryptoAppGetDefaultPwdCallback xmlSecGnuTLSAppGetDefaultPwdCallback
#endif /* XMLSEC_CRYPTO_GNUTLS */
diff --git a/include/xmlsec/io.h b/include/xmlsec/io.h
index 9267573..58ff707 100644
--- a/include/xmlsec/io.h
+++ b/include/xmlsec/io.h
@@ -21,14 +21,14 @@ extern "C" {
#include <xmlsec/xmlsec.h>
#include <xmlsec/transforms.h>
-XMLSEC_EXPORT int xmlSecIOInit (void);
-XMLSEC_EXPORT void xmlSecIOShutdown (void);
-XMLSEC_EXPORT void xmlSecIOCleanupCallbacks (void);
-XMLSEC_EXPORT int xmlSecIORegisterDefaultCallbacks (void);
-XMLSEC_EXPORT int xmlSecIORegisterCallbacks (xmlInputMatchCallback matchFunc,
- xmlInputOpenCallback openFunc,
- xmlInputReadCallback readFunc,
- xmlInputCloseCallback closeFunc);
+XMLSEC_EXPORT int xmlSecIOInit (void);
+XMLSEC_EXPORT void xmlSecIOShutdown (void);
+XMLSEC_EXPORT void xmlSecIOCleanupCallbacks (void);
+XMLSEC_EXPORT int xmlSecIORegisterDefaultCallbacks (void);
+XMLSEC_EXPORT int xmlSecIORegisterCallbacks (xmlInputMatchCallback matchFunc,
+ xmlInputOpenCallback openFunc,
+ xmlInputReadCallback readFunc,
+ xmlInputCloseCallback closeFunc);
/********************************************************************
*
@@ -41,10 +41,10 @@ XMLSEC_EXPORT int xmlSecIORegisterCallbacks (xmlInputMatchCallback matchFu
* The Input URI transform id.
*/
#define xmlSecTransformInputURIId \
- xmlSecTransformInputURIGetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInputURIGetKlass (void);
-XMLSEC_EXPORT int xmlSecTransformInputURIOpen (xmlSecTransformPtr transform,
- const xmlChar* uri);
+ xmlSecTransformInputURIGetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInputURIGetKlass (void);
+XMLSEC_EXPORT int xmlSecTransformInputURIOpen (xmlSecTransformPtr transform,
+ const xmlChar* uri);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/keyinfo.h b/include/xmlsec/keyinfo.h
index dbea0e5..dd2044a 100644
--- a/include/xmlsec/keyinfo.h
+++ b/include/xmlsec/keyinfo.h
@@ -29,12 +29,12 @@ extern "C" {
/**
* Hi level functions
*/
-XMLSEC_EXPORT int xmlSecKeyInfoNodeRead (xmlNodePtr keyInfoNode,
- xmlSecKeyPtr key,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-XMLSEC_EXPORT int xmlSecKeyInfoNodeWrite (xmlNodePtr keyInfoNode,
- xmlSecKeyPtr key,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+XMLSEC_EXPORT int xmlSecKeyInfoNodeRead (xmlNodePtr keyInfoNode,
+ xmlSecKeyPtr key,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+XMLSEC_EXPORT int xmlSecKeyInfoNodeWrite (xmlNodePtr keyInfoNode,
+ xmlSecKeyPtr key,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
/**
* xmlSecKeyInfoMode:
@@ -54,7 +54,7 @@ typedef enum {
* If flag is set then we will continue reading <dsig:KeyInfo />
* element even when key is already found.
*/
-#define XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND 0x00000001
+#define XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND 0x00000001
/**
* XMLSEC_KEYINFO_FLAGS_STOP_ON_UNKNOWN_CHILD:
@@ -62,7 +62,7 @@ typedef enum {
* If flag is set then we abort if an unknown <dsig:KeyInfo />
* child is found.
*/
-#define XMLSEC_KEYINFO_FLAGS_STOP_ON_UNKNOWN_CHILD 0x00000002
+#define XMLSEC_KEYINFO_FLAGS_STOP_ON_UNKNOWN_CHILD 0x00000002
/**
* XMLSEC_KEYINFO_FLAGS_KEYNAME_STOP_ON_UNKNOWN:
@@ -70,7 +70,7 @@ typedef enum {
* If flags is set then we abort if an unknown key name
* (content of <dsig:KeyName /> element) is found.
*/
-#define XMLSEC_KEYINFO_FLAGS_KEYNAME_STOP_ON_UNKNOWN 0x00000004
+#define XMLSEC_KEYINFO_FLAGS_KEYNAME_STOP_ON_UNKNOWN 0x00000004
/**
* XMLSEC_KEYINFO_FLAGS_KEYVALUE_STOP_ON_UNKNOWN_CHILD:
@@ -78,7 +78,7 @@ typedef enum {
* If flags is set then we abort if an unknown <dsig:KeyValue />
* child is found.
*/
-#define XMLSEC_KEYINFO_FLAGS_KEYVALUE_STOP_ON_UNKNOWN_CHILD 0x00000008
+#define XMLSEC_KEYINFO_FLAGS_KEYVALUE_STOP_ON_UNKNOWN_CHILD 0x00000008
/**
* XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_UNKNOWN_HREF:
@@ -86,7 +86,7 @@ typedef enum {
* If flag is set then we abort if an unknown href attribute
* of <dsig:RetrievalMethod /> element is found.
*/
-#define XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_UNKNOWN_HREF 0x00000010
+#define XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_UNKNOWN_HREF 0x00000010
/**
* XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_MISMATCH_HREF:
@@ -94,7 +94,7 @@ typedef enum {
* If flag is set then we abort if an href attribute <dsig:RetrievalMethod />
* element does not match the real key data type.
*/
-#define XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_MISMATCH_HREF 0x00000020
+#define XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_MISMATCH_HREF 0x00000020
/**
* XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CHILD:
@@ -102,7 +102,7 @@ typedef enum {
* If flags is set then we abort if an unknown <dsig:X509Data />
* child is found.
*/
-#define XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CHILD 0x00000100
+#define XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CHILD 0x00000100
/**
* XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS:
@@ -110,7 +110,7 @@ typedef enum {
* If flag is set then we'll load certificates from <dsig:X509Data />
* element without verification.
*/
-#define XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS 0x00000200
+#define XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS 0x00000200
/**
* XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT:
@@ -119,7 +119,7 @@ typedef enum {
* to certificate from <dsig:X509IssuerSerial />, <dsig:X509SKI /> or
* <dsig:X509SubjectName /> elements.
*/
-#define XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT 0x00000400
+#define XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT 0x00000400
/**
* XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_INVALID_CERT:
@@ -127,7 +127,7 @@ typedef enum {
* If the flag is set then we'll stop when <dsig:X509Data /> element
* processing does not return a verified certificate.
*/
-#define XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_INVALID_CERT 0x00000800
+#define XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_INVALID_CERT 0x00000800
/**
* XMLSEC_KEYINFO_FLAGS_ENCKEY_DONT_STOP_ON_FAILED_DECRYPTION:
@@ -143,127 +143,127 @@ typedef enum {
* If the flag is set then we'll stop when we found an empty node.
* Otherwise we just ignore it.
*/
-#define XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE 0x00002000
+#define XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE 0x00002000
/**
* XMLSEC_KEYINFO_FLAGS_X509DATA_SKIP_STRICT_CHECKS:
*
* If the flag is set then we'll skip strict checking of certs and CRLs
*/
-#define XMLSEC_KEYINFO_FLAGS_X509DATA_SKIP_STRICT_CHECKS 0x00004000
+#define XMLSEC_KEYINFO_FLAGS_X509DATA_SKIP_STRICT_CHECKS 0x00004000
-/**
+/**
* xmlSecKeyInfoCtx:
- * @userData: the pointer to user data (xmlsec and xmlsec-crypto
- * never touch this).
- * @flags: the bit mask for flags that control processin.
- * @flags2: reserved for future.
- * @mode: do we read or write <dsig:KeyInfo /> element.
- * @keysMngr: the pointer to current keys manager.
- * @enabledKeyData: the list of enabled @xmlSecKeyDataId (if list is
- * empty then all data ids are enabled).
- * @base64LineSize: the max columns size for base64 encoding.
+ * @userData: the pointer to user data (xmlsec and xmlsec-crypto
+ * never touch this).
+ * @flags: the bit mask for flags that control processin.
+ * @flags2: reserved for future.
+ * @mode: do we read or write <dsig:KeyInfo /> element.
+ * @keysMngr: the pointer to current keys manager.
+ * @enabledKeyData: the list of enabled @xmlSecKeyDataId (if list is
+ * empty then all data ids are enabled).
+ * @base64LineSize: the max columns size for base64 encoding.
* @retrievalMethodCtx: the transforms context for <dsig:RetrievalMethod />
- * element processing.
+ * element processing.
* @maxRetrievalMethodLevel: the max recursion level when processing
- * <dsig:RetrievalMethod /> element; default level is 1
- * (see also @curRetrievalMethodLevel).
- * @encCtx: the encryption context for <dsig:EncryptedKey /> element
- * processing.
+ * <dsig:RetrievalMethod /> element; default level is 1
+ * (see also @curRetrievalMethodLevel).
+ * @encCtx: the encryption context for <dsig:EncryptedKey /> element
+ * processing.
* @maxEncryptedKeyLevel: the max recursion level when processing
- * <enc:EncryptedKey /> element; default level is 1
- * (see @curEncryptedKeyLevel).
+ * <enc:EncryptedKey /> element; default level is 1
+ * (see @curEncryptedKeyLevel).
* @certsVerificationTime: the time to use for X509 certificates verification
- * ("not valid before" and "not valid after" checks);
- * if @certsVerificationTime is equal to 0 (default)
- * then we verify certificates against the system's
- * clock "now".
+ * ("not valid before" and "not valid after" checks);
+ * if @certsVerificationTime is equal to 0 (default)
+ * then we verify certificates against the system's
+ * clock "now".
* @certsVerificationDepth: the max certifications chain length (default is 9).
- * @pgpReserved: reserved for PGP.
+ * @pgpReserved: reserved for PGP.
* @curRetrievalMethodLevel: the current <dsig:RetrievalMethod /> element
- * processing level (see @maxRetrievalMethodLevel).
+ * processing level (see @maxRetrievalMethodLevel).
* @curEncryptedKeyLevel: the current <enc:EncryptedKey /> element
- * processing level (see @maxEncryptedKeyLevel).
- * @keyReq: the current key requirements.
- * @reserved0: reserved for the future.
- * @reserved1: reserved for the future.
+ * processing level (see @maxEncryptedKeyLevel).
+ * @keyReq: the current key requirements.
+ * @reserved0: reserved for the future.
+ * @reserved1: reserved for the future.
*
* The <dsig:KeyInfo /> reading or writing context.
*/
struct _xmlSecKeyInfoCtx {
- void* userData;
- unsigned int flags;
- unsigned int flags2;
- xmlSecKeysMngrPtr keysMngr;
- xmlSecKeyInfoMode mode;
- xmlSecPtrList enabledKeyData;
- int base64LineSize;
+ void* userData;
+ unsigned int flags;
+ unsigned int flags2;
+ xmlSecKeysMngrPtr keysMngr;
+ xmlSecKeyInfoMode mode;
+ xmlSecPtrList enabledKeyData;
+ int base64LineSize;
/* RetrievalMethod */
- xmlSecTransformCtx retrievalMethodCtx;
- int maxRetrievalMethodLevel;
+ xmlSecTransformCtx retrievalMethodCtx;
+ int maxRetrievalMethodLevel;
#ifndef XMLSEC_NO_XMLENC
/* EncryptedKey */
- xmlSecEncCtxPtr encCtx;
- int maxEncryptedKeyLevel;
+ xmlSecEncCtxPtr encCtx;
+ int maxEncryptedKeyLevel;
#endif /* XMLSEC_NO_XMLENC */
-
+
#ifndef XMLSEC_NO_X509
/* x509 certificates */
- time_t certsVerificationTime;
- int certsVerificationDepth;
+ time_t certsVerificationTime;
+ int certsVerificationDepth;
#endif /* XMLSEC_NO_X509 */
/* PGP */
- void* pgpReserved; /* TODO */
+ void* pgpReserved; /* TODO */
/* internal data */
- int curRetrievalMethodLevel;
- int curEncryptedKeyLevel;
- xmlSecKeyReq keyReq;
+ int curRetrievalMethodLevel;
+ int curEncryptedKeyLevel;
+ xmlSecKeyReq keyReq;
/* for the future */
- void* reserved0;
- void* reserved1;
+ void* reserved0;
+ void* reserved1;
};
-XMLSEC_EXPORT xmlSecKeyInfoCtxPtr xmlSecKeyInfoCtxCreate (xmlSecKeysMngrPtr keysMngr);
-XMLSEC_EXPORT void xmlSecKeyInfoCtxDestroy (xmlSecKeyInfoCtxPtr keyInfoCtx);
-XMLSEC_EXPORT int xmlSecKeyInfoCtxInitialize (xmlSecKeyInfoCtxPtr keyInfoCtx,
- xmlSecKeysMngrPtr keysMngr);
-XMLSEC_EXPORT void xmlSecKeyInfoCtxFinalize (xmlSecKeyInfoCtxPtr keyInfoCtx);
-XMLSEC_EXPORT void xmlSecKeyInfoCtxReset (xmlSecKeyInfoCtxPtr keyInfoCtx);
-XMLSEC_EXPORT int xmlSecKeyInfoCtxCopyUserPref (xmlSecKeyInfoCtxPtr dst,
- xmlSecKeyInfoCtxPtr src);
-XMLSEC_EXPORT int xmlSecKeyInfoCtxCreateEncCtx (xmlSecKeyInfoCtxPtr keyInfoCtx);
-XMLSEC_EXPORT void xmlSecKeyInfoCtxDebugDump (xmlSecKeyInfoCtxPtr keyInfoCtx,
- FILE* output);
-XMLSEC_EXPORT void xmlSecKeyInfoCtxDebugXmlDump (xmlSecKeyInfoCtxPtr keyInfoCtx,
- FILE* output);
+XMLSEC_EXPORT xmlSecKeyInfoCtxPtr xmlSecKeyInfoCtxCreate (xmlSecKeysMngrPtr keysMngr);
+XMLSEC_EXPORT void xmlSecKeyInfoCtxDestroy (xmlSecKeyInfoCtxPtr keyInfoCtx);
+XMLSEC_EXPORT int xmlSecKeyInfoCtxInitialize (xmlSecKeyInfoCtxPtr keyInfoCtx,
+ xmlSecKeysMngrPtr keysMngr);
+XMLSEC_EXPORT void xmlSecKeyInfoCtxFinalize (xmlSecKeyInfoCtxPtr keyInfoCtx);
+XMLSEC_EXPORT void xmlSecKeyInfoCtxReset (xmlSecKeyInfoCtxPtr keyInfoCtx);
+XMLSEC_EXPORT int xmlSecKeyInfoCtxCopyUserPref (xmlSecKeyInfoCtxPtr dst,
+ xmlSecKeyInfoCtxPtr src);
+XMLSEC_EXPORT int xmlSecKeyInfoCtxCreateEncCtx (xmlSecKeyInfoCtxPtr keyInfoCtx);
+XMLSEC_EXPORT void xmlSecKeyInfoCtxDebugDump (xmlSecKeyInfoCtxPtr keyInfoCtx,
+ FILE* output);
+XMLSEC_EXPORT void xmlSecKeyInfoCtxDebugXmlDump (xmlSecKeyInfoCtxPtr keyInfoCtx,
+ FILE* output);
/**
* xmlSecKeyDataNameId
*
* The <dsig:KeyName> processing class.
*/
-#define xmlSecKeyDataNameId xmlSecKeyDataNameGetKlass()
-XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataNameGetKlass (void);
+#define xmlSecKeyDataNameId xmlSecKeyDataNameGetKlass()
+XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataNameGetKlass (void);
/**
* xmlSecKeyDataValueId
*
* The <dsig:KeyValue> processing class.
*/
-#define xmlSecKeyDataValueId xmlSecKeyDataValueGetKlass()
-XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataValueGetKlass (void);
+#define xmlSecKeyDataValueId xmlSecKeyDataValueGetKlass()
+XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataValueGetKlass (void);
/**
* xmlSecKeyDataRetrievalMethodId
*
* The <dsig:RetrievalMethod> processing class.
*/
-#define xmlSecKeyDataRetrievalMethodId xmlSecKeyDataRetrievalMethodGetKlass()
-XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataRetrievalMethodGetKlass(void);
+#define xmlSecKeyDataRetrievalMethodId xmlSecKeyDataRetrievalMethodGetKlass()
+XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataRetrievalMethodGetKlass(void);
#ifndef XMLSEC_NO_XMLENC
/**
@@ -271,8 +271,8 @@ XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataRetrievalMethodGetKlass(void);
*
* The <enc:EncryptedKey> processing class.
*/
-#define xmlSecKeyDataEncryptedKeyId xmlSecKeyDataEncryptedKeyGetKlass()
-XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataEncryptedKeyGetKlass(void);
+#define xmlSecKeyDataEncryptedKeyId xmlSecKeyDataEncryptedKeyGetKlass()
+XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataEncryptedKeyGetKlass(void);
#endif /* XMLSEC_NO_XMLENC */
#ifdef __cplusplus
diff --git a/include/xmlsec/keys.h b/include/xmlsec/keys.h
index ba7dcd8..141d01d 100644
--- a/include/xmlsec/keys.h
+++ b/include/xmlsec/keys.h
@@ -27,7 +27,7 @@ extern "C" {
*
* The key usage.
*/
-typedef unsigned int xmlSecKeyUsage;
+typedef unsigned int xmlSecKeyUsage;
/**
* xmlSecKeyUsageSign:
@@ -35,42 +35,42 @@ typedef unsigned int xmlSecKeyUsage;
* Key can be used in any way.
*/
-#define xmlSecKeyUsageSign 0x00000001
+#define xmlSecKeyUsageSign 0x00000001
/**
* xmlSecKeyUsageVerify:
*
* Key for signing.
*/
-#define xmlSecKeyUsageVerify 0x00000002
+#define xmlSecKeyUsageVerify 0x00000002
/**
* xmlSecKeyUsageEncrypt:
*
* Key for signature verification.
*/
-#define xmlSecKeyUsageEncrypt 0x00000004
+#define xmlSecKeyUsageEncrypt 0x00000004
/**
* xmlSecKeyUsageDecrypt:
*
* An encryption key.
*/
-#define xmlSecKeyUsageDecrypt 0x00000008
+#define xmlSecKeyUsageDecrypt 0x00000008
/**
* xmlSecKeyUsageKeyExchange:
*
* The key is used for key exchange.
*/
-#define xmlSecKeyUsageKeyExchange 0x00000010
+#define xmlSecKeyUsageKeyExchange 0x00000010
/**
* xmlSecKeyUsageAny:
*
* A decryption key.
*/
-#define xmlSecKeyUsageAny 0xFFFFFFFF
+#define xmlSecKeyUsageAny 0xFFFFFFFF
/**************************************************************************
@@ -78,30 +78,30 @@ typedef unsigned int xmlSecKeyUsage;
* xmlSecKeyUseWith
*
*************************************************************************/
-typedef struct _xmlSecKeyUseWith xmlSecKeyUseWith, *xmlSecKeyUseWithPtr;
-XMLSEC_EXPORT int xmlSecKeyUseWithInitialize (xmlSecKeyUseWithPtr keyUseWith);
-XMLSEC_EXPORT void xmlSecKeyUseWithFinalize (xmlSecKeyUseWithPtr keyUseWith);
-XMLSEC_EXPORT void xmlSecKeyUseWithReset (xmlSecKeyUseWithPtr keyUseWith);
-XMLSEC_EXPORT int xmlSecKeyUseWithCopy (xmlSecKeyUseWithPtr dst,
- xmlSecKeyUseWithPtr src);
-XMLSEC_EXPORT xmlSecKeyUseWithPtr xmlSecKeyUseWithCreate (const xmlChar* application,
+typedef struct _xmlSecKeyUseWith xmlSecKeyUseWith, *xmlSecKeyUseWithPtr;
+XMLSEC_EXPORT int xmlSecKeyUseWithInitialize (xmlSecKeyUseWithPtr keyUseWith);
+XMLSEC_EXPORT void xmlSecKeyUseWithFinalize (xmlSecKeyUseWithPtr keyUseWith);
+XMLSEC_EXPORT void xmlSecKeyUseWithReset (xmlSecKeyUseWithPtr keyUseWith);
+XMLSEC_EXPORT int xmlSecKeyUseWithCopy (xmlSecKeyUseWithPtr dst,
+ xmlSecKeyUseWithPtr src);
+XMLSEC_EXPORT xmlSecKeyUseWithPtr xmlSecKeyUseWithCreate (const xmlChar* application,
const xmlChar* identifier);
-XMLSEC_EXPORT xmlSecKeyUseWithPtr xmlSecKeyUseWithDuplicate (xmlSecKeyUseWithPtr keyUseWith);
-XMLSEC_EXPORT void xmlSecKeyUseWithDestroy (xmlSecKeyUseWithPtr keyUseWith);
-XMLSEC_EXPORT int xmlSecKeyUseWithSet (xmlSecKeyUseWithPtr keyUseWith,
- const xmlChar* application,
+XMLSEC_EXPORT xmlSecKeyUseWithPtr xmlSecKeyUseWithDuplicate (xmlSecKeyUseWithPtr keyUseWith);
+XMLSEC_EXPORT void xmlSecKeyUseWithDestroy (xmlSecKeyUseWithPtr keyUseWith);
+XMLSEC_EXPORT int xmlSecKeyUseWithSet (xmlSecKeyUseWithPtr keyUseWith,
+ const xmlChar* application,
const xmlChar* identifier);
-XMLSEC_EXPORT void xmlSecKeyUseWithDebugDump (xmlSecKeyUseWithPtr keyUseWith,
- FILE* output);
-XMLSEC_EXPORT void xmlSecKeyUseWithDebugXmlDump (xmlSecKeyUseWithPtr keyUseWith,
- FILE* output);
+XMLSEC_EXPORT void xmlSecKeyUseWithDebugDump (xmlSecKeyUseWithPtr keyUseWith,
+ FILE* output);
+XMLSEC_EXPORT void xmlSecKeyUseWithDebugXmlDump (xmlSecKeyUseWithPtr keyUseWith,
+ FILE* output);
/**
* xmlSecKeyUseWith:
* @application: the application.
* @identifier: the identifier.
- * @reserved1: reserved for future use.
- * @reserved2: reserved for future use.
+ * @reserved1: reserved for future use.
+ * @reserved2: reserved for future use.
*
* Information about application and user of the key.
*/
@@ -118,122 +118,122 @@ struct _xmlSecKeyUseWith {
*
* The keys list klass.
*/
-#define xmlSecKeyUseWithPtrListId xmlSecKeyUseWithPtrListGetKlass()
-XMLSEC_EXPORT xmlSecPtrListId xmlSecKeyUseWithPtrListGetKlass (void);
+#define xmlSecKeyUseWithPtrListId xmlSecKeyUseWithPtrListGetKlass()
+XMLSEC_EXPORT xmlSecPtrListId xmlSecKeyUseWithPtrListGetKlass (void);
/**************************************************************************
*
* xmlSecKeyReq - what key are we looking for?
*
*************************************************************************/
-typedef struct _xmlSecKeyReq xmlSecKeyReq, *xmlSecKeyReqPtr;
+typedef struct _xmlSecKeyReq xmlSecKeyReq, *xmlSecKeyReqPtr;
/**
* xmlSecKeyReq:
- * @keyId: the desired key value klass.
- * @keyType: the desired key type.
- * @keyUsage: the desired key usage.
- * @keyBitsSize: the desired key size (in bits!).
+ * @keyId: the desired key value klass.
+ * @keyType: the desired key type.
+ * @keyUsage: the desired key usage.
+ * @keyBitsSize: the desired key size (in bits!).
* @keyUseWithList: the desired key use with application/identifier information.
- * @reserved1: reserved for future use.
- * @reserved2: reserved for future use.
+ * @reserved1: reserved for future use.
+ * @reserved2: reserved for future use.
*
* The key requirements information.
*/
struct _xmlSecKeyReq {
- xmlSecKeyDataId keyId;
- xmlSecKeyDataType keyType;
- xmlSecKeyUsage keyUsage;
- xmlSecSize keyBitsSize;
+ xmlSecKeyDataId keyId;
+ xmlSecKeyDataType keyType;
+ xmlSecKeyUsage keyUsage;
+ xmlSecSize keyBitsSize;
xmlSecPtrList keyUseWithList;
void* reserved1;
void* reserved2;
};
-XMLSEC_EXPORT int xmlSecKeyReqInitialize (xmlSecKeyReqPtr keyReq);
-XMLSEC_EXPORT void xmlSecKeyReqFinalize (xmlSecKeyReqPtr keyReq);
-XMLSEC_EXPORT void xmlSecKeyReqReset (xmlSecKeyReqPtr keyReq);
-XMLSEC_EXPORT int xmlSecKeyReqCopy (xmlSecKeyReqPtr dst,
- xmlSecKeyReqPtr src);
-XMLSEC_EXPORT int xmlSecKeyReqMatchKey (xmlSecKeyReqPtr keyReq,
- xmlSecKeyPtr key);
-XMLSEC_EXPORT int xmlSecKeyReqMatchKeyValue (xmlSecKeyReqPtr keyReq,
- xmlSecKeyDataPtr value);
-XMLSEC_EXPORT void xmlSecKeyReqDebugDump (xmlSecKeyReqPtr keyReq,
- FILE* output);
-XMLSEC_EXPORT void xmlSecKeyReqDebugXmlDump (xmlSecKeyReqPtr keyReq,
- FILE* output);
+XMLSEC_EXPORT int xmlSecKeyReqInitialize (xmlSecKeyReqPtr keyReq);
+XMLSEC_EXPORT void xmlSecKeyReqFinalize (xmlSecKeyReqPtr keyReq);
+XMLSEC_EXPORT void xmlSecKeyReqReset (xmlSecKeyReqPtr keyReq);
+XMLSEC_EXPORT int xmlSecKeyReqCopy (xmlSecKeyReqPtr dst,
+ xmlSecKeyReqPtr src);
+XMLSEC_EXPORT int xmlSecKeyReqMatchKey (xmlSecKeyReqPtr keyReq,
+ xmlSecKeyPtr key);
+XMLSEC_EXPORT int xmlSecKeyReqMatchKeyValue (xmlSecKeyReqPtr keyReq,
+ xmlSecKeyDataPtr value);
+XMLSEC_EXPORT void xmlSecKeyReqDebugDump (xmlSecKeyReqPtr keyReq,
+ FILE* output);
+XMLSEC_EXPORT void xmlSecKeyReqDebugXmlDump (xmlSecKeyReqPtr keyReq,
+ FILE* output);
/**
* xmlSecKey:
- * @name: the key name.
- * @value: the key value.
- * @dataList: the key data list.
- * @usage: the key usage.
- * @notValidBefore: the start key validity interval.
- * @notValidAfter: the end key validity interval.
+ * @name: the key name.
+ * @value: the key value.
+ * @dataList: the key data list.
+ * @usage: the key usage.
+ * @notValidBefore: the start key validity interval.
+ * @notValidAfter: the end key validity interval.
*
* The key.
*/
struct _xmlSecKey {
- xmlChar* name;
- xmlSecKeyDataPtr value;
- xmlSecPtrListPtr dataList;
- xmlSecKeyUsage usage;
- time_t notValidBefore;
- time_t notValidAfter;
+ xmlChar* name;
+ xmlSecKeyDataPtr value;
+ xmlSecPtrListPtr dataList;
+ xmlSecKeyUsage usage;
+ time_t notValidBefore;
+ time_t notValidAfter;
};
-XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyCreate (void);
-XMLSEC_EXPORT void xmlSecKeyDestroy (xmlSecKeyPtr key);
-XMLSEC_EXPORT void xmlSecKeyEmpty (xmlSecKeyPtr key);
-XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyDuplicate (xmlSecKeyPtr key);
-XMLSEC_EXPORT int xmlSecKeyCopy (xmlSecKeyPtr keyDst,
- xmlSecKeyPtr keySrc);
-
-XMLSEC_EXPORT const xmlChar* xmlSecKeyGetName (xmlSecKeyPtr key);
-XMLSEC_EXPORT int xmlSecKeySetName (xmlSecKeyPtr key,
- const xmlChar* name);
-
-XMLSEC_EXPORT xmlSecKeyDataType xmlSecKeyGetType (xmlSecKeyPtr key);
-
-XMLSEC_EXPORT xmlSecKeyDataPtr xmlSecKeyGetValue (xmlSecKeyPtr key);
-XMLSEC_EXPORT int xmlSecKeySetValue (xmlSecKeyPtr key,
- xmlSecKeyDataPtr value);
-
-XMLSEC_EXPORT xmlSecKeyDataPtr xmlSecKeyGetData (xmlSecKeyPtr key,
- xmlSecKeyDataId dataId);
-XMLSEC_EXPORT xmlSecKeyDataPtr xmlSecKeyEnsureData (xmlSecKeyPtr key,
- xmlSecKeyDataId dataId);
-XMLSEC_EXPORT int xmlSecKeyAdoptData (xmlSecKeyPtr key,
- xmlSecKeyDataPtr data);
-
-XMLSEC_EXPORT void xmlSecKeyDebugDump (xmlSecKeyPtr key,
- FILE *output);
-XMLSEC_EXPORT void xmlSecKeyDebugXmlDump (xmlSecKeyPtr key,
- FILE *output);
-XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyGenerate (xmlSecKeyDataId dataId,
- xmlSecSize sizeBits,
- xmlSecKeyDataType type);
-XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyGenerateByName (const xmlChar* name,
- xmlSecSize sizeBits,
- xmlSecKeyDataType type);
-
-
-XMLSEC_EXPORT int xmlSecKeyMatch (xmlSecKeyPtr key,
- const xmlChar *name,
- xmlSecKeyReqPtr keyReq);
-
-XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyReadBuffer (xmlSecKeyDataId dataId,
- xmlSecBuffer* buffer);
-XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyReadBinaryFile (xmlSecKeyDataId dataId,
- const char* filename);
-XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyReadMemory (xmlSecKeyDataId dataId,
- const xmlSecByte* data,
- xmlSecSize dataSize);
-
-
+XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyCreate (void);
+XMLSEC_EXPORT void xmlSecKeyDestroy (xmlSecKeyPtr key);
+XMLSEC_EXPORT void xmlSecKeyEmpty (xmlSecKeyPtr key);
+XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyDuplicate (xmlSecKeyPtr key);
+XMLSEC_EXPORT int xmlSecKeyCopy (xmlSecKeyPtr keyDst,
+ xmlSecKeyPtr keySrc);
+
+XMLSEC_EXPORT const xmlChar* xmlSecKeyGetName (xmlSecKeyPtr key);
+XMLSEC_EXPORT int xmlSecKeySetName (xmlSecKeyPtr key,
+ const xmlChar* name);
+
+XMLSEC_EXPORT xmlSecKeyDataType xmlSecKeyGetType (xmlSecKeyPtr key);
+
+XMLSEC_EXPORT xmlSecKeyDataPtr xmlSecKeyGetValue (xmlSecKeyPtr key);
+XMLSEC_EXPORT int xmlSecKeySetValue (xmlSecKeyPtr key,
+ xmlSecKeyDataPtr value);
+
+XMLSEC_EXPORT xmlSecKeyDataPtr xmlSecKeyGetData (xmlSecKeyPtr key,
+ xmlSecKeyDataId dataId);
+XMLSEC_EXPORT xmlSecKeyDataPtr xmlSecKeyEnsureData (xmlSecKeyPtr key,
+ xmlSecKeyDataId dataId);
+XMLSEC_EXPORT int xmlSecKeyAdoptData (xmlSecKeyPtr key,
+ xmlSecKeyDataPtr data);
+
+XMLSEC_EXPORT void xmlSecKeyDebugDump (xmlSecKeyPtr key,
+ FILE *output);
+XMLSEC_EXPORT void xmlSecKeyDebugXmlDump (xmlSecKeyPtr key,
+ FILE *output);
+XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyGenerate (xmlSecKeyDataId dataId,
+ xmlSecSize sizeBits,
+ xmlSecKeyDataType type);
+XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyGenerateByName (const xmlChar* name,
+ xmlSecSize sizeBits,
+ xmlSecKeyDataType type);
+
+
+XMLSEC_EXPORT int xmlSecKeyMatch (xmlSecKeyPtr key,
+ const xmlChar *name,
+ xmlSecKeyReqPtr keyReq);
+
+XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyReadBuffer (xmlSecKeyDataId dataId,
+ xmlSecBuffer* buffer);
+XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyReadBinaryFile (xmlSecKeyDataId dataId,
+ const char* filename);
+XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyReadMemory (xmlSecKeyDataId dataId,
+ const xmlSecByte* data,
+ xmlSecSize dataSize);
+
+
/**
* xmlSecKeyIsValid:
* @key: the pointer to key.
@@ -242,9 +242,9 @@ XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyReadMemory (xmlSecKeyDataId dataId,
* or 0 otherwise.
*/
#define xmlSecKeyIsValid(key) \
- ((( key ) != NULL) && \
- (( key )->value != NULL) && \
- ((( key )->value->id) != NULL))
+ ((( key ) != NULL) && \
+ (( key )->value != NULL) && \
+ ((( key )->value->id) != NULL))
/**
* xmlSecKeyCheckId:
* @key: the pointer to key.
@@ -253,8 +253,8 @@ XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyReadMemory (xmlSecKeyDataId dataId,
* Macro. Returns 1 if @key is valid and @key's id is equal to @keyId.
*/
#define xmlSecKeyCheckId(key, keyId) \
- (xmlSecKeyIsValid(( key )) && \
- ((( key )->value->id) == ( keyId )))
+ (xmlSecKeyIsValid(( key )) && \
+ ((( key )->value->id) == ( keyId )))
/***********************************************************************
@@ -267,8 +267,8 @@ XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyReadMemory (xmlSecKeyDataId dataId,
*
* The keys list klass.
*/
-#define xmlSecKeyPtrListId xmlSecKeyPtrListGetKlass()
-XMLSEC_EXPORT xmlSecPtrListId xmlSecKeyPtrListGetKlass (void);
+#define xmlSecKeyPtrListId xmlSecKeyPtrListGetKlass()
+XMLSEC_EXPORT xmlSecPtrListId xmlSecKeyPtrListGetKlass (void);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/keysdata.h b/include/xmlsec/keysdata.h
index 85974c9..25cce3b 100644
--- a/include/xmlsec/keysdata.h
+++ b/include/xmlsec/keysdata.h
@@ -24,12 +24,12 @@ extern "C" {
/**
* Forward declarations
*/
-typedef const struct _xmlSecKeyDataKlass xmlSecKeyDataKlass,
- *xmlSecKeyDataId;
-typedef const struct _xmlSecKeyDataStoreKlass xmlSecKeyDataStoreKlass,
- *xmlSecKeyDataStoreId;
-typedef struct _xmlSecKeyDataList xmlSecKeyDataList,
- *xmlSecKeyDataListPtr;
+typedef const struct _xmlSecKeyDataKlass xmlSecKeyDataKlass,
+ *xmlSecKeyDataId;
+typedef const struct _xmlSecKeyDataStoreKlass xmlSecKeyDataStoreKlass,
+ *xmlSecKeyDataStoreId;
+typedef struct _xmlSecKeyDataList xmlSecKeyDataList,
+ *xmlSecKeyDataListPtr;
/**************************************************************************
@@ -42,42 +42,42 @@ typedef struct _xmlSecKeyDataList xmlSecKeyDataList,
*
* The bits mask that determines possible keys data usage.
*/
-typedef unsigned int xmlSecKeyDataUsage;
+typedef unsigned int xmlSecKeyDataUsage;
/**
* xmlSecKeyDataUsageUnknown:
*
* The key data usage is unknown.
*/
-#define xmlSecKeyDataUsageUnknown 0x00000
+#define xmlSecKeyDataUsageUnknown 0x00000
/**
* xmlSecKeyDataUsageKeyInfoNodeRead:
*
* The key data could be read from a <dsig:KeyInfo/> child.
*/
-#define xmlSecKeyDataUsageKeyInfoNodeRead 0x00001
+#define xmlSecKeyDataUsageKeyInfoNodeRead 0x00001
/**
* xmlSecKeyDataUsageKeyInfoNodeWrite:
*
* The key data could be written to a <dsig:KeyInfo /> child.
*/
-#define xmlSecKeyDataUsageKeyInfoNodeWrite 0x00002
+#define xmlSecKeyDataUsageKeyInfoNodeWrite 0x00002
/**
* xmlSecKeyDataUsageKeyValueNodeRead:
*
* The key data could be read from a <dsig:KeyValue /> child.
*/
-#define xmlSecKeyDataUsageKeyValueNodeRead 0x00004
+#define xmlSecKeyDataUsageKeyValueNodeRead 0x00004
/**
* xmlSecKeyDataUsageKeyValueNodeWrite:
*
* The key data could be written to a <dsig:KeyValue /> child.
*/
-#define xmlSecKeyDataUsageKeyValueNodeWrite 0x00008
+#define xmlSecKeyDataUsageKeyValueNodeWrite 0x00008
/**
* xmlSecKeyDataUsageRetrievalMethodNodeXml:
@@ -85,7 +85,7 @@ typedef unsigned int xmlSecKeyDataUsage;
* The key data could be retrieved using <dsig:RetrievalMethod /> node
* in XML format.
*/
-#define xmlSecKeyDataUsageRetrievalMethodNodeXml 0x00010
+#define xmlSecKeyDataUsageRetrievalMethodNodeXml 0x00010
/**
* xmlSecKeyDataUsageRetrievalMethodNodeBin:
@@ -93,30 +93,30 @@ typedef unsigned int xmlSecKeyDataUsage;
* The key data could be retrieved using <dsig:RetrievalMethod /> node
* in binary format.
*/
-#define xmlSecKeyDataUsageRetrievalMethodNodeBin 0x00020
+#define xmlSecKeyDataUsageRetrievalMethodNodeBin 0x00020
/**
* xmlSecKeyDataUsageAny:
*
* Any key data usage.
*/
-#define xmlSecKeyDataUsageAny 0xFFFFF
+#define xmlSecKeyDataUsageAny 0xFFFFF
/**
* xmlSecKeyDataUsageKeyInfoNode:
*
* The key data could be read and written from/to a <dsig:KeyInfo /> child.
*/
-#define xmlSecKeyDataUsageKeyInfoNode \
- (xmlSecKeyDataUsageKeyInfoNodeRead | xmlSecKeyDataUsageKeyInfoNodeWrite)
+#define xmlSecKeyDataUsageKeyInfoNode \
+ (xmlSecKeyDataUsageKeyInfoNodeRead | xmlSecKeyDataUsageKeyInfoNodeWrite)
/**
* xmlSecKeyDataUsageKeyValueNode:
*
* The key data could be read and written from/to a <dsig:KeyValue /> child.
*/
-#define xmlSecKeyDataUsageKeyValueNode \
- (xmlSecKeyDataUsageKeyValueNodeRead | xmlSecKeyDataUsageKeyValueNodeWrite)
+#define xmlSecKeyDataUsageKeyValueNode \
+ (xmlSecKeyDataUsageKeyValueNodeRead | xmlSecKeyDataUsageKeyValueNodeWrite)
/**
* xmlSecKeyDataUsageRetrievalMethodNode:
@@ -124,8 +124,8 @@ typedef unsigned int xmlSecKeyDataUsage;
* The key data could be retrieved using <dsig:RetrievalMethod /> node
* in any format.
*/
-#define xmlSecKeyDataUsageRetrievalMethodNode \
- (xmlSecKeyDataUsageRetrievalMethodNodeXml | xmlSecKeyDataUsageRetrievalMethodNodeBin)
+#define xmlSecKeyDataUsageRetrievalMethodNode \
+ (xmlSecKeyDataUsageRetrievalMethodNodeXml | xmlSecKeyDataUsageRetrievalMethodNodeBin)
/**************************************************************************
*
@@ -137,70 +137,70 @@ typedef unsigned int xmlSecKeyDataUsage;
*
* The key data type (public/private, session/permanet, etc.).
*/
-typedef unsigned int xmlSecKeyDataType;
+typedef unsigned int xmlSecKeyDataType;
/**
* xmlSecKeyDataTypeUnknown:
*
* The key data type is unknown (same as #xmlSecKeyDataTypeNone).
*/
-#define xmlSecKeyDataTypeUnknown 0x0000
+#define xmlSecKeyDataTypeUnknown 0x0000
/**
* xmlSecKeyDataTypeNone:
*
* The key data type is unknown (same as #xmlSecKeyDataTypeUnknown).
*/
-#define xmlSecKeyDataTypeNone xmlSecKeyDataTypeUnknown
+#define xmlSecKeyDataTypeNone xmlSecKeyDataTypeUnknown
/**
* xmlSecKeyDataTypePublic:
*
* The key data contain a public key.
*/
-#define xmlSecKeyDataTypePublic 0x0001
+#define xmlSecKeyDataTypePublic 0x0001
/**
* xmlSecKeyDataTypePrivate:
*
* The key data contain a private key.
*/
-#define xmlSecKeyDataTypePrivate 0x0002
+#define xmlSecKeyDataTypePrivate 0x0002
/**
* xmlSecKeyDataTypeSymmetric:
*
* The key data contain a symmetric key.
*/
-#define xmlSecKeyDataTypeSymmetric 0x0004
+#define xmlSecKeyDataTypeSymmetric 0x0004
/**
* xmlSecKeyDataTypeSession:
*
* The key data contain session key (one time key, not stored in keys manager).
*/
-#define xmlSecKeyDataTypeSession 0x0008
+#define xmlSecKeyDataTypeSession 0x0008
/**
* xmlSecKeyDataTypePermanent:
*
* The key data contain permanent key (stored in keys manager).
*/
-#define xmlSecKeyDataTypePermanent 0x0010
+#define xmlSecKeyDataTypePermanent 0x0010
/**
* xmlSecKeyDataTypeTrusted:
*
* The key data is trusted.
*/
-#define xmlSecKeyDataTypeTrusted 0x0100
+#define xmlSecKeyDataTypeTrusted 0x0100
/**
* xmlSecKeyDataTypeAny:
*
* Any key data.
*/
-#define xmlSecKeyDataTypeAny 0xFFFF
+#define xmlSecKeyDataTypeAny 0xFFFF
/**************************************************************************
*
@@ -209,15 +209,15 @@ typedef unsigned int xmlSecKeyDataType;
*************************************************************************/
/**
* xmlSecKeyDataFormat:
- * @xmlSecKeyDataFormatUnknown: the key data format is unknown.
- * @xmlSecKeyDataFormatBinary: the binary key data.
- * @xmlSecKeyDataFormatPem: the PEM key data (cert or public/private key).
- * @xmlSecKeyDataFormatDer: the DER key data (cert or public/private key).
- * @xmlSecKeyDataFormatPkcs8Pem: the PKCS8 PEM private key.
- * @xmlSecKeyDataFormatPkcs8Der: the PKCS8 DER private key.
- * @xmlSecKeyDataFormatPkcs12: the PKCS12 format (bag of keys and certs)
- * @xmlSecKeyDataFormatCertPem: the PEM cert.
- * @xmlSecKeyDataFormatCertDer: the DER cert.
+ * @xmlSecKeyDataFormatUnknown: the key data format is unknown.
+ * @xmlSecKeyDataFormatBinary: the binary key data.
+ * @xmlSecKeyDataFormatPem: the PEM key data (cert or public/private key).
+ * @xmlSecKeyDataFormatDer: the DER key data (cert or public/private key).
+ * @xmlSecKeyDataFormatPkcs8Pem: the PKCS8 PEM private key.
+ * @xmlSecKeyDataFormatPkcs8Der: the PKCS8 DER private key.
+ * @xmlSecKeyDataFormatPkcs12: the PKCS12 format (bag of keys and certs)
+ * @xmlSecKeyDataFormatCertPem: the PEM cert.
+ * @xmlSecKeyDataFormatCertDer: the DER cert.
*
* The key data format (binary, der, pem, etc.).
*/
@@ -238,12 +238,12 @@ typedef enum {
* Global xmlSecKeyDataIds methods
*
*************************************************************************/
-XMLSEC_EXPORT xmlSecPtrListPtr xmlSecKeyDataIdsGet (void);
-XMLSEC_EXPORT int xmlSecKeyDataIdsInit (void);
-XMLSEC_EXPORT void xmlSecKeyDataIdsShutdown (void);
-XMLSEC_EXPORT int xmlSecKeyDataIdsRegisterDefault (void);
-XMLSEC_EXPORT int xmlSecKeyDataIdsRegister (xmlSecKeyDataId id);
-
+XMLSEC_EXPORT xmlSecPtrListPtr xmlSecKeyDataIdsGet (void);
+XMLSEC_EXPORT int xmlSecKeyDataIdsInit (void);
+XMLSEC_EXPORT void xmlSecKeyDataIdsShutdown (void);
+XMLSEC_EXPORT int xmlSecKeyDataIdsRegisterDefault (void);
+XMLSEC_EXPORT int xmlSecKeyDataIdsRegister (xmlSecKeyDataId id);
+
/**************************************************************************
*
* xmlSecKeyData
@@ -251,105 +251,105 @@ XMLSEC_EXPORT int xmlSecKeyDataIdsRegister (xmlSecKeyDataId id);
*************************************************************************/
/**
* xmlSecKeyData:
- * @id: the data id (#xmlSecKeyDataId).
- * @reserved0: reserved for the future.
- * @reserved1: reserved for the future.
+ * @id: the data id (#xmlSecKeyDataId).
+ * @reserved0: reserved for the future.
+ * @reserved1: reserved for the future.
*
* The key data: key value (crypto material), x509 data, pgp data, etc.
*/
struct _xmlSecKeyData {
- xmlSecKeyDataId id;
- void* reserved0;
- void* reserved1;
+ xmlSecKeyDataId id;
+ void* reserved0;
+ void* reserved1;
};
-XMLSEC_EXPORT xmlSecKeyDataPtr xmlSecKeyDataCreate (xmlSecKeyDataId id);
-XMLSEC_EXPORT xmlSecKeyDataPtr xmlSecKeyDataDuplicate (xmlSecKeyDataPtr data);
-XMLSEC_EXPORT void xmlSecKeyDataDestroy (xmlSecKeyDataPtr data);
-XMLSEC_EXPORT int xmlSecKeyDataGenerate (xmlSecKeyDataPtr data,
- xmlSecSize sizeBits,
- xmlSecKeyDataType type);
-XMLSEC_EXPORT xmlSecKeyDataType xmlSecKeyDataGetType (xmlSecKeyDataPtr data);
-XMLSEC_EXPORT xmlSecSize xmlSecKeyDataGetSize (xmlSecKeyDataPtr data);
-XMLSEC_EXPORT const xmlChar* xmlSecKeyDataGetIdentifier (xmlSecKeyDataPtr data);
-XMLSEC_EXPORT void xmlSecKeyDataDebugDump (xmlSecKeyDataPtr data,
- FILE *output);
-XMLSEC_EXPORT void xmlSecKeyDataDebugXmlDump (xmlSecKeyDataPtr data,
- FILE *output);
-XMLSEC_EXPORT int xmlSecKeyDataXmlRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-XMLSEC_EXPORT int xmlSecKeyDataXmlWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-XMLSEC_EXPORT int xmlSecKeyDataBinRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- const xmlSecByte* buf,
- xmlSecSize bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-XMLSEC_EXPORT int xmlSecKeyDataBinWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlSecByte** buf,
- xmlSecSize* bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+XMLSEC_EXPORT xmlSecKeyDataPtr xmlSecKeyDataCreate (xmlSecKeyDataId id);
+XMLSEC_EXPORT xmlSecKeyDataPtr xmlSecKeyDataDuplicate (xmlSecKeyDataPtr data);
+XMLSEC_EXPORT void xmlSecKeyDataDestroy (xmlSecKeyDataPtr data);
+XMLSEC_EXPORT int xmlSecKeyDataGenerate (xmlSecKeyDataPtr data,
+ xmlSecSize sizeBits,
+ xmlSecKeyDataType type);
+XMLSEC_EXPORT xmlSecKeyDataType xmlSecKeyDataGetType (xmlSecKeyDataPtr data);
+XMLSEC_EXPORT xmlSecSize xmlSecKeyDataGetSize (xmlSecKeyDataPtr data);
+XMLSEC_EXPORT const xmlChar* xmlSecKeyDataGetIdentifier (xmlSecKeyDataPtr data);
+XMLSEC_EXPORT void xmlSecKeyDataDebugDump (xmlSecKeyDataPtr data,
+ FILE *output);
+XMLSEC_EXPORT void xmlSecKeyDataDebugXmlDump (xmlSecKeyDataPtr data,
+ FILE *output);
+XMLSEC_EXPORT int xmlSecKeyDataXmlRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+XMLSEC_EXPORT int xmlSecKeyDataXmlWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+XMLSEC_EXPORT int xmlSecKeyDataBinRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ const xmlSecByte* buf,
+ xmlSecSize bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+XMLSEC_EXPORT int xmlSecKeyDataBinWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlSecByte** buf,
+ xmlSecSize* bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
/**
* xmlSecKeyDataGetName:
- * @data: the pointer to key data.
+ * @data: the pointer to key data.
*
* Macro. Returns the key data name.
*/
#define xmlSecKeyDataGetName(data) \
- ((xmlSecKeyDataIsValid((data))) ? \
- xmlSecKeyDataKlassGetName((data)->id) : NULL)
+ ((xmlSecKeyDataIsValid((data))) ? \
+ xmlSecKeyDataKlassGetName((data)->id) : NULL)
/**
* xmlSecKeyDataIsValid:
- * @data: the pointer to data.
+ * @data: the pointer to data.
*
* Macro. Returns 1 if @data is not NULL and @data->id is not NULL
* or 0 otherwise.
*/
#define xmlSecKeyDataIsValid(data) \
- ((( data ) != NULL) && \
- (( data )->id != NULL) && \
- (( data )->id->klassSize >= sizeof(xmlSecKeyDataKlass)) && \
- (( data )->id->objSize >= sizeof(xmlSecKeyData)) && \
- (( data )->id->name != NULL))
+ ((( data ) != NULL) && \
+ (( data )->id != NULL) && \
+ (( data )->id->klassSize >= sizeof(xmlSecKeyDataKlass)) && \
+ (( data )->id->objSize >= sizeof(xmlSecKeyData)) && \
+ (( data )->id->name != NULL))
/**
* xmlSecKeyDataCheckId:
- * @data: the pointer to data.
- * @dataId: the data Id.
+ * @data: the pointer to data.
+ * @dataId: the data Id.
*
* Macro. Returns 1 if @data is valid and @data's id is equal to @dataId.
*/
#define xmlSecKeyDataCheckId(data, dataId) \
- (xmlSecKeyDataIsValid(( data )) && \
- ((( data )->id) == ( dataId )))
+ (xmlSecKeyDataIsValid(( data )) && \
+ ((( data )->id) == ( dataId )))
/**
* xmlSecKeyDataCheckUsage:
- * @data: the pointer to data.
- * @usg: the data usage.
+ * @data: the pointer to data.
+ * @usg: the data usage.
*
* Macro. Returns 1 if @data is valid and could be used for @usg.
*/
#define xmlSecKeyDataCheckUsage(data, usg) \
- (xmlSecKeyDataIsValid(( data )) && \
- (((( data )->id->usage) & ( usg )) != 0))
+ (xmlSecKeyDataIsValid(( data )) && \
+ (((( data )->id->usage) & ( usg )) != 0))
/**
* xmlSecKeyDataCheckSize:
- * @data: the pointer to data.
- * @size: the expected size.
+ * @data: the pointer to data.
+ * @size: the expected size.
*
* Macro. Returns 1 if @data is valid and @data's object has at least @size bytes.
*/
#define xmlSecKeyDataCheckSize(data, size) \
- (xmlSecKeyDataIsValid(( data )) && \
- (( data )->id->objSize >= size))
+ (xmlSecKeyDataIsValid(( data )) && \
+ (( data )->id->objSize >= size))
/**************************************************************************
*
@@ -361,231 +361,231 @@ XMLSEC_EXPORT int xmlSecKeyDataBinWrite (xmlSecKeyDataId id,
*
* The "unknown" id.
*/
-#define xmlSecKeyDataIdUnknown ((xmlSecKeyDataId)NULL)
+#define xmlSecKeyDataIdUnknown ((xmlSecKeyDataId)NULL)
/**
* xmlSecKeyDataInitMethod:
- * @data: the pointer to key data.
+ * @data: the pointer to key data.
*
* Key data specific initialization method.
*
* Returns: 0 on success or a negative value if an error occurs.
*/
-typedef int (*xmlSecKeyDataInitMethod) (xmlSecKeyDataPtr data);
+typedef int (*xmlSecKeyDataInitMethod) (xmlSecKeyDataPtr data);
/**
* xmlSecKeyDataDuplicateMethod:
- * @dst: the pointer to destination key data.
- * @src: the poiniter to source key data.
+ * @dst: the pointer to destination key data.
+ * @src: the poiniter to source key data.
*
* Key data specific duplication (copy) method.
*
* Returns: 0 on success or a negative value if an error occurs.
*/
-typedef int (*xmlSecKeyDataDuplicateMethod) (xmlSecKeyDataPtr dst,
- xmlSecKeyDataPtr src);
+typedef int (*xmlSecKeyDataDuplicateMethod) (xmlSecKeyDataPtr dst,
+ xmlSecKeyDataPtr src);
/**
* xmlSecKeyDataFinalizeMethod:
- * @data: the data.
+ * @data: the data.
*
* Key data specific finalization method. All the objects and resources allocated
* by the key data object must be freed inside this method.
*/
-typedef void (*xmlSecKeyDataFinalizeMethod) (xmlSecKeyDataPtr data);
+typedef void (*xmlSecKeyDataFinalizeMethod) (xmlSecKeyDataPtr data);
/**
* xmlSecKeyDataXmlReadMethod:
- * @id: the data id.
- * @key: the key.
- * @node: the pointer to data's value XML node.
- * @keyInfoCtx: the <dsig:KeyInfo/> node processing context.
+ * @id: the data id.
+ * @key: the key.
+ * @node: the pointer to data's value XML node.
+ * @keyInfoCtx: the <dsig:KeyInfo/> node processing context.
*
* Key data specific method for reading XML node.
*
* Returns: 0 on success or a negative value if an error occurs.
*/
-typedef int (*xmlSecKeyDataXmlReadMethod) (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+typedef int (*xmlSecKeyDataXmlReadMethod) (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
/**
* xmlSecKeyDataXmlWriteMethod:
- * @id: the data id.
- * @key: the key.
- * @node: the pointer to data's value XML node.
- * @keyInfoCtx: the <dsig:KeyInfo> node processing context.
+ * @id: the data id.
+ * @key: the key.
+ * @node: the pointer to data's value XML node.
+ * @keyInfoCtx: the <dsig:KeyInfo> node processing context.
*
* Key data specific method for writing XML node.
*
* Returns: 0 on success or a negative value if an error occurs.
*/
-typedef int (*xmlSecKeyDataXmlWriteMethod) (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+typedef int (*xmlSecKeyDataXmlWriteMethod) (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
/**
* xmlSecKeyDataBinReadMethod:
- * @id: the data id.
- * @key: the key.
- * @buf: the input buffer.
- * @bufSize: the buffer size.
- * @keyInfoCtx: the <dsig:KeyInfo/> node processing context.
+ * @id: the data id.
+ * @key: the key.
+ * @buf: the input buffer.
+ * @bufSize: the buffer size.
+ * @keyInfoCtx: the <dsig:KeyInfo/> node processing context.
*
* Key data specific method for reading binary buffer.
*
* Returns: 0 on success or a negative value if an error occurs.
*/
-typedef int (*xmlSecKeyDataBinReadMethod) (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- const xmlSecByte* buf,
- xmlSecSize bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+typedef int (*xmlSecKeyDataBinReadMethod) (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ const xmlSecByte* buf,
+ xmlSecSize bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
/**
* xmlSecKeyDataBinWriteMethod:
- * @id: the data id.
- * @key: the key.
- * @buf: the output buffer.
- * @bufSize: the buffer size.
- * @keyInfoCtx: the <dsig:KeyInfo/> node processing context.
+ * @id: the data id.
+ * @key: the key.
+ * @buf: the output buffer.
+ * @bufSize: the buffer size.
+ * @keyInfoCtx: the <dsig:KeyInfo/> node processing context.
*
* Key data specific method for reading binary buffer.
*
* Returns: 0 on success or a negative value if an error occurs.
*/
-typedef int (*xmlSecKeyDataBinWriteMethod) (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlSecByte** buf,
- xmlSecSize* bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+typedef int (*xmlSecKeyDataBinWriteMethod) (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlSecByte** buf,
+ xmlSecSize* bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
/**
* xmlSecKeyDataGenerateMethod:
- * @data: the pointer to key data.
- * @sizeBits: the key data specific size.
- * @type: the required key type (session/permanent, etc.)
+ * @data: the pointer to key data.
+ * @sizeBits: the key data specific size.
+ * @type: the required key type (session/permanent, etc.)
*
* Key data specific method for generating new key data.
*
* Returns: 0 on success or a negative value if an error occurs.
*/
-typedef int (*xmlSecKeyDataGenerateMethod) (xmlSecKeyDataPtr data,
- xmlSecSize sizeBits,
- xmlSecKeyDataType type);
+typedef int (*xmlSecKeyDataGenerateMethod) (xmlSecKeyDataPtr data,
+ xmlSecSize sizeBits,
+ xmlSecKeyDataType type);
/**
* xmlSecKeyDataGetTypeMethod:
- * @data: the data.
+ * @data: the data.
*
* Key data specific method to get the key type.
*
* Returns: the key type.
*/
-typedef xmlSecKeyDataType (*xmlSecKeyDataGetTypeMethod) (xmlSecKeyDataPtr data);
+typedef xmlSecKeyDataType (*xmlSecKeyDataGetTypeMethod) (xmlSecKeyDataPtr data);
/**
* xmlSecKeyDataGetSizeMethod:
- * @data: the pointer to key data.
+ * @data: the pointer to key data.
*
* Key data specific method to get the key size.
*
* Returns: the key size in bits.
*/
-typedef xmlSecSize (*xmlSecKeyDataGetSizeMethod) (xmlSecKeyDataPtr data);
+typedef xmlSecSize (*xmlSecKeyDataGetSizeMethod) (xmlSecKeyDataPtr data);
/**
* xmlSecKeyDataGetIdentifierMethod:
- * @data: the pointer to key data.
+ * @data: the pointer to key data.
*
* Key data specific method to get the key data identifier string (for example,
* X509 data identifier is the subject of the verified cert).
*
* Returns: the identifier string or NULL if an error occurs.
*/
-typedef const xmlChar* (*xmlSecKeyDataGetIdentifierMethod) (xmlSecKeyDataPtr data);
+typedef const xmlChar* (*xmlSecKeyDataGetIdentifierMethod) (xmlSecKeyDataPtr data);
/**
* xmlSecKeyDataDebugDumpMethod:
- * @data: the data.
- * @output: the FILE to print debug info (should be open for writing).
+ * @data: the data.
+ * @output: the FILE to print debug info (should be open for writing).
*
* Key data specific method for printing debug info.
*/
-typedef void (*xmlSecKeyDataDebugDumpMethod) (xmlSecKeyDataPtr data,
- FILE* output);
+typedef void (*xmlSecKeyDataDebugDumpMethod) (xmlSecKeyDataPtr data,
+ FILE* output);
/**
* xmlSecKeyDataKlass:
- * @klassSize: the klass size.
- * @objSize: the object size.
- * @name: the object name.
- * @usage: the allowed data usage.
- * @href: the identification string (href).
- * @dataNodeName: the data's XML node name.
- * @dataNodeNs: the data's XML node namespace.
- * @initialize: the initialization method.
- * @duplicate: the duplicate (copy) method.
- * @finalize: the finalization (destroy) method.
- * @generate: the new data generation method.
- * @getType: the method to access data's type information.
- * @getSize: the method to access data's size.
- * @getIdentifier: the method to access data's string identifier.
- * @xmlRead: the method for reading data from XML node.
- * @xmlWrite: the method for writing data to XML node.
- * @binRead: the method for reading data from a binary buffer.
- * @binWrite: the method for writing data to binary buffer.
- * @debugDump: the method for printing debug data information.
- * @debugXmlDump: the method for printing debug data information in XML format.
- * @reserved0: reserved for the future.
- * @reserved1: reserved for the future.
+ * @klassSize: the klass size.
+ * @objSize: the object size.
+ * @name: the object name.
+ * @usage: the allowed data usage.
+ * @href: the identification string (href).
+ * @dataNodeName: the data's XML node name.
+ * @dataNodeNs: the data's XML node namespace.
+ * @initialize: the initialization method.
+ * @duplicate: the duplicate (copy) method.
+ * @finalize: the finalization (destroy) method.
+ * @generate: the new data generation method.
+ * @getType: the method to access data's type information.
+ * @getSize: the method to access data's size.
+ * @getIdentifier: the method to access data's string identifier.
+ * @xmlRead: the method for reading data from XML node.
+ * @xmlWrite: the method for writing data to XML node.
+ * @binRead: the method for reading data from a binary buffer.
+ * @binWrite: the method for writing data to binary buffer.
+ * @debugDump: the method for printing debug data information.
+ * @debugXmlDump: the method for printing debug data information in XML format.
+ * @reserved0: reserved for the future.
+ * @reserved1: reserved for the future.
*
* The data id (klass).
*/
struct _xmlSecKeyDataKlass {
- xmlSecSize klassSize;
- xmlSecSize objSize;
+ xmlSecSize klassSize;
+ xmlSecSize objSize;
/* data */
- const xmlChar* name;
- xmlSecKeyDataUsage usage;
- const xmlChar* href;
- const xmlChar* dataNodeName;
- const xmlChar* dataNodeNs;
+ const xmlChar* name;
+ xmlSecKeyDataUsage usage;
+ const xmlChar* href;
+ const xmlChar* dataNodeName;
+ const xmlChar* dataNodeNs;
/* constructors/destructor */
- xmlSecKeyDataInitMethod initialize;
- xmlSecKeyDataDuplicateMethod duplicate;
- xmlSecKeyDataFinalizeMethod finalize;
- xmlSecKeyDataGenerateMethod generate;
+ xmlSecKeyDataInitMethod initialize;
+ xmlSecKeyDataDuplicateMethod duplicate;
+ xmlSecKeyDataFinalizeMethod finalize;
+ xmlSecKeyDataGenerateMethod generate;
/* get info */
- xmlSecKeyDataGetTypeMethod getType;
- xmlSecKeyDataGetSizeMethod getSize;
- xmlSecKeyDataGetIdentifierMethod getIdentifier;
+ xmlSecKeyDataGetTypeMethod getType;
+ xmlSecKeyDataGetSizeMethod getSize;
+ xmlSecKeyDataGetIdentifierMethod getIdentifier;
/* read/write */
- xmlSecKeyDataXmlReadMethod xmlRead;
- xmlSecKeyDataXmlWriteMethod xmlWrite;
- xmlSecKeyDataBinReadMethod binRead;
- xmlSecKeyDataBinWriteMethod binWrite;
+ xmlSecKeyDataXmlReadMethod xmlRead;
+ xmlSecKeyDataXmlWriteMethod xmlWrite;
+ xmlSecKeyDataBinReadMethod binRead;
+ xmlSecKeyDataBinWriteMethod binWrite;
/* debug */
- xmlSecKeyDataDebugDumpMethod debugDump;
- xmlSecKeyDataDebugDumpMethod debugXmlDump;
+ xmlSecKeyDataDebugDumpMethod debugDump;
+ xmlSecKeyDataDebugDumpMethod debugXmlDump;
/* for the future */
- void* reserved0;
- void* reserved1;
+ void* reserved0;
+ void* reserved1;
};
/**
* xmlSecKeyDataKlassGetName:
- * @klass: the data klass.
+ * @klass: the data klass.
*
* Macro. Returns data klass name.
*/
#define xmlSecKeyDataKlassGetName(klass) \
- (((klass)) ? ((klass)->name) : NULL)
+ (((klass)) ? ((klass)->name) : NULL)
/***********************************************************************
*
@@ -598,8 +598,8 @@ struct _xmlSecKeyDataKlass {
*
* The key data klasses list klass id.
*/
-#define xmlSecKeyDataListId xmlSecKeyDataListGetKlass()
-XMLSEC_EXPORT xmlSecPtrListId xmlSecKeyDataListGetKlass (void);
+#define xmlSecKeyDataListId xmlSecKeyDataListGetKlass()
+XMLSEC_EXPORT xmlSecPtrListId xmlSecKeyDataListGetKlass (void);
/***********************************************************************
*
@@ -612,24 +612,24 @@ XMLSEC_EXPORT xmlSecPtrListId xmlSecKeyDataListGetKlass (void);
*
* The key data list klass id.
*/
-#define xmlSecKeyDataIdListId xmlSecKeyDataIdListGetKlass()
-XMLSEC_EXPORT xmlSecPtrListId xmlSecKeyDataIdListGetKlass (void);
-XMLSEC_EXPORT int xmlSecKeyDataIdListFind (xmlSecPtrListPtr list,
- xmlSecKeyDataId dataId);
-XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataIdListFindByNode (xmlSecPtrListPtr list,
- const xmlChar* nodeName,
- const xmlChar* nodeNs,
- xmlSecKeyDataUsage usage);
-XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataIdListFindByHref (xmlSecPtrListPtr list,
- const xmlChar* href,
- xmlSecKeyDataUsage usage);
-XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataIdListFindByName (xmlSecPtrListPtr list,
- const xmlChar* name,
- xmlSecKeyDataUsage usage);
-XMLSEC_EXPORT void xmlSecKeyDataIdListDebugDump (xmlSecPtrListPtr list,
- FILE* output);
-XMLSEC_EXPORT void xmlSecKeyDataIdListDebugXmlDump (xmlSecPtrListPtr list,
- FILE* output);
+#define xmlSecKeyDataIdListId xmlSecKeyDataIdListGetKlass()
+XMLSEC_EXPORT xmlSecPtrListId xmlSecKeyDataIdListGetKlass (void);
+XMLSEC_EXPORT int xmlSecKeyDataIdListFind (xmlSecPtrListPtr list,
+ xmlSecKeyDataId dataId);
+XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataIdListFindByNode (xmlSecPtrListPtr list,
+ const xmlChar* nodeName,
+ const xmlChar* nodeNs,
+ xmlSecKeyDataUsage usage);
+XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataIdListFindByHref (xmlSecPtrListPtr list,
+ const xmlChar* href,
+ xmlSecKeyDataUsage usage);
+XMLSEC_EXPORT xmlSecKeyDataId xmlSecKeyDataIdListFindByName (xmlSecPtrListPtr list,
+ const xmlChar* name,
+ xmlSecKeyDataUsage usage);
+XMLSEC_EXPORT void xmlSecKeyDataIdListDebugDump (xmlSecPtrListPtr list,
+ FILE* output);
+XMLSEC_EXPORT void xmlSecKeyDataIdListDebugXmlDump (xmlSecPtrListPtr list,
+ FILE* output);
/**************************************************************************
*
@@ -643,41 +643,41 @@ XMLSEC_EXPORT void xmlSecKeyDataIdListDebugXmlDump (xmlSecPtrListPtr list,
*
* The binary key data object size.
*/
-#define xmlSecKeyDataBinarySize \
+#define xmlSecKeyDataBinarySize \
(sizeof(xmlSecKeyData) + sizeof(xmlSecBuffer))
-XMLSEC_EXPORT int xmlSecKeyDataBinaryValueInitialize (xmlSecKeyDataPtr data);
-XMLSEC_EXPORT int xmlSecKeyDataBinaryValueDuplicate (xmlSecKeyDataPtr dst,
- xmlSecKeyDataPtr src);
-XMLSEC_EXPORT void xmlSecKeyDataBinaryValueFinalize (xmlSecKeyDataPtr data);
-XMLSEC_EXPORT int xmlSecKeyDataBinaryValueXmlRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-XMLSEC_EXPORT int xmlSecKeyDataBinaryValueXmlWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-XMLSEC_EXPORT int xmlSecKeyDataBinaryValueBinRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- const xmlSecByte* buf,
- xmlSecSize bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-XMLSEC_EXPORT int xmlSecKeyDataBinaryValueBinWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlSecByte** buf,
- xmlSecSize* bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-XMLSEC_EXPORT void xmlSecKeyDataBinaryValueDebugDump (xmlSecKeyDataPtr data,
- FILE* output);
-XMLSEC_EXPORT void xmlSecKeyDataBinaryValueDebugXmlDump (xmlSecKeyDataPtr data,
- FILE* output);
-
-XMLSEC_EXPORT xmlSecSize xmlSecKeyDataBinaryValueGetSize (xmlSecKeyDataPtr data);
-XMLSEC_EXPORT xmlSecBufferPtr xmlSecKeyDataBinaryValueGetBuffer (xmlSecKeyDataPtr data);
-XMLSEC_EXPORT int xmlSecKeyDataBinaryValueSetBuffer (xmlSecKeyDataPtr data,
- const xmlSecByte* buf,
- xmlSecSize bufSize);
+XMLSEC_EXPORT int xmlSecKeyDataBinaryValueInitialize (xmlSecKeyDataPtr data);
+XMLSEC_EXPORT int xmlSecKeyDataBinaryValueDuplicate (xmlSecKeyDataPtr dst,
+ xmlSecKeyDataPtr src);
+XMLSEC_EXPORT void xmlSecKeyDataBinaryValueFinalize (xmlSecKeyDataPtr data);
+XMLSEC_EXPORT int xmlSecKeyDataBinaryValueXmlRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+XMLSEC_EXPORT int xmlSecKeyDataBinaryValueXmlWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+XMLSEC_EXPORT int xmlSecKeyDataBinaryValueBinRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ const xmlSecByte* buf,
+ xmlSecSize bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+XMLSEC_EXPORT int xmlSecKeyDataBinaryValueBinWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlSecByte** buf,
+ xmlSecSize* bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+XMLSEC_EXPORT void xmlSecKeyDataBinaryValueDebugDump (xmlSecKeyDataPtr data,
+ FILE* output);
+XMLSEC_EXPORT void xmlSecKeyDataBinaryValueDebugXmlDump (xmlSecKeyDataPtr data,
+ FILE* output);
+
+XMLSEC_EXPORT xmlSecSize xmlSecKeyDataBinaryValueGetSize (xmlSecKeyDataPtr data);
+XMLSEC_EXPORT xmlSecBufferPtr xmlSecKeyDataBinaryValueGetBuffer (xmlSecKeyDataPtr data);
+XMLSEC_EXPORT int xmlSecKeyDataBinaryValueSetBuffer (xmlSecKeyDataPtr data,
+ const xmlSecByte* buf,
+ xmlSecSize bufSize);
/**************************************************************************
*
@@ -686,28 +686,28 @@ XMLSEC_EXPORT int xmlSecKeyDataBinaryValueSetBuffer (xmlSecKeyDataPtr data,
*************************************************************************/
/**
* xmlSecKeyDataStore:
- * @id: the store id (#xmlSecKeyDataStoreId).
- * @reserved0: reserved for the future.
- * @reserved1: reserved for the future.
+ * @id: the store id (#xmlSecKeyDataStoreId).
+ * @reserved0: reserved for the future.
+ * @reserved1: reserved for the future.
*
* The key data store. Key data store holds common key data specific information
* required for key data processing. For example, X509 data store may hold
* information about trusted (root) certificates.
*/
struct _xmlSecKeyDataStore {
- xmlSecKeyDataStoreId id;
+ xmlSecKeyDataStoreId id;
/* for the future */
- void* reserved0;
- void* reserved1;
+ void* reserved0;
+ void* reserved1;
};
-XMLSEC_EXPORT xmlSecKeyDataStorePtr xmlSecKeyDataStoreCreate (xmlSecKeyDataStoreId id);
-XMLSEC_EXPORT void xmlSecKeyDataStoreDestroy (xmlSecKeyDataStorePtr store);
+XMLSEC_EXPORT xmlSecKeyDataStorePtr xmlSecKeyDataStoreCreate (xmlSecKeyDataStoreId id);
+XMLSEC_EXPORT void xmlSecKeyDataStoreDestroy (xmlSecKeyDataStorePtr store);
/**
* xmlSecKeyDataStoreGetName:
- * @store: the pointer to store.
+ * @store: the pointer to store.
*
* Macro. Returns key data store name.
*/
@@ -717,34 +717,34 @@ XMLSEC_EXPORT void xmlSecKeyDataStoreDestroy (xmlSecKeyDataStorePtr store);
/**
* xmlSecKeyDataStoreIsValid:
- * @store: the pointer to store.
+ * @store: the pointer to store.
*
* Macro. Returns 1 if @store is not NULL and @store->id is not NULL
* or 0 otherwise.
*/
#define xmlSecKeyDataStoreIsValid(store) \
- ((( store ) != NULL) && ((( store )->id) != NULL))
+ ((( store ) != NULL) && ((( store )->id) != NULL))
/**
* xmlSecKeyDataStoreCheckId:
- * @store: the pointer to store.
- * @storeId: the store Id.
+ * @store: the pointer to store.
+ * @storeId: the store Id.
*
* Macro. Returns 1 if @store is valid and @store's id is equal to @storeId.
*/
#define xmlSecKeyDataStoreCheckId(store, storeId) \
- (xmlSecKeyDataStoreIsValid(( store )) && \
- ((( store )->id) == ( storeId )))
+ (xmlSecKeyDataStoreIsValid(( store )) && \
+ ((( store )->id) == ( storeId )))
/**
* xmlSecKeyDataStoreCheckSize:
- * @store: the pointer to store.
- * @size: the expected size.
+ * @store: the pointer to store.
+ * @size: the expected size.
*
* Macro. Returns 1 if @data is valid and @stores's object has at least @size bytes.
*/
#define xmlSecKeyDataStoreCheckSize(store, size) \
- (xmlSecKeyDataStoreIsValid(( store )) && \
- (( store )->id->objSize >= size))
+ (xmlSecKeyDataStoreIsValid(( store )) && \
+ (( store )->id->objSize >= size))
/**************************************************************************
@@ -757,62 +757,62 @@ XMLSEC_EXPORT void xmlSecKeyDataStoreDestroy (xmlSecKeyDataStorePtr store);
*
* The "unknown" id.
*/
-#define xmlSecKeyDataStoreIdUnknown NULL
+#define xmlSecKeyDataStoreIdUnknown NULL
/**
* xmlSecKeyDataStoreInitializeMethod:
- * @store: the data store.
+ * @store: the data store.
*
* Key data store specific initialization method.
*
* Returns: 0 on success or a negative value if an error occurs.
*/
-typedef int (*xmlSecKeyDataStoreInitializeMethod) (xmlSecKeyDataStorePtr store);
+typedef int (*xmlSecKeyDataStoreInitializeMethod) (xmlSecKeyDataStorePtr store);
/**
* xmlSecKeyDataStoreFinalizeMethod:
- * @store: the data store.
+ * @store: the data store.
*
* Key data store specific finalization (destroy) method.
*/
-typedef void (*xmlSecKeyDataStoreFinalizeMethod) (xmlSecKeyDataStorePtr store);
+typedef void (*xmlSecKeyDataStoreFinalizeMethod) (xmlSecKeyDataStorePtr store);
/**
* xmlSecKeyDataStoreKlass:
- * @klassSize: the data store klass size.
- * @objSize: the data store obj size.
- * @name: the store's name.
- * @initialize: the store's initialization method.
- * @finalize: the store's finalization (destroy) method.
- * @reserved0: reserved for the future.
- * @reserved1: reserved for the future.
+ * @klassSize: the data store klass size.
+ * @objSize: the data store obj size.
+ * @name: the store's name.
+ * @initialize: the store's initialization method.
+ * @finalize: the store's finalization (destroy) method.
+ * @reserved0: reserved for the future.
+ * @reserved1: reserved for the future.
*
* The data store id (klass).
*/
struct _xmlSecKeyDataStoreKlass {
- xmlSecSize klassSize;
- xmlSecSize objSize;
+ xmlSecSize klassSize;
+ xmlSecSize objSize;
/* data */
- const xmlChar* name;
+ const xmlChar* name;
/* constructors/destructor */
- xmlSecKeyDataStoreInitializeMethod initialize;
- xmlSecKeyDataStoreFinalizeMethod finalize;
+ xmlSecKeyDataStoreInitializeMethod initialize;
+ xmlSecKeyDataStoreFinalizeMethod finalize;
/* for the future */
- void* reserved0;
- void* reserved1;
+ void* reserved0;
+ void* reserved1;
};
/**
* xmlSecKeyDataStoreKlassGetName:
- * @klass: the pointer to store klass.
+ * @klass: the pointer to store klass.
*
* Macro. Returns store klass name.
*/
#define xmlSecKeyDataStoreKlassGetName(klass) \
- (((klass)) ? ((klass)->name) : NULL)
+ (((klass)) ? ((klass)->name) : NULL)
/***********************************************************************
*
@@ -824,8 +824,8 @@ struct _xmlSecKeyDataStoreKlass {
*
* The data store list id (klass).
*/
-#define xmlSecKeyDataStorePtrListId xmlSecKeyDataStorePtrListGetKlass()
-XMLSEC_EXPORT xmlSecPtrListId xmlSecKeyDataStorePtrListGetKlass (void);
+#define xmlSecKeyDataStorePtrListId xmlSecKeyDataStorePtrListGetKlass()
+XMLSEC_EXPORT xmlSecPtrListId xmlSecKeyDataStorePtrListGetKlass (void);
#ifdef __cplusplus
diff --git a/include/xmlsec/keysmngr.h b/include/xmlsec/keysmngr.h
index 3a99932..e502e87 100644
--- a/include/xmlsec/keysmngr.h
+++ b/include/xmlsec/keysmngr.h
@@ -21,10 +21,10 @@ extern "C" {
#include <xmlsec/keysdata.h>
#include <xmlsec/keyinfo.h>
-typedef const struct _xmlSecKeyKlass xmlSecKeyKlass,
- *xmlSecKeyId;
-typedef const struct _xmlSecKeyStoreKlass xmlSecKeyStoreKlass,
- *xmlSecKeyStoreId;
+typedef const struct _xmlSecKeyKlass xmlSecKeyKlass,
+ *xmlSecKeyId;
+typedef const struct _xmlSecKeyStoreKlass xmlSecKeyStoreKlass,
+ *xmlSecKeyStoreId;
/****************************************************************************
@@ -32,52 +32,52 @@ typedef const struct _xmlSecKeyStoreKlass xmlSecKeyStoreKlass,
* Keys Manager
*
***************************************************************************/
-XMLSEC_EXPORT xmlSecKeysMngrPtr xmlSecKeysMngrCreate (void);
-XMLSEC_EXPORT void xmlSecKeysMngrDestroy (xmlSecKeysMngrPtr mngr);
+XMLSEC_EXPORT xmlSecKeysMngrPtr xmlSecKeysMngrCreate (void);
+XMLSEC_EXPORT void xmlSecKeysMngrDestroy (xmlSecKeysMngrPtr mngr);
-XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeysMngrFindKey (xmlSecKeysMngrPtr mngr,
- const xmlChar* name,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeysMngrFindKey (xmlSecKeysMngrPtr mngr,
+ const xmlChar* name,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
-XMLSEC_EXPORT int xmlSecKeysMngrAdoptKeysStore (xmlSecKeysMngrPtr mngr,
- xmlSecKeyStorePtr store);
-XMLSEC_EXPORT xmlSecKeyStorePtr xmlSecKeysMngrGetKeysStore (xmlSecKeysMngrPtr mngr);
+XMLSEC_EXPORT int xmlSecKeysMngrAdoptKeysStore (xmlSecKeysMngrPtr mngr,
+ xmlSecKeyStorePtr store);
+XMLSEC_EXPORT xmlSecKeyStorePtr xmlSecKeysMngrGetKeysStore (xmlSecKeysMngrPtr mngr);
-XMLSEC_EXPORT int xmlSecKeysMngrAdoptDataStore (xmlSecKeysMngrPtr mngr,
- xmlSecKeyDataStorePtr store);
-XMLSEC_EXPORT xmlSecKeyDataStorePtr xmlSecKeysMngrGetDataStore (xmlSecKeysMngrPtr mngr,
- xmlSecKeyDataStoreId id);
+XMLSEC_EXPORT int xmlSecKeysMngrAdoptDataStore (xmlSecKeysMngrPtr mngr,
+ xmlSecKeyDataStorePtr store);
+XMLSEC_EXPORT xmlSecKeyDataStorePtr xmlSecKeysMngrGetDataStore (xmlSecKeysMngrPtr mngr,
+ xmlSecKeyDataStoreId id);
/**
* xmlSecGetKeyCallback:
- * @keyInfoNode: the pointer to <dsig:KeyInfo/> node.
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> node processing context.
+ * @keyInfoNode: the pointer to <dsig:KeyInfo/> node.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> node processing context.
*
* Reads the <dsig:KeyInfo/> node @keyInfoNode and extracts the key.
*
* Returns: the pointer to key or NULL if the key is not found or
* an error occurs.
*/
-typedef xmlSecKeyPtr (*xmlSecGetKeyCallback) (xmlNodePtr keyInfoNode,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+typedef xmlSecKeyPtr (*xmlSecGetKeyCallback) (xmlNodePtr keyInfoNode,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
/**
* xmlSecKeysMngr:
- * @keysStore: the key store (list of keys known to keys manager).
- * @storesList: the list of key data stores known to keys manager.
- * @getKey: the callback used to read <dsig:KeyInfo/> node.
+ * @keysStore: the key store (list of keys known to keys manager).
+ * @storesList: the list of key data stores known to keys manager.
+ * @getKey: the callback used to read <dsig:KeyInfo/> node.
*
* The keys manager structure.
*/
-struct _xmlSecKeysMngr {
- xmlSecKeyStorePtr keysStore;
- xmlSecPtrList storesList;
- xmlSecGetKeyCallback getKey;
+struct _xmlSecKeysMngr {
+ xmlSecKeyStorePtr keysStore;
+ xmlSecPtrList storesList;
+ xmlSecGetKeyCallback getKey;
};
-XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeysMngrGetKey (xmlNodePtr keyInfoNode,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeysMngrGetKey (xmlNodePtr keyInfoNode,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
/**************************************************************************
@@ -87,28 +87,28 @@ XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeysMngrGetKey (xmlNodePtr keyInfoNode,
*************************************************************************/
/**
* xmlSecKeyStore:
- * @id: the store id (#xmlSecKeyStoreId).
- * @reserved0: reserved for the future.
- * @reserved1: reserved for the future.
+ * @id: the store id (#xmlSecKeyStoreId).
+ * @reserved0: reserved for the future.
+ * @reserved1: reserved for the future.
*
* The keys store.
*/
struct _xmlSecKeyStore {
- xmlSecKeyStoreId id;
+ xmlSecKeyStoreId id;
/* for the future */
- void* reserved0;
- void* reserved1;
+ void* reserved0;
+ void* reserved1;
};
-XMLSEC_EXPORT xmlSecKeyStorePtr xmlSecKeyStoreCreate (xmlSecKeyStoreId id);
-XMLSEC_EXPORT void xmlSecKeyStoreDestroy (xmlSecKeyStorePtr store);
-XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyStoreFindKey (xmlSecKeyStorePtr store,
- const xmlChar* name,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+XMLSEC_EXPORT xmlSecKeyStorePtr xmlSecKeyStoreCreate (xmlSecKeyStoreId id);
+XMLSEC_EXPORT void xmlSecKeyStoreDestroy (xmlSecKeyStorePtr store);
+XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyStoreFindKey (xmlSecKeyStorePtr store,
+ const xmlChar* name,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
/**
* xmlSecKeyStoreGetName:
- * @store: the pointer to store.
+ * @store: the pointer to store.
*
* Macro. Returns key store name.
*/
@@ -118,34 +118,34 @@ XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyStoreFindKey (xmlSecKeyStorePtr store,
/**
* xmlSecKeyStoreIsValid:
- * @store: the pointer to store.
+ * @store: the pointer to store.
*
* Macro. Returns 1 if @store is not NULL and @store->id is not NULL
* or 0 otherwise.
*/
#define xmlSecKeyStoreIsValid(store) \
- ((( store ) != NULL) && ((( store )->id) != NULL))
+ ((( store ) != NULL) && ((( store )->id) != NULL))
/**
* xmlSecKeyStoreCheckId:
- * @store: the pointer to store.
- * @storeId: the store Id.
+ * @store: the pointer to store.
+ * @storeId: the store Id.
*
* Macro. Returns 1 if @store is valid and @store's id is equal to @storeId.
*/
#define xmlSecKeyStoreCheckId(store, storeId) \
- (xmlSecKeyStoreIsValid(( store )) && \
- ((( store )->id) == ( storeId )))
+ (xmlSecKeyStoreIsValid(( store )) && \
+ ((( store )->id) == ( storeId )))
/**
* xmlSecKeyStoreCheckSize:
- * @store: the pointer to store.
- * @size: the expected size.
+ * @store: the pointer to store.
+ * @size: the expected size.
*
* Macro. Returns 1 if @store is valid and @stores's object has at least @size bytes.
*/
#define xmlSecKeyStoreCheckSize(store, size) \
- (xmlSecKeyStoreIsValid(( store )) && \
- (( store )->id->objSize >= size))
+ (xmlSecKeyStoreIsValid(( store )) && \
+ (( store )->id->objSize >= size))
/**************************************************************************
@@ -158,79 +158,79 @@ XMLSEC_EXPORT xmlSecKeyPtr xmlSecKeyStoreFindKey (xmlSecKeyStorePtr store,
*
* The "unknown" id.
*/
-#define xmlSecKeyStoreIdUnknown ((xmlSecKeyDataStoreId)NULL)
+#define xmlSecKeyStoreIdUnknown ((xmlSecKeyDataStoreId)NULL)
/**
* xmlSecKeyStoreInitializeMethod:
- * @store: the store.
+ * @store: the store.
*
* Keys store specific initialization method.
*
* Returns: 0 on success or a negative value if an error occurs.
*/
-typedef int (*xmlSecKeyStoreInitializeMethod) (xmlSecKeyStorePtr store);
+typedef int (*xmlSecKeyStoreInitializeMethod) (xmlSecKeyStorePtr store);
/**
* xmlSecKeyStoreFinalizeMethod:
- * @store: the store.
+ * @store: the store.
*
* Keys store specific finalization (destroy) method.
*/
-typedef void (*xmlSecKeyStoreFinalizeMethod) (xmlSecKeyStorePtr store);
+typedef void (*xmlSecKeyStoreFinalizeMethod) (xmlSecKeyStorePtr store);
/**
* xmlSecKeyStoreFindKeyMethod:
- * @store: the store.
- * @name: the desired key name.
- * @keyInfoCtx: the pointer to key info context.
+ * @store: the store.
+ * @name: the desired key name.
+ * @keyInfoCtx: the pointer to key info context.
*
* Keys store specific find method. The caller is responsible for destroying
* the returned key using #xmlSecKeyDestroy method.
*
* Returns: the pointer to a key or NULL if key is not found or an error occurs.
*/
-typedef xmlSecKeyPtr (*xmlSecKeyStoreFindKeyMethod) (xmlSecKeyStorePtr store,
- const xmlChar* name,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+typedef xmlSecKeyPtr (*xmlSecKeyStoreFindKeyMethod) (xmlSecKeyStorePtr store,
+ const xmlChar* name,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
/**
* xmlSecKeyStoreKlass:
- * @klassSize: the store klass size.
- * @objSize: the store obj size.
- * @name: the store's name.
- * @initialize: the store's initialization method.
- * @finalize: the store's finalization (destroy) method.
- * @findKey: the store's find method.
- * @reserved0: reserved for the future.
- * @reserved1: reserved for the future.
+ * @klassSize: the store klass size.
+ * @objSize: the store obj size.
+ * @name: the store's name.
+ * @initialize: the store's initialization method.
+ * @finalize: the store's finalization (destroy) method.
+ * @findKey: the store's find method.
+ * @reserved0: reserved for the future.
+ * @reserved1: reserved for the future.
*
* The keys store id (klass).
*/
struct _xmlSecKeyStoreKlass {
- xmlSecSize klassSize;
- xmlSecSize objSize;
+ xmlSecSize klassSize;
+ xmlSecSize objSize;
/* data */
- const xmlChar* name;
+ const xmlChar* name;
/* constructors/destructor */
- xmlSecKeyStoreInitializeMethod initialize;
- xmlSecKeyStoreFinalizeMethod finalize;
- xmlSecKeyStoreFindKeyMethod findKey;
+ xmlSecKeyStoreInitializeMethod initialize;
+ xmlSecKeyStoreFinalizeMethod finalize;
+ xmlSecKeyStoreFindKeyMethod findKey;
/* for the future */
- void* reserved0;
- void* reserved1;
+ void* reserved0;
+ void* reserved1;
};
/**
* xmlSecKeyStoreKlassGetName:
- * @klass: the pointer to store klass.
+ * @klass: the pointer to store klass.
*
* Macro. Returns store klass name.
*/
#define xmlSecKeyStoreKlassGetName(klass) \
- (((klass)) ? ((klass)->name) : NULL)
+ (((klass)) ? ((klass)->name) : NULL)
/****************************************************************************
@@ -243,17 +243,17 @@ struct _xmlSecKeyStoreKlass {
*
* A simple keys store klass id.
*/
-#define xmlSecSimpleKeysStoreId xmlSecSimpleKeysStoreGetKlass()
-XMLSEC_EXPORT xmlSecKeyStoreId xmlSecSimpleKeysStoreGetKlass (void);
-XMLSEC_EXPORT int xmlSecSimpleKeysStoreAdoptKey (xmlSecKeyStorePtr store,
- xmlSecKeyPtr key);
-XMLSEC_EXPORT int xmlSecSimpleKeysStoreLoad (xmlSecKeyStorePtr store,
- const char *uri,
- xmlSecKeysMngrPtr keysMngr);
-XMLSEC_EXPORT int xmlSecSimpleKeysStoreSave (xmlSecKeyStorePtr store,
- const char *filename,
- xmlSecKeyDataType type);
-XMLSEC_EXPORT xmlSecPtrListPtr xmlSecSimpleKeysStoreGetKeys (xmlSecKeyStorePtr store);
+#define xmlSecSimpleKeysStoreId xmlSecSimpleKeysStoreGetKlass()
+XMLSEC_EXPORT xmlSecKeyStoreId xmlSecSimpleKeysStoreGetKlass (void);
+XMLSEC_EXPORT int xmlSecSimpleKeysStoreAdoptKey (xmlSecKeyStorePtr store,
+ xmlSecKeyPtr key);
+XMLSEC_EXPORT int xmlSecSimpleKeysStoreLoad (xmlSecKeyStorePtr store,
+ const char *uri,
+ xmlSecKeysMngrPtr keysMngr);
+XMLSEC_EXPORT int xmlSecSimpleKeysStoreSave (xmlSecKeyStorePtr store,
+ const char *filename,
+ xmlSecKeyDataType type);
+XMLSEC_EXPORT xmlSecPtrListPtr xmlSecSimpleKeysStoreGetKeys (xmlSecKeyStorePtr store);
#ifdef __cplusplus
diff --git a/include/xmlsec/list.h b/include/xmlsec/list.h
index 47fa6d8..be94028 100644
--- a/include/xmlsec/list.h
+++ b/include/xmlsec/list.h
@@ -18,88 +18,88 @@ extern "C" {
#include <xmlsec/xmlsec.h>
#include <xmlsec/buffer.h>
-typedef const struct _xmlSecPtrListKlass xmlSecPtrListKlass,
- *xmlSecPtrListId;
-typedef struct _xmlSecPtrList xmlSecPtrList,
- *xmlSecPtrListPtr;
+typedef const struct _xmlSecPtrListKlass xmlSecPtrListKlass,
+ *xmlSecPtrListId;
+typedef struct _xmlSecPtrList xmlSecPtrList,
+ *xmlSecPtrListPtr;
/**
* xmlSecPtrList:
- * @id: the list items description.
- * @data: the list data.
- * @use: the current list size.
- * @max: the max (allocated) list size.
- * @allocMode: the memory allocation mode.
+ * @id: the list items description.
+ * @data: the list data.
+ * @use: the current list size.
+ * @max: the max (allocated) list size.
+ * @allocMode: the memory allocation mode.
*
* The pointers list.
*/
struct _xmlSecPtrList {
- xmlSecPtrListId id;
+ xmlSecPtrListId id;
- xmlSecPtr* data;
- xmlSecSize use;
- xmlSecSize max;
- xmlSecAllocMode allocMode;
+ xmlSecPtr* data;
+ xmlSecSize use;
+ xmlSecSize max;
+ xmlSecAllocMode allocMode;
};
-XMLSEC_EXPORT void xmlSecPtrListSetDefaultAllocMode(xmlSecAllocMode defAllocMode,
- xmlSecSize defInitialSize);
-
-
-XMLSEC_EXPORT int xmlSecPtrListInitialize (xmlSecPtrListPtr list,
- xmlSecPtrListId id);
-XMLSEC_EXPORT void xmlSecPtrListFinalize (xmlSecPtrListPtr list);
-XMLSEC_EXPORT xmlSecPtrListPtr xmlSecPtrListCreate (xmlSecPtrListId id);
-XMLSEC_EXPORT void xmlSecPtrListDestroy (xmlSecPtrListPtr list);
-XMLSEC_EXPORT void xmlSecPtrListEmpty (xmlSecPtrListPtr list);
-
-XMLSEC_EXPORT int xmlSecPtrListCopy (xmlSecPtrListPtr dst,
- xmlSecPtrListPtr src);
-XMLSEC_EXPORT xmlSecPtrListPtr xmlSecPtrListDuplicate (xmlSecPtrListPtr list);
-
-XMLSEC_EXPORT xmlSecSize xmlSecPtrListGetSize (xmlSecPtrListPtr list);
-XMLSEC_EXPORT xmlSecPtr xmlSecPtrListGetItem (xmlSecPtrListPtr list,
- xmlSecSize pos);
-XMLSEC_EXPORT int xmlSecPtrListAdd (xmlSecPtrListPtr list,
- xmlSecPtr item);
-XMLSEC_EXPORT int xmlSecPtrListSet (xmlSecPtrListPtr list,
- xmlSecPtr item,
- xmlSecSize pos);
-XMLSEC_EXPORT int xmlSecPtrListRemove (xmlSecPtrListPtr list,
- xmlSecSize pos);
-XMLSEC_EXPORT void xmlSecPtrListDebugDump (xmlSecPtrListPtr list,
- FILE* output);
-XMLSEC_EXPORT void xmlSecPtrListDebugXmlDump (xmlSecPtrListPtr list,
- FILE* output);
+XMLSEC_EXPORT void xmlSecPtrListSetDefaultAllocMode(xmlSecAllocMode defAllocMode,
+ xmlSecSize defInitialSize);
+
+
+XMLSEC_EXPORT int xmlSecPtrListInitialize (xmlSecPtrListPtr list,
+ xmlSecPtrListId id);
+XMLSEC_EXPORT void xmlSecPtrListFinalize (xmlSecPtrListPtr list);
+XMLSEC_EXPORT xmlSecPtrListPtr xmlSecPtrListCreate (xmlSecPtrListId id);
+XMLSEC_EXPORT void xmlSecPtrListDestroy (xmlSecPtrListPtr list);
+XMLSEC_EXPORT void xmlSecPtrListEmpty (xmlSecPtrListPtr list);
+
+XMLSEC_EXPORT int xmlSecPtrListCopy (xmlSecPtrListPtr dst,
+ xmlSecPtrListPtr src);
+XMLSEC_EXPORT xmlSecPtrListPtr xmlSecPtrListDuplicate (xmlSecPtrListPtr list);
+
+XMLSEC_EXPORT xmlSecSize xmlSecPtrListGetSize (xmlSecPtrListPtr list);
+XMLSEC_EXPORT xmlSecPtr xmlSecPtrListGetItem (xmlSecPtrListPtr list,
+ xmlSecSize pos);
+XMLSEC_EXPORT int xmlSecPtrListAdd (xmlSecPtrListPtr list,
+ xmlSecPtr item);
+XMLSEC_EXPORT int xmlSecPtrListSet (xmlSecPtrListPtr list,
+ xmlSecPtr item,
+ xmlSecSize pos);
+XMLSEC_EXPORT int xmlSecPtrListRemove (xmlSecPtrListPtr list,
+ xmlSecSize pos);
+XMLSEC_EXPORT void xmlSecPtrListDebugDump (xmlSecPtrListPtr list,
+ FILE* output);
+XMLSEC_EXPORT void xmlSecPtrListDebugXmlDump (xmlSecPtrListPtr list,
+ FILE* output);
/**
* xmlSecPtrListGetName:
- * @list: the ponter to list.
+ * @list: the ponter to list.
*
* Macro. Returns lists's name.
*/
#define xmlSecPtrListGetName(list) \
- (((list) != NULL) ? xmlSecPtrListKlassGetName((list)->id) : NULL)
+ (((list) != NULL) ? xmlSecPtrListKlassGetName((list)->id) : NULL)
/**
* xmlSecPtrListIsValid:
- * @list: the pointer to list.
+ * @list: the pointer to list.
*
* Macro. Returns 1 if @list is not NULL and @list->id is not NULL
* or 0 otherwise.
*/
#define xmlSecPtrListIsValid(list) \
- ((( list ) != NULL) && ((( list )->id) != NULL))
+ ((( list ) != NULL) && ((( list )->id) != NULL))
/**
* xmlSecPtrListCheckId:
- * @list: the pointer to list.
- * @dataId: the list Id.
+ * @list: the pointer to list.
+ * @dataId: the list Id.
*
* Macro. Returns 1 if @list is valid and @list's id is equal to @dataId.
*/
#define xmlSecPtrListCheckId(list, dataId) \
- (xmlSecPtrListIsValid(( list )) && \
- ((( list )->id) == ( dataId )))
+ (xmlSecPtrListIsValid(( list )) && \
+ ((( list )->id) == ( dataId )))
/**************************************************************************
@@ -112,63 +112,63 @@ XMLSEC_EXPORT void xmlSecPtrListDebugXmlDump (xmlSecPtrListPtr list,
*
* The "unknown" id.
*/
-#define xmlSecPtrListIdUnknown NULL
+#define xmlSecPtrListIdUnknown NULL
/**
* xmlSecPtrDuplicateItemMethod:
- * @ptr: the poinetr to list item.
+ * @ptr: the poinetr to list item.
*
* Duplicates item @ptr.
*
* Returns: pointer to new item copy or NULL if an error occurs.
*/
-typedef xmlSecPtr (*xmlSecPtrDuplicateItemMethod) (xmlSecPtr ptr);
+typedef xmlSecPtr (*xmlSecPtrDuplicateItemMethod) (xmlSecPtr ptr);
/**
* xmlSecPtrDestroyItemMethod:
- * @ptr: the poinetr to list item.
+ * @ptr: the poinetr to list item.
*
* Destroys list item @ptr.
*/
-typedef void (*xmlSecPtrDestroyItemMethod) (xmlSecPtr ptr);
+typedef void (*xmlSecPtrDestroyItemMethod) (xmlSecPtr ptr);
/**
* xmlSecPtrDebugDumpItemMethod:
- * @ptr: the poinetr to list item.
- * @output: the output FILE.
+ * @ptr: the poinetr to list item.
+ * @output: the output FILE.
*
* Prints debug information about @item to @output.
*/
-typedef void (*xmlSecPtrDebugDumpItemMethod) (xmlSecPtr ptr,
- FILE* output);
+typedef void (*xmlSecPtrDebugDumpItemMethod) (xmlSecPtr ptr,
+ FILE* output);
/**
* xmlSecPtrListKlass:
- * @name: the list klass name.
- * @duplicateItem: the duplciate item method.
- * @destroyItem: the destroy item method.
- * @debugDumpItem: the debug dump item method.
- * @debugXmlDumpItem: the debug dump item in xml format method.
+ * @name: the list klass name.
+ * @duplicateItem: the duplciate item method.
+ * @destroyItem: the destroy item method.
+ * @debugDumpItem: the debug dump item method.
+ * @debugXmlDumpItem: the debug dump item in xml format method.
*
* List klass.
*/
struct _xmlSecPtrListKlass {
- const xmlChar* name;
- xmlSecPtrDuplicateItemMethod duplicateItem;
- xmlSecPtrDestroyItemMethod destroyItem;
- xmlSecPtrDebugDumpItemMethod debugDumpItem;
- xmlSecPtrDebugDumpItemMethod debugXmlDumpItem;
+ const xmlChar* name;
+ xmlSecPtrDuplicateItemMethod duplicateItem;
+ xmlSecPtrDestroyItemMethod destroyItem;
+ xmlSecPtrDebugDumpItemMethod debugDumpItem;
+ xmlSecPtrDebugDumpItemMethod debugXmlDumpItem;
};
/**
* xmlSecPtrListKlassGetName:
- * @klass: the list klass.
+ * @klass: the list klass.
*2
* Macro. Returns the list klass name.
*/
#define xmlSecPtrListKlassGetName(klass) \
- (((klass) != NULL) ? ((klass)->name) : NULL)
+ (((klass) != NULL) ? ((klass)->name) : NULL)
/**************************************************************************
*
@@ -181,8 +181,8 @@ struct _xmlSecPtrListKlass {
* Strings list klass.
*/
#define xmlSecStringListId \
- xmlSecStringListGetKlass()
-XMLSEC_EXPORT xmlSecPtrListId xmlSecStringListGetKlass (void);
+ xmlSecStringListGetKlass()
+XMLSEC_EXPORT xmlSecPtrListId xmlSecStringListGetKlass (void);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/membuf.h b/include/xmlsec/membuf.h
index 4242f4f..b25e4c5 100644
--- a/include/xmlsec/membuf.h
+++ b/include/xmlsec/membuf.h
@@ -32,9 +32,9 @@ extern "C" {
* The Memory Buffer transform klass.
*/
#define xmlSecTransformMemBufId \
- xmlSecTransformMemBufGetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformMemBufGetKlass (void);
-XMLSEC_EXPORT xmlSecBufferPtr xmlSecTransformMemBufGetBuffer (xmlSecTransformPtr transform);
+ xmlSecTransformMemBufGetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformMemBufGetKlass (void);
+XMLSEC_EXPORT xmlSecBufferPtr xmlSecTransformMemBufGetBuffer (xmlSecTransformPtr transform);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/mscrypto/app.h b/include/xmlsec/mscrypto/app.h
index f75b219..7dd03e2 100644
--- a/include/xmlsec/mscrypto/app.h
+++ b/include/xmlsec/mscrypto/app.h
@@ -24,32 +24,32 @@ extern "C" {
/**
* Init/shutdown
*/
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppInit (const char* config);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppShutdown (void);
-XMLSEC_CRYPTO_EXPORT const char*xmlSecMSCryptoAppGetCertStoreName (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppInit (const char* config);
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppShutdown (void);
+XMLSEC_CRYPTO_EXPORT const char*xmlSecMSCryptoAppGetCertStoreName (void);
/**
* Keys Manager
*/
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppDefaultKeysMngrInit(
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppDefaultKeysMngrInit(
xmlSecKeysMngrPtr mngr);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppDefaultKeysMngrAdoptKey(
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppDefaultKeysMngrAdoptKey(
xmlSecKeysMngrPtr mngr,
xmlSecKeyPtr key);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppDefaultKeysMngrLoad(
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppDefaultKeysMngrLoad(
xmlSecKeysMngrPtr mngr,
- const char* uri);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppDefaultKeysMngrSave(
+ const char* uri);
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppDefaultKeysMngrSave(
xmlSecKeysMngrPtr mngr,
- const char* filename,
- xmlSecKeyDataType type);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppDefaultKeysMngrPrivateKeyLoad(
+ const char* filename,
+ xmlSecKeyDataType type);
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppDefaultKeysMngrPrivateKeyLoad(
xmlSecKeysMngrPtr mngr,
HCRYPTKEY hKey);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppDefaultKeysMngrPublicKeyLoad(
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppDefaultKeysMngrPublicKeyLoad(
xmlSecKeysMngrPtr mngr,
HCRYPTKEY hKey);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppDefaultKeysMngrSymKeyLoad(
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppDefaultKeysMngrSymKeyLoad(
xmlSecKeysMngrPtr mngr,
HCRYPTKEY hKey);
#ifndef XMLSEC_NO_X509
@@ -65,17 +65,17 @@ XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppDefaultKeysMngrAdoptUntrustedStore(
xmlSecKeysMngrPtr mngr,
HCERTSTORE untrustedStore);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppKeysMngrCertLoad(
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppKeysMngrCertLoad(
xmlSecKeysMngrPtr mngr,
- const char *filename,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppKeysMngrCertLoadMemory(
+ const char *filename,
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type);
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppKeysMngrCertLoadMemory(
xmlSecKeysMngrPtr mngr,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type);
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type);
#endif /* XMLSEC_NO_X509 */
@@ -83,36 +83,36 @@ XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppKeysMngrCertLoadMemory(
/**
* Keys
*/
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCryptoAppKeyLoad (const char *filename,
- xmlSecKeyDataFormat format,
- const char *pwd,
- void *pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCryptoAppKeyLoadMemory (const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCryptoAppKeyLoad (const char *filename,
+ xmlSecKeyDataFormat format,
+ const char *pwd,
+ void *pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCryptoAppKeyLoadMemory (const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format,
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
#ifndef XMLSEC_NO_X509
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCryptoAppPkcs12Load (const char *filename,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCryptoAppPkcs12LoadMemory (const xmlSecByte* data,
- xmlSecSize dataSize,
- const char* pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppKeyCertLoad (xmlSecKeyPtr key,
- const char* filename,
- xmlSecKeyDataFormat format);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppKeyCertLoadMemory (xmlSecKeyPtr key,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCryptoAppPkcs12Load (const char *filename,
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecMSCryptoAppPkcs12LoadMemory (const xmlSecByte* data,
+ xmlSecSize dataSize,
+ const char* pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppKeyCertLoad (xmlSecKeyPtr key,
+ const char* filename,
+ xmlSecKeyDataFormat format);
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoAppKeyCertLoadMemory (xmlSecKeyPtr key,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format);
#endif /* XMLSEC_NO_X509 */
-XMLSEC_CRYPTO_EXPORT void* xmlSecMSCryptoAppGetDefaultPwdCallback (void);
+XMLSEC_CRYPTO_EXPORT void* xmlSecMSCryptoAppGetDefaultPwdCallback (void);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/mscrypto/certkeys.h b/include/xmlsec/mscrypto/certkeys.h
index 132ab09..00565bf 100644
--- a/include/xmlsec/mscrypto/certkeys.h
+++ b/include/xmlsec/mscrypto/certkeys.h
@@ -20,12 +20,12 @@ extern "C" {
#include <xmlsec/keys.h>
#include <xmlsec/transforms.h>
-XMLSEC_CRYPTO_EXPORT PCCERT_CONTEXT xmlSecMSCryptoKeyDataGetCert (xmlSecKeyDataPtr data);
-XMLSEC_CRYPTO_EXPORT HCRYPTKEY xmlSecMSCryptoKeyDataGetKey (xmlSecKeyDataPtr data,
- xmlSecKeyDataType type);
-XMLSEC_CRYPTO_EXPORT HCRYPTKEY xmlSecMSCryptoKeyDataGetDecryptKey(xmlSecKeyDataPtr data);
-XMLSEC_CRYPTO_EXPORT PCCERT_CONTEXT xmlSecMSCryptoCertDup (PCCERT_CONTEXT pCert);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataPtr xmlSecMSCryptoCertAdopt (PCCERT_CONTEXT pCert, xmlSecKeyDataType type);
+XMLSEC_CRYPTO_EXPORT PCCERT_CONTEXT xmlSecMSCryptoKeyDataGetCert (xmlSecKeyDataPtr data);
+XMLSEC_CRYPTO_EXPORT HCRYPTKEY xmlSecMSCryptoKeyDataGetKey (xmlSecKeyDataPtr data,
+ xmlSecKeyDataType type);
+XMLSEC_CRYPTO_EXPORT HCRYPTKEY xmlSecMSCryptoKeyDataGetDecryptKey(xmlSecKeyDataPtr data);
+XMLSEC_CRYPTO_EXPORT PCCERT_CONTEXT xmlSecMSCryptoCertDup (PCCERT_CONTEXT pCert);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataPtr xmlSecMSCryptoCertAdopt (PCCERT_CONTEXT pCert, xmlSecKeyDataType type);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/mscrypto/crypto.h b/include/xmlsec/mscrypto/crypto.h
index 15caa36..c8d704a 100644
--- a/include/xmlsec/mscrypto/crypto.h
+++ b/include/xmlsec/mscrypto/crypto.h
@@ -21,33 +21,33 @@ extern "C" {
#include <xmlsec/transforms.h>
#include <xmlsec/dl.h>
-XMLSEC_CRYPTO_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoGetFunctions_mscrypto(void);
+XMLSEC_CRYPTO_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoGetFunctions_mscrypto(void);
/**
* Init shutdown
*/
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoInit (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoShutdown (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoInit (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoShutdown (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoKeysMngrInit (xmlSecKeysMngrPtr mngr);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoGenerateRandom (xmlSecBufferPtr buffer,
- size_t size);
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoKeysMngrInit (xmlSecKeysMngrPtr mngr);
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoGenerateRandom (xmlSecBufferPtr buffer,
+ size_t size);
-XMLSEC_CRYPTO_EXPORT void xmlSecMSCryptoErrorsDefaultCallback(const char* file,
- int line,
- const char* func,
- const char* errorObject,
- const char* errorSubject,
- int reason,
- const char* msg);
+XMLSEC_CRYPTO_EXPORT void xmlSecMSCryptoErrorsDefaultCallback(const char* file,
+ int line,
+ const char* func,
+ const char* errorObject,
+ const char* errorSubject,
+ int reason,
+ const char* msg);
/**
* Utils
*/
-XMLSEC_CRYPTO_EXPORT BYTE* xmlSecMSCryptoCertStrToName (DWORD dwCertEncodingType,
- LPCTSTR pszX500,
- DWORD dwStrType,
- DWORD* len);
+XMLSEC_CRYPTO_EXPORT BYTE* xmlSecMSCryptoCertStrToName (DWORD dwCertEncodingType,
+ LPCTSTR pszX500,
+ DWORD dwStrType,
+ DWORD* len);
@@ -64,8 +64,8 @@ XMLSEC_CRYPTO_EXPORT BYTE* xmlSecMSCryptoCertStrToName (DWORD dwCertEncodingTyp
* The DSA key klass.
*/
#define xmlSecMSCryptoKeyDataDsaId \
- xmlSecMSCryptoKeyDataDsaGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataDsaGetKlass (void);
+ xmlSecMSCryptoKeyDataDsaGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataDsaGetKlass (void);
/**
* xmlSecMSCryptoTransformDsaSha1Id:
@@ -73,7 +73,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataDsaGetKlass (void);
* The DSA SHA1 signature transform klass.
*/
#define xmlSecMSCryptoTransformDsaSha1Id \
- xmlSecMSCryptoTransformDsaSha1GetKlass()
+ xmlSecMSCryptoTransformDsaSha1GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformDsaSha1GetKlass(void);
#endif /* XMLSEC_NO_DSA */
@@ -91,8 +91,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformDsaSha1GetKlass(vo
* The GOST2001 key klass.
*/
#define xmlSecMSCryptoKeyDataGost2001Id \
- xmlSecMSCryptoKeyDataGost2001GetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataGost2001GetKlass (void);
+ xmlSecMSCryptoKeyDataGost2001GetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataGost2001GetKlass (void);
/**
* xmlSecMSCryptoTransformGost2001GostR3411_94Id:
@@ -100,7 +100,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataGost2001GetKlass (voi
* The GOST2001 GOSTR3411_94 signature transform klass.
*/
#define xmlSecMSCryptoTransformGost2001GostR3411_94Id \
- xmlSecMSCryptoTransformGost2001GostR3411_94GetKlass()
+ xmlSecMSCryptoTransformGost2001GostR3411_94GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformGost2001GostR3411_94GetKlass(void);
#endif /* XMLSEC_NO_GOST */
@@ -118,7 +118,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformGost2001GostR3411_
* The RSA key klass.
*/
#define xmlSecMSCryptoKeyDataRsaId \
- xmlSecMSCryptoKeyDataRsaGetKlass()
+ xmlSecMSCryptoKeyDataRsaGetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataRsaGetKlass(void);
@@ -128,8 +128,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataRsaGetKlass(void);
* The RSA-SHA1 signature transform klass.
*/
-#define xmlSecMSCryptoTransformRsaSha1Id \
- xmlSecMSCryptoTransformRsaSha1GetKlass()
+#define xmlSecMSCryptoTransformRsaSha1Id \
+ xmlSecMSCryptoTransformRsaSha1GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformRsaSha1GetKlass(void);
/**
@@ -138,7 +138,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformRsaSha1GetKlass(vo
* The RSA PKCS1 key transport transform klass.
*/
#define xmlSecMSCryptoTransformRsaPkcs1Id \
- xmlSecMSCryptoTransformRsaPkcs1GetKlass()
+ xmlSecMSCryptoTransformRsaPkcs1GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformRsaPkcs1GetKlass(void);
/**
@@ -148,7 +148,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformRsaPkcs1GetKlass(v
*/
/*
#define xmlSecMSCryptoTransformRsaOaepId \
- xmlSecMSCryptoTransformRsaOaepGetKlass()
+ xmlSecMSCryptoTransformRsaOaepGetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformRsaOaepGetKlass(void);
*/
#endif /* XMLSEC_NO_RSA */
@@ -166,7 +166,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformRsaOaepGetKlass(vo
* The SHA1 digest transform klass.
*/
#define xmlSecMSCryptoTransformSha1Id \
- xmlSecMSCryptoTransformSha1GetKlass()
+ xmlSecMSCryptoTransformSha1GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformSha1GetKlass(void);
#endif /* XMLSEC_NO_SHA1 */
@@ -183,7 +183,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformSha1GetKlass(void)
* The GOSTR3411_94 digest transform klass.
*/
#define xmlSecMSCryptoTransformGostR3411_94Id \
- xmlSecMSCryptoTransformGostR3411_94GetKlass()
+ xmlSecMSCryptoTransformGostR3411_94GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformGostR3411_94GetKlass(void);
#endif /* XMLSEC_NO_GOST */
@@ -199,19 +199,19 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformGostR3411_94GetKla
* The AES key data klass.
*/
#define xmlSecMSCryptoKeyDataAesId \
- xmlSecMSCryptoKeyDataAesGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataAesGetKlass(void);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoKeyDataAesSet (xmlSecKeyDataPtr data,
- const xmlSecByte* buf,
- xmlSecSize bufSize);
+ xmlSecMSCryptoKeyDataAesGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataAesGetKlass(void);
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoKeyDataAesSet (xmlSecKeyDataPtr data,
+ const xmlSecByte* buf,
+ xmlSecSize bufSize);
/**
* xmlSecMSCryptoTransformAes128CbcId:
*
* The AES128 CBC cipher transform klass.
*/
#define xmlSecMSCryptoTransformAes128CbcId \
- xmlSecMSCryptoTransformAes128CbcGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformAes128CbcGetKlass(void);
+ xmlSecMSCryptoTransformAes128CbcGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformAes128CbcGetKlass(void);
/**
* xmlSecMSCryptoTransformAes192CbcId:
@@ -219,8 +219,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformAes128CbcGetKlass(
* The AES192 CBC cipher transform klass.
*/
#define xmlSecMSCryptoTransformAes192CbcId \
- xmlSecMSCryptoTransformAes192CbcGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformAes192CbcGetKlass(void);
+ xmlSecMSCryptoTransformAes192CbcGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformAes192CbcGetKlass(void);
/**
* xmlSecMSCryptoTransformAes256CbcId:
@@ -228,8 +228,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformAes192CbcGetKlass(
* The AES256 CBC cipher transform klass.
*/
#define xmlSecMSCryptoTransformAes256CbcId \
- xmlSecMSCryptoTransformAes256CbcGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformAes256CbcGetKlass(void);
+ xmlSecMSCryptoTransformAes256CbcGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformAes256CbcGetKlass(void);
#endif /* XMLSEC_NO_AES */
@@ -247,8 +247,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformAes256CbcGetKlass(
* The DES key data klass.
*/
#define xmlSecMSCryptoKeyDataDesId \
- xmlSecMSCryptoKeyDataDesGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataDesGetKlass(void);
+ xmlSecMSCryptoKeyDataDesGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataDesGetKlass(void);
/**
* xmlSecMSCryptoTransformDes3CbcId:
@@ -256,7 +256,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataDesGetKlass(void);
* The DES3 CBC cipher transform klass.
*/
#define xmlSecMSCryptoTransformDes3CbcId \
- xmlSecMSCryptoTransformDes3CbcGetKlass()
+ xmlSecMSCryptoTransformDes3CbcGetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecMSCryptoTransformDes3CbcGetKlass(void);
diff --git a/include/xmlsec/mscrypto/keysstore.h b/include/xmlsec/mscrypto/keysstore.h
index 7d728be..dda5aa9 100644
--- a/include/xmlsec/mscrypto/keysstore.h
+++ b/include/xmlsec/mscrypto/keysstore.h
@@ -27,16 +27,16 @@ extern "C" {
*
* A MSCrypto keys store klass id.
*/
-#define xmlSecMSCryptoKeysStoreId xmlSecMSCryptoKeysStoreGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyStoreId xmlSecMSCryptoKeysStoreGetKlass (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoKeysStoreAdoptKey (xmlSecKeyStorePtr store,
- xmlSecKeyPtr key);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoKeysStoreLoad (xmlSecKeyStorePtr store,
- const char *uri,
- xmlSecKeysMngrPtr keysMngr);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoKeysStoreSave (xmlSecKeyStorePtr store,
- const char *filename,
- xmlSecKeyDataType type);
+#define xmlSecMSCryptoKeysStoreId xmlSecMSCryptoKeysStoreGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyStoreId xmlSecMSCryptoKeysStoreGetKlass (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoKeysStoreAdoptKey (xmlSecKeyStorePtr store,
+ xmlSecKeyPtr key);
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoKeysStoreLoad (xmlSecKeyStorePtr store,
+ const char *uri,
+ xmlSecKeysMngrPtr keysMngr);
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoKeysStoreSave (xmlSecKeyStorePtr store,
+ const char *filename,
+ xmlSecKeyDataType type);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/mscrypto/symbols.h b/include/xmlsec/mscrypto/symbols.h
index 6565255..9ff1cbb 100644
--- a/include/xmlsec/mscrypto/symbols.h
+++ b/include/xmlsec/mscrypto/symbols.h
@@ -25,70 +25,70 @@ extern "C" {
/**
* Crypto Init/shutdown
*/
-#define xmlSecCryptoInit xmlSecMSCryptoInit
-#define xmlSecCryptoShutdown xmlSecMSCryptoShutdown
+#define xmlSecCryptoInit xmlSecMSCryptoInit
+#define xmlSecCryptoShutdown xmlSecMSCryptoShutdown
-#define xmlSecCryptoKeysMngrInit xmlSecMSCryptoKeysMngrInit
+#define xmlSecCryptoKeysMngrInit xmlSecMSCryptoKeysMngrInit
/**
* Key data ids
*/
-#define xmlSecKeyDataAesId xmlSecMSCryptoKeyDataAesId
-#define xmlSecKeyDataDesId xmlSecMSCryptoKeyDataDesId
-#define xmlSecKeyDataDsaId xmlSecMSCryptoKeyDataDsaId
+#define xmlSecKeyDataAesId xmlSecMSCryptoKeyDataAesId
+#define xmlSecKeyDataDesId xmlSecMSCryptoKeyDataDesId
+#define xmlSecKeyDataDsaId xmlSecMSCryptoKeyDataDsaId
#define xmlSecKeyDataGost2001Id xmlSecMSCryptoKeyDataGost2001Id
-#define xmlSecKeyDataHmacId xmlSecMSCryptoKeyDataHmacId
-#define xmlSecKeyDataRsaId xmlSecMSCryptoKeyDataRsaId
-#define xmlSecKeyDataX509Id xmlSecMSCryptoKeyDataX509Id
+#define xmlSecKeyDataHmacId xmlSecMSCryptoKeyDataHmacId
+#define xmlSecKeyDataRsaId xmlSecMSCryptoKeyDataRsaId
+#define xmlSecKeyDataX509Id xmlSecMSCryptoKeyDataX509Id
#define xmlSecKeyDataRawX509CertId xmlSecMSCryptoKeyDataRawX509CertId
/**
* Key data store ids
*/
-#define xmlSecX509StoreId xmlSecMSCryptoX509StoreId
+#define xmlSecX509StoreId xmlSecMSCryptoX509StoreId
/**
* Crypto transforms ids
*/
-#define xmlSecTransformAes128CbcId xmlSecMSCryptoTransformAes128CbcId
-#define xmlSecTransformAes192CbcId xmlSecMSCryptoTransformAes192CbcId
-#define xmlSecTransformAes256CbcId xmlSecMSCryptoTransformAes256CbcId
-#define xmlSecTransformKWAes128Id xmlSecMSCryptoTransformKWAes128Id
-#define xmlSecTransformKWAes192Id xmlSecMSCryptoTransformKWAes192Id
-#define xmlSecTransformKWAes256Id xmlSecMSCryptoTransformKWAes256Id
-#define xmlSecTransformDes3CbcId xmlSecMSCryptoTransformDes3CbcId
-#define xmlSecTransformKWDes3Id xmlSecMSCryptoTransformKWDes3Id
-#define xmlSecTransformDsaSha1Id xmlSecMSCryptoTransformDsaSha1Id
-#define xmlSecTransformGost2001GostR3411_94Id xmlSecMSCryptoTransformGost2001GostR3411_94Id
-#define xmlSecTransformHmacMd5Id xmlSecMSCryptoTransformHmacMd5Id
-#define xmlSecTransformHmacRipemd160Id xmlSecMSCryptoTransformHmacRipemd160Id
-#define xmlSecTransformHmacSha1Id xmlSecMSCryptoTransformHmacSha1Id
-#define xmlSecTransformRipemd160Id xmlSecMSCryptoTransformRipemd160Id
-#define xmlSecTransformRsaSha1Id xmlSecMSCryptoTransformRsaSha1Id
-#define xmlSecTransformRsaPkcs1Id xmlSecMSCryptoTransformRsaPkcs1Id
-#define xmlSecTransformRsaOaepId xmlSecMSCryptoTransformRsaOaepId
-#define xmlSecTransformSha1Id xmlSecMSCryptoTransformSha1Id
-#define xmlSecTransformGostR3411_94Id xmlSecMSCryptoTransformGostR3411_94Id
+#define xmlSecTransformAes128CbcId xmlSecMSCryptoTransformAes128CbcId
+#define xmlSecTransformAes192CbcId xmlSecMSCryptoTransformAes192CbcId
+#define xmlSecTransformAes256CbcId xmlSecMSCryptoTransformAes256CbcId
+#define xmlSecTransformKWAes128Id xmlSecMSCryptoTransformKWAes128Id
+#define xmlSecTransformKWAes192Id xmlSecMSCryptoTransformKWAes192Id
+#define xmlSecTransformKWAes256Id xmlSecMSCryptoTransformKWAes256Id
+#define xmlSecTransformDes3CbcId xmlSecMSCryptoTransformDes3CbcId
+#define xmlSecTransformKWDes3Id xmlSecMSCryptoTransformKWDes3Id
+#define xmlSecTransformDsaSha1Id xmlSecMSCryptoTransformDsaSha1Id
+#define xmlSecTransformGost2001GostR3411_94Id xmlSecMSCryptoTransformGost2001GostR3411_94Id
+#define xmlSecTransformHmacMd5Id xmlSecMSCryptoTransformHmacMd5Id
+#define xmlSecTransformHmacRipemd160Id xmlSecMSCryptoTransformHmacRipemd160Id
+#define xmlSecTransformHmacSha1Id xmlSecMSCryptoTransformHmacSha1Id
+#define xmlSecTransformRipemd160Id xmlSecMSCryptoTransformRipemd160Id
+#define xmlSecTransformRsaSha1Id xmlSecMSCryptoTransformRsaSha1Id
+#define xmlSecTransformRsaPkcs1Id xmlSecMSCryptoTransformRsaPkcs1Id
+#define xmlSecTransformRsaOaepId xmlSecMSCryptoTransformRsaOaepId
+#define xmlSecTransformSha1Id xmlSecMSCryptoTransformSha1Id
+#define xmlSecTransformGostR3411_94Id xmlSecMSCryptoTransformGostR3411_94Id
/**
* High level routines form xmlsec command line utility
*/
-#define xmlSecCryptoAppInit xmlSecMSCryptoAppInit
-#define xmlSecCryptoAppShutdown xmlSecMSCryptoAppShutdown
-#define xmlSecCryptoAppDefaultKeysMngrInit xmlSecMSCryptoAppDefaultKeysMngrInit
-#define xmlSecCryptoAppDefaultKeysMngrAdoptKey xmlSecMSCryptoAppDefaultKeysMngrAdoptKey
-#define xmlSecCryptoAppDefaultKeysMngrLoad xmlSecMSCryptoAppDefaultKeysMngrLoad
-#define xmlSecCryptoAppDefaultKeysMngrSave xmlSecMSCryptoAppDefaultKeysMngrSave
-#define xmlSecCryptoAppKeysMngrCertLoad xmlSecMSCryptoAppKeysMngrCertLoad
-#define xmlSecCryptoAppKeysMngrCertLoadMemory xmlSecMSCryptoAppKeysMngrCertLoadMemory
-#define xmlSecCryptoAppKeyLoad xmlSecMSCryptoAppKeyLoad
-#define xmlSecCryptoAppPkcs12Load xmlSecMSCryptoAppPkcs12Load
-#define xmlSecCryptoAppKeyCertLoad xmlSecMSCryptoAppKeyCertLoad
-#define xmlSecCryptoAppKeyLoadMemory xmlSecMSCryptoAppKeyLoadMemory
-#define xmlSecCryptoAppPkcs12LoadMemory xmlSecMSCryptoAppPkcs12LoadMemory
-#define xmlSecCryptoAppKeyCertLoadMemory xmlSecMSCryptoAppKeyCertLoadMemory
-#define xmlSecCryptoAppGetDefaultPwdCallback xmlSecMSCryptoAppGetDefaultPwdCallback
+#define xmlSecCryptoAppInit xmlSecMSCryptoAppInit
+#define xmlSecCryptoAppShutdown xmlSecMSCryptoAppShutdown
+#define xmlSecCryptoAppDefaultKeysMngrInit xmlSecMSCryptoAppDefaultKeysMngrInit
+#define xmlSecCryptoAppDefaultKeysMngrAdoptKey xmlSecMSCryptoAppDefaultKeysMngrAdoptKey
+#define xmlSecCryptoAppDefaultKeysMngrLoad xmlSecMSCryptoAppDefaultKeysMngrLoad
+#define xmlSecCryptoAppDefaultKeysMngrSave xmlSecMSCryptoAppDefaultKeysMngrSave
+#define xmlSecCryptoAppKeysMngrCertLoad xmlSecMSCryptoAppKeysMngrCertLoad
+#define xmlSecCryptoAppKeysMngrCertLoadMemory xmlSecMSCryptoAppKeysMngrCertLoadMemory
+#define xmlSecCryptoAppKeyLoad xmlSecMSCryptoAppKeyLoad
+#define xmlSecCryptoAppPkcs12Load xmlSecMSCryptoAppPkcs12Load
+#define xmlSecCryptoAppKeyCertLoad xmlSecMSCryptoAppKeyCertLoad
+#define xmlSecCryptoAppKeyLoadMemory xmlSecMSCryptoAppKeyLoadMemory
+#define xmlSecCryptoAppPkcs12LoadMemory xmlSecMSCryptoAppPkcs12LoadMemory
+#define xmlSecCryptoAppKeyCertLoadMemory xmlSecMSCryptoAppKeyCertLoadMemory
+#define xmlSecCryptoAppGetDefaultPwdCallback xmlSecMSCryptoAppGetDefaultPwdCallback
#endif /* XMLSEC_CRYPTO_MSCRYPTO */
diff --git a/include/xmlsec/mscrypto/x509.h b/include/xmlsec/mscrypto/x509.h
index c84b6f6..f460c03 100644
--- a/include/xmlsec/mscrypto/x509.h
+++ b/include/xmlsec/mscrypto/x509.h
@@ -28,23 +28,23 @@ extern "C" {
* The MSCrypto X509 data klass.
*/
#define xmlSecMSCryptoKeyDataX509Id \
- xmlSecMSCryptoKeyDataX509GetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataX509GetKlass(void);
+ xmlSecMSCryptoKeyDataX509GetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataX509GetKlass(void);
-XMLSEC_CRYPTO_EXPORT PCCERT_CONTEXT xmlSecMSCryptoKeyDataX509GetKeyCert (xmlSecKeyDataPtr data);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoKeyDataX509AdoptKeyCert (xmlSecKeyDataPtr data,
- PCCERT_CONTEXT cert);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoKeyDataX509AdoptCert (xmlSecKeyDataPtr data,
- PCCERT_CONTEXT cert);
-XMLSEC_CRYPTO_EXPORT PCCERT_CONTEXT xmlSecMSCryptoKeyDataX509GetCert (xmlSecKeyDataPtr data,
- xmlSecSize pos);
-XMLSEC_CRYPTO_EXPORT xmlSecSize xmlSecMSCryptoKeyDataX509GetCertsSize (xmlSecKeyDataPtr data);
+XMLSEC_CRYPTO_EXPORT PCCERT_CONTEXT xmlSecMSCryptoKeyDataX509GetKeyCert (xmlSecKeyDataPtr data);
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoKeyDataX509AdoptKeyCert (xmlSecKeyDataPtr data,
+ PCCERT_CONTEXT cert);
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoKeyDataX509AdoptCert (xmlSecKeyDataPtr data,
+ PCCERT_CONTEXT cert);
+XMLSEC_CRYPTO_EXPORT PCCERT_CONTEXT xmlSecMSCryptoKeyDataX509GetCert (xmlSecKeyDataPtr data,
+ xmlSecSize pos);
+XMLSEC_CRYPTO_EXPORT xmlSecSize xmlSecMSCryptoKeyDataX509GetCertsSize (xmlSecKeyDataPtr data);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoKeyDataX509AdoptCrl (xmlSecKeyDataPtr data,
- PCCRL_CONTEXT crl);
-XMLSEC_CRYPTO_EXPORT PCCRL_CONTEXT xmlSecMSCryptoKeyDataX509GetCrl (xmlSecKeyDataPtr data,
- xmlSecSize pos);
-XMLSEC_CRYPTO_EXPORT xmlSecSize xmlSecMSCryptoKeyDataX509GetCrlsSize (xmlSecKeyDataPtr data);
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoKeyDataX509AdoptCrl (xmlSecKeyDataPtr data,
+ PCCRL_CONTEXT crl);
+XMLSEC_CRYPTO_EXPORT PCCRL_CONTEXT xmlSecMSCryptoKeyDataX509GetCrl (xmlSecKeyDataPtr data,
+ xmlSecSize pos);
+XMLSEC_CRYPTO_EXPORT xmlSecSize xmlSecMSCryptoKeyDataX509GetCrlsSize (xmlSecKeyDataPtr data);
/**
@@ -53,8 +53,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecSize xmlSecMSCryptoKeyDataX509GetCrlsSize (xmlSecKey
* The MSCrypto raw X509 certificate klass.
*/
#define xmlSecMSCryptoKeyDataRawX509CertId \
- xmlSecMSCryptoKeyDataRawX509CertGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataRawX509CertGetKlass(void);
+ xmlSecMSCryptoKeyDataRawX509CertGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataRawX509CertGetKlass(void);
/**
* xmlSecMSCryptoX509StoreId:
@@ -62,38 +62,38 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecMSCryptoKeyDataRawX509CertGetKlass(v
* The MSCrypto X509 store klass.
*/
#define xmlSecMSCryptoX509StoreId \
- xmlSecMSCryptoX509StoreGetKlass()
+ xmlSecMSCryptoX509StoreGetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecKeyDataStoreId xmlSecMSCryptoX509StoreGetKlass(void);
-XMLSEC_CRYPTO_EXPORT PCCERT_CONTEXT xmlSecMSCryptoX509StoreFindCert (xmlSecKeyDataStorePtr store,
- xmlChar *subjectName,
- xmlChar *issuerName,
- xmlChar *issuerSerial,
- xmlChar *ski,
- xmlSecKeyInfoCtx* keyInfoCtx);
-
-
-XMLSEC_CRYPTO_EXPORT PCCERT_CONTEXT xmlSecMSCryptoX509StoreVerify (xmlSecKeyDataStorePtr store,
- HCERTSTORE certs,
- xmlSecKeyInfoCtx* keyInfoCtx);
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoX509StoreAdoptCert (xmlSecKeyDataStorePtr store,
- PCCERT_CONTEXT cert,
- xmlSecKeyDataType type);
-
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoX509StoreAdoptKeyStore (
- xmlSecKeyDataStorePtr store,
- HCERTSTORE keyStore
- ) ;
-
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoX509StoreAdoptTrustedStore (
- xmlSecKeyDataStorePtr store,
- HCERTSTORE trustedStore
- ) ;
-
-XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoX509StoreAdoptUntrustedStore (
- xmlSecKeyDataStorePtr store,
- HCERTSTORE untrustedStore
- ) ;
+XMLSEC_CRYPTO_EXPORT PCCERT_CONTEXT xmlSecMSCryptoX509StoreFindCert (xmlSecKeyDataStorePtr store,
+ xmlChar *subjectName,
+ xmlChar *issuerName,
+ xmlChar *issuerSerial,
+ xmlChar *ski,
+ xmlSecKeyInfoCtx* keyInfoCtx);
+
+
+XMLSEC_CRYPTO_EXPORT PCCERT_CONTEXT xmlSecMSCryptoX509StoreVerify (xmlSecKeyDataStorePtr store,
+ HCERTSTORE certs,
+ xmlSecKeyInfoCtx* keyInfoCtx);
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoX509StoreAdoptCert (xmlSecKeyDataStorePtr store,
+ PCCERT_CONTEXT cert,
+ xmlSecKeyDataType type);
+
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoX509StoreAdoptKeyStore (
+ xmlSecKeyDataStorePtr store,
+ HCERTSTORE keyStore
+ ) ;
+
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoX509StoreAdoptTrustedStore (
+ xmlSecKeyDataStorePtr store,
+ HCERTSTORE trustedStore
+ ) ;
+
+XMLSEC_CRYPTO_EXPORT int xmlSecMSCryptoX509StoreAdoptUntrustedStore (
+ xmlSecKeyDataStorePtr store,
+ HCERTSTORE untrustedStore
+ ) ;
XMLSEC_CRYPTO_EXPORT void xmlSecMSCryptoX509StoreEnableSystemTrustedCerts (
xmlSecKeyDataStorePtr store,
diff --git a/include/xmlsec/nodeset.h b/include/xmlsec/nodeset.h
index 7630467..62af10e 100644
--- a/include/xmlsec/nodeset.h
+++ b/include/xmlsec/nodeset.h
@@ -20,21 +20,21 @@ extern "C" {
#include <xmlsec/xmlsec.h>
-typedef struct _xmlSecNodeSet xmlSecNodeSet, *xmlSecNodeSetPtr;
+typedef struct _xmlSecNodeSet xmlSecNodeSet, *xmlSecNodeSetPtr;
/**
* xmlSecNodeSetType:
- * @xmlSecNodeSetNormal: nodes set = nodes in the list.
- * @xmlSecNodeSetInvert: nodes set = all document nodes minus nodes in the list.
- * @xmlSecNodeSetTree: nodes set = nodes in the list and all their subtress.
- * @xmlSecNodeSetTreeWithoutComments: nodes set = nodes in the list and
- * all their subtress but no comment nodes.
- * @xmlSecNodeSetTreeInvert: nodes set = all document nodes minus nodes in the
- * list and all their subtress.
- * @xmlSecNodeSetTreeWithoutCommentsInvert: nodes set = all document nodes
- * minus (nodes in the list and all their subtress
- * plus all comment nodes).
- * @xmlSecNodeSetList: nodes set = all nodes in the chidren list of nodes sets.
+ * @xmlSecNodeSetNormal: nodes set = nodes in the list.
+ * @xmlSecNodeSetInvert: nodes set = all document nodes minus nodes in the list.
+ * @xmlSecNodeSetTree: nodes set = nodes in the list and all their subtress.
+ * @xmlSecNodeSetTreeWithoutComments: nodes set = nodes in the list and
+ * all their subtress but no comment nodes.
+ * @xmlSecNodeSetTreeInvert: nodes set = all document nodes minus nodes in the
+ * list and all their subtress.
+ * @xmlSecNodeSetTreeWithoutCommentsInvert: nodes set = all document nodes
+ * minus (nodes in the list and all their subtress
+ * plus all comment nodes).
+ * @xmlSecNodeSetList: nodes set = all nodes in the chidren list of nodes sets.
*
* The basic nodes sets types.
*/
@@ -50,9 +50,9 @@ typedef enum {
/**
* xmlSecNodeSetOp:
- * @xmlSecNodeSetIntersection: intersection.
- * @xmlSecNodeSetSubtraction: subtraction.
- * @xmlSecNodeSetUnion: union.
+ * @xmlSecNodeSetIntersection: intersection.
+ * @xmlSecNodeSetSubtraction: subtraction.
+ * @xmlSecNodeSetUnion: union.
*
* The simple nodes sets operations.
*/
@@ -64,73 +64,73 @@ typedef enum {
/**
* xmlSecNodeSet:
- * @nodes: the nodes list.
- * @doc: the parent XML document.
- * @destroyDoc: the flag: if set to 1 then @doc will
- * be destroyed when node set is destroyed.
- * @type: the nodes set type.
- * @op: the operation type.
- * @next: the next nodes set.
- * @prev: the previous nodes set.
- * @children: the children list (valid only if type
- * equal to #xmlSecNodeSetList).
+ * @nodes: the nodes list.
+ * @doc: the parent XML document.
+ * @destroyDoc: the flag: if set to 1 then @doc will
+ * be destroyed when node set is destroyed.
+ * @type: the nodes set type.
+ * @op: the operation type.
+ * @next: the next nodes set.
+ * @prev: the previous nodes set.
+ * @children: the children list (valid only if type
+ * equal to #xmlSecNodeSetList).
*
* The enchanced nodes set.
*/
struct _xmlSecNodeSet {
- xmlNodeSetPtr nodes;
- xmlDocPtr doc;
- int destroyDoc;
- xmlSecNodeSetType type;
- xmlSecNodeSetOp op;
- xmlSecNodeSetPtr next;
- xmlSecNodeSetPtr prev;
- xmlSecNodeSetPtr children;
+ xmlNodeSetPtr nodes;
+ xmlDocPtr doc;
+ int destroyDoc;
+ xmlSecNodeSetType type;
+ xmlSecNodeSetOp op;
+ xmlSecNodeSetPtr next;
+ xmlSecNodeSetPtr prev;
+ xmlSecNodeSetPtr children;
};
/**
* xmlSecNodeSetWalkCallback:
- * @nset: the pointer to #xmlSecNodeSet structure.
- * @cur: the pointer current XML node.
- * @parent: the pointer to the @cur parent node.
- * @data: the pointer to application specific data.
+ * @nset: the pointer to #xmlSecNodeSet structure.
+ * @cur: the pointer current XML node.
+ * @parent: the pointer to the @cur parent node.
+ * @data: the pointer to application specific data.
*
* The callback function called once per each node in the nodes set.
*
* Returns: 0 on success or a negative value if an error occurs
* an walk procedure should be interrupted.
*/
-typedef int (*xmlSecNodeSetWalkCallback) (xmlSecNodeSetPtr nset,
- xmlNodePtr cur,
- xmlNodePtr parent,
- void* data);
+typedef int (*xmlSecNodeSetWalkCallback) (xmlSecNodeSetPtr nset,
+ xmlNodePtr cur,
+ xmlNodePtr parent,
+ void* data);
-XMLSEC_EXPORT xmlSecNodeSetPtr xmlSecNodeSetCreate (xmlDocPtr doc,
- xmlNodeSetPtr nodes,
- xmlSecNodeSetType type);
-XMLSEC_EXPORT void xmlSecNodeSetDestroy (xmlSecNodeSetPtr nset);
-XMLSEC_EXPORT void xmlSecNodeSetDocDestroy (xmlSecNodeSetPtr nset);
-XMLSEC_EXPORT int xmlSecNodeSetContains (xmlSecNodeSetPtr nset,
- xmlNodePtr node,
- xmlNodePtr parent);
-XMLSEC_EXPORT xmlSecNodeSetPtr xmlSecNodeSetAdd (xmlSecNodeSetPtr nset,
- xmlSecNodeSetPtr newNSet,
- xmlSecNodeSetOp op);
-XMLSEC_EXPORT xmlSecNodeSetPtr xmlSecNodeSetAddList (xmlSecNodeSetPtr nset,
- xmlSecNodeSetPtr newNSet,
- xmlSecNodeSetOp op);
-XMLSEC_EXPORT xmlSecNodeSetPtr xmlSecNodeSetGetChildren(xmlDocPtr doc,
- const xmlNodePtr parent,
- int withComments,
- int invert);
-XMLSEC_EXPORT int xmlSecNodeSetWalk (xmlSecNodeSetPtr nset,
- xmlSecNodeSetWalkCallback walkFunc,
- void* data);
-XMLSEC_EXPORT int xmlSecNodeSetDumpTextNodes(xmlSecNodeSetPtr nset,
- xmlOutputBufferPtr out);
-XMLSEC_EXPORT void xmlSecNodeSetDebugDump (xmlSecNodeSetPtr nset,
- FILE *output);
-
+XMLSEC_EXPORT xmlSecNodeSetPtr xmlSecNodeSetCreate (xmlDocPtr doc,
+ xmlNodeSetPtr nodes,
+ xmlSecNodeSetType type);
+XMLSEC_EXPORT void xmlSecNodeSetDestroy (xmlSecNodeSetPtr nset);
+XMLSEC_EXPORT void xmlSecNodeSetDocDestroy (xmlSecNodeSetPtr nset);
+XMLSEC_EXPORT int xmlSecNodeSetContains (xmlSecNodeSetPtr nset,
+ xmlNodePtr node,
+ xmlNodePtr parent);
+XMLSEC_EXPORT xmlSecNodeSetPtr xmlSecNodeSetAdd (xmlSecNodeSetPtr nset,
+ xmlSecNodeSetPtr newNSet,
+ xmlSecNodeSetOp op);
+XMLSEC_EXPORT xmlSecNodeSetPtr xmlSecNodeSetAddList (xmlSecNodeSetPtr nset,
+ xmlSecNodeSetPtr newNSet,
+ xmlSecNodeSetOp op);
+XMLSEC_EXPORT xmlSecNodeSetPtr xmlSecNodeSetGetChildren(xmlDocPtr doc,
+ const xmlNodePtr parent,
+ int withComments,
+ int invert);
+XMLSEC_EXPORT int xmlSecNodeSetWalk (xmlSecNodeSetPtr nset,
+ xmlSecNodeSetWalkCallback walkFunc,
+ void* data);
+XMLSEC_EXPORT int xmlSecNodeSetDumpTextNodes(xmlSecNodeSetPtr nset,
+ xmlOutputBufferPtr out);
+XMLSEC_EXPORT void xmlSecNodeSetDebugDump (xmlSecNodeSetPtr nset,
+ FILE *output);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/include/xmlsec/nss/app.h b/include/xmlsec/nss/app.h
index b78492f..5f88dd0 100644
--- a/include/xmlsec/nss/app.h
+++ b/include/xmlsec/nss/app.h
@@ -25,84 +25,84 @@ extern "C" {
/**
* Init/shutdown
*/
-XMLSEC_CRYPTO_EXPORT int xmlSecNssAppInit (const char* config);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssAppShutdown (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssAppInit (const char* config);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssAppShutdown (void);
/**
* Keys Manager
*/
-XMLSEC_CRYPTO_EXPORT int xmlSecNssAppDefaultKeysMngrInit (xmlSecKeysMngrPtr mngr);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr,
- xmlSecKeyPtr key);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssAppDefaultKeysMngrLoad (xmlSecKeysMngrPtr mngr,
- const char* uri);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssAppDefaultKeysMngrSave (xmlSecKeysMngrPtr mngr,
- const char* filename,
- xmlSecKeyDataType type);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssAppDefaultKeysMngrInit (xmlSecKeysMngrPtr mngr);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr,
+ xmlSecKeyPtr key);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssAppDefaultKeysMngrLoad (xmlSecKeysMngrPtr mngr,
+ const char* uri);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssAppDefaultKeysMngrSave (xmlSecKeysMngrPtr mngr,
+ const char* filename,
+ xmlSecKeyDataType type);
#ifndef XMLSEC_NO_X509
-XMLSEC_CRYPTO_EXPORT int xmlSecNssAppKeysMngrCertLoad (xmlSecKeysMngrPtr mngr,
- const char *filename,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr,
- const xmlSecByte *data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssAppKeysMngrCertLoadSECItem(xmlSecKeysMngrPtr mngr,
- SECItem* secItem,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssAppKeysMngrCertLoad (xmlSecKeysMngrPtr mngr,
+ const char *filename,
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr,
+ const xmlSecByte *data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssAppKeysMngrCertLoadSECItem(xmlSecKeysMngrPtr mngr,
+ SECItem* secItem,
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type);
#endif /* XMLSEC_NO_X509 */
/**
* Keys
*/
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecNssAppKeyLoad (const char *filename,
- xmlSecKeyDataFormat format,
- const char *pwd,
- void *pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecNssAppKeyLoadMemory (const xmlSecByte *data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format,
- const char *pwd,
- void *pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecNssAppKeyLoadSECItem (SECItem* secItem,
- xmlSecKeyDataFormat format,
- const char *pwd,
- void *pwdCallback,
- void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecNssAppKeyLoad (const char *filename,
+ xmlSecKeyDataFormat format,
+ const char *pwd,
+ void *pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecNssAppKeyLoadMemory (const xmlSecByte *data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format,
+ const char *pwd,
+ void *pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecNssAppKeyLoadSECItem (SECItem* secItem,
+ xmlSecKeyDataFormat format,
+ const char *pwd,
+ void *pwdCallback,
+ void* pwdCallbackCtx);
#ifndef XMLSEC_NO_X509
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecNssAppPkcs12Load (const char *filename,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecNssAppPkcs12LoadMemory (const xmlSecByte *data,
- xmlSecSize dataSize,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecNssAppPkcs12LoadSECItem (SECItem* secItem,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssAppKeyCertLoad (xmlSecKeyPtr key,
- const char* filename,
- xmlSecKeyDataFormat format);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssAppKeyCertLoadMemory (xmlSecKeyPtr key,
- const xmlSecByte *data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssAppKeyCertLoadSECItem (xmlSecKeyPtr key,
- SECItem* secItem,
- xmlSecKeyDataFormat format);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecNssAppKeyFromCertLoadSECItem(SECItem* secItem,
- xmlSecKeyDataFormat format);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecNssAppPkcs12Load (const char *filename,
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecNssAppPkcs12LoadMemory (const xmlSecByte *data,
+ xmlSecSize dataSize,
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecNssAppPkcs12LoadSECItem (SECItem* secItem,
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssAppKeyCertLoad (xmlSecKeyPtr key,
+ const char* filename,
+ xmlSecKeyDataFormat format);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssAppKeyCertLoadMemory (xmlSecKeyPtr key,
+ const xmlSecByte *data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssAppKeyCertLoadSECItem (xmlSecKeyPtr key,
+ SECItem* secItem,
+ xmlSecKeyDataFormat format);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecNssAppKeyFromCertLoadSECItem(SECItem* secItem,
+ xmlSecKeyDataFormat format);
#endif /* XMLSEC_NO_X509 */
-XMLSEC_CRYPTO_EXPORT void* xmlSecNssAppGetDefaultPwdCallback(void);
+XMLSEC_CRYPTO_EXPORT void* xmlSecNssAppGetDefaultPwdCallback(void);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/nss/bignum.h b/include/xmlsec/nss/bignum.h
index b5d98bc..c2eb49e 100644
--- a/include/xmlsec/nss/bignum.h
+++ b/include/xmlsec/nss/bignum.h
@@ -22,12 +22,12 @@ extern "C" {
#include <xmlsec/xmlsec.h>
-XMLSEC_CRYPTO_EXPORT SECItem* xmlSecNssNodeGetBigNumValue (PRArenaPool *arena,
- const xmlNodePtr cur,
- SECItem *a);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssNodeSetBigNumValue (xmlNodePtr cur,
- const SECItem *a,
- int addLineBreaks);
+XMLSEC_CRYPTO_EXPORT SECItem* xmlSecNssNodeGetBigNumValue (PRArenaPool *arena,
+ const xmlNodePtr cur,
+ SECItem *a);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssNodeSetBigNumValue (xmlNodePtr cur,
+ const SECItem *a,
+ int addLineBreaks);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/nss/crypto.h b/include/xmlsec/nss/crypto.h
index 42ba6ca..27ecedc 100644
--- a/include/xmlsec/nss/crypto.h
+++ b/include/xmlsec/nss/crypto.h
@@ -23,25 +23,25 @@ extern "C" {
#include <xmlsec/transforms.h>
#include <xmlsec/dl.h>
-XMLSEC_CRYPTO_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoGetFunctions_nss(void);
+XMLSEC_CRYPTO_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoGetFunctions_nss(void);
/**
* Init shutdown
*/
-XMLSEC_CRYPTO_EXPORT int xmlSecNssInit (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssShutdown (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssInit (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssShutdown (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssKeysMngrInit (xmlSecKeysMngrPtr mngr);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssGenerateRandom (xmlSecBufferPtr buffer,
- xmlSecSize size);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssKeysMngrInit (xmlSecKeysMngrPtr mngr);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssGenerateRandom (xmlSecBufferPtr buffer,
+ xmlSecSize size);
-XMLSEC_CRYPTO_EXPORT void xmlSecNssErrorsDefaultCallback (const char* file,
- int line,
- const char* func,
- const char* errorObject,
- const char* errorSubject,
- int reason,
- const char* msg);
+XMLSEC_CRYPTO_EXPORT void xmlSecNssErrorsDefaultCallback (const char* file,
+ int line,
+ const char* func,
+ const char* errorObject,
+ const char* errorSubject,
+ int reason,
+ const char* msg);
XMLSEC_CRYPTO_EXPORT PK11SlotInfo * xmlSecNssGetInternalKeySlot(void);
@@ -57,19 +57,19 @@ XMLSEC_CRYPTO_EXPORT PK11SlotInfo * xmlSecNssGetInternalKeySlot(void);
* The AES key data klass.
*/
#define xmlSecNssKeyDataAesId \
- xmlSecNssKeyDataAesGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecNssKeyDataAesGetKlass (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssKeyDataAesSet (xmlSecKeyDataPtr data,
- const xmlSecByte* buf,
- xmlSecSize bufSize);
+ xmlSecNssKeyDataAesGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecNssKeyDataAesGetKlass (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssKeyDataAesSet (xmlSecKeyDataPtr data,
+ const xmlSecByte* buf,
+ xmlSecSize bufSize);
/**
* xmlSecNssTransformAes128CbcId:
*
* The AES128 CBC cipher transform klass.
*/
#define xmlSecNssTransformAes128CbcId \
- xmlSecNssTransformAes128CbcGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformAes128CbcGetKlass(void);
+ xmlSecNssTransformAes128CbcGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformAes128CbcGetKlass(void);
/**
* xmlSecNssTransformAes192CbcId:
@@ -77,8 +77,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformAes128CbcGetKlass(void)
* The AES192 CBC cipher transform klass.
*/
#define xmlSecNssTransformAes192CbcId \
- xmlSecNssTransformAes192CbcGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformAes192CbcGetKlass(void);
+ xmlSecNssTransformAes192CbcGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformAes192CbcGetKlass(void);
/**
* xmlSecNssTransformAes256CbcId:
@@ -86,8 +86,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformAes192CbcGetKlass(void)
* The AES256 CBC cipher transform klass.
*/
#define xmlSecNssTransformAes256CbcId \
- xmlSecNssTransformAes256CbcGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformAes256CbcGetKlass(void);
+ xmlSecNssTransformAes256CbcGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformAes256CbcGetKlass(void);
/**
* xmlSecNssTransformKWAes128Id:
@@ -95,8 +95,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformAes256CbcGetKlass(void)
* The AES 128 key wrap transform klass.
*/
#define xmlSecNssTransformKWAes128Id \
- xmlSecNssTransformKWAes128GetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformKWAes128GetKlass(void);
+ xmlSecNssTransformKWAes128GetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformKWAes128GetKlass(void);
/**
* xmlSecNssTransformKWAes192Id:
@@ -104,8 +104,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformKWAes128GetKlass(void);
* The AES 192 key wrap transform klass.
*/
#define xmlSecNssTransformKWAes192Id \
- xmlSecNssTransformKWAes192GetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformKWAes192GetKlass(void);
+ xmlSecNssTransformKWAes192GetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformKWAes192GetKlass(void);
/**
* xmlSecNssTransformKWAes256Id:
@@ -113,8 +113,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformKWAes192GetKlass(void);
* The AES 256 key wrap transform klass.
*/
#define xmlSecNssTransformKWAes256Id \
- xmlSecNssTransformKWAes256GetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformKWAes256GetKlass(void);
+ xmlSecNssTransformKWAes256GetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformKWAes256GetKlass(void);
#endif /* XMLSEC_NO_AES */
@@ -130,11 +130,11 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformKWAes256GetKlass(void);
* The DES key data klass.
*/
#define xmlSecNssKeyDataDesId \
- xmlSecNssKeyDataDesGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecNssKeyDataDesGetKlass (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssKeyDataDesSet (xmlSecKeyDataPtr data,
- const xmlSecByte* buf,
- xmlSecSize bufSize);
+ xmlSecNssKeyDataDesGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecNssKeyDataDesGetKlass (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssKeyDataDesSet (xmlSecKeyDataPtr data,
+ const xmlSecByte* buf,
+ xmlSecSize bufSize);
/**
* xmlSecNssTransformDes3CbcId:
@@ -142,7 +142,7 @@ XMLSEC_CRYPTO_EXPORT int xmlSecNssKeyDataDesSet (xmlSecKeyDataPtr data,
* The Triple DES CBC cipher transform klass.
*/
#define xmlSecNssTransformDes3CbcId \
- xmlSecNssTransformDes3CbcGetKlass()
+ xmlSecNssTransformDes3CbcGetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformDes3CbcGetKlass(void);
/**
@@ -151,7 +151,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformDes3CbcGetKlass(void);
* The DES3 CBC cipher transform klass.
*/
#define xmlSecNssTransformKWDes3Id \
- xmlSecNssTransformKWDes3GetKlass()
+ xmlSecNssTransformKWDes3GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformKWDes3GetKlass(void);
@@ -170,8 +170,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformKWDes3GetKlass(void);
* The DSA key klass.
*/
#define xmlSecNssKeyDataDsaId \
- xmlSecNssKeyDataDsaGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecNssKeyDataDsaGetKlass (void);
+ xmlSecNssKeyDataDsaGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecNssKeyDataDsaGetKlass (void);
/**
* xmlSecNssTransformDsaSha1Id:
@@ -179,7 +179,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecNssKeyDataDsaGetKlass (void);
* The DSA SHA1 signature transform klass.
*/
#define xmlSecNssTransformDsaSha1Id \
- xmlSecNssTransformDsaSha1GetKlass()
+ xmlSecNssTransformDsaSha1GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformDsaSha1GetKlass(void);
#endif /* XMLSEC_NO_DSA */
@@ -201,18 +201,18 @@ XMLSEC_CRYPTO_EXPORT void xmlSecNssHmacSetMinOutputLength(int min_l
* The DHMAC key data klass.
*/
#define xmlSecNssKeyDataHmacId \
- xmlSecNssKeyDataHmacGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecNssKeyDataHmacGetKlass (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssKeyDataHmacSet (xmlSecKeyDataPtr data,
- const xmlSecByte* buf,
- xmlSecSize bufSize);
+ xmlSecNssKeyDataHmacGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecNssKeyDataHmacGetKlass (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssKeyDataHmacSet (xmlSecKeyDataPtr data,
+ const xmlSecByte* buf,
+ xmlSecSize bufSize);
/**
* xmlSecNssTransformHmacMd5Id:
*
* The HMAC with MD5 signature transform klass.
*/
#define xmlSecNssTransformHmacMd5Id \
- xmlSecNssTransformHmacMd5GetKlass()
+ xmlSecNssTransformHmacMd5GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformHmacMd5GetKlass(void);
/**
@@ -221,7 +221,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformHmacMd5GetKlass(void);
* The HMAC with RipeMD160 signature transform klass.
*/
#define xmlSecNssTransformHmacRipemd160Id \
- xmlSecNssTransformHmacRipemd160GetKlass()
+ xmlSecNssTransformHmacRipemd160GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformHmacRipemd160GetKlass(void);
/**
@@ -230,7 +230,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformHmacRipemd160GetKlass(v
* The HMAC with SHA1 signature transform klass.
*/
#define xmlSecNssTransformHmacSha1Id \
- xmlSecNssTransformHmacSha1GetKlass()
+ xmlSecNssTransformHmacSha1GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformHmacSha1GetKlass(void);
@@ -250,16 +250,16 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformHmacSha1GetKlass(void);
* The RSA key klass.
*/
#define xmlSecNssKeyDataRsaId \
- xmlSecNssKeyDataRsaGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecNssKeyDataRsaGetKlass (void);
+ xmlSecNssKeyDataRsaGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecNssKeyDataRsaGetKlass (void);
/**
* xmlSecNssTransformRsaSha1Id:
*
* The RSA-SHA1 signature transform klass.
*/
-#define xmlSecNssTransformRsaSha1Id \
- xmlSecNssTransformRsaSha1GetKlass()
+#define xmlSecNssTransformRsaSha1Id \
+ xmlSecNssTransformRsaSha1GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformRsaSha1GetKlass(void);
/**
@@ -300,8 +300,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformRsaOaepGetKlass(void);
* The SHA1 digest transform klass.
*/
#define xmlSecNssTransformSha1Id \
- xmlSecNssTransformSha1GetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformSha1GetKlass (void);
+ xmlSecNssTransformSha1GetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecNssTransformSha1GetKlass (void);
#endif /* XMLSEC_NO_SHA1 */
#ifdef __cplusplus
diff --git a/include/xmlsec/nss/keysstore.h b/include/xmlsec/nss/keysstore.h
index 10e6bb3..c26ab18 100644
--- a/include/xmlsec/nss/keysstore.h
+++ b/include/xmlsec/nss/keysstore.h
@@ -27,16 +27,16 @@ extern "C" {
*
* A Nss keys store klass id.
*/
-#define xmlSecNssKeysStoreId xmlSecNssKeysStoreGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyStoreId xmlSecNssKeysStoreGetKlass (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssKeysStoreAdoptKey (xmlSecKeyStorePtr store,
- xmlSecKeyPtr key);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssKeysStoreLoad (xmlSecKeyStorePtr store,
- const char *uri,
- xmlSecKeysMngrPtr keysMngr);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssKeysStoreSave (xmlSecKeyStorePtr store,
- const char *filename,
- xmlSecKeyDataType type);
+#define xmlSecNssKeysStoreId xmlSecNssKeysStoreGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyStoreId xmlSecNssKeysStoreGetKlass (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssKeysStoreAdoptKey (xmlSecKeyStorePtr store,
+ xmlSecKeyPtr key);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssKeysStoreLoad (xmlSecKeyStorePtr store,
+ const char *uri,
+ xmlSecKeysMngrPtr keysMngr);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssKeysStoreSave (xmlSecKeyStorePtr store,
+ const char *filename,
+ xmlSecKeyDataType type);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/nss/pkikeys.h b/include/xmlsec/nss/pkikeys.h
index fd4a6e8..641ba7f 100644
--- a/include/xmlsec/nss/pkikeys.h
+++ b/include/xmlsec/nss/pkikeys.h
@@ -21,17 +21,17 @@ extern "C" {
#include <xmlsec/transforms.h>
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataPtr xmlSecNssPKIAdoptKey (SECKEYPrivateKey *privkey,
- SECKEYPublicKey *pubkey);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataPtr xmlSecNssPKIAdoptKey (SECKEYPrivateKey *privkey,
+ SECKEYPublicKey *pubkey);
-XMLSEC_CRYPTO_EXPORT SECKEYPublicKey* xmlSecNssPKIKeyDataGetPubKey (xmlSecKeyDataPtr data);
+XMLSEC_CRYPTO_EXPORT SECKEYPublicKey* xmlSecNssPKIKeyDataGetPubKey (xmlSecKeyDataPtr data);
-XMLSEC_CRYPTO_EXPORT SECKEYPrivateKey* xmlSecNssPKIKeyDataGetPrivKey (xmlSecKeyDataPtr data);
+XMLSEC_CRYPTO_EXPORT SECKEYPrivateKey* xmlSecNssPKIKeyDataGetPrivKey (xmlSecKeyDataPtr data);
-XMLSEC_CRYPTO_EXPORT KeyType xmlSecNssPKIKeyDataGetKeyType (xmlSecKeyDataPtr data);
+XMLSEC_CRYPTO_EXPORT KeyType xmlSecNssPKIKeyDataGetKeyType (xmlSecKeyDataPtr data);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssPKIKeyDataDuplicate (xmlSecKeyDataPtr dst,
- xmlSecKeyDataPtr src);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssPKIKeyDataDuplicate (xmlSecKeyDataPtr dst,
+ xmlSecKeyDataPtr src);
diff --git a/include/xmlsec/nss/symbols.h b/include/xmlsec/nss/symbols.h
index b01a1fa..ea03591 100644
--- a/include/xmlsec/nss/symbols.h
+++ b/include/xmlsec/nss/symbols.h
@@ -27,66 +27,66 @@ extern "C" {
/**
* Crypto Init/shutdown
*/
-#define xmlSecCryptoInit xmlSecNssInit
-#define xmlSecCryptoShutdown xmlSecNssShutdown
+#define xmlSecCryptoInit xmlSecNssInit
+#define xmlSecCryptoShutdown xmlSecNssShutdown
-#define xmlSecCryptoKeysMngrInit xmlSecNssKeysMngrInit
+#define xmlSecCryptoKeysMngrInit xmlSecNssKeysMngrInit
/**
* Key data ids
*/
-#define xmlSecKeyDataAesId xmlSecNssKeyDataAesId
-#define xmlSecKeyDataDesId xmlSecNssKeyDataDesId
-#define xmlSecKeyDataDsaId xmlSecNssKeyDataDsaId
-#define xmlSecKeyDataHmacId xmlSecNssKeyDataHmacId
-#define xmlSecKeyDataRsaId xmlSecNssKeyDataRsaId
-#define xmlSecKeyDataX509Id xmlSecNssKeyDataX509Id
-#define xmlSecKeyDataRawX509CertId xmlSecNssKeyDataRawX509CertId
+#define xmlSecKeyDataAesId xmlSecNssKeyDataAesId
+#define xmlSecKeyDataDesId xmlSecNssKeyDataDesId
+#define xmlSecKeyDataDsaId xmlSecNssKeyDataDsaId
+#define xmlSecKeyDataHmacId xmlSecNssKeyDataHmacId
+#define xmlSecKeyDataRsaId xmlSecNssKeyDataRsaId
+#define xmlSecKeyDataX509Id xmlSecNssKeyDataX509Id
+#define xmlSecKeyDataRawX509CertId xmlSecNssKeyDataRawX509CertId
/**
* Key data store ids
*/
-#define xmlSecX509StoreId xmlSecNssX509StoreId
+#define xmlSecX509StoreId xmlSecNssX509StoreId
/**
* Crypto transforms ids
*/
-#define xmlSecTransformAes128CbcId xmlSecNssTransformAes128CbcId
-#define xmlSecTransformAes192CbcId xmlSecNssTransformAes192CbcId
-#define xmlSecTransformAes256CbcId xmlSecNssTransformAes256CbcId
-#define xmlSecTransformKWAes128Id xmlSecNssTransformKWAes128Id
-#define xmlSecTransformKWAes192Id xmlSecNssTransformKWAes192Id
-#define xmlSecTransformKWAes256Id xmlSecNssTransformKWAes256Id
-#define xmlSecTransformDes3CbcId xmlSecNssTransformDes3CbcId
-#define xmlSecTransformKWDes3Id xmlSecNssTransformKWDes3Id
-#define xmlSecTransformDsaSha1Id xmlSecNssTransformDsaSha1Id
-#define xmlSecTransformHmacMd5Id xmlSecNssTransformHmacMd5Id
-#define xmlSecTransformHmacRipemd160Id xmlSecNssTransformHmacRipemd160Id
-#define xmlSecTransformHmacSha1Id xmlSecNssTransformHmacSha1Id
-#define xmlSecTransformRipemd160Id xmlSecNssTransformRipemd160Id
-#define xmlSecTransformRsaSha1Id xmlSecNssTransformRsaSha1Id
-#define xmlSecTransformRsaPkcs1Id xmlSecNssTransformRsaPkcs1Id
-#define xmlSecTransformRsaOaepId xmlSecNssTransformRsaOaepId
-#define xmlSecTransformSha1Id xmlSecNssTransformSha1Id
+#define xmlSecTransformAes128CbcId xmlSecNssTransformAes128CbcId
+#define xmlSecTransformAes192CbcId xmlSecNssTransformAes192CbcId
+#define xmlSecTransformAes256CbcId xmlSecNssTransformAes256CbcId
+#define xmlSecTransformKWAes128Id xmlSecNssTransformKWAes128Id
+#define xmlSecTransformKWAes192Id xmlSecNssTransformKWAes192Id
+#define xmlSecTransformKWAes256Id xmlSecNssTransformKWAes256Id
+#define xmlSecTransformDes3CbcId xmlSecNssTransformDes3CbcId
+#define xmlSecTransformKWDes3Id xmlSecNssTransformKWDes3Id
+#define xmlSecTransformDsaSha1Id xmlSecNssTransformDsaSha1Id
+#define xmlSecTransformHmacMd5Id xmlSecNssTransformHmacMd5Id
+#define xmlSecTransformHmacRipemd160Id xmlSecNssTransformHmacRipemd160Id
+#define xmlSecTransformHmacSha1Id xmlSecNssTransformHmacSha1Id
+#define xmlSecTransformRipemd160Id xmlSecNssTransformRipemd160Id
+#define xmlSecTransformRsaSha1Id xmlSecNssTransformRsaSha1Id
+#define xmlSecTransformRsaPkcs1Id xmlSecNssTransformRsaPkcs1Id
+#define xmlSecTransformRsaOaepId xmlSecNssTransformRsaOaepId
+#define xmlSecTransformSha1Id xmlSecNssTransformSha1Id
/**
* High level routines form xmlsec command line utility
*/
-#define xmlSecCryptoAppInit xmlSecNssAppInit
-#define xmlSecCryptoAppShutdown xmlSecNssAppShutdown
-#define xmlSecCryptoAppDefaultKeysMngrInit xmlSecNssAppDefaultKeysMngrInit
-#define xmlSecCryptoAppDefaultKeysMngrAdoptKey xmlSecNssAppDefaultKeysMngrAdoptKey
-#define xmlSecCryptoAppDefaultKeysMngrLoad xmlSecNssAppDefaultKeysMngrLoad
-#define xmlSecCryptoAppDefaultKeysMngrSave xmlSecNssAppDefaultKeysMngrSave
-#define xmlSecCryptoAppKeysMngrCertLoad xmlSecNssAppKeysMngrCertLoad
-#define xmlSecCryptoAppKeysMngrCertLoadMemory xmlSecNssAppKeysMngrCertLoadMemory
-#define xmlSecCryptoAppKeyLoad xmlSecNssAppKeyLoad
-#define xmlSecCryptoAppPkcs12Load xmlSecNssAppPkcs12Load
-#define xmlSecCryptoAppKeyCertLoad xmlSecNssAppKeyCertLoad
-#define xmlSecCryptoAppKeyLoadMemory xmlSecNssAppKeyLoadMemory
-#define xmlSecCryptoAppPkcs12LoadMemory xmlSecNssAppPkcs12LoadMemory
-#define xmlSecCryptoAppKeyCertLoadMemory xmlSecNssAppKeyCertLoadMemory
-#define xmlSecCryptoAppGetDefaultPwdCallback xmlSecNssAppGetDefaultPwdCallback
+#define xmlSecCryptoAppInit xmlSecNssAppInit
+#define xmlSecCryptoAppShutdown xmlSecNssAppShutdown
+#define xmlSecCryptoAppDefaultKeysMngrInit xmlSecNssAppDefaultKeysMngrInit
+#define xmlSecCryptoAppDefaultKeysMngrAdoptKey xmlSecNssAppDefaultKeysMngrAdoptKey
+#define xmlSecCryptoAppDefaultKeysMngrLoad xmlSecNssAppDefaultKeysMngrLoad
+#define xmlSecCryptoAppDefaultKeysMngrSave xmlSecNssAppDefaultKeysMngrSave
+#define xmlSecCryptoAppKeysMngrCertLoad xmlSecNssAppKeysMngrCertLoad
+#define xmlSecCryptoAppKeysMngrCertLoadMemory xmlSecNssAppKeysMngrCertLoadMemory
+#define xmlSecCryptoAppKeyLoad xmlSecNssAppKeyLoad
+#define xmlSecCryptoAppPkcs12Load xmlSecNssAppPkcs12Load
+#define xmlSecCryptoAppKeyCertLoad xmlSecNssAppKeyCertLoad
+#define xmlSecCryptoAppKeyLoadMemory xmlSecNssAppKeyLoadMemory
+#define xmlSecCryptoAppPkcs12LoadMemory xmlSecNssAppPkcs12LoadMemory
+#define xmlSecCryptoAppKeyCertLoadMemory xmlSecNssAppKeyCertLoadMemory
+#define xmlSecCryptoAppGetDefaultPwdCallback xmlSecNssAppGetDefaultPwdCallback
#endif /* XMLSEC_CRYPTO_NSS */
diff --git a/include/xmlsec/nss/x509.h b/include/xmlsec/nss/x509.h
index 1e3ba5e..cfad2d8 100644
--- a/include/xmlsec/nss/x509.h
+++ b/include/xmlsec/nss/x509.h
@@ -29,25 +29,25 @@ extern "C" {
* The NSS X509 data klass.
*/
#define xmlSecNssKeyDataX509Id \
- xmlSecNssKeyDataX509GetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecNssKeyDataX509GetKlass(void);
+ xmlSecNssKeyDataX509GetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecNssKeyDataX509GetKlass(void);
-XMLSEC_CRYPTO_EXPORT CERTCertificate* xmlSecNssKeyDataX509GetKeyCert(xmlSecKeyDataPtr data);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data,
- CERTCertificate* cert);
+XMLSEC_CRYPTO_EXPORT CERTCertificate* xmlSecNssKeyDataX509GetKeyCert(xmlSecKeyDataPtr data);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data,
+ CERTCertificate* cert);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssKeyDataX509AdoptCert(xmlSecKeyDataPtr data,
- CERTCertificate* cert);
-XMLSEC_CRYPTO_EXPORT CERTCertificate* xmlSecNssKeyDataX509GetCert (xmlSecKeyDataPtr data,
- xmlSecSize pos);
-XMLSEC_CRYPTO_EXPORT xmlSecSize xmlSecNssKeyDataX509GetCertsSize(xmlSecKeyDataPtr data);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssKeyDataX509AdoptCert(xmlSecKeyDataPtr data,
+ CERTCertificate* cert);
+XMLSEC_CRYPTO_EXPORT CERTCertificate* xmlSecNssKeyDataX509GetCert (xmlSecKeyDataPtr data,
+ xmlSecSize pos);
+XMLSEC_CRYPTO_EXPORT xmlSecSize xmlSecNssKeyDataX509GetCertsSize(xmlSecKeyDataPtr data);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssKeyDataX509AdoptCrl(xmlSecKeyDataPtr data,
- CERTSignedCrl* crl);
-XMLSEC_CRYPTO_EXPORT CERTSignedCrl* xmlSecNssKeyDataX509GetCrl (xmlSecKeyDataPtr data,
- xmlSecSize pos);
-XMLSEC_CRYPTO_EXPORT xmlSecSize xmlSecNssKeyDataX509GetCrlsSize(xmlSecKeyDataPtr data);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataPtr xmlSecNssX509CertGetKey (CERTCertificate* cert);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssKeyDataX509AdoptCrl(xmlSecKeyDataPtr data,
+ CERTSignedCrl* crl);
+XMLSEC_CRYPTO_EXPORT CERTSignedCrl* xmlSecNssKeyDataX509GetCrl (xmlSecKeyDataPtr data,
+ xmlSecSize pos);
+XMLSEC_CRYPTO_EXPORT xmlSecSize xmlSecNssKeyDataX509GetCrlsSize(xmlSecKeyDataPtr data);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataPtr xmlSecNssX509CertGetKey (CERTCertificate* cert);
/**
@@ -56,8 +56,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataPtr xmlSecNssX509CertGetKey (CERTCertificate*
* The NSS raw X509 certificate klass.
*/
#define xmlSecNssKeyDataRawX509CertId \
- xmlSecNssKeyDataRawX509CertGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecNssKeyDataRawX509CertGetKlass(void);
+ xmlSecNssKeyDataRawX509CertGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecNssKeyDataRawX509CertGetKlass(void);
/**
* xmlSecNssX509StoreId:
@@ -65,20 +65,20 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecNssKeyDataRawX509CertGetKlass(void);
* The NSS X509 store klass.
*/
#define xmlSecNssX509StoreId \
- xmlSecNssX509StoreGetKlass()
+ xmlSecNssX509StoreGetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecKeyDataStoreId xmlSecNssX509StoreGetKlass(void);
-XMLSEC_CRYPTO_EXPORT CERTCertificate* xmlSecNssX509StoreFindCert (xmlSecKeyDataStorePtr store,
- xmlChar *subjectName,
- xmlChar *issuerName,
- xmlChar *issuerSerial,
- xmlChar *ski,
- xmlSecKeyInfoCtx* keyInfoCtx);
-
-XMLSEC_CRYPTO_EXPORT CERTCertificate* xmlSecNssX509StoreVerify (xmlSecKeyDataStorePtr store,
- CERTCertList* certs,
- xmlSecKeyInfoCtx* keyInfoCtx);
-XMLSEC_CRYPTO_EXPORT int xmlSecNssX509StoreAdoptCert (xmlSecKeyDataStorePtr store,
- CERTCertificate* cert,
+XMLSEC_CRYPTO_EXPORT CERTCertificate* xmlSecNssX509StoreFindCert (xmlSecKeyDataStorePtr store,
+ xmlChar *subjectName,
+ xmlChar *issuerName,
+ xmlChar *issuerSerial,
+ xmlChar *ski,
+ xmlSecKeyInfoCtx* keyInfoCtx);
+
+XMLSEC_CRYPTO_EXPORT CERTCertificate* xmlSecNssX509StoreVerify (xmlSecKeyDataStorePtr store,
+ CERTCertList* certs,
+ xmlSecKeyInfoCtx* keyInfoCtx);
+XMLSEC_CRYPTO_EXPORT int xmlSecNssX509StoreAdoptCert (xmlSecKeyDataStorePtr store,
+ CERTCertificate* cert,
xmlSecKeyDataType type);
diff --git a/include/xmlsec/openssl/app.h b/include/xmlsec/openssl/app.h
index d781af2..59cc87e 100644
--- a/include/xmlsec/openssl/app.h
+++ b/include/xmlsec/openssl/app.h
@@ -24,37 +24,37 @@ extern "C" {
/**
* Init/shutdown
*/
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppInit (const char* config);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppShutdown (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppInit (const char* config);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppShutdown (void);
/**
* Keys Manager
*/
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr,
- xmlSecKeyPtr key);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr,
- const char* uri);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr,
- const char* filename,
- xmlSecKeyDataType type);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr,
+ xmlSecKeyPtr key);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr,
+ const char* uri);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr,
+ const char* filename,
+ xmlSecKeyDataType type);
#ifndef XMLSEC_NO_X509
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr,
- const char *filename,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppKeysMngrCertLoadBIO(xmlSecKeysMngrPtr mngr,
- BIO* bio,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type);
-
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppKeysMngrAddCertsPath(xmlSecKeysMngrPtr mngr,
- const char *path);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr,
+ const char *filename,
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppKeysMngrCertLoadBIO(xmlSecKeysMngrPtr mngr,
+ BIO* bio,
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type);
+
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppKeysMngrAddCertsPath(xmlSecKeysMngrPtr mngr,
+ const char *path);
XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppKeysMngrAddCertsFile(xmlSecKeysMngrPtr mngr,
const char *file);
@@ -64,53 +64,53 @@ XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppKeysMngrAddCertsFile(xml
/**
* Keys
*/
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecOpenSSLAppKeyLoad (const char *filename,
- xmlSecKeyDataFormat format,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecOpenSSLAppKeyLoadMemory (const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecOpenSSLAppKeyLoadBIO (BIO* bio,
- xmlSecKeyDataFormat format,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecOpenSSLAppKeyLoad (const char *filename,
+ xmlSecKeyDataFormat format,
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecOpenSSLAppKeyLoadMemory (const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format,
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecOpenSSLAppKeyLoadBIO (BIO* bio,
+ xmlSecKeyDataFormat format,
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
#ifndef XMLSEC_NO_X509
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecOpenSSLAppPkcs12Load (const char* filename,
- const char* pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecOpenSSLAppPkcs12LoadMemory(const xmlSecByte* data,
- xmlSecSize dataSize,
- const char* pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecOpenSSLAppPkcs12LoadBIO (BIO* bio,
- const char* pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
-
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppKeyCertLoad (xmlSecKeyPtr key,
- const char* filename,
- xmlSecKeyDataFormat format);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppKeyCertLoadMemory(xmlSecKeyPtr key,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppKeyCertLoadBIO (xmlSecKeyPtr key,
- BIO* bio,
- xmlSecKeyDataFormat format);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecOpenSSLAppKeyFromCertLoadBIO(BIO* bio,
- xmlSecKeyDataFormat format);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecOpenSSLAppPkcs12Load (const char* filename,
+ const char* pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecOpenSSLAppPkcs12LoadMemory(const xmlSecByte* data,
+ xmlSecSize dataSize,
+ const char* pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecOpenSSLAppPkcs12LoadBIO (BIO* bio,
+ const char* pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
+
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppKeyCertLoad (xmlSecKeyPtr key,
+ const char* filename,
+ xmlSecKeyDataFormat format);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppKeyCertLoadMemory(xmlSecKeyPtr key,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLAppKeyCertLoadBIO (xmlSecKeyPtr key,
+ BIO* bio,
+ xmlSecKeyDataFormat format);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecOpenSSLAppKeyFromCertLoadBIO(BIO* bio,
+ xmlSecKeyDataFormat format);
#endif /* XMLSEC_NO_X509 */
-XMLSEC_CRYPTO_EXPORT void* xmlSecOpenSSLAppGetDefaultPwdCallback(void);
+XMLSEC_CRYPTO_EXPORT void* xmlSecOpenSSLAppGetDefaultPwdCallback(void);
#ifdef __cplusplus
diff --git a/include/xmlsec/openssl/bn.h b/include/xmlsec/openssl/bn.h
index b6ec461..eeadf39 100644
--- a/include/xmlsec/openssl/bn.h
+++ b/include/xmlsec/openssl/bn.h
@@ -21,11 +21,11 @@ extern "C" {
#include <xmlsec/xmlsec.h>
-XMLSEC_CRYPTO_EXPORT BIGNUM* xmlSecOpenSSLNodeGetBNValue (const xmlNodePtr cur,
- BIGNUM **a);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLNodeSetBNValue (xmlNodePtr cur,
- const BIGNUM *a,
- int addLineBreaks);
+XMLSEC_CRYPTO_EXPORT BIGNUM* xmlSecOpenSSLNodeGetBNValue (const xmlNodePtr cur,
+ BIGNUM **a);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLNodeSetBNValue (xmlNodePtr cur,
+ const BIGNUM *a,
+ int addLineBreaks);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/openssl/crypto.h b/include/xmlsec/openssl/crypto.h
index 4fe0ca7..d7bdc4d 100644
--- a/include/xmlsec/openssl/crypto.h
+++ b/include/xmlsec/openssl/crypto.h
@@ -30,23 +30,23 @@ extern "C" {
/* OpenSSL 0.9.6 does not have AES */
#if defined(XMLSEC_OPENSSL_096)
-#define XMLSEC_NO_AES 1
+#define XMLSEC_NO_AES 1
#endif /* XMLSEC_OPENSSL_096 */
-XMLSEC_CRYPTO_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoGetFunctions_openssl(void);
+XMLSEC_CRYPTO_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoGetFunctions_openssl(void);
/**
* Init shutdown
*/
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLInit (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLShutdown (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLInit (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLShutdown (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeysMngrInit (xmlSecKeysMngrPtr mngr);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLGenerateRandom (xmlSecBufferPtr buffer,
- xmlSecSize size);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeysMngrInit (xmlSecKeysMngrPtr mngr);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLGenerateRandom (xmlSecBufferPtr buffer,
+ xmlSecSize size);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLSetDefaultTrustedCertsFolder(const xmlChar* path);
-XMLSEC_CRYPTO_EXPORT const xmlChar* xmlSecOpenSSLGetDefaultTrustedCertsFolder(void);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLSetDefaultTrustedCertsFolder(const xmlChar* path);
+XMLSEC_CRYPTO_EXPORT const xmlChar* xmlSecOpenSSLGetDefaultTrustedCertsFolder(void);
/********************************************************************
*
@@ -60,19 +60,19 @@ XMLSEC_CRYPTO_EXPORT const xmlChar* xmlSecOpenSSLGetDefaultTrustedCertsFolder(vo
* The AES key klass.
*/
#define xmlSecOpenSSLKeyDataAesId \
- xmlSecOpenSSLKeyDataAesGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecOpenSSLKeyDataAesGetKlass (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataAesSet (xmlSecKeyDataPtr data,
- const xmlSecByte* buf,
- xmlSecSize bufSize);
+ xmlSecOpenSSLKeyDataAesGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecOpenSSLKeyDataAesGetKlass (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataAesSet (xmlSecKeyDataPtr data,
+ const xmlSecByte* buf,
+ xmlSecSize bufSize);
/**
* xmlSecOpenSSLTransformAes128CbcId:
*
* The AES128 CBC cipher transform klass.
*/
#define xmlSecOpenSSLTransformAes128CbcId \
- xmlSecOpenSSLTransformAes128CbcGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformAes128CbcGetKlass(void);
+ xmlSecOpenSSLTransformAes128CbcGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformAes128CbcGetKlass(void);
/**
* xmlSecOpenSSLTransformAes192CbcId:
@@ -80,8 +80,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformAes128CbcGetKlass(v
* The AES192 CBC cipher transform klass.
*/
#define xmlSecOpenSSLTransformAes192CbcId \
- xmlSecOpenSSLTransformAes192CbcGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformAes192CbcGetKlass(void);
+ xmlSecOpenSSLTransformAes192CbcGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformAes192CbcGetKlass(void);
/**
* xmlSecOpenSSLTransformAes256CbcId:
@@ -89,8 +89,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformAes192CbcGetKlass(v
* The AES256 CBC cipher transform klass.
*/
#define xmlSecOpenSSLTransformAes256CbcId \
- xmlSecOpenSSLTransformAes256CbcGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformAes256CbcGetKlass(void);
+ xmlSecOpenSSLTransformAes256CbcGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformAes256CbcGetKlass(void);
/**
* xmlSecOpenSSLTransformKWAes128Id:
@@ -98,8 +98,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformAes256CbcGetKlass(v
* The AES 128 key wrap transform klass.
*/
#define xmlSecOpenSSLTransformKWAes128Id \
- xmlSecOpenSSLTransformKWAes128GetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformKWAes128GetKlass(void);
+ xmlSecOpenSSLTransformKWAes128GetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformKWAes128GetKlass(void);
/**
* xmlSecOpenSSLTransformKWAes192Id:
@@ -107,8 +107,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformKWAes128GetKlass(vo
* The AES 192 key wrap transform klass.
*/
#define xmlSecOpenSSLTransformKWAes192Id \
- xmlSecOpenSSLTransformKWAes192GetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformKWAes192GetKlass(void);
+ xmlSecOpenSSLTransformKWAes192GetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformKWAes192GetKlass(void);
/**
* xmlSecOpenSSLTransformKWAes256Id:
@@ -116,8 +116,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformKWAes192GetKlass(vo
* The AES 256 key wrap transform klass.
*/
#define xmlSecOpenSSLTransformKWAes256Id \
- xmlSecOpenSSLTransformKWAes256GetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformKWAes256GetKlass(void);
+ xmlSecOpenSSLTransformKWAes256GetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformKWAes256GetKlass(void);
#endif /* XMLSEC_NO_AES */
@@ -133,18 +133,18 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformKWAes256GetKlass(vo
* The DES key klass.
*/
#define xmlSecOpenSSLKeyDataDesId \
- xmlSecOpenSSLKeyDataDesGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecOpenSSLKeyDataDesGetKlass (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataDesSet (xmlSecKeyDataPtr data,
- const xmlSecByte* buf,
- xmlSecSize bufSize);
+ xmlSecOpenSSLKeyDataDesGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecOpenSSLKeyDataDesGetKlass (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataDesSet (xmlSecKeyDataPtr data,
+ const xmlSecByte* buf,
+ xmlSecSize bufSize);
/**
* xmlSecOpenSSLTransformDes3CbcId:
*
* The DES3 CBC cipher transform klass.
*/
#define xmlSecOpenSSLTransformDes3CbcId \
- xmlSecOpenSSLTransformDes3CbcGetKlass()
+ xmlSecOpenSSLTransformDes3CbcGetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformDes3CbcGetKlass(void);
/**
@@ -153,7 +153,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformDes3CbcGetKlass(voi
* The DES3 CBC cipher transform klass.
*/
#define xmlSecOpenSSLTransformKWDes3Id \
- xmlSecOpenSSLTransformKWDes3GetKlass()
+ xmlSecOpenSSLTransformKWDes3GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformKWDes3GetKlass(void);
#endif /* XMLSEC_NO_DES */
@@ -172,14 +172,14 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformKWDes3GetKlass(void
* The DSA key klass.
*/
#define xmlSecOpenSSLKeyDataDsaId \
- xmlSecOpenSSLKeyDataDsaGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecOpenSSLKeyDataDsaGetKlass (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataDsaAdoptDsa (xmlSecKeyDataPtr data,
- DSA* dsa);
-XMLSEC_CRYPTO_EXPORT DSA* xmlSecOpenSSLKeyDataDsaGetDsa (xmlSecKeyDataPtr data);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataDsaAdoptEvp (xmlSecKeyDataPtr data,
- EVP_PKEY* pKey);
-XMLSEC_CRYPTO_EXPORT EVP_PKEY* xmlSecOpenSSLKeyDataDsaGetEvp (xmlSecKeyDataPtr data);
+ xmlSecOpenSSLKeyDataDsaGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecOpenSSLKeyDataDsaGetKlass (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataDsaAdoptDsa (xmlSecKeyDataPtr data,
+ DSA* dsa);
+XMLSEC_CRYPTO_EXPORT DSA* xmlSecOpenSSLKeyDataDsaGetDsa (xmlSecKeyDataPtr data);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataDsaAdoptEvp (xmlSecKeyDataPtr data,
+ EVP_PKEY* pKey);
+XMLSEC_CRYPTO_EXPORT EVP_PKEY* xmlSecOpenSSLKeyDataDsaGetEvp (xmlSecKeyDataPtr data);
#ifndef XMLSEC_NO_SHA1
/**
@@ -188,7 +188,7 @@ XMLSEC_CRYPTO_EXPORT EVP_PKEY* xmlSecOpenSSLKeyDataDsaGetEvp (xmlSecKeyDataPtr
* The DSA SHA1 signature transform klass.
*/
#define xmlSecOpenSSLTransformDsaSha1Id \
- xmlSecOpenSSLTransformDsaSha1GetKlass()
+ xmlSecOpenSSLTransformDsaSha1GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformDsaSha1GetKlass(void);
#endif /* XMLSEC_NO_SHA1 */
@@ -210,20 +210,20 @@ XMLSEC_CRYPTO_EXPORT void xmlSecOpenSSLHmacSetMinOutputLength(int m
* The DHMAC key klass.
*/
#define xmlSecOpenSSLKeyDataHmacId \
- xmlSecOpenSSLKeyDataHmacGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecOpenSSLKeyDataHmacGetKlass(void);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataHmacSet (xmlSecKeyDataPtr data,
- const xmlSecByte* buf,
- xmlSecSize bufSize);
+ xmlSecOpenSSLKeyDataHmacGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecOpenSSLKeyDataHmacGetKlass(void);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataHmacSet (xmlSecKeyDataPtr data,
+ const xmlSecByte* buf,
+ xmlSecSize bufSize);
-#ifndef XMLSEC_NO_MD5
+#ifndef XMLSEC_NO_MD5
/**
* xmlSecOpenSSLTransformHmacMd5Id:
*
* The HMAC with MD5 signature transform klass.
*/
#define xmlSecOpenSSLTransformHmacMd5Id \
- xmlSecOpenSSLTransformHmacMd5GetKlass()
+ xmlSecOpenSSLTransformHmacMd5GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacMd5GetKlass(void);
#endif /* XMLSEC_NO_MD5 */
@@ -234,7 +234,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacMd5GetKlass(voi
* The HMAC with RipeMD160 signature transform klass.
*/
#define xmlSecOpenSSLTransformHmacRipemd160Id \
- xmlSecOpenSSLTransformHmacRipemd160GetKlass()
+ xmlSecOpenSSLTransformHmacRipemd160GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacRipemd160GetKlass(void);
#endif /* XMLSEC_NO_RIPEMD160 */
@@ -245,7 +245,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacRipemd160GetKla
* The HMAC with SHA1 signature transform klass.
*/
#define xmlSecOpenSSLTransformHmacSha1Id \
- xmlSecOpenSSLTransformHmacSha1GetKlass()
+ xmlSecOpenSSLTransformHmacSha1GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacSha1GetKlass(void);
#endif /* XMLSEC_NO_SHA1 */
@@ -256,7 +256,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacSha1GetKlass(vo
* The HMAC with SHA224 signature transform klass.
*/
#define xmlSecOpenSSLTransformHmacSha224Id \
- xmlSecOpenSSLTransformHmacSha224GetKlass()
+ xmlSecOpenSSLTransformHmacSha224GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacSha224GetKlass(void);
#endif /* XMLSEC_NO_SHA224 */
@@ -267,7 +267,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacSha224GetKlass(
* The HMAC with SHA256 signature transform klass.
*/
#define xmlSecOpenSSLTransformHmacSha256Id \
- xmlSecOpenSSLTransformHmacSha256GetKlass()
+ xmlSecOpenSSLTransformHmacSha256GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacSha256GetKlass(void);
#endif /* XMLSEC_NO_SHA256 */
@@ -278,7 +278,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacSha256GetKlass(
* The HMAC with SHA384 signature transform klass.
*/
#define xmlSecOpenSSLTransformHmacSha384Id \
- xmlSecOpenSSLTransformHmacSha384GetKlass()
+ xmlSecOpenSSLTransformHmacSha384GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacSha384GetKlass(void);
#endif /* XMLSEC_NO_SHA384 */
@@ -289,7 +289,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacSha384GetKlass(
* The HMAC with SHA512 signature transform klass.
*/
#define xmlSecOpenSSLTransformHmacSha512Id \
- xmlSecOpenSSLTransformHmacSha512GetKlass()
+ xmlSecOpenSSLTransformHmacSha512GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacSha512GetKlass(void);
#endif /* XMLSEC_NO_SHA512 */
@@ -307,7 +307,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformHmacSha512GetKlass(
* The MD5 digest transform klass.
*/
#define xmlSecOpenSSLTransformMd5Id \
- xmlSecOpenSSLTransformMd5GetKlass()
+ xmlSecOpenSSLTransformMd5GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformMd5GetKlass(void);
#endif /* XMLSEC_NO_MD5 */
@@ -324,7 +324,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformMd5GetKlass(void);
* The RIPEMD160 digest transform klass.
*/
#define xmlSecOpenSSLTransformRipemd160Id \
- xmlSecOpenSSLTransformRipemd160GetKlass()
+ xmlSecOpenSSLTransformRipemd160GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRipemd160GetKlass(void);
#endif /* XMLSEC_NO_RIPEMD160 */
@@ -343,14 +343,14 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRipemd160GetKlass(v
* The RSA key klass.
*/
#define xmlSecOpenSSLKeyDataRsaId \
- xmlSecOpenSSLKeyDataRsaGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecOpenSSLKeyDataRsaGetKlass (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataRsaAdoptRsa (xmlSecKeyDataPtr data,
- RSA* rsa);
-XMLSEC_CRYPTO_EXPORT RSA* xmlSecOpenSSLKeyDataRsaGetRsa (xmlSecKeyDataPtr data);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataRsaAdoptEvp (xmlSecKeyDataPtr data,
- EVP_PKEY* pKey);
-XMLSEC_CRYPTO_EXPORT EVP_PKEY* xmlSecOpenSSLKeyDataRsaGetEvp (xmlSecKeyDataPtr data);
+ xmlSecOpenSSLKeyDataRsaGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecOpenSSLKeyDataRsaGetKlass (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataRsaAdoptRsa (xmlSecKeyDataPtr data,
+ RSA* rsa);
+XMLSEC_CRYPTO_EXPORT RSA* xmlSecOpenSSLKeyDataRsaGetRsa (xmlSecKeyDataPtr data);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataRsaAdoptEvp (xmlSecKeyDataPtr data,
+ EVP_PKEY* pKey);
+XMLSEC_CRYPTO_EXPORT EVP_PKEY* xmlSecOpenSSLKeyDataRsaGetEvp (xmlSecKeyDataPtr data);
#ifndef XMLSEC_NO_MD5
/**
@@ -358,8 +358,8 @@ XMLSEC_CRYPTO_EXPORT EVP_PKEY* xmlSecOpenSSLKeyDataRsaGetEvp (xmlSecKeyDataPtr
*
* The RSA-MD5 signature transform klass.
*/
-#define xmlSecOpenSSLTransformRsaMd5Id \
- xmlSecOpenSSLTransformRsaMd5GetKlass()
+#define xmlSecOpenSSLTransformRsaMd5Id \
+ xmlSecOpenSSLTransformRsaMd5GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaMd5GetKlass(void);
#endif /* XMLSEC_NO_MD5 */
@@ -369,8 +369,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaMd5GetKlass(void
*
* The RSA-RIPEMD160 signature transform klass.
*/
-#define xmlSecOpenSSLTransformRsaRipemd160Id \
- xmlSecOpenSSLTransformRsaRipemd160GetKlass()
+#define xmlSecOpenSSLTransformRsaRipemd160Id \
+ xmlSecOpenSSLTransformRsaRipemd160GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaRipemd160GetKlass(void);
#endif /* XMLSEC_NO_RIPEMD160 */
@@ -380,8 +380,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaRipemd160GetKlas
*
* The RSA-SHA1 signature transform klass.
*/
-#define xmlSecOpenSSLTransformRsaSha1Id \
- xmlSecOpenSSLTransformRsaSha1GetKlass()
+#define xmlSecOpenSSLTransformRsaSha1Id \
+ xmlSecOpenSSLTransformRsaSha1GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaSha1GetKlass(void);
#endif /* XMLSEC_NO_SHA1 */
@@ -391,8 +391,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaSha1GetKlass(voi
*
* The RSA-SHA224 signature transform klass.
*/
-#define xmlSecOpenSSLTransformRsaSha224Id \
- xmlSecOpenSSLTransformRsaSha224GetKlass()
+#define xmlSecOpenSSLTransformRsaSha224Id \
+ xmlSecOpenSSLTransformRsaSha224GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaSha224GetKlass(void);
#endif /* XMLSEC_NO_SHA224 */
@@ -402,8 +402,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaSha224GetKlass(v
*
* The RSA-SHA256 signature transform klass.
*/
-#define xmlSecOpenSSLTransformRsaSha256Id \
- xmlSecOpenSSLTransformRsaSha256GetKlass()
+#define xmlSecOpenSSLTransformRsaSha256Id \
+ xmlSecOpenSSLTransformRsaSha256GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaSha256GetKlass(void);
#endif /* XMLSEC_NO_SHA256 */
@@ -413,8 +413,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaSha256GetKlass(v
*
* The RSA-SHA384 signature transform klass.
*/
-#define xmlSecOpenSSLTransformRsaSha384Id \
- xmlSecOpenSSLTransformRsaSha384GetKlass()
+#define xmlSecOpenSSLTransformRsaSha384Id \
+ xmlSecOpenSSLTransformRsaSha384GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaSha384GetKlass(void);
#endif /* XMLSEC_NO_SHA384 */
@@ -424,8 +424,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaSha384GetKlass(v
*
* The RSA-SHA512 signature transform klass.
*/
-#define xmlSecOpenSSLTransformRsaSha512Id \
- xmlSecOpenSSLTransformRsaSha512GetKlass()
+#define xmlSecOpenSSLTransformRsaSha512Id \
+ xmlSecOpenSSLTransformRsaSha512GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaSha512GetKlass(void);
#endif /* XMLSEC_NO_SHA512 */
@@ -435,7 +435,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaSha512GetKlass(v
* The RSA PKCS1 key transport transform klass.
*/
#define xmlSecOpenSSLTransformRsaPkcs1Id \
- xmlSecOpenSSLTransformRsaPkcs1GetKlass()
+ xmlSecOpenSSLTransformRsaPkcs1GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaPkcs1GetKlass(void);
/**
@@ -444,7 +444,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaPkcs1GetKlass(vo
* The RSA PKCS1 key transport transform klass.
*/
#define xmlSecOpenSSLTransformRsaOaepId \
- xmlSecOpenSSLTransformRsaOaepGetKlass()
+ xmlSecOpenSSLTransformRsaOaepGetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaOaepGetKlass(void);
#endif /* XMLSEC_NO_RSA */
@@ -462,7 +462,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformRsaOaepGetKlass(voi
* The SHA1 digest transform klass.
*/
#define xmlSecOpenSSLTransformSha1Id \
- xmlSecOpenSSLTransformSha1GetKlass()
+ xmlSecOpenSSLTransformSha1GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformSha1GetKlass(void);
#endif /* XMLSEC_NO_SHA1 */
@@ -479,7 +479,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformSha1GetKlass(void);
* The SHA224 digest transform klass.
*/
#define xmlSecOpenSSLTransformSha224Id \
- xmlSecOpenSSLTransformSha224GetKlass()
+ xmlSecOpenSSLTransformSha224GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformSha224GetKlass(void);
#endif /* XMLSEC_NO_SHA224 */
@@ -496,7 +496,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformSha224GetKlass(void
* The SHA256 digest transform klass.
*/
#define xmlSecOpenSSLTransformSha256Id \
- xmlSecOpenSSLTransformSha256GetKlass()
+ xmlSecOpenSSLTransformSha256GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformSha256GetKlass(void);
#endif /* XMLSEC_NO_SHA256 */
@@ -512,7 +512,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformSha256GetKlass(void
* The SHA384 digest transform klass.
*/
#define xmlSecOpenSSLTransformSha384Id \
- xmlSecOpenSSLTransformSha384GetKlass()
+ xmlSecOpenSSLTransformSha384GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformSha384GetKlass(void);
#endif /* XMLSEC_NO_SHA384 */
@@ -528,7 +528,7 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformSha384GetKlass(void
* The SHA512 digest transform klass.
*/
#define xmlSecOpenSSLTransformSha512Id \
- xmlSecOpenSSLTransformSha512GetKlass()
+ xmlSecOpenSSLTransformSha512GetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformSha512GetKlass(void);
#endif /* XMLSEC_NO_SHA512 */
@@ -545,22 +545,22 @@ XMLSEC_CRYPTO_EXPORT xmlSecTransformId xmlSecOpenSSLTransformSha512GetKlass(void
*
* Macro. The XMLSec library klass for OpenSSL errors reporting functions.
*/
-#define XMLSEC_OPENSSL_ERRORS_LIB (ERR_LIB_USER + 57)
+#define XMLSEC_OPENSSL_ERRORS_LIB (ERR_LIB_USER + 57)
/**
* XMLSEC_OPENSSL_ERRORS_FUNCTION:
*
* Macro. The XMLSec library functions OpenSSL errors reporting functions.
*/
-#define XMLSEC_OPENSSL_ERRORS_FUNCTION 0
+#define XMLSEC_OPENSSL_ERRORS_FUNCTION 0
-XMLSEC_CRYPTO_EXPORT void xmlSecOpenSSLErrorsDefaultCallback (const char* file,
- int line,
- const char* func,
- const char* errorObject,
- const char* errorSubject,
- int reason,
- const char* msg);
+XMLSEC_CRYPTO_EXPORT void xmlSecOpenSSLErrorsDefaultCallback (const char* file,
+ int line,
+ const char* func,
+ const char* errorObject,
+ const char* errorSubject,
+ int reason,
+ const char* msg);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/openssl/evp.h b/include/xmlsec/openssl/evp.h
index 4270bf0..41cee0a 100644
--- a/include/xmlsec/openssl/evp.h
+++ b/include/xmlsec/openssl/evp.h
@@ -22,17 +22,17 @@ extern "C" {
#include <xmlsec/openssl/crypto.h>
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLEvpKeyDataAdoptEvp (xmlSecKeyDataPtr data,
- EVP_PKEY* pKey);
-XMLSEC_CRYPTO_EXPORT EVP_PKEY* xmlSecOpenSSLEvpKeyDataGetEvp (xmlSecKeyDataPtr data);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLEvpKeyDataAdoptEvp (xmlSecKeyDataPtr data,
+ EVP_PKEY* pKey);
+XMLSEC_CRYPTO_EXPORT EVP_PKEY* xmlSecOpenSSLEvpKeyDataGetEvp (xmlSecKeyDataPtr data);
/******************************************************************************
*
* EVP helper functions
*
*****************************************************************************/
-XMLSEC_CRYPTO_EXPORT EVP_PKEY* xmlSecOpenSSLEvpKeyDup (EVP_PKEY* pKey);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataPtr xmlSecOpenSSLEvpKeyAdopt (EVP_PKEY *pKey);
+XMLSEC_CRYPTO_EXPORT EVP_PKEY* xmlSecOpenSSLEvpKeyDup (EVP_PKEY* pKey);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataPtr xmlSecOpenSSLEvpKeyAdopt (EVP_PKEY *pKey);
#ifdef __cplusplus
diff --git a/include/xmlsec/openssl/symbols.h b/include/xmlsec/openssl/symbols.h
index 295c234..5b4692f 100644
--- a/include/xmlsec/openssl/symbols.h
+++ b/include/xmlsec/openssl/symbols.h
@@ -25,85 +25,85 @@ extern "C" {
/**
* Crypto Init/shutdown
*/
-#define xmlSecCryptoInit xmlSecOpenSSLInit
-#define xmlSecCryptoShutdown xmlSecOpenSSLShutdown
+#define xmlSecCryptoInit xmlSecOpenSSLInit
+#define xmlSecCryptoShutdown xmlSecOpenSSLShutdown
-#define xmlSecCryptoKeysMngrInit xmlSecOpenSSLKeysMngrInit
+#define xmlSecCryptoKeysMngrInit xmlSecOpenSSLKeysMngrInit
/**
* Key data ids
*/
-#define xmlSecKeyDataAesId xmlSecOpenSSLKeyDataAesId
-#define xmlSecKeyDataDesId xmlSecOpenSSLKeyDataDesId
-#define xmlSecKeyDataDsaId xmlSecOpenSSLKeyDataDsaId
-#define xmlSecKeyDataHmacId xmlSecOpenSSLKeyDataHmacId
-#define xmlSecKeyDataRsaId xmlSecOpenSSLKeyDataRsaId
-#define xmlSecKeyDataX509Id xmlSecOpenSSLKeyDataX509Id
-#define xmlSecKeyDataRawX509CertId xmlSecOpenSSLKeyDataRawX509CertId
+#define xmlSecKeyDataAesId xmlSecOpenSSLKeyDataAesId
+#define xmlSecKeyDataDesId xmlSecOpenSSLKeyDataDesId
+#define xmlSecKeyDataDsaId xmlSecOpenSSLKeyDataDsaId
+#define xmlSecKeyDataHmacId xmlSecOpenSSLKeyDataHmacId
+#define xmlSecKeyDataRsaId xmlSecOpenSSLKeyDataRsaId
+#define xmlSecKeyDataX509Id xmlSecOpenSSLKeyDataX509Id
+#define xmlSecKeyDataRawX509CertId xmlSecOpenSSLKeyDataRawX509CertId
/**
* Key data store ids
*/
-#define xmlSecX509StoreId xmlSecOpenSSLX509StoreId
+#define xmlSecX509StoreId xmlSecOpenSSLX509StoreId
/**
* Crypto transforms ids
*/
-#define xmlSecTransformAes128CbcId xmlSecOpenSSLTransformAes128CbcId
-#define xmlSecTransformAes192CbcId xmlSecOpenSSLTransformAes192CbcId
-#define xmlSecTransformAes256CbcId xmlSecOpenSSLTransformAes256CbcId
-#define xmlSecTransformKWAes128Id xmlSecOpenSSLTransformKWAes128Id
-#define xmlSecTransformKWAes192Id xmlSecOpenSSLTransformKWAes192Id
-#define xmlSecTransformKWAes256Id xmlSecOpenSSLTransformKWAes256Id
-#define xmlSecTransformDes3CbcId xmlSecOpenSSLTransformDes3CbcId
-#define xmlSecTransformKWDes3Id xmlSecOpenSSLTransformKWDes3Id
-#define xmlSecTransformDsaSha1Id xmlSecOpenSSLTransformDsaSha1Id
-#define xmlSecTransformHmacMd5Id xmlSecOpenSSLTransformHmacMd5Id
-#define xmlSecTransformHmacRipemd160Id xmlSecOpenSSLTransformHmacRipemd160Id
-#define xmlSecTransformHmacSha1Id xmlSecOpenSSLTransformHmacSha1Id
-#define xmlSecTransformHmacSha224Id xmlSecOpenSSLTransformHmacSha224Id
-#define xmlSecTransformHmacSha256Id xmlSecOpenSSLTransformHmacSha256Id
-#define xmlSecTransformHmacSha384Id xmlSecOpenSSLTransformHmacSha384Id
-#define xmlSecTransformHmacSha512Id xmlSecOpenSSLTransformHmacSha512Id
-#define xmlSecTransformMd5Id xmlSecOpenSSLTransformMd5Id
-#define xmlSecTransformRipemd160Id xmlSecOpenSSLTransformRipemd160Id
-#define xmlSecTransformRsaMd5Id xmlSecOpenSSLTransformRsaMd5Id
-#define xmlSecTransformRsaRipemd160Id xmlSecOpenSSLTransformRsaRipemd160Id
-#define xmlSecTransformRsaSha1Id xmlSecOpenSSLTransformRsaSha1Id
-#define xmlSecTransformRsaSha224Id xmlSecOpenSSLTransformRsaSha224Id
-#define xmlSecTransformRsaSha256Id xmlSecOpenSSLTransformRsaSha256Id
-#define xmlSecTransformRsaSha384Id xmlSecOpenSSLTransformRsaSha384Id
-#define xmlSecTransformRsaSha512Id xmlSecOpenSSLTransformRsaSha512Id
-#define xmlSecTransformRsaPkcs1Id xmlSecOpenSSLTransformRsaPkcs1Id
-#define xmlSecTransformRsaOaepId xmlSecOpenSSLTransformRsaOaepId
-#define xmlSecTransformSha1Id xmlSecOpenSSLTransformSha1Id
-#define xmlSecTransformSha224Id xmlSecOpenSSLTransformSha224Id
-#define xmlSecTransformSha256Id xmlSecOpenSSLTransformSha256Id
-#define xmlSecTransformSha384Id xmlSecOpenSSLTransformSha384Id
-#define xmlSecTransformSha512Id xmlSecOpenSSLTransformSha512Id
+#define xmlSecTransformAes128CbcId xmlSecOpenSSLTransformAes128CbcId
+#define xmlSecTransformAes192CbcId xmlSecOpenSSLTransformAes192CbcId
+#define xmlSecTransformAes256CbcId xmlSecOpenSSLTransformAes256CbcId
+#define xmlSecTransformKWAes128Id xmlSecOpenSSLTransformKWAes128Id
+#define xmlSecTransformKWAes192Id xmlSecOpenSSLTransformKWAes192Id
+#define xmlSecTransformKWAes256Id xmlSecOpenSSLTransformKWAes256Id
+#define xmlSecTransformDes3CbcId xmlSecOpenSSLTransformDes3CbcId
+#define xmlSecTransformKWDes3Id xmlSecOpenSSLTransformKWDes3Id
+#define xmlSecTransformDsaSha1Id xmlSecOpenSSLTransformDsaSha1Id
+#define xmlSecTransformHmacMd5Id xmlSecOpenSSLTransformHmacMd5Id
+#define xmlSecTransformHmacRipemd160Id xmlSecOpenSSLTransformHmacRipemd160Id
+#define xmlSecTransformHmacSha1Id xmlSecOpenSSLTransformHmacSha1Id
+#define xmlSecTransformHmacSha224Id xmlSecOpenSSLTransformHmacSha224Id
+#define xmlSecTransformHmacSha256Id xmlSecOpenSSLTransformHmacSha256Id
+#define xmlSecTransformHmacSha384Id xmlSecOpenSSLTransformHmacSha384Id
+#define xmlSecTransformHmacSha512Id xmlSecOpenSSLTransformHmacSha512Id
+#define xmlSecTransformMd5Id xmlSecOpenSSLTransformMd5Id
+#define xmlSecTransformRipemd160Id xmlSecOpenSSLTransformRipemd160Id
+#define xmlSecTransformRsaMd5Id xmlSecOpenSSLTransformRsaMd5Id
+#define xmlSecTransformRsaRipemd160Id xmlSecOpenSSLTransformRsaRipemd160Id
+#define xmlSecTransformRsaSha1Id xmlSecOpenSSLTransformRsaSha1Id
+#define xmlSecTransformRsaSha224Id xmlSecOpenSSLTransformRsaSha224Id
+#define xmlSecTransformRsaSha256Id xmlSecOpenSSLTransformRsaSha256Id
+#define xmlSecTransformRsaSha384Id xmlSecOpenSSLTransformRsaSha384Id
+#define xmlSecTransformRsaSha512Id xmlSecOpenSSLTransformRsaSha512Id
+#define xmlSecTransformRsaPkcs1Id xmlSecOpenSSLTransformRsaPkcs1Id
+#define xmlSecTransformRsaOaepId xmlSecOpenSSLTransformRsaOaepId
+#define xmlSecTransformSha1Id xmlSecOpenSSLTransformSha1Id
+#define xmlSecTransformSha224Id xmlSecOpenSSLTransformSha224Id
+#define xmlSecTransformSha256Id xmlSecOpenSSLTransformSha256Id
+#define xmlSecTransformSha384Id xmlSecOpenSSLTransformSha384Id
+#define xmlSecTransformSha512Id xmlSecOpenSSLTransformSha512Id
/**
* High level routines form xmlsec command line utility
*/
-#define xmlSecCryptoAppInit xmlSecOpenSSLAppInit
-#define xmlSecCryptoAppShutdown xmlSecOpenSSLAppShutdown
-#define xmlSecCryptoAppDefaultKeysMngrInit xmlSecOpenSSLAppDefaultKeysMngrInit
-#define xmlSecCryptoAppDefaultKeysMngrAdoptKey xmlSecOpenSSLAppDefaultKeysMngrAdoptKey
-#define xmlSecCryptoAppDefaultKeysMngrLoad xmlSecOpenSSLAppDefaultKeysMngrLoad
-#define xmlSecCryptoAppDefaultKeysMngrSave xmlSecOpenSSLAppDefaultKeysMngrSave
-#define xmlSecCryptoAppKeysMngrCertLoad xmlSecOpenSSLAppKeysMngrCertLoad
-#define xmlSecCryptoAppKeysMngrCertLoadMemory xmlSecOpenSSLAppKeysMngrCertLoadMemory
-#define xmlSecCryptoAppKeyLoad xmlSecOpenSSLAppKeyLoad
-#define xmlSecCryptoAppPkcs12Load xmlSecOpenSSLAppPkcs12Load
-#define xmlSecCryptoAppKeyCertLoad xmlSecOpenSSLAppKeyCertLoad
-#define xmlSecCryptoAppKeyLoadMemory xmlSecOpenSSLAppKeyLoadMemory
-#define xmlSecCryptoAppPkcs12LoadMemory xmlSecOpenSSLAppPkcs12LoadMemory
-#define xmlSecCryptoAppKeyCertLoadMemory xmlSecOpenSSLAppKeyCertLoadMemory
-#define xmlSecCryptoAppGetDefaultPwdCallback xmlSecOpenSSLAppGetDefaultPwdCallback
+#define xmlSecCryptoAppInit xmlSecOpenSSLAppInit
+#define xmlSecCryptoAppShutdown xmlSecOpenSSLAppShutdown
+#define xmlSecCryptoAppDefaultKeysMngrInit xmlSecOpenSSLAppDefaultKeysMngrInit
+#define xmlSecCryptoAppDefaultKeysMngrAdoptKey xmlSecOpenSSLAppDefaultKeysMngrAdoptKey
+#define xmlSecCryptoAppDefaultKeysMngrLoad xmlSecOpenSSLAppDefaultKeysMngrLoad
+#define xmlSecCryptoAppDefaultKeysMngrSave xmlSecOpenSSLAppDefaultKeysMngrSave
+#define xmlSecCryptoAppKeysMngrCertLoad xmlSecOpenSSLAppKeysMngrCertLoad
+#define xmlSecCryptoAppKeysMngrCertLoadMemory xmlSecOpenSSLAppKeysMngrCertLoadMemory
+#define xmlSecCryptoAppKeyLoad xmlSecOpenSSLAppKeyLoad
+#define xmlSecCryptoAppPkcs12Load xmlSecOpenSSLAppPkcs12Load
+#define xmlSecCryptoAppKeyCertLoad xmlSecOpenSSLAppKeyCertLoad
+#define xmlSecCryptoAppKeyLoadMemory xmlSecOpenSSLAppKeyLoadMemory
+#define xmlSecCryptoAppPkcs12LoadMemory xmlSecOpenSSLAppPkcs12LoadMemory
+#define xmlSecCryptoAppKeyCertLoadMemory xmlSecOpenSSLAppKeyCertLoadMemory
+#define xmlSecCryptoAppGetDefaultPwdCallback xmlSecOpenSSLAppGetDefaultPwdCallback
/* todo: this should go away on next API refresh */
-#define xmlSecCryptoAppKeysMngrAddCertsPath xmlSecOpenSSLAppKeysMngrAddCertsPath
+#define xmlSecCryptoAppKeysMngrAddCertsPath xmlSecOpenSSLAppKeysMngrAddCertsPath
#endif /* XMLSEC_CRYPTO_OPENSSL */
diff --git a/include/xmlsec/openssl/x509.h b/include/xmlsec/openssl/x509.h
index ce0b4d0..e041ec7 100644
--- a/include/xmlsec/openssl/x509.h
+++ b/include/xmlsec/openssl/x509.h
@@ -26,14 +26,14 @@ extern "C" {
*
* Macro. To make docbook happy.
*/
-#define XMLSEC_STACK_OF_X509 STACK_OF(X509)
+#define XMLSEC_STACK_OF_X509 STACK_OF(X509)
/**
* XMLSEC_STACK_OF_X509_CRL:
*
* Macro. To make docbook happy.
*/
-#define XMLSEC_STACK_OF_X509_CRL STACK_OF(X509_CRL)
+#define XMLSEC_STACK_OF_X509_CRL STACK_OF(X509_CRL)
/**
* xmlSecOpenSSLKeyDataX509Id:
@@ -41,26 +41,26 @@ extern "C" {
* The OpenSSL X509 data klass.
*/
#define xmlSecOpenSSLKeyDataX509Id \
- xmlSecOpenSSLKeyDataX509GetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecOpenSSLKeyDataX509GetKlass(void);
+ xmlSecOpenSSLKeyDataX509GetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecOpenSSLKeyDataX509GetKlass(void);
-XMLSEC_CRYPTO_EXPORT X509* xmlSecOpenSSLKeyDataX509GetKeyCert(xmlSecKeyDataPtr data);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data,
- X509* cert);
+XMLSEC_CRYPTO_EXPORT X509* xmlSecOpenSSLKeyDataX509GetKeyCert(xmlSecKeyDataPtr data);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data,
+ X509* cert);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataX509AdoptCert(xmlSecKeyDataPtr data,
- X509* cert);
-XMLSEC_CRYPTO_EXPORT X509* xmlSecOpenSSLKeyDataX509GetCert (xmlSecKeyDataPtr data,
- xmlSecSize pos);
-XMLSEC_CRYPTO_EXPORT xmlSecSize xmlSecOpenSSLKeyDataX509GetCertsSize(xmlSecKeyDataPtr data);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataX509AdoptCert(xmlSecKeyDataPtr data,
+ X509* cert);
+XMLSEC_CRYPTO_EXPORT X509* xmlSecOpenSSLKeyDataX509GetCert (xmlSecKeyDataPtr data,
+ xmlSecSize pos);
+XMLSEC_CRYPTO_EXPORT xmlSecSize xmlSecOpenSSLKeyDataX509GetCertsSize(xmlSecKeyDataPtr data);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataX509AdoptCrl(xmlSecKeyDataPtr data,
- X509_CRL* crl);
-XMLSEC_CRYPTO_EXPORT X509_CRL* xmlSecOpenSSLKeyDataX509GetCrl (xmlSecKeyDataPtr data,
- xmlSecSize pos);
-XMLSEC_CRYPTO_EXPORT xmlSecSize xmlSecOpenSSLKeyDataX509GetCrlsSize(xmlSecKeyDataPtr data);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLKeyDataX509AdoptCrl(xmlSecKeyDataPtr data,
+ X509_CRL* crl);
+XMLSEC_CRYPTO_EXPORT X509_CRL* xmlSecOpenSSLKeyDataX509GetCrl (xmlSecKeyDataPtr data,
+ xmlSecSize pos);
+XMLSEC_CRYPTO_EXPORT xmlSecSize xmlSecOpenSSLKeyDataX509GetCrlsSize(xmlSecKeyDataPtr data);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataPtr xmlSecOpenSSLX509CertGetKey (X509* cert);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataPtr xmlSecOpenSSLX509CertGetKey (X509* cert);
/**
@@ -69,8 +69,8 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataPtr xmlSecOpenSSLX509CertGetKey (X509* cert);
* The OpenSSL raw X509 certificate klass.
*/
#define xmlSecOpenSSLKeyDataRawX509CertId \
- xmlSecOpenSSLKeyDataRawX509CertGetKlass()
-XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecOpenSSLKeyDataRawX509CertGetKlass(void);
+ xmlSecOpenSSLKeyDataRawX509CertGetKlass()
+XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecOpenSSLKeyDataRawX509CertGetKlass(void);
/**
* xmlSecOpenSSLX509StoreId:
@@ -78,25 +78,25 @@ XMLSEC_CRYPTO_EXPORT xmlSecKeyDataId xmlSecOpenSSLKeyDataRawX509CertGetKlass(vo
* The OpenSSL X509 store klass.
*/
#define xmlSecOpenSSLX509StoreId \
- xmlSecOpenSSLX509StoreGetKlass()
+ xmlSecOpenSSLX509StoreGetKlass()
XMLSEC_CRYPTO_EXPORT xmlSecKeyDataStoreId xmlSecOpenSSLX509StoreGetKlass(void);
-XMLSEC_CRYPTO_EXPORT X509* xmlSecOpenSSLX509StoreFindCert (xmlSecKeyDataStorePtr store,
- xmlChar *subjectName,
- xmlChar *issuerName,
- xmlChar *issuerSerial,
- xmlChar *ski,
- xmlSecKeyInfoCtx* keyInfoCtx);
-XMLSEC_CRYPTO_EXPORT X509* xmlSecOpenSSLX509StoreVerify (xmlSecKeyDataStorePtr store,
- XMLSEC_STACK_OF_X509* certs,
- XMLSEC_STACK_OF_X509_CRL* crls,
- xmlSecKeyInfoCtx* keyInfoCtx);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLX509StoreAdoptCert (xmlSecKeyDataStorePtr store,
- X509* cert,
- xmlSecKeyDataType type);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLX509StoreAdoptCrl (xmlSecKeyDataStorePtr store,
- X509_CRL* crl);
-XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLX509StoreAddCertsPath(xmlSecKeyDataStorePtr store,
- const char* path);
+XMLSEC_CRYPTO_EXPORT X509* xmlSecOpenSSLX509StoreFindCert (xmlSecKeyDataStorePtr store,
+ xmlChar *subjectName,
+ xmlChar *issuerName,
+ xmlChar *issuerSerial,
+ xmlChar *ski,
+ xmlSecKeyInfoCtx* keyInfoCtx);
+XMLSEC_CRYPTO_EXPORT X509* xmlSecOpenSSLX509StoreVerify (xmlSecKeyDataStorePtr store,
+ XMLSEC_STACK_OF_X509* certs,
+ XMLSEC_STACK_OF_X509_CRL* crls,
+ xmlSecKeyInfoCtx* keyInfoCtx);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLX509StoreAdoptCert (xmlSecKeyDataStorePtr store,
+ X509* cert,
+ xmlSecKeyDataType type);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLX509StoreAdoptCrl (xmlSecKeyDataStorePtr store,
+ X509_CRL* crl);
+XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLX509StoreAddCertsPath(xmlSecKeyDataStorePtr store,
+ const char* path);
XMLSEC_CRYPTO_EXPORT int xmlSecOpenSSLX509StoreAddCertsFile(xmlSecKeyDataStorePtr store,
const char* file);
diff --git a/include/xmlsec/parser.h b/include/xmlsec/parser.h
index 754c907..c10bf1f 100644
--- a/include/xmlsec/parser.h
+++ b/include/xmlsec/parser.h
@@ -21,16 +21,16 @@ extern "C" {
#include <xmlsec/transforms.h>
-XMLSEC_EXPORT xmlDocPtr xmlSecParseFile (const char *filename);
-XMLSEC_EXPORT xmlDocPtr xmlSecParseMemory (const xmlSecByte *buffer,
- xmlSecSize size,
- int recovery);
-XMLSEC_EXPORT xmlDocPtr xmlSecParseMemoryExt (const xmlSecByte *prefix,
- xmlSecSize prefixSize,
- const xmlSecByte *buffer,
- xmlSecSize bufferSize,
- const xmlSecByte *postfix,
- xmlSecSize postfixSize);
+XMLSEC_EXPORT xmlDocPtr xmlSecParseFile (const char *filename);
+XMLSEC_EXPORT xmlDocPtr xmlSecParseMemory (const xmlSecByte *buffer,
+ xmlSecSize size,
+ int recovery);
+XMLSEC_EXPORT xmlDocPtr xmlSecParseMemoryExt (const xmlSecByte *prefix,
+ xmlSecSize prefixSize,
+ const xmlSecByte *buffer,
+ xmlSecSize bufferSize,
+ const xmlSecByte *postfix,
+ xmlSecSize postfixSize);
/**
@@ -39,8 +39,8 @@ XMLSEC_EXPORT xmlDocPtr xmlSecParseMemoryExt (const xmlSecByte *prefix,
* The XML Parser transform klass.
*/
#define xmlSecTransformXmlParserId \
- xmlSecTransformXmlParserGetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXmlParserGetKlass (void);
+ xmlSecTransformXmlParserGetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXmlParserGetKlass (void);
#ifdef __cplusplus
diff --git a/include/xmlsec/private.h b/include/xmlsec/private.h
index 5d5fc77..9e22e33 100644
--- a/include/xmlsec/private.h
+++ b/include/xmlsec/private.h
@@ -42,7 +42,7 @@ extern "C" {
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecCryptoInitMethod) (void);
+typedef int (*xmlSecCryptoInitMethod) (void);
/**
* xmlSecCryptoShutdownMethod:
*
@@ -50,16 +50,16 @@ typedef int (*xmlSecCryptoInitMethod) (void);
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecCryptoShutdownMethod) (void);
+typedef int (*xmlSecCryptoShutdownMethod) (void);
/**
* xmlSecCryptoKeysMngrInitMethod:
- * @mngr: the pointer to keys manager.
+ * @mngr: the pointer to keys manager.
*
* Initializes @mngr with xmlsec-crypto library specific data.
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecCryptoKeysMngrInitMethod) (xmlSecKeysMngrPtr mngr);
+typedef int (*xmlSecCryptoKeysMngrInitMethod) (xmlSecKeysMngrPtr mngr);
/*****************************************************************************
*
@@ -75,7 +75,7 @@ typedef int (*xmlSecCryptoKeysMngrInitMethod) (xmlSecKeysMngrPtr mngr);
* (the xmlsec-crypto library is not loaded or this key data klass is not
* implemented).
*/
-typedef xmlSecKeyDataId (*xmlSecCryptoKeyDataGetKlassMethod) (void);
+typedef xmlSecKeyDataId (*xmlSecCryptoKeyDataGetKlassMethod) (void);
/*****************************************************************************
*
@@ -91,7 +91,7 @@ typedef xmlSecKeyDataId (*xmlSecCryptoKeyDataGetKlassMethod) (void);
* (the xmlsec-crypto library is not loaded or this key data store klass is not
* implemented).
*/
-typedef xmlSecKeyDataStoreId (*xmlSecCryptoKeyDataStoreGetKlassMethod)(void);
+typedef xmlSecKeyDataStoreId (*xmlSecCryptoKeyDataStoreGetKlassMethod)(void);
/*****************************************************************************
*
@@ -107,7 +107,7 @@ typedef xmlSecKeyDataStoreId (*xmlSecCryptoKeyDataStoreGetKlassMethod)(void);
* (the xmlsec-crypto library is not loaded or this transform is not
* implemented).
*/
-typedef xmlSecTransformId (*xmlSecCryptoTransformGetKlassMethod) (void);
+typedef xmlSecTransformId (*xmlSecCryptoTransformGetKlassMethod) (void);
/*****************************************************************************
*
@@ -116,7 +116,7 @@ typedef xmlSecTransformId (*xmlSecCryptoTransformGetKlassMethod) (void);
****************************************************************************/
/**
* xmlSecCryptoAppInitMethod:
- * @config: the path to crypto library configuration.
+ * @config: the path to crypto library configuration.
*
* General crypto engine initialization. This function is used
* by XMLSec command line utility and called before
@@ -124,7 +124,7 @@ typedef xmlSecTransformId (*xmlSecCryptoTransformGetKlassMethod) (void);
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecCryptoAppInitMethod) (const char* config);
+typedef int (*xmlSecCryptoAppInitMethod) (const char* config);
/**
* xmlSecCryptoAppShutdownMethod:
*
@@ -134,139 +134,139 @@ typedef int (*xmlSecCryptoAppInitMethod) (const char* config);
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecCryptoAppShutdownMethod) (void);
+typedef int (*xmlSecCryptoAppShutdownMethod) (void);
/**
* xmlSecCryptoAppDefaultKeysMngrInitMethod:
- * @mngr: the pointer to keys manager.
+ * @mngr: the pointer to keys manager.
*
* Initializes @mngr with simple keys store #xmlSecSimpleKeysStoreId
* and a default crypto key data stores.
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecCryptoAppDefaultKeysMngrInitMethod)
- (xmlSecKeysMngrPtr mngr);
+typedef int (*xmlSecCryptoAppDefaultKeysMngrInitMethod)
+ (xmlSecKeysMngrPtr mngr);
/**
* xmlSecCryptoAppDefaultKeysMngrAdoptKeyMethod:
- * @mngr: the pointer to keys manager.
- * @key: the pointer to key.
+ * @mngr: the pointer to keys manager.
+ * @key: the pointer to key.
*
* Adds @key to the keys manager @mngr created with #xmlSecCryptoAppDefaultKeysMngrInit
* function.
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecCryptoAppDefaultKeysMngrAdoptKeyMethod)
- (xmlSecKeysMngrPtr mngr,
- xmlSecKeyPtr key);
+typedef int (*xmlSecCryptoAppDefaultKeysMngrAdoptKeyMethod)
+ (xmlSecKeysMngrPtr mngr,
+ xmlSecKeyPtr key);
/**
* xmlSecCryptoAppDefaultKeysMngrLoadMethod:
- * @mngr: the pointer to keys manager.
- * @uri: the uri.
+ * @mngr: the pointer to keys manager.
+ * @uri: the uri.
*
* Loads XML keys file from @uri to the keys manager @mngr created
* with #xmlSecCryptoAppDefaultKeysMngrInit function.
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecCryptoAppDefaultKeysMngrLoadMethod)
- (xmlSecKeysMngrPtr mngr,
- const char* uri);
+typedef int (*xmlSecCryptoAppDefaultKeysMngrLoadMethod)
+ (xmlSecKeysMngrPtr mngr,
+ const char* uri);
/**
* xmlSecCryptoAppDefaultKeysMngrSaveMethod:
- * @mngr: the pointer to keys manager.
- * @filename: the destination filename.
- * @type: the type of keys to save (public/private/symmetric).
+ * @mngr: the pointer to keys manager.
+ * @filename: the destination filename.
+ * @type: the type of keys to save (public/private/symmetric).
*
* Saves keys from @mngr to XML keys file.
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecCryptoAppDefaultKeysMngrSaveMethod)
- (xmlSecKeysMngrPtr mngr,
- const char* filename,
- xmlSecKeyDataType type);
+typedef int (*xmlSecCryptoAppDefaultKeysMngrSaveMethod)
+ (xmlSecKeysMngrPtr mngr,
+ const char* filename,
+ xmlSecKeyDataType type);
/**
* xmlSecCryptoAppKeysMngrCertLoadMethod:
- * @mngr: the keys manager.
- * @filename: the certificate file.
- * @format: the certificate file format.
- * @type: the flag that indicates is the certificate in @filename
- * trusted or not.
+ * @mngr: the keys manager.
+ * @filename: the certificate file.
+ * @format: the certificate file format.
+ * @type: the flag that indicates is the certificate in @filename
+ * trusted or not.
*
* Reads cert from @filename and adds to the list of trusted or known
* untrusted certs in @store.
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecCryptoAppKeysMngrCertLoadMethod)(xmlSecKeysMngrPtr mngr,
- const char *filename,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type);
+typedef int (*xmlSecCryptoAppKeysMngrCertLoadMethod)(xmlSecKeysMngrPtr mngr,
+ const char *filename,
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type);
/**
* xmlSecCryptoAppKeysMngrCertLoadMemoryMethod:
- * @mngr: the keys manager.
- * @data: the key data.
- * @dataSize: the key data size.
- * @format: the certificate format.
- * @type: the flag that indicates is the certificate in @data
- * trusted or not.
+ * @mngr: the keys manager.
+ * @data: the key data.
+ * @dataSize: the key data size.
+ * @format: the certificate format.
+ * @type: the flag that indicates is the certificate in @data
+ * trusted or not.
*
* Reads cert from @data and adds to the list of trusted or known
* untrusted certs in @store.
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecCryptoAppKeysMngrCertLoadMemoryMethod)(xmlSecKeysMngrPtr mngr,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type);
+typedef int (*xmlSecCryptoAppKeysMngrCertLoadMemoryMethod)(xmlSecKeysMngrPtr mngr,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type);
/**
* xmlSecCryptoAppKeyLoadMethod:
- * @filename: the key filename.
- * @format: the key file format.
- * @pwd: the key file password.
- * @pwdCallback: the key password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @filename: the key filename.
+ * @format: the key file format.
+ * @pwd: the key file password.
+ * @pwdCallback: the key password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key from the a file.
*
* Returns: pointer to the key or NULL if an error occurs.
*/
-typedef xmlSecKeyPtr (*xmlSecCryptoAppKeyLoadMethod) (const char *filename,
- xmlSecKeyDataFormat format,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
+typedef xmlSecKeyPtr (*xmlSecCryptoAppKeyLoadMethod) (const char *filename,
+ xmlSecKeyDataFormat format,
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
/**
* xmlSecCryptoAppKeyLoadMemoryMethod:
- * @data: the key data.
- * @dataSize: the key data size.
- * @format: the key data format.
- * @pwd: the key data password.
- * @pwdCallback: the key password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @data: the key data.
+ * @dataSize: the key data size.
+ * @format: the key data format.
+ * @pwd: the key data password.
+ * @pwdCallback: the key password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key from the binary data buffer.
*
* Returns: pointer to the key or NULL if an error occurs.
*/
-typedef xmlSecKeyPtr (*xmlSecCryptoAppKeyLoadMemoryMethod) (const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
+typedef xmlSecKeyPtr (*xmlSecCryptoAppKeyLoadMemoryMethod) (const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format,
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
/**
* xmlSecCryptoAppPkcs12LoadMethod:
- * @filename: the PKCS12 key filename.
- * @pwd: the PKCS12 file password.
- * @pwdCallback: the password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @filename: the PKCS12 key filename.
+ * @pwd: the PKCS12 file password.
+ * @pwdCallback: the password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key and all associated certificates from the PKCS12 file.
* For uniformity, call xmlSecCryptoAppKeyLoad instead of this function. Pass
@@ -274,17 +274,17 @@ typedef xmlSecKeyPtr (*xmlSecCryptoAppKeyLoadMemoryMethod) (const xmlSecByte* d
*
* Returns: pointer to the key or NULL if an error occurs.
*/
-typedef xmlSecKeyPtr (*xmlSecCryptoAppPkcs12LoadMethod) (const char* filename,
- const char* pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
+typedef xmlSecKeyPtr (*xmlSecCryptoAppPkcs12LoadMethod) (const char* filename,
+ const char* pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
/**
* xmlSecCryptoAppPkcs12LoadMemoryMethod:
- * @data: the pkcs12 data.
- * @dataSize: the pkcs12 data size.
- * @pwd: the PKCS12 data password.
- * @pwdCallback: the password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @data: the pkcs12 data.
+ * @dataSize: the pkcs12 data size.
+ * @pwd: the PKCS12 data password.
+ * @pwdCallback: the password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key and all associated certificates from the PKCS12 binary data.
* For uniformity, call xmlSecCryptoAppKeyLoad instead of this function. Pass
@@ -292,102 +292,102 @@ typedef xmlSecKeyPtr (*xmlSecCryptoAppPkcs12LoadMethod) (const char* filename,
*
* Returns: pointer to the key or NULL if an error occurs.
*/
-typedef xmlSecKeyPtr (*xmlSecCryptoAppPkcs12LoadMemoryMethod)(const xmlSecByte* data,
- xmlSecSize dataSize,
- const char* pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
+typedef xmlSecKeyPtr (*xmlSecCryptoAppPkcs12LoadMemoryMethod)(const xmlSecByte* data,
+ xmlSecSize dataSize,
+ const char* pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
/**
* xmlSecCryptoAppKeyCertLoadMethod:
- * @key: the pointer to key.
- * @filename: the certificate filename.
- * @format: the certificate file format.
+ * @key: the pointer to key.
+ * @filename: the certificate filename.
+ * @format: the certificate file format.
*
* Reads the certificate from $ filename and adds it to key.
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecCryptoAppKeyCertLoadMethod) (xmlSecKeyPtr key,
- const char* filename,
- xmlSecKeyDataFormat format);
+typedef int (*xmlSecCryptoAppKeyCertLoadMethod) (xmlSecKeyPtr key,
+ const char* filename,
+ xmlSecKeyDataFormat format);
/**
* xmlSecCryptoAppKeyCertLoadMemoryMethod:
- * @key: the pointer to key.
- * @data: the cert data.
- * @dataSize: the cert data size.
- * @format: the certificate data format.
+ * @key: the pointer to key.
+ * @data: the cert data.
+ * @dataSize: the cert data size.
+ * @format: the certificate data format.
*
* Reads the certificate from binary @data buffer and adds it to key.
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecCryptoAppKeyCertLoadMemoryMethod)(xmlSecKeyPtr key,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format);
+typedef int (*xmlSecCryptoAppKeyCertLoadMemoryMethod)(xmlSecKeyPtr key,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format);
/**
* xmlSecCryptoDLFunctions:
- * @cryptoInit: the xmlsec-crypto library initialization method.
- * @cryptoShutdown: the xmlsec-crypto library shutdown method.
- * @cryptoKeysMngrInit: the xmlsec-crypto library keys manager init method.
- * @keyDataAesGetKlass: the method to get pointer to AES key data klass.
- * @keyDataDesGetKlass: the method to get pointer to DES key data klass.
- * @keyDataDsaGetKlass: the method to get pointer to DSA key data klass.
- * @keyDataGost2001GetKlass: the method to get pointer to GOST 2001 key data klass.
- * @keyDataHmacGetKlass: the method to get pointer to HMAC key data klass.
- * @keyDataRsaGetKlass: the method to get pointer to RSA key data klass.
- * @keyDataX509GetKlass: the method to get pointer to X509 key data klass.
- * @keyDataRawX509CertGetKlass: the method to get pointer to raw X509 cert key data klass.
- * @x509StoreGetKlass: the method to get pointer to X509 key data store.
- * @transformAes128CbcGetKlass: the method to get pointer to AES 128 encryption transform.
- * @transformAes192CbcGetKlass: the method to get pointer to AES 192 encryption transform.
- * @transformAes256CbcGetKlass: the method to get pointer to AES 256 encryption transform.
- * @transformKWAes128GetKlass: the method to get pointer to AES 128 key wrapper transform.
- * @transformKWAes192GetKlass: the method to get pointer to AES 192 key wrapper transform.
- * @transformKWAes256GetKlass: the method to get pointer to AES 256 key wrapper transform.
- * @transformDes3CbcGetKlass: the method to get pointer to Triple DES encryption transform.
- * @transformKWDes3GetKlass: the method to get pointer to Triple DES key wrapper transform.
- * @transformDsaSha1GetKlass: the method to get pointer to DSA-SHA1 signature transform.
+ * @cryptoInit: the xmlsec-crypto library initialization method.
+ * @cryptoShutdown: the xmlsec-crypto library shutdown method.
+ * @cryptoKeysMngrInit: the xmlsec-crypto library keys manager init method.
+ * @keyDataAesGetKlass: the method to get pointer to AES key data klass.
+ * @keyDataDesGetKlass: the method to get pointer to DES key data klass.
+ * @keyDataDsaGetKlass: the method to get pointer to DSA key data klass.
+ * @keyDataGost2001GetKlass: the method to get pointer to GOST 2001 key data klass.
+ * @keyDataHmacGetKlass: the method to get pointer to HMAC key data klass.
+ * @keyDataRsaGetKlass: the method to get pointer to RSA key data klass.
+ * @keyDataX509GetKlass: the method to get pointer to X509 key data klass.
+ * @keyDataRawX509CertGetKlass: the method to get pointer to raw X509 cert key data klass.
+ * @x509StoreGetKlass: the method to get pointer to X509 key data store.
+ * @transformAes128CbcGetKlass: the method to get pointer to AES 128 encryption transform.
+ * @transformAes192CbcGetKlass: the method to get pointer to AES 192 encryption transform.
+ * @transformAes256CbcGetKlass: the method to get pointer to AES 256 encryption transform.
+ * @transformKWAes128GetKlass: the method to get pointer to AES 128 key wrapper transform.
+ * @transformKWAes192GetKlass: the method to get pointer to AES 192 key wrapper transform.
+ * @transformKWAes256GetKlass: the method to get pointer to AES 256 key wrapper transform.
+ * @transformDes3CbcGetKlass: the method to get pointer to Triple DES encryption transform.
+ * @transformKWDes3GetKlass: the method to get pointer to Triple DES key wrapper transform.
+ * @transformDsaSha1GetKlass: the method to get pointer to DSA-SHA1 signature transform.
* @transformGost2001GostR3411_94GetKlass: the method to get pointer to GOST2001 transform.
- * @transformHmacMd5GetKlass: the method to get pointer to HMAC-MD5 transform.
+ * @transformHmacMd5GetKlass: the method to get pointer to HMAC-MD5 transform.
* @transformHmacRipemd160GetKlass: the method to get pointer to HMAC-RIPEMD160 transform.
- * @transformHmacSha1GetKlass: the method to get pointer to HMAC-SHA1 transform.
+ * @transformHmacSha1GetKlass: the method to get pointer to HMAC-SHA1 transform.
* @transformHmacSha224GetKlass: the method to get pointer to HMAC-SHA224 transform.
* @transformHmacSha256GetKlass: the method to get pointer to HMAC-SHA256 transform.
* @transformHmacSha384GetKlass: the method to get pointer to HMAC-SHA384 transform.
* @transformHmacSha512GetKlass: the method to get pointer to HMAC-SHA512 transform.
- * @transformMd5GetKlass: the method to get pointer to MD5 digest transform.
- * @transformRipemd160GetKlass: the method to get pointer to RIPEMD160 digest transform.
- * @transformRsaMd5GetKlass: the method to get pointer to RSA-MD5 signature transform.
+ * @transformMd5GetKlass: the method to get pointer to MD5 digest transform.
+ * @transformRipemd160GetKlass: the method to get pointer to RIPEMD160 digest transform.
+ * @transformRsaMd5GetKlass: the method to get pointer to RSA-MD5 signature transform.
* @transformRsaRipemd160GetKlass: the method to get pointer to RSA-RIPEMD160 signature transform.
- * @transformRsaSha1GetKlass: the method to get pointer to RSA-SHA1 signature transform.
- * @transformRsaSha224GetKlass: the method to get pointer to RSA-SHA224 signature transform.
- * @transformRsaSha256GetKlass: the method to get pointer to RSA-SHA256 signature transform.
- * @transformRsaSha384GetKlass: the method to get pointer to RSA-SHA384 signature transform.
- * @transformRsaSha512GetKlass: the method to get pointer to RSA-SHA512 signature transform.
- * @transformRsaPkcs1GetKlass: the method to get pointer to RSA-PKCS1_5 key transport transform.
- * @transformRsaOaepGetKlass: the method to get pointer to RSA-OAEP key transport transform.
+ * @transformRsaSha1GetKlass: the method to get pointer to RSA-SHA1 signature transform.
+ * @transformRsaSha224GetKlass: the method to get pointer to RSA-SHA224 signature transform.
+ * @transformRsaSha256GetKlass: the method to get pointer to RSA-SHA256 signature transform.
+ * @transformRsaSha384GetKlass: the method to get pointer to RSA-SHA384 signature transform.
+ * @transformRsaSha512GetKlass: the method to get pointer to RSA-SHA512 signature transform.
+ * @transformRsaPkcs1GetKlass: the method to get pointer to RSA-PKCS1_5 key transport transform.
+ * @transformRsaOaepGetKlass: the method to get pointer to RSA-OAEP key transport transform.
* @transformGostR3411_94GetKlass: the method to get pointer to GOST R3411 transform.
- * @transformSha1GetKlass: the method to get pointer to SHA1 digest transform.
- * @transformSha224GetKlass: the method to get pointer to SHA224 digest transform.
- * @transformSha256GetKlass: the method to get pointer to SHA256 digest transform.
- * @transformSha384GetKlass: the method to get pointer to SHA384 digest transform.
- * @transformSha512GetKlass: the method to get pointer to SHA512 digest transform.
- * @cryptoAppInit: the default crypto engine initialization method.
- * @cryptoAppShutdown: the default crypto engine shutdown method.
- * @cryptoAppDefaultKeysMngrInit: the default keys manager init method.
- * @cryptoAppDefaultKeysMngrAdoptKey: the default keys manager adopt key method.
- * @cryptoAppDefaultKeysMngrLoad: the default keys manager load method.
- * @cryptoAppDefaultKeysMngrSave: the default keys manager save method.
- * @cryptoAppKeysMngrCertLoad: the default keys manager file cert load method.
- * @cryptoAppKeysMngrCertLoadMemory: the default keys manager memory cert load method.
- * @cryptoAppKeyLoad: the key file load method.
- * @cryptoAppKeyLoadMemory: the meory key load method.
- * @cryptoAppPkcs12Load: the pkcs12 file load method.
- * @cryptoAppPkcs12LoadMemory: the memory pkcs12 load method.
- * @cryptoAppKeyCertLoad: the cert file load method.
- * @cryptoAppKeyCertLoadMemory: the memory cert load method.
+ * @transformSha1GetKlass: the method to get pointer to SHA1 digest transform.
+ * @transformSha224GetKlass: the method to get pointer to SHA224 digest transform.
+ * @transformSha256GetKlass: the method to get pointer to SHA256 digest transform.
+ * @transformSha384GetKlass: the method to get pointer to SHA384 digest transform.
+ * @transformSha512GetKlass: the method to get pointer to SHA512 digest transform.
+ * @cryptoAppInit: the default crypto engine initialization method.
+ * @cryptoAppShutdown: the default crypto engine shutdown method.
+ * @cryptoAppDefaultKeysMngrInit: the default keys manager init method.
+ * @cryptoAppDefaultKeysMngrAdoptKey: the default keys manager adopt key method.
+ * @cryptoAppDefaultKeysMngrLoad: the default keys manager load method.
+ * @cryptoAppDefaultKeysMngrSave: the default keys manager save method.
+ * @cryptoAppKeysMngrCertLoad: the default keys manager file cert load method.
+ * @cryptoAppKeysMngrCertLoadMemory: the default keys manager memory cert load method.
+ * @cryptoAppKeyLoad: the key file load method.
+ * @cryptoAppKeyLoadMemory: the meory key load method.
+ * @cryptoAppPkcs12Load: the pkcs12 file load method.
+ * @cryptoAppPkcs12LoadMemory: the memory pkcs12 load method.
+ * @cryptoAppKeyCertLoad: the cert file load method.
+ * @cryptoAppKeyCertLoadMemory: the memory cert load method.
* @cryptoAppDefaultPwdCallback:the default password callback.
*
* The list of crypto engine functions, key data and transform classes.
@@ -396,83 +396,83 @@ struct _xmlSecCryptoDLFunctions {
/**
* Crypto Init/shutdown
*/
- xmlSecCryptoInitMethod cryptoInit;
- xmlSecCryptoShutdownMethod cryptoShutdown;
- xmlSecCryptoKeysMngrInitMethod cryptoKeysMngrInit;
+ xmlSecCryptoInitMethod cryptoInit;
+ xmlSecCryptoShutdownMethod cryptoShutdown;
+ xmlSecCryptoKeysMngrInitMethod cryptoKeysMngrInit;
/**
* Key data ids
*/
- xmlSecCryptoKeyDataGetKlassMethod keyDataAesGetKlass;
- xmlSecCryptoKeyDataGetKlassMethod keyDataDesGetKlass;
- xmlSecCryptoKeyDataGetKlassMethod keyDataDsaGetKlass;
- xmlSecCryptoKeyDataGetKlassMethod keyDataGost2001GetKlass;
- xmlSecCryptoKeyDataGetKlassMethod keyDataHmacGetKlass;
- xmlSecCryptoKeyDataGetKlassMethod keyDataRsaGetKlass;
- xmlSecCryptoKeyDataGetKlassMethod keyDataX509GetKlass;
- xmlSecCryptoKeyDataGetKlassMethod keyDataRawX509CertGetKlass;
+ xmlSecCryptoKeyDataGetKlassMethod keyDataAesGetKlass;
+ xmlSecCryptoKeyDataGetKlassMethod keyDataDesGetKlass;
+ xmlSecCryptoKeyDataGetKlassMethod keyDataDsaGetKlass;
+ xmlSecCryptoKeyDataGetKlassMethod keyDataGost2001GetKlass;
+ xmlSecCryptoKeyDataGetKlassMethod keyDataHmacGetKlass;
+ xmlSecCryptoKeyDataGetKlassMethod keyDataRsaGetKlass;
+ xmlSecCryptoKeyDataGetKlassMethod keyDataX509GetKlass;
+ xmlSecCryptoKeyDataGetKlassMethod keyDataRawX509CertGetKlass;
/**
* Key data store ids
*/
- xmlSecCryptoKeyDataStoreGetKlassMethod x509StoreGetKlass;
+ xmlSecCryptoKeyDataStoreGetKlassMethod x509StoreGetKlass;
/**
* Crypto transforms ids
*/
- xmlSecCryptoTransformGetKlassMethod transformAes128CbcGetKlass;
- xmlSecCryptoTransformGetKlassMethod transformAes192CbcGetKlass;
- xmlSecCryptoTransformGetKlassMethod transformAes256CbcGetKlass;
- xmlSecCryptoTransformGetKlassMethod transformKWAes128GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformKWAes192GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformKWAes256GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformDes3CbcGetKlass;
- xmlSecCryptoTransformGetKlassMethod transformKWDes3GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformDsaSha1GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformGost2001GostR3411_94GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformHmacMd5GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformHmacRipemd160GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformHmacSha1GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformHmacSha224GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformHmacSha256GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformHmacSha384GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformHmacSha512GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformMd5GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformRipemd160GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformRsaMd5GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformRsaRipemd160GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformRsaSha1GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformRsaSha224GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformRsaSha256GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformRsaSha384GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformRsaSha512GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformRsaPkcs1GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformRsaOaepGetKlass;
- xmlSecCryptoTransformGetKlassMethod transformGostR3411_94GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformSha1GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformSha224GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformSha256GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformSha384GetKlass;
- xmlSecCryptoTransformGetKlassMethod transformSha512GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformAes128CbcGetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformAes192CbcGetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformAes256CbcGetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformKWAes128GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformKWAes192GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformKWAes256GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformDes3CbcGetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformKWDes3GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformDsaSha1GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformGost2001GostR3411_94GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformHmacMd5GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformHmacRipemd160GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformHmacSha1GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformHmacSha224GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformHmacSha256GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformHmacSha384GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformHmacSha512GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformMd5GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformRipemd160GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformRsaMd5GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformRsaRipemd160GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformRsaSha1GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformRsaSha224GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformRsaSha256GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformRsaSha384GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformRsaSha512GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformRsaPkcs1GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformRsaOaepGetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformGostR3411_94GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformSha1GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformSha224GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformSha256GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformSha384GetKlass;
+ xmlSecCryptoTransformGetKlassMethod transformSha512GetKlass;
/**
* High level routines form xmlsec command line utility
*/
- xmlSecCryptoAppInitMethod cryptoAppInit;
- xmlSecCryptoAppShutdownMethod cryptoAppShutdown;
- xmlSecCryptoAppDefaultKeysMngrInitMethod cryptoAppDefaultKeysMngrInit;
+ xmlSecCryptoAppInitMethod cryptoAppInit;
+ xmlSecCryptoAppShutdownMethod cryptoAppShutdown;
+ xmlSecCryptoAppDefaultKeysMngrInitMethod cryptoAppDefaultKeysMngrInit;
xmlSecCryptoAppDefaultKeysMngrAdoptKeyMethod cryptoAppDefaultKeysMngrAdoptKey;
- xmlSecCryptoAppDefaultKeysMngrLoadMethod cryptoAppDefaultKeysMngrLoad;
- xmlSecCryptoAppDefaultKeysMngrSaveMethod cryptoAppDefaultKeysMngrSave;
- xmlSecCryptoAppKeysMngrCertLoadMethod cryptoAppKeysMngrCertLoad;
- xmlSecCryptoAppKeysMngrCertLoadMemoryMethod cryptoAppKeysMngrCertLoadMemory;
- xmlSecCryptoAppKeyLoadMethod cryptoAppKeyLoad;
- xmlSecCryptoAppKeyLoadMemoryMethod cryptoAppKeyLoadMemory;
- xmlSecCryptoAppPkcs12LoadMethod cryptoAppPkcs12Load;
- xmlSecCryptoAppPkcs12LoadMemoryMethod cryptoAppPkcs12LoadMemory;
- xmlSecCryptoAppKeyCertLoadMethod cryptoAppKeyCertLoad;
- xmlSecCryptoAppKeyCertLoadMemoryMethod cryptoAppKeyCertLoadMemory;
- void* cryptoAppDefaultPwdCallback;
+ xmlSecCryptoAppDefaultKeysMngrLoadMethod cryptoAppDefaultKeysMngrLoad;
+ xmlSecCryptoAppDefaultKeysMngrSaveMethod cryptoAppDefaultKeysMngrSave;
+ xmlSecCryptoAppKeysMngrCertLoadMethod cryptoAppKeysMngrCertLoad;
+ xmlSecCryptoAppKeysMngrCertLoadMemoryMethod cryptoAppKeysMngrCertLoadMemory;
+ xmlSecCryptoAppKeyLoadMethod cryptoAppKeyLoad;
+ xmlSecCryptoAppKeyLoadMemoryMethod cryptoAppKeyLoadMemory;
+ xmlSecCryptoAppPkcs12LoadMethod cryptoAppPkcs12Load;
+ xmlSecCryptoAppPkcs12LoadMemoryMethod cryptoAppPkcs12LoadMemory;
+ xmlSecCryptoAppKeyCertLoadMethod cryptoAppKeyCertLoad;
+ xmlSecCryptoAppKeyCertLoadMemoryMethod cryptoAppKeyCertLoadMemory;
+ void* cryptoAppDefaultPwdCallback;
};
#include <libxml/xmlstring.h>
@@ -482,14 +482,14 @@ struct _xmlSecCryptoDLFunctions {
*
* Prints a string (see @xmlStrPrintf).
*/
-#define xmlSecStrPrintf xmlStrPrintf
+#define xmlSecStrPrintf xmlStrPrintf
/**
* xmlSecStrVPrintf:
*
* Prints a string (see @xmlStrVPrintf).
*/
-#define xmlSecStrVPrintf xmlStrVPrintf
+#define xmlSecStrVPrintf xmlStrVPrintf
#ifdef __cplusplus
}
diff --git a/include/xmlsec/private/xkms.h b/include/xmlsec/private/xkms.h
index 5ba3a6e..c86bb0d 100644
--- a/include/xmlsec/private/xkms.h
+++ b/include/xmlsec/private/xkms.h
@@ -17,11 +17,11 @@
#endif /* XMLSEC_PRIVATE */
#ifndef XMLSEC_NO_XKMS
-
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <stdio.h>
+#include <stdio.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
@@ -40,63 +40,63 @@ extern "C" {
* XKMS RespondWith Klass
*
************************************************************************/
-typedef int (*xmlSecXkmsRespondWithNodeReadMethod) (xmlSecXkmsRespondWithId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-typedef int (*xmlSecXkmsRespondWithNodeWriteMethod) (xmlSecXkmsRespondWithId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
+typedef int (*xmlSecXkmsRespondWithNodeReadMethod) (xmlSecXkmsRespondWithId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+typedef int (*xmlSecXkmsRespondWithNodeWriteMethod) (xmlSecXkmsRespondWithId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
struct _xmlSecXkmsRespondWithKlass {
- const xmlChar* valueName;
- const xmlChar* valueNs;
+ const xmlChar* valueName;
+ const xmlChar* valueNs;
- const xmlChar* nodeName;
- const xmlChar* nodeNs;
+ const xmlChar* nodeName;
+ const xmlChar* nodeNs;
- xmlSecXkmsRespondWithNodeReadMethod readNode;
- xmlSecXkmsRespondWithNodeWriteMethod writeNode;
+ xmlSecXkmsRespondWithNodeReadMethod readNode;
+ xmlSecXkmsRespondWithNodeWriteMethod writeNode;
- void* reserved1;
- void* reserved2;
+ void* reserved1;
+ void* reserved2;
};
#define xmlSecXkmsRespondWithKlassGetName(id) \
- ((((id) != NULL) && ((id)->valueName != NULL)) ? (id)->valueName : NULL)
+ ((((id) != NULL) && ((id)->valueName != NULL)) ? (id)->valueName : NULL)
/************************************************************************
*
* XKMS ServerRequest Klass
*
************************************************************************/
-typedef int (*xmlSecXkmsServerRequestNodeReadMethod)
- (xmlSecXkmsServerRequestId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-typedef int (*xmlSecXkmsServerRequestExecuteMethod)
- (xmlSecXkmsServerRequestId id,
- xmlSecXkmsServerCtxPtr ctx);
-typedef int (*xmlSecXkmsServerRequestNodeWriteMethod)
- (xmlSecXkmsServerRequestId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
+typedef int (*xmlSecXkmsServerRequestNodeReadMethod)
+ (xmlSecXkmsServerRequestId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+typedef int (*xmlSecXkmsServerRequestExecuteMethod)
+ (xmlSecXkmsServerRequestId id,
+ xmlSecXkmsServerCtxPtr ctx);
+typedef int (*xmlSecXkmsServerRequestNodeWriteMethod)
+ (xmlSecXkmsServerRequestId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
struct _xmlSecXkmsServerRequestKlass {
- const xmlChar* name;
- const xmlChar* requestNodeName;
- const xmlChar* requestNodeNs;
- const xmlChar* resultNodeName;
- const xmlChar* resultNodeNs;
- xmlSecBitMask flags;
+ const xmlChar* name;
+ const xmlChar* requestNodeName;
+ const xmlChar* requestNodeNs;
+ const xmlChar* resultNodeName;
+ const xmlChar* resultNodeNs;
+ xmlSecBitMask flags;
- xmlSecXkmsServerRequestNodeReadMethod readNode;
- xmlSecXkmsServerRequestNodeWriteMethod writeNode;
- xmlSecXkmsServerRequestExecuteMethod execute;
+ xmlSecXkmsServerRequestNodeReadMethod readNode;
+ xmlSecXkmsServerRequestNodeWriteMethod writeNode;
+ xmlSecXkmsServerRequestExecuteMethod execute;
- void* reserved1;
- void* reserved2;
+ void* reserved1;
+ void* reserved2;
};
#define xmlSecXkmsServerRequestKlassGetName(id) \
- ((((id) != NULL) && ((id)->name != NULL)) ? (id)->name : NULL)
+ ((((id) != NULL) && ((id)->name != NULL)) ? (id)->name : NULL)
/************************************************************************
diff --git a/include/xmlsec/skeleton/app.h b/include/xmlsec/skeleton/app.h
index 33c2969..93f65d3 100644
--- a/include/xmlsec/skeleton/app.h
+++ b/include/xmlsec/skeleton/app.h
@@ -21,67 +21,67 @@ extern "C" {
/**
* Init/shutdown
*/
-XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonAppInit (const char* config);
-XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonAppShutdown (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonAppInit (const char* config);
+XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonAppShutdown (void);
/**
* Keys Manager
*/
-XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonAppDefaultKeysMngrInit (xmlSecKeysMngrPtr mngr);
-XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr,
- xmlSecKeyPtr key);
-XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonAppDefaultKeysMngrLoad (xmlSecKeysMngrPtr mngr,
- const char* uri);
-XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonAppDefaultKeysMngrSave (xmlSecKeysMngrPtr mngr,
- const char* filename,
- xmlSecKeyDataType type);
+XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonAppDefaultKeysMngrInit (xmlSecKeysMngrPtr mngr);
+XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr,
+ xmlSecKeyPtr key);
+XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonAppDefaultKeysMngrLoad (xmlSecKeysMngrPtr mngr,
+ const char* uri);
+XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonAppDefaultKeysMngrSave (xmlSecKeysMngrPtr mngr,
+ const char* filename,
+ xmlSecKeyDataType type);
#ifndef XMLSEC_NO_X509
-XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonAppKeysMngrCertLoad (xmlSecKeysMngrPtr mngr,
- const char *filename,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type);
-XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonAppKeysMngrCertLoadMemory (xmlSecKeysMngrPtr mngr,
- const xmlSecByte *data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type);
+XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonAppKeysMngrCertLoad (xmlSecKeysMngrPtr mngr,
+ const char *filename,
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type);
+XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonAppKeysMngrCertLoadMemory (xmlSecKeysMngrPtr mngr,
+ const xmlSecByte *data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type);
#endif /* XMLSEC_NO_X509 */
/**
* Keys
*/
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSkeletonAppKeyLoad (const char *filename,
- xmlSecKeyDataFormat format,
- const char *pwd,
- void *pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSkeletonAppKeyLoadMemory (const xmlSecByte *data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format,
- const char *pwd,
- void *pwdCallback,
- void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSkeletonAppKeyLoad (const char *filename,
+ xmlSecKeyDataFormat format,
+ const char *pwd,
+ void *pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSkeletonAppKeyLoadMemory (const xmlSecByte *data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format,
+ const char *pwd,
+ void *pwdCallback,
+ void* pwdCallbackCtx);
#ifndef XMLSEC_NO_X509
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSkeletonAppPkcs12Load (const char *filename,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSkeletonAppPkcs12LoadMemory (const xmlSecByte *data,
- xmlSecSize dataSize,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx);
-XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonAppKeyCertLoad (xmlSecKeyPtr key,
- const char* filename,
- xmlSecKeyDataFormat format);
-XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonAppKeyCertLoadMemory (xmlSecKeyPtr key,
- const xmlSecByte *data,
- xmlSecSize dataSize,
- xmlSecKeyDataFormat format);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSkeletonAppPkcs12Load (const char *filename,
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT xmlSecKeyPtr xmlSecSkeletonAppPkcs12LoadMemory (const xmlSecByte *data,
+ xmlSecSize dataSize,
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx);
+XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonAppKeyCertLoad (xmlSecKeyPtr key,
+ const char* filename,
+ xmlSecKeyDataFormat format);
+XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonAppKeyCertLoadMemory (xmlSecKeyPtr key,
+ const xmlSecByte *data,
+ xmlSecSize dataSize,
+ xmlSecKeyDataFormat format);
#endif /* XMLSEC_NO_X509 */
-XMLSEC_CRYPTO_EXPORT void* xmlSecSkeletonAppGetDefaultPwdCallback (void);
+XMLSEC_CRYPTO_EXPORT void* xmlSecSkeletonAppGetDefaultPwdCallback (void);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/skeleton/crypto.h b/include/xmlsec/skeleton/crypto.h
index 3b32c23..1d9f008 100644
--- a/include/xmlsec/skeleton/crypto.h
+++ b/include/xmlsec/skeleton/crypto.h
@@ -18,15 +18,15 @@ extern "C" {
#include <xmlsec/transforms.h>
#include <xmlsec/dl.h>
-XMLSEC_CRYPTO_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoGetFunctions_skeleton(void);
+XMLSEC_CRYPTO_EXPORT xmlSecCryptoDLFunctionsPtr xmlSecCryptoGetFunctions_skeleton(void);
/**
* Init shutdown
*/
-XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonInit (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonShutdown (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonInit (void);
+XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonShutdown (void);
-XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonKeysMngrInit (xmlSecKeysMngrPtr mngr);
+XMLSEC_CRYPTO_EXPORT int xmlSecSkeletonKeysMngrInit (xmlSecKeysMngrPtr mngr);
#ifdef __cplusplus
diff --git a/include/xmlsec/skeleton/symbols.h b/include/xmlsec/skeleton/symbols.h
index 1473f01..d87d03d 100644
--- a/include/xmlsec/skeleton/symbols.h
+++ b/include/xmlsec/skeleton/symbols.h
@@ -25,79 +25,79 @@ extern "C" {
/**
* Crypto Init/shutdown
*/
-#define xmlSecCryptoInit xmlSecSkeletonInit
-#define xmlSecCryptoShutdown xmlSecSkeletonShutdown
+#define xmlSecCryptoInit xmlSecSkeletonInit
+#define xmlSecCryptoShutdown xmlSecSkeletonShutdown
-#define xmlSecCryptoKeysMngrInit xmlSecSkeletonKeysMngrInit
+#define xmlSecCryptoKeysMngrInit xmlSecSkeletonKeysMngrInit
/**
* Key data ids
*/
-#define xmlSecKeyDataAesId xmlSecSkeletonKeyDataAesId
-#define xmlSecKeyDataDesId xmlSecSkeletonKeyDataDesId
-#define xmlSecKeyDataDsaId xmlSecSkeletonKeyDataDsaId
-#define xmlSecKeyDataHmacId xmlSecSkeletonKeyDataHmacId
-#define xmlSecKeyDataRsaId xmlSecSkeletonKeyDataRsaId
-#define xmlSecKeyDataX509Id xmlSecSkeletonKeyDataX509Id
-#define xmlSecKeyDataRawX509CertId xmlSecSkeletonKeyDataRawX509CertId
+#define xmlSecKeyDataAesId xmlSecSkeletonKeyDataAesId
+#define xmlSecKeyDataDesId xmlSecSkeletonKeyDataDesId
+#define xmlSecKeyDataDsaId xmlSecSkeletonKeyDataDsaId
+#define xmlSecKeyDataHmacId xmlSecSkeletonKeyDataHmacId
+#define xmlSecKeyDataRsaId xmlSecSkeletonKeyDataRsaId
+#define xmlSecKeyDataX509Id xmlSecSkeletonKeyDataX509Id
+#define xmlSecKeyDataRawX509CertId xmlSecSkeletonKeyDataRawX509CertId
/**
* Key data store ids
*/
-#define xmlSecX509StoreId xmlSecSkeletonX509StoreId
+#define xmlSecX509StoreId xmlSecSkeletonX509StoreId
/**
* Crypto transforms ids
*/
-#define xmlSecTransformAes128CbcId xmlSecSkeletonTransformAes128CbcId
-#define xmlSecTransformAes192CbcId xmlSecSkeletonTransformAes192CbcId
-#define xmlSecTransformAes256CbcId xmlSecSkeletonTransformAes256CbcId
-#define xmlSecTransformKWAes128Id xmlSecSkeletonTransformKWAes128Id
-#define xmlSecTransformKWAes192Id xmlSecSkeletonTransformKWAes192Id
-#define xmlSecTransformKWAes256Id xmlSecSkeletonTransformKWAes256Id
-#define xmlSecTransformDes3CbcId xmlSecSkeletonTransformDes3CbcId
-#define xmlSecTransformKWDes3Id xmlSecSkeletonTransformKWDes3Id
-#define xmlSecTransformDsaSha1Id xmlSecSkeletonTransformDsaSha1Id
-#define xmlSecTransformHmacMd5Id xmlSecSkeletonTransformHmacMd5Id
-#define xmlSecTransformHmacRipemd160Id xmlSecSkeletonTransformHmacRipemd160Id
-#define xmlSecTransformHmacSha1Id xmlSecSkeletonTransformHmacSha1Id
-#define xmlSecTransformHmacSha224Id xmlSecSkeletonTransformHmacSha224Id
-#define xmlSecTransformHmacSha256Id xmlSecSkeletonTransformHmacSha256Id
-#define xmlSecTransformHmacSha384Id xmlSecSkeletonTransformHmacSha384Id
-#define xmlSecTransformHmacSha512Id xmlSecSkeletonTransformHmacSha512Id
-#define xmlSecTransformMd5Id xmlSecSkeletonTransformMd5Id
-#define xmlSecTransformRipemd160Id xmlSecSkeletonTransformRipemd160Id
-#define xmlSecTransformRsaSha1Id xmlSecSkeletonTransformRsaSha1Id
-#define xmlSecTransformRsaSha224Id xmlSecSkeletonTransformRsaSha224Id
-#define xmlSecTransformRsaSha256Id xmlSecSkeletonTransformRsaSha256Id
-#define xmlSecTransformRsaSha384Id xmlSecSkeletonTransformRsaSha384Id
-#define xmlSecTransformRsaSha512Id xmlSecSkeletonTransformRsaSha512Id
-#define xmlSecTransformRsaPkcs1Id xmlSecSkeletonTransformRsaPkcs1Id
-#define xmlSecTransformRsaOaepId xmlSecSkeletonTransformRsaOaepId
-#define xmlSecTransformSha1Id xmlSecSkeletonTransformSha1Id
-#define xmlSecTransformSha224Id xmlSecSkeletonTransformSha224Id
-#define xmlSecTransformSha256Id xmlSecSkeletonTransformSha256Id
-#define xmlSecTransformSha384Id xmlSecSkeletonTransformSha384Id
-#define xmlSecTransformSha512Id xmlSecSkeletonTransformSha512Id
+#define xmlSecTransformAes128CbcId xmlSecSkeletonTransformAes128CbcId
+#define xmlSecTransformAes192CbcId xmlSecSkeletonTransformAes192CbcId
+#define xmlSecTransformAes256CbcId xmlSecSkeletonTransformAes256CbcId
+#define xmlSecTransformKWAes128Id xmlSecSkeletonTransformKWAes128Id
+#define xmlSecTransformKWAes192Id xmlSecSkeletonTransformKWAes192Id
+#define xmlSecTransformKWAes256Id xmlSecSkeletonTransformKWAes256Id
+#define xmlSecTransformDes3CbcId xmlSecSkeletonTransformDes3CbcId
+#define xmlSecTransformKWDes3Id xmlSecSkeletonTransformKWDes3Id
+#define xmlSecTransformDsaSha1Id xmlSecSkeletonTransformDsaSha1Id
+#define xmlSecTransformHmacMd5Id xmlSecSkeletonTransformHmacMd5Id
+#define xmlSecTransformHmacRipemd160Id xmlSecSkeletonTransformHmacRipemd160Id
+#define xmlSecTransformHmacSha1Id xmlSecSkeletonTransformHmacSha1Id
+#define xmlSecTransformHmacSha224Id xmlSecSkeletonTransformHmacSha224Id
+#define xmlSecTransformHmacSha256Id xmlSecSkeletonTransformHmacSha256Id
+#define xmlSecTransformHmacSha384Id xmlSecSkeletonTransformHmacSha384Id
+#define xmlSecTransformHmacSha512Id xmlSecSkeletonTransformHmacSha512Id
+#define xmlSecTransformMd5Id xmlSecSkeletonTransformMd5Id
+#define xmlSecTransformRipemd160Id xmlSecSkeletonTransformRipemd160Id
+#define xmlSecTransformRsaSha1Id xmlSecSkeletonTransformRsaSha1Id
+#define xmlSecTransformRsaSha224Id xmlSecSkeletonTransformRsaSha224Id
+#define xmlSecTransformRsaSha256Id xmlSecSkeletonTransformRsaSha256Id
+#define xmlSecTransformRsaSha384Id xmlSecSkeletonTransformRsaSha384Id
+#define xmlSecTransformRsaSha512Id xmlSecSkeletonTransformRsaSha512Id
+#define xmlSecTransformRsaPkcs1Id xmlSecSkeletonTransformRsaPkcs1Id
+#define xmlSecTransformRsaOaepId xmlSecSkeletonTransformRsaOaepId
+#define xmlSecTransformSha1Id xmlSecSkeletonTransformSha1Id
+#define xmlSecTransformSha224Id xmlSecSkeletonTransformSha224Id
+#define xmlSecTransformSha256Id xmlSecSkeletonTransformSha256Id
+#define xmlSecTransformSha384Id xmlSecSkeletonTransformSha384Id
+#define xmlSecTransformSha512Id xmlSecSkeletonTransformSha512Id
/**
* High level routines form xmlsec command line utility
*/
-#define xmlSecCryptoAppInit xmlSecSkeletonAppInit
-#define xmlSecCryptoAppShutdown xmlSecSkeletonAppShutdown
-#define xmlSecCryptoAppDefaultKeysMngrInit xmlSecSkeletonAppDefaultKeysMngrInit
-#define xmlSecCryptoAppDefaultKeysMngrAdoptKey xmlSecSkeletonAppDefaultKeysMngrAdoptKey
-#define xmlSecCryptoAppDefaultKeysMngrLoad xmlSecSkeletonAppDefaultKeysMngrLoad
-#define xmlSecCryptoAppDefaultKeysMngrSave xmlSecSkeletonAppDefaultKeysMngrSave
-#define xmlSecCryptoAppKeysMngrCertLoad xmlSecSkeletonAppKeysMngrCertLoad
-#define xmlSecCryptoAppKeysMngrCertLoadMemory xmlSecSkeletonAppKeysMngrCertLoadMemory
-#define xmlSecCryptoAppKeyLoad xmlSecSkeletonAppKeyLoad
-#define xmlSecCryptoAppPkcs12Load xmlSecSkeletonAppPkcs12Load
-#define xmlSecCryptoAppKeyCertLoad xmlSecSkeletonAppKeyCertLoad
-#define xmlSecCryptoAppKeyLoadMemory xmlSecSkeletonAppKeyLoadMemory
-#define xmlSecCryptoAppPkcs12LoadMemory xmlSecSkeletonAppPkcs12LoadMemory
-#define xmlSecCryptoAppKeyCertLoadMemory xmlSecSkeletonAppKeyCertLoadMemory
-#define xmlSecCryptoAppGetDefaultPwdCallback xmlSecSkeletonAppGetDefaultPwdCallback
+#define xmlSecCryptoAppInit xmlSecSkeletonAppInit
+#define xmlSecCryptoAppShutdown xmlSecSkeletonAppShutdown
+#define xmlSecCryptoAppDefaultKeysMngrInit xmlSecSkeletonAppDefaultKeysMngrInit
+#define xmlSecCryptoAppDefaultKeysMngrAdoptKey xmlSecSkeletonAppDefaultKeysMngrAdoptKey
+#define xmlSecCryptoAppDefaultKeysMngrLoad xmlSecSkeletonAppDefaultKeysMngrLoad
+#define xmlSecCryptoAppDefaultKeysMngrSave xmlSecSkeletonAppDefaultKeysMngrSave
+#define xmlSecCryptoAppKeysMngrCertLoad xmlSecSkeletonAppKeysMngrCertLoad
+#define xmlSecCryptoAppKeysMngrCertLoadMemory xmlSecSkeletonAppKeysMngrCertLoadMemory
+#define xmlSecCryptoAppKeyLoad xmlSecSkeletonAppKeyLoad
+#define xmlSecCryptoAppPkcs12Load xmlSecSkeletonAppPkcs12Load
+#define xmlSecCryptoAppKeyCertLoad xmlSecSkeletonAppKeyCertLoad
+#define xmlSecCryptoAppKeyLoadMemory xmlSecSkeletonAppKeyLoadMemory
+#define xmlSecCryptoAppPkcs12LoadMemory xmlSecSkeletonAppPkcs12LoadMemory
+#define xmlSecCryptoAppKeyCertLoadMemory xmlSecSkeletonAppKeyCertLoadMemory
+#define xmlSecCryptoAppGetDefaultPwdCallback xmlSecSkeletonAppGetDefaultPwdCallback
#endif /* XMLSEC_CRYPTO_SKELETON */
diff --git a/include/xmlsec/soap.h b/include/xmlsec/soap.h
index 4862a84..1aa5649 100644
--- a/include/xmlsec/soap.h
+++ b/include/xmlsec/soap.h
@@ -26,22 +26,22 @@ extern "C" {
* SOAP 1.1
*
**********************************************************************/
-XMLSEC_EXPORT xmlNodePtr xmlSecSoap11CreateEnvelope (xmlDocPtr doc);
-XMLSEC_EXPORT xmlNodePtr xmlSecSoap11EnsureHeader (xmlNodePtr envNode);
-XMLSEC_EXPORT xmlNodePtr xmlSecSoap11AddBodyEntry (xmlNodePtr envNode,
- xmlNodePtr entryNode);
-XMLSEC_EXPORT xmlNodePtr xmlSecSoap11AddFaultEntry (xmlNodePtr envNode,
- const xmlChar* faultCodeHref,
- const xmlChar* faultCodeLocalPart,
- const xmlChar* faultString,
- const xmlChar* faultActor);
-XMLSEC_EXPORT int xmlSecSoap11CheckEnvelope (xmlNodePtr envNode);
-XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetHeader (xmlNodePtr envNode);
-XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetBody (xmlNodePtr envNode);
-XMLSEC_EXPORT xmlSecSize xmlSecSoap11GetBodyEntriesNumber(xmlNodePtr envNode);
-XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetBodyEntry (xmlNodePtr envNode,
- xmlSecSize pos);
-XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetFaultEntry (xmlNodePtr envNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecSoap11CreateEnvelope (xmlDocPtr doc);
+XMLSEC_EXPORT xmlNodePtr xmlSecSoap11EnsureHeader (xmlNodePtr envNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecSoap11AddBodyEntry (xmlNodePtr envNode,
+ xmlNodePtr entryNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecSoap11AddFaultEntry (xmlNodePtr envNode,
+ const xmlChar* faultCodeHref,
+ const xmlChar* faultCodeLocalPart,
+ const xmlChar* faultString,
+ const xmlChar* faultActor);
+XMLSEC_EXPORT int xmlSecSoap11CheckEnvelope (xmlNodePtr envNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetHeader (xmlNodePtr envNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetBody (xmlNodePtr envNode);
+XMLSEC_EXPORT xmlSecSize xmlSecSoap11GetBodyEntriesNumber(xmlNodePtr envNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetBodyEntry (xmlNodePtr envNode,
+ xmlSecSize pos);
+XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetFaultEntry (xmlNodePtr envNode);
/***********************************************************************
@@ -51,34 +51,34 @@ XMLSEC_EXPORT xmlNodePtr xmlSecSoap11GetFaultEntry (xmlNodePtr envNode);
**********************************************************************/
/**
* xmlSecSoap12FaultCode:
- * @xmlSecSoap12FaultCodeUnknown: The fault code is not available.
- * @xmlSecSoap12FaultCodeVersionMismatch: The faulting node found an
- * invalid element information
- * item instead of the expected
- * Envelope element information item.
- * @xmlSecSoap12FaultCodeMustUnderstand: An immediate child element
- * information item of the SOAP
- * Header element information item
- * targeted at the faulting node
- * that was not understood by the
- * faulting node contained a SOAP
- * mustUnderstand attribute
- * information item with a value of "true"
- * @xmlSecSoap12FaultCodeDataEncodingUnknown: A SOAP header block or SOAP
- * body child element information
- * item targeted at the faulting
- * SOAP node is scoped with a data
- * encoding that the faulting node
- * does not support.
- * @xmlSecSoap12FaultCodeSender: The message was incorrectly
- * formed or did not contain the
- * appropriate information in order
- * to succeed.
- * @xmlSecSoap12FaultCodeReceiver: The message could not be processed
- * for reasons attributable to the
- * processing of the message rather
- * than to the contents of the
- * message itself.
+ * @xmlSecSoap12FaultCodeUnknown: The fault code is not available.
+ * @xmlSecSoap12FaultCodeVersionMismatch: The faulting node found an
+ * invalid element information
+ * item instead of the expected
+ * Envelope element information item.
+ * @xmlSecSoap12FaultCodeMustUnderstand: An immediate child element
+ * information item of the SOAP
+ * Header element information item
+ * targeted at the faulting node
+ * that was not understood by the
+ * faulting node contained a SOAP
+ * mustUnderstand attribute
+ * information item with a value of "true"
+ * @xmlSecSoap12FaultCodeDataEncodingUnknown: A SOAP header block or SOAP
+ * body child element information
+ * item targeted at the faulting
+ * SOAP node is scoped with a data
+ * encoding that the faulting node
+ * does not support.
+ * @xmlSecSoap12FaultCodeSender: The message was incorrectly
+ * formed or did not contain the
+ * appropriate information in order
+ * to succeed.
+ * @xmlSecSoap12FaultCodeReceiver: The message could not be processed
+ * for reasons attributable to the
+ * processing of the message rather
+ * than to the contents of the
+ * message itself.
*
* The values of the <Value> child element information item of the
* <Code> element information item (http://www.w3.org/TR/2003/REC-soap12-part1-20030624/#faultcodes).
@@ -92,33 +92,33 @@ typedef enum {
xmlSecSoap12FaultCodeReceiver
} xmlSecSoap12FaultCode;
-XMLSEC_EXPORT xmlNodePtr xmlSecSoap12CreateEnvelope (xmlDocPtr doc);
-XMLSEC_EXPORT xmlNodePtr xmlSecSoap12EnsureHeader (xmlNodePtr envNode);
-XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddBodyEntry (xmlNodePtr envNode,
- xmlNodePtr entryNode);
-XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddFaultEntry (xmlNodePtr envNode,
- xmlSecSoap12FaultCode faultCode,
- const xmlChar* faultReasonText,
- const xmlChar* faultReasonLang,
- const xmlChar* faultNodeURI,
- const xmlChar* faultRole);
-XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddFaultSubcode (xmlNodePtr faultNode,
- const xmlChar* subCodeHref,
- const xmlChar* subCodeName);
-XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddFaultReasonText (xmlNodePtr faultNode,
- const xmlChar* faultReasonText,
- const xmlChar* faultReasonLang);
-XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddFaultDetailEntry (xmlNodePtr faultNode,
- xmlNodePtr detailEntryNode);
-XMLSEC_EXPORT int xmlSecSoap12CheckEnvelope (xmlNodePtr envNode);
-XMLSEC_EXPORT xmlNodePtr xmlSecSoap12GetHeader (xmlNodePtr envNode);
-XMLSEC_EXPORT xmlNodePtr xmlSecSoap12GetBody (xmlNodePtr envNode);
-XMLSEC_EXPORT xmlSecSize xmlSecSoap12GetBodyEntriesNumber(xmlNodePtr envNode);
-XMLSEC_EXPORT xmlNodePtr xmlSecSoap12GetBodyEntry (xmlNodePtr envNode,
- xmlSecSize pos);
-XMLSEC_EXPORT xmlNodePtr xmlSecSoap12GetFaultEntry (xmlNodePtr envNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecSoap12CreateEnvelope (xmlDocPtr doc);
+XMLSEC_EXPORT xmlNodePtr xmlSecSoap12EnsureHeader (xmlNodePtr envNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddBodyEntry (xmlNodePtr envNode,
+ xmlNodePtr entryNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddFaultEntry (xmlNodePtr envNode,
+ xmlSecSoap12FaultCode faultCode,
+ const xmlChar* faultReasonText,
+ const xmlChar* faultReasonLang,
+ const xmlChar* faultNodeURI,
+ const xmlChar* faultRole);
+XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddFaultSubcode (xmlNodePtr faultNode,
+ const xmlChar* subCodeHref,
+ const xmlChar* subCodeName);
+XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddFaultReasonText (xmlNodePtr faultNode,
+ const xmlChar* faultReasonText,
+ const xmlChar* faultReasonLang);
+XMLSEC_EXPORT xmlNodePtr xmlSecSoap12AddFaultDetailEntry (xmlNodePtr faultNode,
+ xmlNodePtr detailEntryNode);
+XMLSEC_EXPORT int xmlSecSoap12CheckEnvelope (xmlNodePtr envNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecSoap12GetHeader (xmlNodePtr envNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecSoap12GetBody (xmlNodePtr envNode);
+XMLSEC_EXPORT xmlSecSize xmlSecSoap12GetBodyEntriesNumber(xmlNodePtr envNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecSoap12GetBodyEntry (xmlNodePtr envNode,
+ xmlSecSize pos);
+XMLSEC_EXPORT xmlNodePtr xmlSecSoap12GetFaultEntry (xmlNodePtr envNode);
-
+
#endif /* XMLSEC_NO_SOAP */
diff --git a/include/xmlsec/templates.h b/include/xmlsec/templates.h
index 11d1c2c..7162dce 100644
--- a/include/xmlsec/templates.h
+++ b/include/xmlsec/templates.h
@@ -25,66 +25,66 @@ extern "C" {
* <dsig:Signature> node
*
**********************************************************************/
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureCreate (xmlDocPtr doc,
- xmlSecTransformId c14nMethodId,
- xmlSecTransformId signMethodId,
- const xmlChar *id);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureCreate (xmlDocPtr doc,
+ xmlSecTransformId c14nMethodId,
+ xmlSecTransformId signMethodId,
+ const xmlChar *id);
XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureCreateNsPref (xmlDocPtr doc,
xmlSecTransformId c14nMethodId,
xmlSecTransformId signMethodId,
const xmlChar *id,
const xmlChar *nsPrefix);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureEnsureKeyInfo (xmlNodePtr signNode,
- const xmlChar *id);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureAddReference (xmlNodePtr signNode,
- xmlSecTransformId digestMethodId,
- const xmlChar *id,
- const xmlChar *uri,
- const xmlChar *type);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureAddObject (xmlNodePtr signNode,
- const xmlChar *id,
- const xmlChar *mimeType,
- const xmlChar *encoding);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureGetSignMethodNode (xmlNodePtr signNode);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureGetC14NMethodNode (xmlNodePtr signNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureEnsureKeyInfo (xmlNodePtr signNode,
+ const xmlChar *id);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureAddReference (xmlNodePtr signNode,
+ xmlSecTransformId digestMethodId,
+ const xmlChar *id,
+ const xmlChar *uri,
+ const xmlChar *type);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureAddObject (xmlNodePtr signNode,
+ const xmlChar *id,
+ const xmlChar *mimeType,
+ const xmlChar *encoding);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureGetSignMethodNode (xmlNodePtr signNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplSignatureGetC14NMethodNode (xmlNodePtr signNode);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplReferenceAddTransform (xmlNodePtr referenceNode,
- xmlSecTransformId transformId);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplObjectAddSignProperties (xmlNodePtr objectNode,
- const xmlChar *id,
- const xmlChar *target);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplObjectAddManifest (xmlNodePtr objectNode,
- const xmlChar *id);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplManifestAddReference (xmlNodePtr manifestNode,
- xmlSecTransformId digestMethodId,
- const xmlChar *id,
- const xmlChar *uri,
- const xmlChar *type);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplReferenceAddTransform (xmlNodePtr referenceNode,
+ xmlSecTransformId transformId);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplObjectAddSignProperties (xmlNodePtr objectNode,
+ const xmlChar *id,
+ const xmlChar *target);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplObjectAddManifest (xmlNodePtr objectNode,
+ const xmlChar *id);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplManifestAddReference (xmlNodePtr manifestNode,
+ xmlSecTransformId digestMethodId,
+ const xmlChar *id,
+ const xmlChar *uri,
+ const xmlChar *type);
/***********************************************************************
*
* <enc:EncryptedData> node
*
**********************************************************************/
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataCreate (xmlDocPtr doc,
- xmlSecTransformId encMethodId,
- const xmlChar *id,
- const xmlChar *type,
- const xmlChar *mimeType,
- const xmlChar *encoding);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataEnsureKeyInfo (xmlNodePtr encNode,
- const xmlChar *id);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataEnsureEncProperties (xmlNodePtr encNode,
- const xmlChar *id);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataAddEncProperty (xmlNodePtr encNode,
- const xmlChar *id,
- const xmlChar *target);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataEnsureCipherValue (xmlNodePtr encNode);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataEnsureCipherReference (xmlNodePtr encNode,
- const xmlChar *uri);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataGetEncMethodNode (xmlNodePtr encNode);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplCipherReferenceAddTransform (xmlNodePtr cipherReferenceNode,
- xmlSecTransformId transformId);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataCreate (xmlDocPtr doc,
+ xmlSecTransformId encMethodId,
+ const xmlChar *id,
+ const xmlChar *type,
+ const xmlChar *mimeType,
+ const xmlChar *encoding);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataEnsureKeyInfo (xmlNodePtr encNode,
+ const xmlChar *id);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataEnsureEncProperties (xmlNodePtr encNode,
+ const xmlChar *id);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataAddEncProperty (xmlNodePtr encNode,
+ const xmlChar *id,
+ const xmlChar *target);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataEnsureCipherValue (xmlNodePtr encNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataEnsureCipherReference (xmlNodePtr encNode,
+ const xmlChar *uri);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplEncDataGetEncMethodNode (xmlNodePtr encNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplCipherReferenceAddTransform (xmlNodePtr cipherReferenceNode,
+ xmlSecTransformId transformId);
/***********************************************************************
*
@@ -93,7 +93,7 @@ XMLSEC_EXPORT xmlNodePtr xmlSecTmplCipherReferenceAddTransform (xmlNodePtr ciphe
**********************************************************************/
XMLSEC_EXPORT xmlNodePtr xmlSecTmplReferenceListAddDataReference(xmlNodePtr encNode,
const xmlChar *uri);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplReferenceListAddKeyReference (xmlNodePtr encNode,
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplReferenceListAddKeyReference (xmlNodePtr encNode,
const xmlChar *uri);
/***********************************************************************
@@ -101,58 +101,58 @@ XMLSEC_EXPORT xmlNodePtr xmlSecTmplReferenceListAddKeyReference (xmlNodePtr encN
* <dsig:KeyInfo> node
*
**********************************************************************/
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplKeyInfoAddKeyName (xmlNodePtr keyInfoNode,
- const xmlChar* name);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplKeyInfoAddKeyValue (xmlNodePtr keyInfoNode);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplKeyInfoAddX509Data (xmlNodePtr keyInfoNode);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplKeyInfoAddRetrievalMethod (xmlNodePtr keyInfoNode,
- const xmlChar *uri,
- const xmlChar *type);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplRetrievalMethodAddTransform (xmlNodePtr retrMethodNode,
- xmlSecTransformId transformId);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplKeyInfoAddEncryptedKey (xmlNodePtr keyInfoNode,
- xmlSecTransformId encMethodId,
- const xmlChar *id,
- const xmlChar *type,
- const xmlChar *recipient);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplKeyInfoAddKeyName (xmlNodePtr keyInfoNode,
+ const xmlChar* name);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplKeyInfoAddKeyValue (xmlNodePtr keyInfoNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplKeyInfoAddX509Data (xmlNodePtr keyInfoNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplKeyInfoAddRetrievalMethod (xmlNodePtr keyInfoNode,
+ const xmlChar *uri,
+ const xmlChar *type);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplRetrievalMethodAddTransform (xmlNodePtr retrMethodNode,
+ xmlSecTransformId transformId);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplKeyInfoAddEncryptedKey (xmlNodePtr keyInfoNode,
+ xmlSecTransformId encMethodId,
+ const xmlChar *id,
+ const xmlChar *type,
+ const xmlChar *recipient);
/***********************************************************************
*
* <dsig:X509Data> node
*
**********************************************************************/
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509DataAddIssuerSerial (xmlNodePtr x509DataNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509DataAddIssuerSerial (xmlNodePtr x509DataNode);
XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509IssuerSerialAddIssuerName(xmlNodePtr x509IssuerSerialNode, const xmlChar* issuerName);
XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509IssuerSerialAddSerialNumber(xmlNodePtr x509IssuerSerialNode, const xmlChar* serial);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509DataAddSubjectName (xmlNodePtr x509DataNode);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509DataAddSKI (xmlNodePtr x509DataNode);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509DataAddCertificate (xmlNodePtr x509DataNode);
-XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509DataAddCRL (xmlNodePtr x509DataNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509DataAddSubjectName (xmlNodePtr x509DataNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509DataAddSKI (xmlNodePtr x509DataNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509DataAddCertificate (xmlNodePtr x509DataNode);
+XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509DataAddCRL (xmlNodePtr x509DataNode);
/***********************************************************************
*
* <dsig:Transform> node
*
**********************************************************************/
-XMLSEC_EXPORT int xmlSecTmplTransformAddHmacOutputLength (xmlNodePtr transformNode,
- xmlSecSize bitsLen);
-XMLSEC_EXPORT int xmlSecTmplTransformAddRsaOaepParam (xmlNodePtr transformNode,
- const xmlSecByte *buf,
- xmlSecSize size);
-XMLSEC_EXPORT int xmlSecTmplTransformAddXsltStylesheet (xmlNodePtr transformNode,
- const xmlChar *xslt);
-XMLSEC_EXPORT int xmlSecTmplTransformAddC14NInclNamespaces(xmlNodePtr transformNode,
- const xmlChar *prefixList);
-XMLSEC_EXPORT int xmlSecTmplTransformAddXPath (xmlNodePtr transformNode,
- const xmlChar *expression,
- const xmlChar **nsList);
-XMLSEC_EXPORT int xmlSecTmplTransformAddXPath2 (xmlNodePtr transformNode,
- const xmlChar* type,
- const xmlChar *expression,
- const xmlChar **nsList);
-XMLSEC_EXPORT int xmlSecTmplTransformAddXPointer (xmlNodePtr transformNode,
- const xmlChar *expression,
- const xmlChar **nsList);
+XMLSEC_EXPORT int xmlSecTmplTransformAddHmacOutputLength (xmlNodePtr transformNode,
+ xmlSecSize bitsLen);
+XMLSEC_EXPORT int xmlSecTmplTransformAddRsaOaepParam (xmlNodePtr transformNode,
+ const xmlSecByte *buf,
+ xmlSecSize size);
+XMLSEC_EXPORT int xmlSecTmplTransformAddXsltStylesheet (xmlNodePtr transformNode,
+ const xmlChar *xslt);
+XMLSEC_EXPORT int xmlSecTmplTransformAddC14NInclNamespaces(xmlNodePtr transformNode,
+ const xmlChar *prefixList);
+XMLSEC_EXPORT int xmlSecTmplTransformAddXPath (xmlNodePtr transformNode,
+ const xmlChar *expression,
+ const xmlChar **nsList);
+XMLSEC_EXPORT int xmlSecTmplTransformAddXPath2 (xmlNodePtr transformNode,
+ const xmlChar* type,
+ const xmlChar *expression,
+ const xmlChar **nsList);
+XMLSEC_EXPORT int xmlSecTmplTransformAddXPointer (xmlNodePtr transformNode,
+ const xmlChar *expression,
+ const xmlChar **nsList);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/transforms.h b/include/xmlsec/transforms.h
index 4008cae..879ec52 100644
--- a/include/xmlsec/transforms.h
+++ b/include/xmlsec/transforms.h
@@ -24,8 +24,8 @@ extern "C" {
#include <xmlsec/nodeset.h>
#include <xmlsec/keys.h>
-typedef const struct _xmlSecTransformKlass xmlSecTransformKlass,
- *xmlSecTransformId;
+typedef const struct _xmlSecTransformKlass xmlSecTransformKlass,
+ *xmlSecTransformId;
/**
* XMLSEC_TRANSFORM_BINARY_CHUNK:
@@ -33,26 +33,26 @@ typedef const struct _xmlSecTransformKlass xmlSecTransformKlass,
* The binary data chunks size. XMLSec processes binary data one chunk
* at a time. Changing this impacts xmlsec memory usage and performance.
*/
-#define XMLSEC_TRANSFORM_BINARY_CHUNK 64
+#define XMLSEC_TRANSFORM_BINARY_CHUNK 64
/**********************************************************************
*
* Hi-level functions
*
*********************************************************************/
-XMLSEC_EXPORT xmlSecPtrListPtr xmlSecTransformIdsGet (void);
-XMLSEC_EXPORT int xmlSecTransformIdsInit (void);
-XMLSEC_EXPORT void xmlSecTransformIdsShutdown (void);
-XMLSEC_EXPORT int xmlSecTransformIdsRegisterDefault(void);
-XMLSEC_EXPORT int xmlSecTransformIdsRegister (xmlSecTransformId id);
+XMLSEC_EXPORT xmlSecPtrListPtr xmlSecTransformIdsGet (void);
+XMLSEC_EXPORT int xmlSecTransformIdsInit (void);
+XMLSEC_EXPORT void xmlSecTransformIdsShutdown (void);
+XMLSEC_EXPORT int xmlSecTransformIdsRegisterDefault(void);
+XMLSEC_EXPORT int xmlSecTransformIdsRegister (xmlSecTransformId id);
/**
* xmlSecTransformStatus:
- * @xmlSecTransformStatusNone: the status unknown.
- * @xmlSecTransformStatusWorking: the transform is executed.
- * @xmlSecTransformStatusFinished: the transform finished
- * @xmlSecTransformStatusOk: the transform succeeded.
- * @xmlSecTransformStatusFail: the transform failed (an error occur).
+ * @xmlSecTransformStatusNone: the status unknown.
+ * @xmlSecTransformStatusWorking: the transform is executed.
+ * @xmlSecTransformStatusFinished: the transform finished
+ * @xmlSecTransformStatusOk: the transform succeeded.
+ * @xmlSecTransformStatusFail: the transform failed (an error occur).
*
* The transform execution status.
*/
@@ -66,9 +66,9 @@ typedef enum {
/**
* xmlSecTransformMode:
- * @xmlSecTransformModeNone: the mode is unknown.
- * @xmlSecTransformModePush: pushing data thru transform.
- * @xmlSecTransformModePop: popping data from transform.
+ * @xmlSecTransformModeNone: the mode is unknown.
+ * @xmlSecTransformModePush: pushing data thru transform.
+ * @xmlSecTransformModePop: popping data from transform.
*
* The transform operation mode
*/
@@ -80,13 +80,13 @@ typedef enum {
/**
* xmlSecTransformOperation:
- * @xmlSecTransformOperationNone: the operation is unknown.
- * @xmlSecTransformOperationEncode: the encode operation (for base64 transform).
- * @xmlSecTransformOperationDecode: the decode operation (for base64 transform).
- * @xmlSecTransformOperationSign: the sign or digest operation.
- * @xmlSecTransformOperationVerify: the verification of signature or digest operation.
- * @xmlSecTransformOperationEncrypt: the encryption operation.
- * @xmlSecTransformOperationDecrypt: the decryption operation.
+ * @xmlSecTransformOperationNone: the operation is unknown.
+ * @xmlSecTransformOperationEncode: the encode operation (for base64 transform).
+ * @xmlSecTransformOperationDecode: the decode operation (for base64 transform).
+ * @xmlSecTransformOperationSign: the sign or digest operation.
+ * @xmlSecTransformOperationVerify: the verification of signature or digest operation.
+ * @xmlSecTransformOperationEncrypt: the encryption operation.
+ * @xmlSecTransformOperationDecrypt: the decryption operation.
*
* The transform operation.
*/
@@ -110,52 +110,52 @@ typedef enum {
*
* URI transform type bit mask.
*/
-typedef unsigned int xmlSecTransformUriType;
+typedef unsigned int xmlSecTransformUriType;
/**
* xmlSecTransformUriTypeNone:
*
* The URI type is unknown or not set.
*/
-#define xmlSecTransformUriTypeNone 0x0000
+#define xmlSecTransformUriTypeNone 0x0000
/**
* xmlSecTransformUriTypeEmpty:
*
* The empty URI ("") type.
*/
-#define xmlSecTransformUriTypeEmpty 0x0001
+#define xmlSecTransformUriTypeEmpty 0x0001
/**
* xmlSecTransformUriTypeSameDocument:
*
* The smae document ("#...") but not empty ("") URI type.
*/
-#define xmlSecTransformUriTypeSameDocument 0x0002
+#define xmlSecTransformUriTypeSameDocument 0x0002
/**
* xmlSecTransformUriTypeLocal:
*
* The local URI ("file:///....") type.
*/
-#define xmlSecTransformUriTypeLocal 0x0004
+#define xmlSecTransformUriTypeLocal 0x0004
/**
* xmlSecTransformUriTypeRemote:
*
* The remote URI type.
*/
-#define xmlSecTransformUriTypeRemote 0x0008
+#define xmlSecTransformUriTypeRemote 0x0008
/**
* xmlSecTransformUriTypeAny:
*
* Any URI type.
*/
-#define xmlSecTransformUriTypeAny 0xFFFF
+#define xmlSecTransformUriTypeAny 0xFFFF
-XMLSEC_EXPORT int xmlSecTransformUriTypeCheck (xmlSecTransformUriType type,
- const xmlChar* uri);
+XMLSEC_EXPORT int xmlSecTransformUriTypeCheck (xmlSecTransformUriType type,
+ const xmlChar* uri);
/**************************************************************************
*
* xmlSecTransformDataType
@@ -166,28 +166,28 @@ XMLSEC_EXPORT int xmlSecTransformUriTypeCheck (xmlSecTransformUriType type,
*
* Transform data type bit mask.
*/
-typedef xmlSecByte xmlSecTransformDataType;
+typedef xmlSecByte xmlSecTransformDataType;
/**
* xmlSecTransformDataTypeUnknown:
*
* The transform data type is unknown or nor data expected.
*/
-#define xmlSecTransformDataTypeUnknown 0x0000
+#define xmlSecTransformDataTypeUnknown 0x0000
/**
* xmlSecTransformDataTypeBin:
*
* The binary transform data.
*/
-#define xmlSecTransformDataTypeBin 0x0001
+#define xmlSecTransformDataTypeBin 0x0001
/**
* xmlSecTransformDataTypeXml:
*
* The xml transform data.
*/
-#define xmlSecTransformDataTypeXml 0x0002
+#define xmlSecTransformDataTypeXml 0x0002
/**************************************************************************
*
@@ -199,56 +199,56 @@ typedef xmlSecByte xmlSecTransformDataType;
*
* The transform usage bit mask.
*/
-typedef unsigned int xmlSecTransformUsage;
+typedef unsigned int xmlSecTransformUsage;
/**
* xmlSecTransformUsageUnknown:
*
* Transforms usage is unknown or undefined.
*/
-#define xmlSecTransformUsageUnknown 0x0000
+#define xmlSecTransformUsageUnknown 0x0000
/**
* xmlSecTransformUsageDSigTransform:
*
* Transform could be used in <dsig:Transform>.
*/
-#define xmlSecTransformUsageDSigTransform 0x0001
+#define xmlSecTransformUsageDSigTransform 0x0001
/**
* xmlSecTransformUsageC14NMethod:
*
* Transform could be used in <dsig:CanonicalizationMethod>.
*/
-#define xmlSecTransformUsageC14NMethod 0x0002
+#define xmlSecTransformUsageC14NMethod 0x0002
/**
* xmlSecTransformUsageDigestMethod:
*
* Transform could be used in <dsig:DigestMethod>.
*/
-#define xmlSecTransformUsageDigestMethod 0x0004
+#define xmlSecTransformUsageDigestMethod 0x0004
/**
* xmlSecTransformUsageSignatureMethod:
*
* Transform could be used in <dsig:SignatureMethod>.
*/
-#define xmlSecTransformUsageSignatureMethod 0x0008
+#define xmlSecTransformUsageSignatureMethod 0x0008
/**
* xmlSecTransformUsageEncryptionMethod:
*
* Transform could be used in <enc:EncryptionMethod>.
*/
-#define xmlSecTransformUsageEncryptionMethod 0x0010
+#define xmlSecTransformUsageEncryptionMethod 0x0010
/**
* xmlSecTransformUsageAny:
*
* Transform could be used for operation.
*/
-#define xmlSecTransformUsageAny 0xFFFF
+#define xmlSecTransformUsageAny 0xFFFF
/**************************************************************************
*
@@ -257,7 +257,7 @@ typedef unsigned int xmlSecTransformUsage;
*************************************************************************/
/**
* xmlSecTransformCtxPreExecuteCallback:
- * @transformCtx: the pointer to transform's context.
+ * @transformCtx: the pointer to transform's context.
*
* The callback called after creating transforms chain but before
* starting data processing. Application can use this callback to
@@ -267,7 +267,7 @@ typedef unsigned int xmlSecTransformUsage;
* Returns: 0 on success and a negative value otherwise (in this case,
* transforms chain will not be executed and xmlsec processing stops).
*/
-typedef int (*xmlSecTransformCtxPreExecuteCallback) (xmlSecTransformCtxPtr transformCtx);
+typedef int (*xmlSecTransformCtxPreExecuteCallback) (xmlSecTransformCtxPtr transformCtx);
/**
* XMLSEC_TRANSFORMCTX_FLAGS_USE_VISA3D_HACK:
@@ -276,98 +276,98 @@ typedef int (*xmlSecTransformCtxPreExecuteCallback) (xmlSecTransformCtxPtr t
* without using XPointers. This allows one to sign/verify Visa3D
* documents that don't follow XML, XPointer and XML DSig specifications.
*/
-#define XMLSEC_TRANSFORMCTX_FLAGS_USE_VISA3D_HACK 0x00000001
+#define XMLSEC_TRANSFORMCTX_FLAGS_USE_VISA3D_HACK 0x00000001
/**
* xmlSecTransformCtx:
- * @userData: the pointer to user data (xmlsec and xmlsec-crypto never
- * touch this).
- * @flags: the bit mask flags to control transforms execution
- * (reserved for the future).
- * @flags2: the bit mask flags to control transforms execution
- * (reserved for the future).
- * @enabledUris: the allowed transform data source uri types.
- * @enabledTransforms: the list of enabled transforms; if list is empty (default)
- * then all registered transforms are enabled.
- * @preExecCallback: the callback called after preparing transform chain
- * and right before actual data processing; application
- * can use this callback to change transforms parameters,
- * insert additional transforms in the chain or do
- * additional validation (and abort transform execution
- * if needed).
- * @result: the pointer to transforms result buffer.
- * @status: the transforms chain processng status.
- * @uri: the data source URI without xpointer expression.
- * @xptrExpr: the xpointer expression from data source URI (if any).
- * @first: the first transform in the chain.
- * @last: the last transform in the chain.
- * @reserved0: reserved for the future.
- * @reserved1: reserved for the future.
+ * @userData: the pointer to user data (xmlsec and xmlsec-crypto never
+ * touch this).
+ * @flags: the bit mask flags to control transforms execution
+ * (reserved for the future).
+ * @flags2: the bit mask flags to control transforms execution
+ * (reserved for the future).
+ * @enabledUris: the allowed transform data source uri types.
+ * @enabledTransforms: the list of enabled transforms; if list is empty (default)
+ * then all registered transforms are enabled.
+ * @preExecCallback: the callback called after preparing transform chain
+ * and right before actual data processing; application
+ * can use this callback to change transforms parameters,
+ * insert additional transforms in the chain or do
+ * additional validation (and abort transform execution
+ * if needed).
+ * @result: the pointer to transforms result buffer.
+ * @status: the transforms chain processng status.
+ * @uri: the data source URI without xpointer expression.
+ * @xptrExpr: the xpointer expression from data source URI (if any).
+ * @first: the first transform in the chain.
+ * @last: the last transform in the chain.
+ * @reserved0: reserved for the future.
+ * @reserved1: reserved for the future.
*
* The transform execution context.
*/
struct _xmlSecTransformCtx {
/* user settings */
- void* userData;
- unsigned int flags;
- unsigned int flags2;
- xmlSecTransformUriType enabledUris;
- xmlSecPtrList enabledTransforms;
- xmlSecTransformCtxPreExecuteCallback preExecCallback;
+ void* userData;
+ unsigned int flags;
+ unsigned int flags2;
+ xmlSecTransformUriType enabledUris;
+ xmlSecPtrList enabledTransforms;
+ xmlSecTransformCtxPreExecuteCallback preExecCallback;
/* results */
- xmlSecBufferPtr result;
- xmlSecTransformStatus status;
- xmlChar* uri;
- xmlChar* xptrExpr;
- xmlSecTransformPtr first;
- xmlSecTransformPtr last;
+ xmlSecBufferPtr result;
+ xmlSecTransformStatus status;
+ xmlChar* uri;
+ xmlChar* xptrExpr;
+ xmlSecTransformPtr first;
+ xmlSecTransformPtr last;
/* for the future */
- void* reserved0;
- void* reserved1;
+ void* reserved0;
+ void* reserved1;
};
-XMLSEC_EXPORT xmlSecTransformCtxPtr xmlSecTransformCtxCreate (void);
-XMLSEC_EXPORT void xmlSecTransformCtxDestroy (xmlSecTransformCtxPtr ctx);
-XMLSEC_EXPORT int xmlSecTransformCtxInitialize (xmlSecTransformCtxPtr ctx);
-XMLSEC_EXPORT void xmlSecTransformCtxFinalize (xmlSecTransformCtxPtr ctx);
-XMLSEC_EXPORT void xmlSecTransformCtxReset (xmlSecTransformCtxPtr ctx);
-XMLSEC_EXPORT int xmlSecTransformCtxCopyUserPref (xmlSecTransformCtxPtr dst,
- xmlSecTransformCtxPtr src);
-XMLSEC_EXPORT int xmlSecTransformCtxSetUri (xmlSecTransformCtxPtr ctx,
- const xmlChar* uri,
- xmlNodePtr hereNode);
-XMLSEC_EXPORT int xmlSecTransformCtxAppend (xmlSecTransformCtxPtr ctx,
- xmlSecTransformPtr transform);
-XMLSEC_EXPORT int xmlSecTransformCtxPrepend (xmlSecTransformCtxPtr ctx,
- xmlSecTransformPtr transform);
-XMLSEC_EXPORT xmlSecTransformPtr xmlSecTransformCtxCreateAndAppend(xmlSecTransformCtxPtr ctx,
- xmlSecTransformId id);
-XMLSEC_EXPORT xmlSecTransformPtr xmlSecTransformCtxCreateAndPrepend(xmlSecTransformCtxPtr ctx,
- xmlSecTransformId id);
-XMLSEC_EXPORT xmlSecTransformPtr xmlSecTransformCtxNodeRead (xmlSecTransformCtxPtr ctx,
- xmlNodePtr node,
- xmlSecTransformUsage usage);
-XMLSEC_EXPORT int xmlSecTransformCtxNodesListRead (xmlSecTransformCtxPtr ctx,
- xmlNodePtr node,
- xmlSecTransformUsage usage);
-XMLSEC_EXPORT int xmlSecTransformCtxPrepare (xmlSecTransformCtxPtr ctx,
- xmlSecTransformDataType inputDataType);
-XMLSEC_EXPORT int xmlSecTransformCtxBinaryExecute (xmlSecTransformCtxPtr ctx,
- const xmlSecByte* data,
- xmlSecSize dataSize);
-XMLSEC_EXPORT int xmlSecTransformCtxUriExecute (xmlSecTransformCtxPtr ctx,
- const xmlChar* uri);
-XMLSEC_EXPORT int xmlSecTransformCtxXmlExecute (xmlSecTransformCtxPtr ctx,
- xmlSecNodeSetPtr nodes);
-XMLSEC_EXPORT int xmlSecTransformCtxExecute (xmlSecTransformCtxPtr ctx,
- xmlDocPtr doc);
-XMLSEC_EXPORT void xmlSecTransformCtxDebugDump (xmlSecTransformCtxPtr ctx,
- FILE* output);
-XMLSEC_EXPORT void xmlSecTransformCtxDebugXmlDump (xmlSecTransformCtxPtr ctx,
- FILE* output);
-
+XMLSEC_EXPORT xmlSecTransformCtxPtr xmlSecTransformCtxCreate (void);
+XMLSEC_EXPORT void xmlSecTransformCtxDestroy (xmlSecTransformCtxPtr ctx);
+XMLSEC_EXPORT int xmlSecTransformCtxInitialize (xmlSecTransformCtxPtr ctx);
+XMLSEC_EXPORT void xmlSecTransformCtxFinalize (xmlSecTransformCtxPtr ctx);
+XMLSEC_EXPORT void xmlSecTransformCtxReset (xmlSecTransformCtxPtr ctx);
+XMLSEC_EXPORT int xmlSecTransformCtxCopyUserPref (xmlSecTransformCtxPtr dst,
+ xmlSecTransformCtxPtr src);
+XMLSEC_EXPORT int xmlSecTransformCtxSetUri (xmlSecTransformCtxPtr ctx,
+ const xmlChar* uri,
+ xmlNodePtr hereNode);
+XMLSEC_EXPORT int xmlSecTransformCtxAppend (xmlSecTransformCtxPtr ctx,
+ xmlSecTransformPtr transform);
+XMLSEC_EXPORT int xmlSecTransformCtxPrepend (xmlSecTransformCtxPtr ctx,
+ xmlSecTransformPtr transform);
+XMLSEC_EXPORT xmlSecTransformPtr xmlSecTransformCtxCreateAndAppend(xmlSecTransformCtxPtr ctx,
+ xmlSecTransformId id);
+XMLSEC_EXPORT xmlSecTransformPtr xmlSecTransformCtxCreateAndPrepend(xmlSecTransformCtxPtr ctx,
+ xmlSecTransformId id);
+XMLSEC_EXPORT xmlSecTransformPtr xmlSecTransformCtxNodeRead (xmlSecTransformCtxPtr ctx,
+ xmlNodePtr node,
+ xmlSecTransformUsage usage);
+XMLSEC_EXPORT int xmlSecTransformCtxNodesListRead (xmlSecTransformCtxPtr ctx,
+ xmlNodePtr node,
+ xmlSecTransformUsage usage);
+XMLSEC_EXPORT int xmlSecTransformCtxPrepare (xmlSecTransformCtxPtr ctx,
+ xmlSecTransformDataType inputDataType);
+XMLSEC_EXPORT int xmlSecTransformCtxBinaryExecute (xmlSecTransformCtxPtr ctx,
+ const xmlSecByte* data,
+ xmlSecSize dataSize);
+XMLSEC_EXPORT int xmlSecTransformCtxUriExecute (xmlSecTransformCtxPtr ctx,
+ const xmlChar* uri);
+XMLSEC_EXPORT int xmlSecTransformCtxXmlExecute (xmlSecTransformCtxPtr ctx,
+ xmlSecNodeSetPtr nodes);
+XMLSEC_EXPORT int xmlSecTransformCtxExecute (xmlSecTransformCtxPtr ctx,
+ xmlDocPtr doc);
+XMLSEC_EXPORT void xmlSecTransformCtxDebugDump (xmlSecTransformCtxPtr ctx,
+ FILE* output);
+XMLSEC_EXPORT void xmlSecTransformCtxDebugXmlDump (xmlSecTransformCtxPtr ctx,
+ FILE* output);
+
/**************************************************************************
*
* xmlSecTransform
@@ -375,147 +375,147 @@ XMLSEC_EXPORT void xmlSecTransformCtxDebugXmlDump (xmlSecTransformCtxPtr ctx,
*************************************************************************/
/**
* xmlSecTransform:
- * @id: the transform id (pointer to #xmlSecTransformId).
- * @operation: the transform's opertaion.
- * @status: the current status.
- * @hereNode: the pointer to transform's <dsig:Transform /> node.
- * @next: the pointer to next transform in the chain.
- * @prev: the pointer to previous transform in the chain.
- * @inBuf: the input binary data buffer.
- * @outBuf: the output binary data buffer.
- * @inNodes: the input XML nodes.
- * @outNodes: the output XML nodes.
- * @reserved0: reserved for the future.
- * @reserved1: reserved for the future.
+ * @id: the transform id (pointer to #xmlSecTransformId).
+ * @operation: the transform's opertaion.
+ * @status: the current status.
+ * @hereNode: the pointer to transform's <dsig:Transform /> node.
+ * @next: the pointer to next transform in the chain.
+ * @prev: the pointer to previous transform in the chain.
+ * @inBuf: the input binary data buffer.
+ * @outBuf: the output binary data buffer.
+ * @inNodes: the input XML nodes.
+ * @outNodes: the output XML nodes.
+ * @reserved0: reserved for the future.
+ * @reserved1: reserved for the future.
*
* The transform structure.
*/
struct _xmlSecTransform {
- xmlSecTransformId id;
- xmlSecTransformOperation operation;
- xmlSecTransformStatus status;
- xmlNodePtr hereNode;
+ xmlSecTransformId id;
+ xmlSecTransformOperation operation;
+ xmlSecTransformStatus status;
+ xmlNodePtr hereNode;
/* transforms chain */
- xmlSecTransformPtr next;
- xmlSecTransformPtr prev;
+ xmlSecTransformPtr next;
+ xmlSecTransformPtr prev;
/* binary data */
- xmlSecBuffer inBuf;
- xmlSecBuffer outBuf;
+ xmlSecBuffer inBuf;
+ xmlSecBuffer outBuf;
/* xml data */
- xmlSecNodeSetPtr inNodes;
- xmlSecNodeSetPtr outNodes;
+ xmlSecNodeSetPtr inNodes;
+ xmlSecNodeSetPtr outNodes;
/* reserved for the future */
- void* reserved0;
- void* reserved1;
+ void* reserved0;
+ void* reserved1;
};
-XMLSEC_EXPORT xmlSecTransformPtr xmlSecTransformCreate (xmlSecTransformId id);
-XMLSEC_EXPORT void xmlSecTransformDestroy (xmlSecTransformPtr transform);
-XMLSEC_EXPORT xmlSecTransformPtr xmlSecTransformNodeRead (xmlNodePtr node,
- xmlSecTransformUsage usage,
- xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int xmlSecTransformPump (xmlSecTransformPtr left,
- xmlSecTransformPtr right,
- xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int xmlSecTransformSetKey (xmlSecTransformPtr transform,
- xmlSecKeyPtr key);
-XMLSEC_EXPORT int xmlSecTransformSetKeyReq(xmlSecTransformPtr transform,
- xmlSecKeyReqPtr keyReq);
-XMLSEC_EXPORT int xmlSecTransformVerify (xmlSecTransformPtr transform,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int xmlSecTransformVerifyNodeContent(xmlSecTransformPtr transform,
- xmlNodePtr node,
- xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT xmlSecTransformDataType xmlSecTransformGetDataType(xmlSecTransformPtr transform,
- xmlSecTransformMode mode,
- xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int xmlSecTransformPushBin (xmlSecTransformPtr transform,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- int final,
- xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int xmlSecTransformPopBin (xmlSecTransformPtr transform,
- xmlSecByte* data,
- xmlSecSize maxDataSize,
- xmlSecSize* dataSize,
- xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int xmlSecTransformPushXml (xmlSecTransformPtr transform,
- xmlSecNodeSetPtr nodes,
- xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int xmlSecTransformPopXml (xmlSecTransformPtr transform,
- xmlSecNodeSetPtr* nodes,
- xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int xmlSecTransformExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT void xmlSecTransformDebugDump(xmlSecTransformPtr transform,
- FILE* output);
-XMLSEC_EXPORT void xmlSecTransformDebugXmlDump(xmlSecTransformPtr transform,
- FILE* output);
+XMLSEC_EXPORT xmlSecTransformPtr xmlSecTransformCreate (xmlSecTransformId id);
+XMLSEC_EXPORT void xmlSecTransformDestroy (xmlSecTransformPtr transform);
+XMLSEC_EXPORT xmlSecTransformPtr xmlSecTransformNodeRead (xmlNodePtr node,
+ xmlSecTransformUsage usage,
+ xmlSecTransformCtxPtr transformCtx);
+XMLSEC_EXPORT int xmlSecTransformPump (xmlSecTransformPtr left,
+ xmlSecTransformPtr right,
+ xmlSecTransformCtxPtr transformCtx);
+XMLSEC_EXPORT int xmlSecTransformSetKey (xmlSecTransformPtr transform,
+ xmlSecKeyPtr key);
+XMLSEC_EXPORT int xmlSecTransformSetKeyReq(xmlSecTransformPtr transform,
+ xmlSecKeyReqPtr keyReq);
+XMLSEC_EXPORT int xmlSecTransformVerify (xmlSecTransformPtr transform,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx);
+XMLSEC_EXPORT int xmlSecTransformVerifyNodeContent(xmlSecTransformPtr transform,
+ xmlNodePtr node,
+ xmlSecTransformCtxPtr transformCtx);
+XMLSEC_EXPORT xmlSecTransformDataType xmlSecTransformGetDataType(xmlSecTransformPtr transform,
+ xmlSecTransformMode mode,
+ xmlSecTransformCtxPtr transformCtx);
+XMLSEC_EXPORT int xmlSecTransformPushBin (xmlSecTransformPtr transform,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ int final,
+ xmlSecTransformCtxPtr transformCtx);
+XMLSEC_EXPORT int xmlSecTransformPopBin (xmlSecTransformPtr transform,
+ xmlSecByte* data,
+ xmlSecSize maxDataSize,
+ xmlSecSize* dataSize,
+ xmlSecTransformCtxPtr transformCtx);
+XMLSEC_EXPORT int xmlSecTransformPushXml (xmlSecTransformPtr transform,
+ xmlSecNodeSetPtr nodes,
+ xmlSecTransformCtxPtr transformCtx);
+XMLSEC_EXPORT int xmlSecTransformPopXml (xmlSecTransformPtr transform,
+ xmlSecNodeSetPtr* nodes,
+ xmlSecTransformCtxPtr transformCtx);
+XMLSEC_EXPORT int xmlSecTransformExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
+XMLSEC_EXPORT void xmlSecTransformDebugDump(xmlSecTransformPtr transform,
+ FILE* output);
+XMLSEC_EXPORT void xmlSecTransformDebugXmlDump(xmlSecTransformPtr transform,
+ FILE* output);
/**
* xmlSecTransformGetName:
- * @transform: the pointer to transform.
+ * @transform: the pointer to transform.
*
* Macro. Returns transform name.
*/
#define xmlSecTransformGetName(transform) \
- ((xmlSecTransformIsValid((transform))) ? \
- xmlSecTransformKlassGetName((transform)->id) : NULL)
+ ((xmlSecTransformIsValid((transform))) ? \
+ xmlSecTransformKlassGetName((transform)->id) : NULL)
/**
* xmlSecTransformIsValid:
- * @transform: the pointer to transform.
+ * @transform: the pointer to transform.
*
* Macro. Returns 1 if the @transform is valid or 0 otherwise.
*/
#define xmlSecTransformIsValid(transform) \
- ((( transform ) != NULL) && \
- (( transform )->id != NULL) && \
- (( transform )->id->klassSize >= sizeof(xmlSecTransformKlass)) && \
- (( transform )->id->objSize >= sizeof(xmlSecTransform)) && \
- (( transform )->id->name != NULL))
+ ((( transform ) != NULL) && \
+ (( transform )->id != NULL) && \
+ (( transform )->id->klassSize >= sizeof(xmlSecTransformKlass)) && \
+ (( transform )->id->objSize >= sizeof(xmlSecTransform)) && \
+ (( transform )->id->name != NULL))
/**
* xmlSecTransformCheckType:
- * @transform: the pointer to transform.
- * @t: the transform type.
+ * @transform: the pointer to transform.
+ * @t: the transform type.
*
* Macro. Returns 1 if the @transform is valid and has specified type @t
* or 0 otherwise.
*/
#define xmlSecTransformCheckType(transform, t) \
- (xmlSecTransformIsValid(( transform )) && \
- ((( transform )->id->type) == ( t )))
+ (xmlSecTransformIsValid(( transform )) && \
+ ((( transform )->id->type) == ( t )))
/**
* xmlSecTransformCheckId:
- * @transform: the pointer to transform.
- * @i: the transform id.
+ * @transform: the pointer to transform.
+ * @i: the transform id.
*
* Macro. Returns 1 if the @transform is valid and has specified id @i
* or 0 otherwise.
*/
#define xmlSecTransformCheckId(transform, i) \
- (xmlSecTransformIsValid(( transform )) && \
- ((((const xmlSecTransformId) (( transform )->id))) == ( i )))
+ (xmlSecTransformIsValid(( transform )) && \
+ ((((const xmlSecTransformId) (( transform )->id))) == ( i )))
/**
* xmlSecTransformCheckSize:
- * @transform: the pointer to transform.
- * @size: the transform object size.
+ * @transform: the pointer to transform.
+ * @size: the transform object size.
*
* Macro. Returns 1 if the @transform is valid and has at least @size
* bytes or 0 otherwise.
*/
#define xmlSecTransformCheckSize(transform, size) \
- (xmlSecTransformIsValid(( transform )) && \
- ((( transform )->id->objSize) >= ( size )))
+ (xmlSecTransformIsValid(( transform )) && \
+ ((( transform )->id->objSize) >= ( size )))
/************************************************************************
@@ -523,45 +523,45 @@ XMLSEC_EXPORT void xmlSecTransformDebugXmlDump(xmlSecTransformPtr transform,
* Operations on transforms chain
*
************************************************************************/
-XMLSEC_EXPORT int xmlSecTransformConnect (xmlSecTransformPtr left,
- xmlSecTransformPtr right,
- xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT void xmlSecTransformRemove (xmlSecTransformPtr transform);
+XMLSEC_EXPORT int xmlSecTransformConnect (xmlSecTransformPtr left,
+ xmlSecTransformPtr right,
+ xmlSecTransformCtxPtr transformCtx);
+XMLSEC_EXPORT void xmlSecTransformRemove (xmlSecTransformPtr transform);
/************************************************************************
*
* Default callbacks, most of the transforms can use them
*
************************************************************************/
-XMLSEC_EXPORT xmlSecTransformDataType xmlSecTransformDefaultGetDataType(xmlSecTransformPtr transform,
- xmlSecTransformMode mode,
- xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int xmlSecTransformDefaultPushBin(xmlSecTransformPtr transform,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- int final,
- xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int xmlSecTransformDefaultPopBin(xmlSecTransformPtr transform,
- xmlSecByte* data,
- xmlSecSize maxDataSize,
- xmlSecSize* dataSize,
- xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int xmlSecTransformDefaultPushXml(xmlSecTransformPtr transform,
- xmlSecNodeSetPtr nodes,
- xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT int xmlSecTransformDefaultPopXml(xmlSecTransformPtr transform,
- xmlSecNodeSetPtr* nodes,
- xmlSecTransformCtxPtr transformCtx);
+XMLSEC_EXPORT xmlSecTransformDataType xmlSecTransformDefaultGetDataType(xmlSecTransformPtr transform,
+ xmlSecTransformMode mode,
+ xmlSecTransformCtxPtr transformCtx);
+XMLSEC_EXPORT int xmlSecTransformDefaultPushBin(xmlSecTransformPtr transform,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ int final,
+ xmlSecTransformCtxPtr transformCtx);
+XMLSEC_EXPORT int xmlSecTransformDefaultPopBin(xmlSecTransformPtr transform,
+ xmlSecByte* data,
+ xmlSecSize maxDataSize,
+ xmlSecSize* dataSize,
+ xmlSecTransformCtxPtr transformCtx);
+XMLSEC_EXPORT int xmlSecTransformDefaultPushXml(xmlSecTransformPtr transform,
+ xmlSecNodeSetPtr nodes,
+ xmlSecTransformCtxPtr transformCtx);
+XMLSEC_EXPORT int xmlSecTransformDefaultPopXml(xmlSecTransformPtr transform,
+ xmlSecNodeSetPtr* nodes,
+ xmlSecTransformCtxPtr transformCtx);
/************************************************************************
*
* IO buffers for transforms
*
************************************************************************/
-XMLSEC_EXPORT xmlOutputBufferPtr xmlSecTransformCreateOutputBuffer(xmlSecTransformPtr transform,
- xmlSecTransformCtxPtr transformCtx);
-XMLSEC_EXPORT xmlParserInputBufferPtr xmlSecTransformCreateInputBuffer(xmlSecTransformPtr transform,
- xmlSecTransformCtxPtr transformCtx);
+XMLSEC_EXPORT xmlOutputBufferPtr xmlSecTransformCreateOutputBuffer(xmlSecTransformPtr transform,
+ xmlSecTransformCtxPtr transformCtx);
+XMLSEC_EXPORT xmlParserInputBufferPtr xmlSecTransformCreateInputBuffer(xmlSecTransformPtr transform,
+ xmlSecTransformCtxPtr transformCtx);
/************************************************************************
*
@@ -570,96 +570,96 @@ XMLSEC_EXPORT xmlParserInputBufferPtr xmlSecTransformCreateInputBuffer(xmlSecTr
************************************************************************/
/**
* xmlSecTransformInitializeMethod:
- * @transform: the pointer to transform object.
+ * @transform: the pointer to transform object.
*
* The transform specific initialization method.
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecTransformInitializeMethod) (xmlSecTransformPtr transform);
+typedef int (*xmlSecTransformInitializeMethod) (xmlSecTransformPtr transform);
/**
* xmlSecTransformFinalizeMethod:
- * @transform: the pointer to transform object.
+ * @transform: the pointer to transform object.
*
* The transform specific destroy method.
*/
-typedef void (*xmlSecTransformFinalizeMethod) (xmlSecTransformPtr transform);
+typedef void (*xmlSecTransformFinalizeMethod) (xmlSecTransformPtr transform);
/**
* xmlSecTransformGetDataTypeMethod:
- * @transform: the pointer to transform object.
- * @mode: the mode.
- * @transformCtx: the pointer to transform context object.
+ * @transform: the pointer to transform object.
+ * @mode: the mode.
+ * @transformCtx: the pointer to transform context object.
*
* The transform specific method to query information about transform
* data type in specified mode @mode.
*
* Returns: transform data type.
*/
-typedef xmlSecTransformDataType (*xmlSecTransformGetDataTypeMethod)(xmlSecTransformPtr transform,
- xmlSecTransformMode mode,
- xmlSecTransformCtxPtr transformCtx);
+typedef xmlSecTransformDataType (*xmlSecTransformGetDataTypeMethod)(xmlSecTransformPtr transform,
+ xmlSecTransformMode mode,
+ xmlSecTransformCtxPtr transformCtx);
/**
* xmlSecTransformNodeReadMethod:
- * @transform: the pointer to transform object.
- * @node: the pointer to <dsig:Transform/> node.
- * @transformCtx: the pointer to transform context object.
+ * @transform: the pointer to transform object.
+ * @node: the pointer to <dsig:Transform/> node.
+ * @transformCtx: the pointer to transform context object.
*
* The transform specific method to read the transform data from
* the @node.
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecTransformNodeReadMethod) (xmlSecTransformPtr transform,
- xmlNodePtr node,
- xmlSecTransformCtxPtr transformCtx);
+typedef int (*xmlSecTransformNodeReadMethod) (xmlSecTransformPtr transform,
+ xmlNodePtr node,
+ xmlSecTransformCtxPtr transformCtx);
/**
* xmlSecTransformNodeWriteMethod:
- * @transform: the pointer to transform object.
- * @node: the pointer to <dsig:Transform/> node.
- * @transformCtx: the pointer to transform context object.
+ * @transform: the pointer to transform object.
+ * @node: the pointer to <dsig:Transform/> node.
+ * @transformCtx: the pointer to transform context object.
*
* The transform specific method to write transform information to an XML node @node.
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecTransformNodeWriteMethod) (xmlSecTransformPtr transform,
- xmlNodePtr node,
- xmlSecTransformCtxPtr transformCtx);
+typedef int (*xmlSecTransformNodeWriteMethod) (xmlSecTransformPtr transform,
+ xmlNodePtr node,
+ xmlSecTransformCtxPtr transformCtx);
/**
* xmlSecTransformSetKeyRequirementsMethod:
- * @transform: the pointer to transform object.
- * @keyReq: the pointer to key requirements structure.
+ * @transform: the pointer to transform object.
+ * @keyReq: the pointer to key requirements structure.
*
* Transform specific method to set transform's key requirements.
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecTransformSetKeyRequirementsMethod)(xmlSecTransformPtr transform,
- xmlSecKeyReqPtr keyReq);
+typedef int (*xmlSecTransformSetKeyRequirementsMethod)(xmlSecTransformPtr transform,
+ xmlSecKeyReqPtr keyReq);
/**
* xmlSecTransformSetKeyMethod:
- * @transform: the pointer to transform object.
- * @key: the pointer to key.
+ * @transform: the pointer to transform object.
+ * @key: the pointer to key.
*
* The transform specific method to set the key for use.
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecTransformSetKeyMethod) (xmlSecTransformPtr transform,
- xmlSecKeyPtr key);
+typedef int (*xmlSecTransformSetKeyMethod) (xmlSecTransformPtr transform,
+ xmlSecKeyPtr key);
/**
* xmlSecTransformVerifyMethod:
- * @transform: the pointer to transform object.
- * @data: the input buffer.
- * @dataSize: the size of input buffer @data.
- * @transformCtx: the pointer to transform context object.
+ * @transform: the pointer to transform object.
+ * @data: the input buffer.
+ * @dataSize: the size of input buffer @data.
+ * @transformCtx: the pointer to transform context object.
*
* The transform specific method to verify transform processing results
* (used by digest and signature transforms). This method sets @status
@@ -668,36 +668,36 @@ typedef int (*xmlSecTransformSetKeyMethod) (xmlSecTransformPtr transform,
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecTransformVerifyMethod) (xmlSecTransformPtr transform,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx);
+typedef int (*xmlSecTransformVerifyMethod) (xmlSecTransformPtr transform,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx);
/**
* xmlSecTransformPushBinMethod:
- * @transform: the pointer to transform object.
- * @data: the input binary data,
- * @dataSize: the input data size.
- * @final: the flag: if set to 1 then it's the last
- * data chunk.
- * @transformCtx: the pointer to transform context object.
+ * @transform: the pointer to transform object.
+ * @data: the input binary data,
+ * @dataSize: the input data size.
+ * @final: the flag: if set to 1 then it's the last
+ * data chunk.
+ * @transformCtx: the pointer to transform context object.
*
* The transform specific method to process data from @data and push
* result to the next transform in the chain.
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecTransformPushBinMethod) (xmlSecTransformPtr transform,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- int final,
- xmlSecTransformCtxPtr transformCtx);
+typedef int (*xmlSecTransformPushBinMethod) (xmlSecTransformPtr transform,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ int final,
+ xmlSecTransformCtxPtr transformCtx);
/**
* xmlSecTransformPopBinMethod:
- * @transform: the pointer to transform object.
- * @data: the buffer to store result data.
- * @maxDataSize: the size of the buffer @data.
- * @dataSize: the pointer to returned data size.
- * @transformCtx: the pointer to transform context object.
+ * @transform: the pointer to transform object.
+ * @data: the buffer to store result data.
+ * @maxDataSize: the size of the buffer @data.
+ * @dataSize: the pointer to returned data size.
+ * @transformCtx: the pointer to transform context object.
*
* The transform specific method to pop data from previous transform
* in the chain and return result in the @data buffer. The size of returned
@@ -705,120 +705,120 @@ typedef int (*xmlSecTransformPushBinMethod) (xmlSecTransformPtr transform,
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecTransformPopBinMethod) (xmlSecTransformPtr transform,
- xmlSecByte* data,
- xmlSecSize maxDataSize,
- xmlSecSize* dataSize,
- xmlSecTransformCtxPtr transformCtx);
+typedef int (*xmlSecTransformPopBinMethod) (xmlSecTransformPtr transform,
+ xmlSecByte* data,
+ xmlSecSize maxDataSize,
+ xmlSecSize* dataSize,
+ xmlSecTransformCtxPtr transformCtx);
/**
* xmlSecTransformPushXmlMethod:
- * @transform: the pointer to transform object.
- * @nodes: the input nodes.
- * @transformCtx: the pointer to transform context object.
+ * @transform: the pointer to transform object.
+ * @nodes: the input nodes.
+ * @transformCtx: the pointer to transform context object.
*
* The transform specific method to process @nodes and push result to the next
* transform in the chain.
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecTransformPushXmlMethod) (xmlSecTransformPtr transform,
- xmlSecNodeSetPtr nodes,
- xmlSecTransformCtxPtr transformCtx);
+typedef int (*xmlSecTransformPushXmlMethod) (xmlSecTransformPtr transform,
+ xmlSecNodeSetPtr nodes,
+ xmlSecTransformCtxPtr transformCtx);
/**
* xmlSecTransformPopXmlMethod:
- * @transform: the pointer to transform object.
- * @nodes: the pointer to store popinter to result nodes.
- * @transformCtx: the pointer to transform context object.
+ * @transform: the pointer to transform object.
+ * @nodes: the pointer to store popinter to result nodes.
+ * @transformCtx: the pointer to transform context object.
*
* The transform specific method to pop data from previous transform in the chain,
* process the data and return result in @nodes.
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecTransformPopXmlMethod) (xmlSecTransformPtr transform,
- xmlSecNodeSetPtr* nodes,
- xmlSecTransformCtxPtr transformCtx);
+typedef int (*xmlSecTransformPopXmlMethod) (xmlSecTransformPtr transform,
+ xmlSecNodeSetPtr* nodes,
+ xmlSecTransformCtxPtr transformCtx);
/**
* xmlSecTransformExecuteMethod:
- * @transform: the pointer to transform object.
- * @last: the flag: if set to 1 then it's the last data chunk.
- * @transformCtx: the pointer to transform context object.
+ * @transform: the pointer to transform object.
+ * @last: the flag: if set to 1 then it's the last data chunk.
+ * @transformCtx: the pointer to transform context object.
*
* Transform specific method to process a chunk of data.
*
* Returns: 0 on success or a negative value otherwise.
*/
-typedef int (*xmlSecTransformExecuteMethod) (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
+typedef int (*xmlSecTransformExecuteMethod) (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
/**
* xmlSecTransformKlass:
- * @klassSize: the transform klass structure size.
- * @objSize: the transform object size.
- * @name: the transform's name.
- * @href: the transform's identification string (href).
- * @usage: the allowed transforms usages.
- * @initialize: the initialization method.
- * @finalize: the finmalization (destroy) function.
- * @readNode: the XML node read method.
- * @writeNode: the XML node write method.
- * @setKeyReq: the set key requirements method.
- * @setKey: the set key method.
- * @verify: the verify method (for digest and signature transforms).
- * @getDataType: the input/output data type query method.
- * @pushBin: the binary data "push thru chain" processing method.
- * @popBin: the binary data "pop from chain" procesing method.
- * @pushXml: the XML data "push thru chain" processing method.
- * @popXml: the XML data "pop from chain" procesing method.
- * @execute: the low level data processing method used by default
- * implementations of @pushBin, @popBin, @pushXml and @popXml.
- * @reserved0: reserved for the future.
- * @reserved1: reserved for the future.
+ * @klassSize: the transform klass structure size.
+ * @objSize: the transform object size.
+ * @name: the transform's name.
+ * @href: the transform's identification string (href).
+ * @usage: the allowed transforms usages.
+ * @initialize: the initialization method.
+ * @finalize: the finmalization (destroy) function.
+ * @readNode: the XML node read method.
+ * @writeNode: the XML node write method.
+ * @setKeyReq: the set key requirements method.
+ * @setKey: the set key method.
+ * @verify: the verify method (for digest and signature transforms).
+ * @getDataType: the input/output data type query method.
+ * @pushBin: the binary data "push thru chain" processing method.
+ * @popBin: the binary data "pop from chain" procesing method.
+ * @pushXml: the XML data "push thru chain" processing method.
+ * @popXml: the XML data "pop from chain" procesing method.
+ * @execute: the low level data processing method used by default
+ * implementations of @pushBin, @popBin, @pushXml and @popXml.
+ * @reserved0: reserved for the future.
+ * @reserved1: reserved for the future.
*
* The transform klass desccription structure.
*/
struct _xmlSecTransformKlass {
/* data */
- xmlSecSize klassSize;
- xmlSecSize objSize;
- const xmlChar* name;
- const xmlChar* href;
- xmlSecTransformUsage usage;
+ xmlSecSize klassSize;
+ xmlSecSize objSize;
+ const xmlChar* name;
+ const xmlChar* href;
+ xmlSecTransformUsage usage;
/* methods */
- xmlSecTransformInitializeMethod initialize;
- xmlSecTransformFinalizeMethod finalize;
+ xmlSecTransformInitializeMethod initialize;
+ xmlSecTransformFinalizeMethod finalize;
- xmlSecTransformNodeReadMethod readNode;
- xmlSecTransformNodeWriteMethod writeNode;
+ xmlSecTransformNodeReadMethod readNode;
+ xmlSecTransformNodeWriteMethod writeNode;
- xmlSecTransformSetKeyRequirementsMethod setKeyReq;
- xmlSecTransformSetKeyMethod setKey;
- xmlSecTransformVerifyMethod verify;
- xmlSecTransformGetDataTypeMethod getDataType;
+ xmlSecTransformSetKeyRequirementsMethod setKeyReq;
+ xmlSecTransformSetKeyMethod setKey;
+ xmlSecTransformVerifyMethod verify;
+ xmlSecTransformGetDataTypeMethod getDataType;
- xmlSecTransformPushBinMethod pushBin;
- xmlSecTransformPopBinMethod popBin;
- xmlSecTransformPushXmlMethod pushXml;
- xmlSecTransformPopXmlMethod popXml;
+ xmlSecTransformPushBinMethod pushBin;
+ xmlSecTransformPopBinMethod popBin;
+ xmlSecTransformPushXmlMethod pushXml;
+ xmlSecTransformPopXmlMethod popXml;
/* low level method */
- xmlSecTransformExecuteMethod execute;
+ xmlSecTransformExecuteMethod execute;
/* reserved for future */
- void* reserved0;
- void* reserved1;
+ void* reserved0;
+ void* reserved1;
};
/**
* xmlSecTransformKlassGetName:
- * @klass: the transofrm's klass.
+ * @klass: the transofrm's klass.
*
* Macro. Returns transform klass name.
*/
#define xmlSecTransformKlassGetName(klass) \
- (((klass)) ? ((klass)->name) : NULL)
+ (((klass)) ? ((klass)->name) : NULL)
/***********************************************************************
*
@@ -830,20 +830,20 @@ struct _xmlSecTransformKlass {
*
* Transform klasses list klass.
*/
-#define xmlSecTransformIdListId xmlSecTransformIdListGetKlass()
-XMLSEC_EXPORT xmlSecPtrListId xmlSecTransformIdListGetKlass (void);
-XMLSEC_EXPORT int xmlSecTransformIdListFind (xmlSecPtrListPtr list,
- xmlSecTransformId transformId);
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformIdListFindByHref (xmlSecPtrListPtr list,
- const xmlChar* href,
- xmlSecTransformUsage usage);
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformIdListFindByName (xmlSecPtrListPtr list,
- const xmlChar* name,
- xmlSecTransformUsage usage);
-XMLSEC_EXPORT void xmlSecTransformIdListDebugDump (xmlSecPtrListPtr list,
- FILE* output);
-XMLSEC_EXPORT void xmlSecTransformIdListDebugXmlDump(xmlSecPtrListPtr list,
- FILE* output);
+#define xmlSecTransformIdListId xmlSecTransformIdListGetKlass()
+XMLSEC_EXPORT xmlSecPtrListId xmlSecTransformIdListGetKlass (void);
+XMLSEC_EXPORT int xmlSecTransformIdListFind (xmlSecPtrListPtr list,
+ xmlSecTransformId transformId);
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformIdListFindByHref (xmlSecPtrListPtr list,
+ const xmlChar* href,
+ xmlSecTransformUsage usage);
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformIdListFindByName (xmlSecPtrListPtr list,
+ const xmlChar* name,
+ xmlSecTransformUsage usage);
+XMLSEC_EXPORT void xmlSecTransformIdListDebugDump (xmlSecPtrListPtr list,
+ FILE* output);
+XMLSEC_EXPORT void xmlSecTransformIdListDebugXmlDump(xmlSecPtrListPtr list,
+ FILE* output);
/********************************************************************
@@ -856,7 +856,7 @@ XMLSEC_EXPORT void xmlSecTransformIdListDebugXmlDump(xmlSecPtrListPtr list,
*
* The "unknown" transform id (NULL).
*/
-#define xmlSecTransformIdUnknown ((xmlSecTransformId)NULL)
+#define xmlSecTransformIdUnknown ((xmlSecTransformId)NULL)
/**
* xmlSecTransformBase64Id:
@@ -864,18 +864,18 @@ XMLSEC_EXPORT void xmlSecTransformIdListDebugXmlDump(xmlSecPtrListPtr list,
* The base64 encode transform klass.
*/
#define xmlSecTransformBase64Id \
- xmlSecTransformBase64GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformBase64GetKlass (void);
-XMLSEC_EXPORT void xmlSecTransformBase64SetLineSize (xmlSecTransformPtr transform,
- xmlSecSize lineSize);
+ xmlSecTransformBase64GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformBase64GetKlass (void);
+XMLSEC_EXPORT void xmlSecTransformBase64SetLineSize (xmlSecTransformPtr transform,
+ xmlSecSize lineSize);
/**
* xmlSecTransformInclC14NId:
*
* The regular (inclusive) C14N without comments transform klass.
*/
#define xmlSecTransformInclC14NId \
- xmlSecTransformInclC14NGetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14NGetKlass (void);
+ xmlSecTransformInclC14NGetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14NGetKlass (void);
/**
* xmlSecTransformInclC14NWithCommentsId:
@@ -883,8 +883,8 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14NGetKlass (void);
* The regular (inclusive) C14N with comments transform klass.
*/
#define xmlSecTransformInclC14NWithCommentsId \
- xmlSecTransformInclC14NWithCommentsGetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14NWithCommentsGetKlass(void);
+ xmlSecTransformInclC14NWithCommentsGetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14NWithCommentsGetKlass(void);
/**
* xmlSecTransformInclC14N11Id:
@@ -892,8 +892,8 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14NWithCommentsGetKlass(void
* The regular (inclusive) C14N 1.1 without comments transform klass.
*/
#define xmlSecTransformInclC14N11Id \
- xmlSecTransformInclC14N11GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14N11GetKlass (void);
+ xmlSecTransformInclC14N11GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14N11GetKlass (void);
/**
* xmlSecTransformInclC14N11WithCommentsId:
@@ -901,8 +901,8 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14N11GetKlass (void);
* The regular (inclusive) C14N 1.1 with comments transform klass.
*/
#define xmlSecTransformInclC14N11WithCommentsId \
- xmlSecTransformInclC14N11WithCommentsGetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14N11WithCommentsGetKlass(void);
+ xmlSecTransformInclC14N11WithCommentsGetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14N11WithCommentsGetKlass(void);
/**
* xmlSecTransformExclC14NId
@@ -910,8 +910,8 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformInclC14N11WithCommentsGetKlass(vo
* The exclusive C14N without comments transform klass.
*/
#define xmlSecTransformExclC14NId \
- xmlSecTransformExclC14NGetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformExclC14NGetKlass (void);
+ xmlSecTransformExclC14NGetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformExclC14NGetKlass (void);
/**
* xmlSecTransformExclC14NWithCommentsId:
@@ -919,8 +919,8 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformExclC14NGetKlass (void);
* The exclusive C14N with comments transform klass.
*/
#define xmlSecTransformExclC14NWithCommentsId \
- xmlSecTransformExclC14NWithCommentsGetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformExclC14NWithCommentsGetKlass(void);
+ xmlSecTransformExclC14NWithCommentsGetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformExclC14NWithCommentsGetKlass(void);
/**
* xmlSecTransformEnvelopedId:
@@ -928,8 +928,8 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformExclC14NWithCommentsGetKlass(void
* The "enveloped" transform klass.
*/
#define xmlSecTransformEnvelopedId \
- xmlSecTransformEnvelopedGetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformEnvelopedGetKlass (void);
+ xmlSecTransformEnvelopedGetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformEnvelopedGetKlass (void);
/**
* xmlSecTransformXPathId:
@@ -937,8 +937,8 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformEnvelopedGetKlass (void);
* The XPath transform klass.
*/
#define xmlSecTransformXPathId \
- xmlSecTransformXPathGetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXPathGetKlass (void);
+ xmlSecTransformXPathGetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXPathGetKlass (void);
/**
* xmlSecTransformXPath2Id:
@@ -946,8 +946,8 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXPathGetKlass (void);
* The XPath2 transform klass.
*/
#define xmlSecTransformXPath2Id \
- xmlSecTransformXPath2GetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXPath2GetKlass (void);
+ xmlSecTransformXPath2GetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXPath2GetKlass (void);
/**
* xmlSecTransformXPointerId:
@@ -955,12 +955,12 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXPath2GetKlass (void);
* The XPointer transform klass.
*/
#define xmlSecTransformXPointerId \
- xmlSecTransformXPointerGetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXPointerGetKlass (void);
-XMLSEC_EXPORT int xmlSecTransformXPointerSetExpr (xmlSecTransformPtr transform,
- const xmlChar* expr,
- xmlSecNodeSetType nodeSetType,
- xmlNodePtr hereNode);
+ xmlSecTransformXPointerGetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXPointerGetKlass (void);
+XMLSEC_EXPORT int xmlSecTransformXPointerSetExpr (xmlSecTransformPtr transform,
+ const xmlChar* expr,
+ xmlSecNodeSetType nodeSetType,
+ xmlNodePtr hereNode);
#ifndef XMLSEC_NO_XSLT
/**
* xmlSecTransformXsltId:
@@ -968,8 +968,8 @@ XMLSEC_EXPORT int xmlSecTransformXPointerSetExpr (xmlSecTransformPtr transform
* The XSLT transform klass.
*/
#define xmlSecTransformXsltId \
- xmlSecTransformXsltGetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXsltGetKlass (void);
+ xmlSecTransformXsltGetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXsltGetKlass (void);
#endif /* XMLSEC_NO_XSLT */
/**
@@ -978,8 +978,8 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformXsltGetKlass (void);
* The "remove all xml tags" transform klass (used before base64 transforms).
*/
#define xmlSecTransformRemoveXmlTagsC14NId \
- xmlSecTransformRemoveXmlTagsC14NGetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRemoveXmlTagsC14NGetKlass(void);
+ xmlSecTransformRemoveXmlTagsC14NGetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRemoveXmlTagsC14NGetKlass(void);
/**
* xmlSecTransformVisa3DHackId:
@@ -990,10 +990,10 @@ XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRemoveXmlTagsC14NGetKlass(void);
* such expressions thru XPath/XPointer engine, we need to have this hack here.
*/
#define xmlSecTransformVisa3DHackId \
- xmlSecTransformVisa3DHackGetKlass()
-XMLSEC_EXPORT xmlSecTransformId xmlSecTransformVisa3DHackGetKlass (void);
-XMLSEC_EXPORT int xmlSecTransformVisa3DHackSetID (xmlSecTransformPtr transform,
- const xmlChar* id);
+ xmlSecTransformVisa3DHackGetKlass()
+XMLSEC_EXPORT xmlSecTransformId xmlSecTransformVisa3DHackGetKlass (void);
+XMLSEC_EXPORT int xmlSecTransformVisa3DHackSetID (xmlSecTransformPtr transform,
+ const xmlChar* id);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/version.h b/include/xmlsec/version.h
index 48c9b47..93ff884 100644
--- a/include/xmlsec/version.h
+++ b/include/xmlsec/version.h
@@ -21,28 +21,28 @@ extern "C" {
* The library version string in the format
* "<major-number>.<minor-number>.<sub-minor-number>".
*/
-#define XMLSEC_VERSION "1.2.14"
+#define XMLSEC_VERSION "1.2.14"
/**
* XMLSEC_VERSION_MAJOR:
*
* The library major version number.
*/
-#define XMLSEC_VERSION_MAJOR 1
+#define XMLSEC_VERSION_MAJOR 1
/**
* XMLSEC_VERSION_MINOR:
*
* The library minor version number.
*/
-#define XMLSEC_VERSION_MINOR 2
+#define XMLSEC_VERSION_MINOR 2
/**
* XMLSEC_VERSION_SUBMINOR:
*
* The library sub-minor version number.
*/
-#define XMLSEC_VERSION_SUBMINOR 14
+#define XMLSEC_VERSION_SUBMINOR 14
/**
* XMLSEC_VERSION_INFO:
@@ -50,7 +50,7 @@ extern "C" {
* The library version info string in the format
* "<major-number>+<minor-number>:<sub-minor-number>:<minor-number>".
*/
-#define XMLSEC_VERSION_INFO "3:14:2"
+#define XMLSEC_VERSION_INFO "3:14:2"
#ifdef __cplusplus
diff --git a/include/xmlsec/x509.h b/include/xmlsec/x509.h
index b211482..93ba8e3 100644
--- a/include/xmlsec/x509.h
+++ b/include/xmlsec/x509.h
@@ -10,11 +10,11 @@
#define __XMLSEC_X509_H__
#ifndef XMLSEC_NO_X509
-
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <stdio.h>
+#include <stdio.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
@@ -32,43 +32,43 @@ extern "C" {
*
* <dsig:X509Certificate/> node found or would be written back.
*/
-#define XMLSEC_X509DATA_CERTIFICATE_NODE 0x00000001
+#define XMLSEC_X509DATA_CERTIFICATE_NODE 0x00000001
/**
* XMLSEC_X509DATA_SUBJECTNAME_NODE:
*
* <dsig:X509SubjectName/> node found or would be written back.
*/
-#define XMLSEC_X509DATA_SUBJECTNAME_NODE 0x00000002
+#define XMLSEC_X509DATA_SUBJECTNAME_NODE 0x00000002
/**
* XMLSEC_X509DATA_ISSUERSERIAL_NODE:
*
* <dsig:X509IssuerSerial/> node found or would be written back.
*/
-#define XMLSEC_X509DATA_ISSUERSERIAL_NODE 0x00000004
+#define XMLSEC_X509DATA_ISSUERSERIAL_NODE 0x00000004
/**
* XMLSEC_X509DATA_SKI_NODE:
*
* <dsig:/X509SKI> node found or would be written back.
*/
-#define XMLSEC_X509DATA_SKI_NODE 0x00000008
+#define XMLSEC_X509DATA_SKI_NODE 0x00000008
/**
* XMLSEC_X509DATA_CRL_NODE:
*
* <dsig:X509CRL/> node found or would be written back.
*/
-#define XMLSEC_X509DATA_CRL_NODE 0x00000010
+#define XMLSEC_X509DATA_CRL_NODE 0x00000010
/**
* XMLSEC_X509DATA_DEFAULT:
*
* Default set of nodes to write in case of empty
* <dsig:X509Data/> node template.
*/
-#define XMLSEC_X509DATA_DEFAULT \
- (XMLSEC_X509DATA_CERTIFICATE_NODE | XMLSEC_X509DATA_CRL_NODE)
-
-XMLSEC_EXPORT int xmlSecX509DataGetNodeContent (xmlNodePtr node,
- int deleteChildren,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+#define XMLSEC_X509DATA_DEFAULT \
+ (XMLSEC_X509DATA_CERTIFICATE_NODE | XMLSEC_X509DATA_CRL_NODE)
+
+XMLSEC_EXPORT int xmlSecX509DataGetNodeContent (xmlNodePtr node,
+ int deleteChildren,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/xkms.h b/include/xmlsec/xkms.h
index 5b19657..9c8c68f 100644
--- a/include/xmlsec/xkms.h
+++ b/include/xmlsec/xkms.h
@@ -13,11 +13,11 @@
#define __XMLSEC_XKMS_H__
#ifndef XMLSEC_NO_XKMS
-
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <stdio.h>
+#include <stdio.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
@@ -36,11 +36,11 @@ extern "C" {
* declared in "xmlsec/private/xkms.h" file.
*
************************************************************************/
-typedef struct _xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithKlass,
- *xmlSecXkmsRespondWithId;
+typedef struct _xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithKlass,
+ *xmlSecXkmsRespondWithId;
-typedef struct _xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestKlass,
- *xmlSecXkmsServerRequestId;
+typedef struct _xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestKlass,
+ *xmlSecXkmsServerRequestId;
/**
@@ -164,91 +164,91 @@ XMLSEC_EXPORT const xmlChar* xmlSecXkmsServerFormatToString (xmlSecXkmsServe
************************************************************************/
/**
* xmlSecXkmsServerCtx:
- * @userData: the pointer to user data (xmlsec and xmlsec-crypto libraries
- * never touches this).
- * @flags: the XML Encryption processing flags.
- * @flags2: the XML Encryption processing flags.
- * @keyInfoReadCtx: the reading key context.
- * @keyInfoWriteCtx: the writing key context (not used for signature verification).
- * @reserved0: reserved for the future.
- * @reserved1: reserved for the future.
+ * @userData: the pointer to user data (xmlsec and xmlsec-crypto libraries
+ * never touches this).
+ * @flags: the XML Encryption processing flags.
+ * @flags2: the XML Encryption processing flags.
+ * @keyInfoReadCtx: the reading key context.
+ * @keyInfoWriteCtx: the writing key context (not used for signature verification).
+ * @reserved0: reserved for the future.
+ * @reserved1: reserved for the future.
*
* XKMS context.
*/
struct _xmlSecXkmsServerCtx {
/* these data user can set before performing the operation */
- void* userData;
- xmlSecBitMask flags;
- xmlSecBitMask flags2;
- xmlSecKeyInfoCtx keyInfoReadCtx;
- xmlSecKeyInfoCtx keyInfoWriteCtx;
- xmlSecPtrList enabledRespondWithIds;
- xmlSecPtrList enabledServerRequestIds;
- xmlChar* expectedService;
- xmlChar* idPrefix;
- xmlSecSize idLen;
+ void* userData;
+ xmlSecBitMask flags;
+ xmlSecBitMask flags2;
+ xmlSecKeyInfoCtx keyInfoReadCtx;
+ xmlSecKeyInfoCtx keyInfoWriteCtx;
+ xmlSecPtrList enabledRespondWithIds;
+ xmlSecPtrList enabledServerRequestIds;
+ xmlChar* expectedService;
+ xmlChar* idPrefix;
+ xmlSecSize idLen;
/* these data are returned */
- xmlSecPtrList keys;
- xmlSecXkmsResultMajor resultMajor;
- xmlSecXkmsResultMinor resultMinor;
- xmlSecXkmsServerRequestId requestId;
- xmlChar* id;
- xmlChar* service;
- xmlChar* nonce;
- xmlChar* originalRequestId;
+ xmlSecPtrList keys;
+ xmlSecXkmsResultMajor resultMajor;
+ xmlSecXkmsResultMinor resultMinor;
+ xmlSecXkmsServerRequestId requestId;
+ xmlChar* id;
+ xmlChar* service;
+ xmlChar* nonce;
+ xmlChar* originalRequestId;
xmlChar* pendingNotificationMechanism;
xmlChar* pendingNotificationIdentifier;
- int responseLimit;
- xmlSecBitMask responseMechanismMask;
- xmlSecPtrListPtr compoundRequestContexts;
+ int responseLimit;
+ xmlSecBitMask responseMechanismMask;
+ xmlSecPtrListPtr compoundRequestContexts;
/* these are internal data, nobody should change that except us */
- xmlNodePtr requestNode;
- xmlNodePtr opaqueClientDataNode;
- xmlNodePtr firtsMsgExtNode;
- xmlNodePtr keyInfoNode;
- xmlSecPtrList respWithList;
+ xmlNodePtr requestNode;
+ xmlNodePtr opaqueClientDataNode;
+ xmlNodePtr firtsMsgExtNode;
+ xmlNodePtr keyInfoNode;
+ xmlSecPtrList respWithList;
/* reserved for future */
- void* reserved0;
- void* reserved1;
+ void* reserved0;
+ void* reserved1;
};
XMLSEC_EXPORT xmlSecXkmsServerCtxPtr xmlSecXkmsServerCtxCreate (xmlSecKeysMngrPtr keysMngr);
-XMLSEC_EXPORT void xmlSecXkmsServerCtxDestroy (xmlSecXkmsServerCtxPtr ctx);
-XMLSEC_EXPORT int xmlSecXkmsServerCtxInitialize (xmlSecXkmsServerCtxPtr ctx,
- xmlSecKeysMngrPtr keysMngr);
-XMLSEC_EXPORT void xmlSecXkmsServerCtxFinalize (xmlSecXkmsServerCtxPtr ctx);
-XMLSEC_EXPORT void xmlSecXkmsServerCtxReset (xmlSecXkmsServerCtxPtr ctx);
-XMLSEC_EXPORT int xmlSecXkmsServerCtxCopyUserPref (xmlSecXkmsServerCtxPtr dst,
- xmlSecXkmsServerCtxPtr src);
-XMLSEC_EXPORT xmlNodePtr xmlSecXkmsServerCtxProcess (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node,
+XMLSEC_EXPORT void xmlSecXkmsServerCtxDestroy (xmlSecXkmsServerCtxPtr ctx);
+XMLSEC_EXPORT int xmlSecXkmsServerCtxInitialize (xmlSecXkmsServerCtxPtr ctx,
+ xmlSecKeysMngrPtr keysMngr);
+XMLSEC_EXPORT void xmlSecXkmsServerCtxFinalize (xmlSecXkmsServerCtxPtr ctx);
+XMLSEC_EXPORT void xmlSecXkmsServerCtxReset (xmlSecXkmsServerCtxPtr ctx);
+XMLSEC_EXPORT int xmlSecXkmsServerCtxCopyUserPref (xmlSecXkmsServerCtxPtr dst,
+ xmlSecXkmsServerCtxPtr src);
+XMLSEC_EXPORT xmlNodePtr xmlSecXkmsServerCtxProcess (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node,
xmlSecXkmsServerFormat format,
- xmlDocPtr doc);
-XMLSEC_EXPORT int xmlSecXkmsServerCtxRequestRead (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-XMLSEC_EXPORT xmlNodePtr xmlSecXkmsServerCtxResponseWrite(xmlSecXkmsServerCtxPtr ctx,
- xmlDocPtr doc);
-XMLSEC_EXPORT xmlNodePtr xmlSecXkmsServerCtxRequestUnwrap(xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node,
+ xmlDocPtr doc);
+XMLSEC_EXPORT int xmlSecXkmsServerCtxRequestRead (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+XMLSEC_EXPORT xmlNodePtr xmlSecXkmsServerCtxResponseWrite(xmlSecXkmsServerCtxPtr ctx,
+ xmlDocPtr doc);
+XMLSEC_EXPORT xmlNodePtr xmlSecXkmsServerCtxRequestUnwrap(xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node,
xmlSecXkmsServerFormat format);
-XMLSEC_EXPORT xmlNodePtr xmlSecXkmsServerCtxResponseWrap (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node,
+XMLSEC_EXPORT xmlNodePtr xmlSecXkmsServerCtxResponseWrap (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node,
xmlSecXkmsServerFormat format,
xmlDocPtr doc);
-XMLSEC_EXPORT xmlNodePtr xmlSecXkmsServerCtxFatalErrorResponseCreate
- (xmlSecXkmsServerCtxPtr ctx,
+XMLSEC_EXPORT xmlNodePtr xmlSecXkmsServerCtxFatalErrorResponseCreate
+ (xmlSecXkmsServerCtxPtr ctx,
xmlSecXkmsServerFormat format,
xmlDocPtr doc);
-XMLSEC_EXPORT void xmlSecXkmsServerCtxSetResult (xmlSecXkmsServerCtxPtr ctx,
- xmlSecXkmsResultMajor resultMajor,
+XMLSEC_EXPORT void xmlSecXkmsServerCtxSetResult (xmlSecXkmsServerCtxPtr ctx,
+ xmlSecXkmsResultMajor resultMajor,
xmlSecXkmsResultMinor resultMinor);
-XMLSEC_EXPORT void xmlSecXkmsServerCtxDebugDump (xmlSecXkmsServerCtxPtr ctx,
- FILE* output);
-XMLSEC_EXPORT void xmlSecXkmsServerCtxDebugXmlDump (xmlSecXkmsServerCtxPtr ctx,
- FILE* output);
+XMLSEC_EXPORT void xmlSecXkmsServerCtxDebugDump (xmlSecXkmsServerCtxPtr ctx,
+ FILE* output);
+XMLSEC_EXPORT void xmlSecXkmsServerCtxDebugXmlDump (xmlSecXkmsServerCtxPtr ctx,
+ FILE* output);
/************************************************************************
*
@@ -260,8 +260,8 @@ XMLSEC_EXPORT void xmlSecXkmsServerCtxDebugXmlDump (xmlSecXkmsServerCtxPtr ctx,
*
* zmlSecXkmsServerCtx klasses list klass.
*/
-#define xmlSecXkmsServerCtxPtrListId xmlSecXkmsServerCtxPtrListGetKlass()
-XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsServerCtxPtrListGetKlass
+#define xmlSecXkmsServerCtxPtrListId xmlSecXkmsServerCtxPtrListGetKlass()
+XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsServerCtxPtrListGetKlass
(void);
/************************************************************************
@@ -275,7 +275,7 @@ XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsServerCtxPtrListGetKlass
* If flag is set then we abort if an unknown <xkms:ResponseMechanism/>
* value is found.
*/
-#define XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPONSE_MECHANISM 0x00000001
+#define XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPONSE_MECHANISM 0x00000001
/**
* XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPOND_WITH
@@ -283,7 +283,7 @@ XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsServerCtxPtrListGetKlass
* If flag is set then we abort if an unknown <xkms:RespondWith/>
* value is found.
*/
-#define XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPOND_WITH 0x00000002
+#define XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPOND_WITH 0x00000002
/**
* XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_KEY_USAGE
@@ -291,7 +291,7 @@ XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsServerCtxPtrListGetKlass
* If flag is set then we abort if an unknown <xkms:KeyUsage/>
* value is found.
*/
-#define XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_KEY_USAGE 0x00000004
+#define XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_KEY_USAGE 0x00000004
/************************************************************************
*
@@ -305,7 +305,7 @@ XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsServerCtxPtrListGetKlass
* accept a response that uses asynchronous processing, i.e. the service
* MAY return the MajorResult code Pending.
*/
-#define XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_PENDING 0x00000001
+#define XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_PENDING 0x00000001
/**
* XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REPRESENT:
@@ -314,7 +314,7 @@ XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsServerCtxPtrListGetKlass
* accept a response that uses the two phase protocol, i.e. the service
* MAY return the MajorResult code Represent.
*/
-#define XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REPRESENT 0x00000002
+#define XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REPRESENT 0x00000002
/**
* XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REQUEST_SIGNATURE_VALUE:
@@ -322,7 +322,7 @@ XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsServerCtxPtrListGetKlass
* XKMS ResponseMechanism element value. The requestor is prepared to
* accept a response that carries a <RequestSignatureValue> element.
*/
-#define XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REQUEST_SIGNATURE_VALUE 0x00000004
+#define XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REQUEST_SIGNATURE_VALUE 0x00000004
/************************************************************************
*
@@ -334,7 +334,7 @@ XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsServerCtxPtrListGetKlass
*
* The ResponseLimit is not specified.
*/
-#define XMLSEC_XKMS_NO_RESPONSE_LIMIT -1
+#define XMLSEC_XKMS_NO_RESPONSE_LIMIT -1
/************************************************************************
@@ -349,10 +349,10 @@ XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsServerCtxPtrListGetKlass
* considered to be trustworthy by the XKMS service.
*
* X.509 Equivalents
- * - Valid: Certificate path anchored by trusted root successfully constructed.
- * - Invalid: Certificate path could not be constructed to a trusted root.
+ * - Valid: Certificate path anchored by trusted root successfully constructed.
+ * - Invalid: Certificate path could not be constructed to a trusted root.
*/
-#define XMLSEC_XKMS_KEY_BINDING_REASON_MASK_ISSUER_TRAST 0x00000001
+#define XMLSEC_XKMS_KEY_BINDING_REASON_MASK_ISSUER_TRAST 0x00000001
/**
* XMLSEC_XKMS_KEY_BINDING_REASON_MASK_REVOCATION_STATUS:
@@ -361,10 +361,10 @@ XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsServerCtxPtrListGetKlass
* key binding with an authoritative source
*
* X.509 Equivalents
- * - Valid: Certificate status validated using CRL or OCSP.
- * - Invalid: Certificate status returned revoked or suspended.
+ * - Valid: Certificate status validated using CRL or OCSP.
+ * - Invalid: Certificate status returned revoked or suspended.
*/
-#define XMLSEC_XKMS_KEY_BINDING_REASON_MASK_REVOCATION_STATUS 0x00000002
+#define XMLSEC_XKMS_KEY_BINDING_REASON_MASK_REVOCATION_STATUS 0x00000002
/**
* XMLSEC_XKMS_KEY_BINDING_REASON_MASK_VALIDITY_INTERVAL:
@@ -373,11 +373,11 @@ XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsServerCtxPtrListGetKlass
* the key binding
*
* X.509 Equivalents
- * - Valid: The certificate chain was valid at the requested time instant.
- * - Invalid: The requested time instant was before or after the certificate
+ * - Valid: The certificate chain was valid at the requested time instant.
+ * - Invalid: The requested time instant was before or after the certificate
* chain validity interval.
*/
-#define XMLSEC_XKMS_KEY_BINDING_REASON_MASK_VALIDITY_INTERVAL 0x00000004
+#define XMLSEC_XKMS_KEY_BINDING_REASON_MASK_VALIDITY_INTERVAL 0x00000004
/**
* XMLSEC_XKMS_KEY_BINDING_REASON_MASK_SIGNATURE:
@@ -386,10 +386,10 @@ XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsServerCtxPtrListGetKlass
* successfully verified.
*
* X.509 Equivalents
- * - Valid: Certificate Signature verified.
+ * - Valid: Certificate Signature verified.
* - Invalid: Certificate Signature verification failed.
*/
-#define XMLSEC_XKMS_KEY_BINDING_REASON_MASK_SIGNATURE 0x00000008
+#define XMLSEC_XKMS_KEY_BINDING_REASON_MASK_SIGNATURE 0x00000008
/************************************************************************
@@ -397,31 +397,31 @@ XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsServerCtxPtrListGetKlass
* XKMS RespondWith Klass
*
************************************************************************/
-XMLSEC_EXPORT xmlSecPtrListPtr xmlSecXkmsRespondWithIdsGet (void);
-XMLSEC_EXPORT int xmlSecXkmsRespondWithIdsInit (void);
-XMLSEC_EXPORT void xmlSecXkmsRespondWithIdsShutdown(void);
-XMLSEC_EXPORT int xmlSecXkmsRespondWithIdsRegisterDefault
+XMLSEC_EXPORT xmlSecPtrListPtr xmlSecXkmsRespondWithIdsGet (void);
+XMLSEC_EXPORT int xmlSecXkmsRespondWithIdsInit (void);
+XMLSEC_EXPORT void xmlSecXkmsRespondWithIdsShutdown(void);
+XMLSEC_EXPORT int xmlSecXkmsRespondWithIdsRegisterDefault
(void);
-XMLSEC_EXPORT int xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithId id);
-XMLSEC_EXPORT int xmlSecXkmsRespondWithNodeRead (xmlSecXkmsRespondWithId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-XMLSEC_EXPORT int xmlSecXkmsRespondWithNodeWrite (xmlSecXkmsRespondWithId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-XMLSEC_EXPORT void xmlSecXkmsRespondWithDebugDump (xmlSecXkmsRespondWithId id,
- FILE* output);
-XMLSEC_EXPORT void xmlSecXkmsRespondWithDebugXmlDump
+XMLSEC_EXPORT int xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithId id);
+XMLSEC_EXPORT int xmlSecXkmsRespondWithNodeRead (xmlSecXkmsRespondWithId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+XMLSEC_EXPORT int xmlSecXkmsRespondWithNodeWrite (xmlSecXkmsRespondWithId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+XMLSEC_EXPORT void xmlSecXkmsRespondWithDebugDump (xmlSecXkmsRespondWithId id,
+ FILE* output);
+XMLSEC_EXPORT void xmlSecXkmsRespondWithDebugXmlDump
(xmlSecXkmsRespondWithId id,
- FILE* output);
-XMLSEC_EXPORT int xmlSecXkmsRespondWithDefaultNodeRead
+ FILE* output);
+XMLSEC_EXPORT int xmlSecXkmsRespondWithDefaultNodeRead
(xmlSecXkmsRespondWithId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-XMLSEC_EXPORT int xmlSecXkmsRespondWithDefaultNodeWrite
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+XMLSEC_EXPORT int xmlSecXkmsRespondWithDefaultNodeWrite
(xmlSecXkmsRespondWithId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
/************************************************************************
*
* XKMS RespondWith Klass List
@@ -432,17 +432,17 @@ XMLSEC_EXPORT int xmlSecXkmsRespondWithDefaultNodeWrite
*
* XKMS RespondWith klasses list klass.
*/
-#define xmlSecXkmsRespondWithIdListId xmlSecXkmsRespondWithIdListGetKlass()
-XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsRespondWithIdListGetKlass
+#define xmlSecXkmsRespondWithIdListId xmlSecXkmsRespondWithIdListGetKlass()
+XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsRespondWithIdListGetKlass
(void);
-XMLSEC_EXPORT int xmlSecXkmsRespondWithIdListFind (xmlSecPtrListPtr list,
- xmlSecXkmsRespondWithId id);
+XMLSEC_EXPORT int xmlSecXkmsRespondWithIdListFind (xmlSecPtrListPtr list,
+ xmlSecXkmsRespondWithId id);
XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithIdListFindByNodeValue
- (xmlSecPtrListPtr list,
- xmlNodePtr node);
-XMLSEC_EXPORT int xmlSecXkmsRespondWithIdListWrite(xmlSecPtrListPtr list,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
+ (xmlSecPtrListPtr list,
+ xmlNodePtr node);
+XMLSEC_EXPORT int xmlSecXkmsRespondWithIdListWrite(xmlSecPtrListPtr list,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
/********************************************************************
*
@@ -454,7 +454,7 @@ XMLSEC_EXPORT int xmlSecXkmsRespondWithIdListWrite(xmlSecPtrListPtr list,
*
* The "unknown" RespondWith id (NULL).
*/
-#define xmlSecXkmsRespondWithIdUnknown NULL
+#define xmlSecXkmsRespondWithIdUnknown NULL
/**
* xmlSecXkmsRespondWithKeyNameId:
@@ -462,8 +462,8 @@ XMLSEC_EXPORT int xmlSecXkmsRespondWithIdListWrite(xmlSecPtrListPtr list,
* The respond with KeyName klass.
*/
#define xmlSecXkmsRespondWithKeyNameId \
- xmlSecXkmsRespondWithKeyNameGetKlass()
-XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithKeyNameGetKlass(void);
+ xmlSecXkmsRespondWithKeyNameGetKlass()
+XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithKeyNameGetKlass(void);
/**
* xmlSecXkmsRespondWithKeyValueId:
@@ -471,8 +471,8 @@ XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithKeyNameGetKlass(void)
* The respond with KeyValue klass.
*/
#define xmlSecXkmsRespondWithKeyValueId \
- xmlSecXkmsRespondWithKeyValueGetKlass()
-XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithKeyValueGetKlass(void);
+ xmlSecXkmsRespondWithKeyValueGetKlass()
+XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithKeyValueGetKlass(void);
/**
* xmlSecXkmsRespondWithPrivateKeyId:
@@ -480,8 +480,8 @@ XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithKeyValueGetKlass(void
* The respond with PrivateKey klass.
*/
#define xmlSecXkmsRespondWithPrivateKeyId \
- xmlSecXkmsRespondWithPrivateKeyGetKlass()
-XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithPrivateKeyGetKlass(void);
+ xmlSecXkmsRespondWithPrivateKeyGetKlass()
+XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithPrivateKeyGetKlass(void);
/**
* xmlSecXkmsRespondWithRetrievalMethodId:
@@ -489,8 +489,8 @@ XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithPrivateKeyGetKlass(vo
* The respond with RetrievalMethod klass.
*/
#define xmlSecXkmsRespondWithRetrievalMethodId \
- xmlSecXkmsRespondWithRetrievalMethodGetKlass()
-XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithRetrievalMethodGetKlass(void);
+ xmlSecXkmsRespondWithRetrievalMethodGetKlass()
+XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithRetrievalMethodGetKlass(void);
/**
* xmlSecXkmsRespondWithX509CertId:
@@ -498,8 +498,8 @@ XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithRetrievalMethodGetKla
* The respond with X509Cert klass.
*/
#define xmlSecXkmsRespondWithX509CertId \
- xmlSecXkmsRespondWithX509CertGetKlass()
-XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithX509CertGetKlass(void);
+ xmlSecXkmsRespondWithX509CertGetKlass()
+XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithX509CertGetKlass(void);
/**
* xmlSecXkmsRespondWithX509ChainId:
@@ -507,8 +507,8 @@ XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithX509CertGetKlass(void
* The respond with X509Chain klass.
*/
#define xmlSecXkmsRespondWithX509ChainId \
- xmlSecXkmsRespondWithX509ChainGetKlass()
-XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithX509ChainGetKlass(void);
+ xmlSecXkmsRespondWithX509ChainGetKlass()
+XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithX509ChainGetKlass(void);
/**
* xmlSecXkmsRespondWithX509CRLId:
@@ -516,8 +516,8 @@ XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithX509ChainGetKlass(voi
* The respond with X509CRL klass.
*/
#define xmlSecXkmsRespondWithX509CRLId \
- xmlSecXkmsRespondWithX509CRLGetKlass()
-XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithX509CRLGetKlass(void);
+ xmlSecXkmsRespondWithX509CRLGetKlass()
+XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithX509CRLGetKlass(void);
/**
@@ -526,8 +526,8 @@ XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithX509CRLGetKlass(void)
* The respond with PGP klass.
*/
#define xmlSecXkmsRespondWithPGPId \
- xmlSecXkmsRespondWithPGPGetKlass()
-XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithPGPGetKlass(void);
+ xmlSecXkmsRespondWithPGPGetKlass()
+XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithPGPGetKlass(void);
/**
* xmlSecXkmsRespondWithSPKIId:
@@ -535,8 +535,8 @@ XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithPGPGetKlass(void);
* The respond with SPKI klass.
*/
#define xmlSecXkmsRespondWithSPKIId \
- xmlSecXkmsRespondWithSPKIGetKlass()
-XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithSPKIGetKlass(void);
+ xmlSecXkmsRespondWithSPKIGetKlass()
+XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithSPKIGetKlass(void);
/************************************************************************
@@ -544,28 +544,28 @@ XMLSEC_EXPORT xmlSecXkmsRespondWithId xmlSecXkmsRespondWithSPKIGetKlass(void);
* XKMS ServerRequest Klass
*
************************************************************************/
-XMLSEC_EXPORT xmlSecPtrListPtr xmlSecXkmsServerRequestIdsGet (void);
-XMLSEC_EXPORT int xmlSecXkmsServerRequestIdsInit (void);
-XMLSEC_EXPORT void xmlSecXkmsServerRequestIdsShutdown
- (void);
-XMLSEC_EXPORT int xmlSecXkmsServerRequestIdsRegisterDefault
- (void);
-XMLSEC_EXPORT int xmlSecXkmsServerRequestIdsRegister
- (xmlSecXkmsServerRequestId id);
-XMLSEC_EXPORT int xmlSecXkmsServerRequestNodeRead (xmlSecXkmsServerRequestId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-XMLSEC_EXPORT int xmlSecXkmsServerRequestExecute (xmlSecXkmsServerRequestId id,
- xmlSecXkmsServerCtxPtr ctx);
-XMLSEC_EXPORT xmlNodePtr xmlSecXkmsServerRequestNodeWrite(xmlSecXkmsServerRequestId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlDocPtr doc,
- xmlNodePtr node);
-XMLSEC_EXPORT void xmlSecXkmsServerRequestDebugDump(xmlSecXkmsServerRequestId id,
- FILE* output);
-XMLSEC_EXPORT void xmlSecXkmsServerRequestDebugXmlDump
- (xmlSecXkmsServerRequestId id,
- FILE* output);
+XMLSEC_EXPORT xmlSecPtrListPtr xmlSecXkmsServerRequestIdsGet (void);
+XMLSEC_EXPORT int xmlSecXkmsServerRequestIdsInit (void);
+XMLSEC_EXPORT void xmlSecXkmsServerRequestIdsShutdown
+ (void);
+XMLSEC_EXPORT int xmlSecXkmsServerRequestIdsRegisterDefault
+ (void);
+XMLSEC_EXPORT int xmlSecXkmsServerRequestIdsRegister
+ (xmlSecXkmsServerRequestId id);
+XMLSEC_EXPORT int xmlSecXkmsServerRequestNodeRead (xmlSecXkmsServerRequestId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+XMLSEC_EXPORT int xmlSecXkmsServerRequestExecute (xmlSecXkmsServerRequestId id,
+ xmlSecXkmsServerCtxPtr ctx);
+XMLSEC_EXPORT xmlNodePtr xmlSecXkmsServerRequestNodeWrite(xmlSecXkmsServerRequestId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlDocPtr doc,
+ xmlNodePtr node);
+XMLSEC_EXPORT void xmlSecXkmsServerRequestDebugDump(xmlSecXkmsServerRequestId id,
+ FILE* output);
+XMLSEC_EXPORT void xmlSecXkmsServerRequestDebugXmlDump
+ (xmlSecXkmsServerRequestId id,
+ FILE* output);
/************************************************************************
*
@@ -577,25 +577,25 @@ XMLSEC_EXPORT void xmlSecXkmsServerRequestDebugXmlDump
*
* XKMS ServerRequest klasses list klass.
*/
-#define xmlSecXkmsServerRequestIdListId xmlSecXkmsServerRequestIdListGetKlass()
-XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsServerRequestIdListGetKlass
- (void);
-XMLSEC_EXPORT int xmlSecXkmsServerRequestIdListFind
- (xmlSecPtrListPtr list,
- xmlSecXkmsServerRequestId id);
-XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestIdListFindByName
- (xmlSecPtrListPtr list,
- const xmlChar* name);
-XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestIdListFindByNode
- (xmlSecPtrListPtr list,
- xmlNodePtr node);
+#define xmlSecXkmsServerRequestIdListId xmlSecXkmsServerRequestIdListGetKlass()
+XMLSEC_EXPORT xmlSecPtrListId xmlSecXkmsServerRequestIdListGetKlass
+ (void);
+XMLSEC_EXPORT int xmlSecXkmsServerRequestIdListFind
+ (xmlSecPtrListPtr list,
+ xmlSecXkmsServerRequestId id);
+XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestIdListFindByName
+ (xmlSecPtrListPtr list,
+ const xmlChar* name);
+XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestIdListFindByNode
+ (xmlSecPtrListPtr list,
+ xmlNodePtr node);
/**
* xmlSecXkmsServerRequestIdUnknown:
*
* The "unknown" ServerRequest id (NULL).
*/
-#define xmlSecXkmsServerRequestIdUnknown NULL
+#define xmlSecXkmsServerRequestIdUnknown NULL
/**
* xmlSecXkmsServerRequestResultId:
@@ -603,8 +603,8 @@ XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestIdListFindByNode
* The Result response klass.
*/
#define xmlSecXkmsServerRequestResultId \
- xmlSecXkmsServerRequestResultGetKlass()
-XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestResultGetKlass(void);
+ xmlSecXkmsServerRequestResultGetKlass()
+XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestResultGetKlass(void);
/**
* xmlSecXkmsServerRequestStatusId:
@@ -612,8 +612,8 @@ XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestResultGetKlass(vo
* The StatusRequest klass.
*/
#define xmlSecXkmsServerRequestStatusId \
- xmlSecXkmsServerRequestStatusGetKlass()
-XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestStatusGetKlass(void);
+ xmlSecXkmsServerRequestStatusGetKlass()
+XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestStatusGetKlass(void);
/**
* xmlSecXkmsServerRequestCompoundId:
@@ -621,8 +621,8 @@ XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestStatusGetKlass(vo
* The CompoundRequest klass.
*/
#define xmlSecXkmsServerRequestCompoundId \
- xmlSecXkmsServerRequestCompoundGetKlass()
-XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestCompoundGetKlass(void);
+ xmlSecXkmsServerRequestCompoundGetKlass()
+XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestCompoundGetKlass(void);
/**
* xmlSecXkmsServerRequestLocateId:
@@ -630,8 +630,8 @@ XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestCompoundGetKlass(
* The LocateRequest klass.
*/
#define xmlSecXkmsServerRequestLocateId \
- xmlSecXkmsServerRequestLocateGetKlass()
-XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestLocateGetKlass(void);
+ xmlSecXkmsServerRequestLocateGetKlass()
+XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestLocateGetKlass(void);
/**
* xmlSecXkmsServerRequestValidateId:
@@ -639,8 +639,8 @@ XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestLocateGetKlass(vo
* The ValidateRequest klass.
*/
#define xmlSecXkmsServerRequestValidateId \
- xmlSecXkmsServerRequestValidateGetKlass()
-XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestValidateGetKlass(void);
+ xmlSecXkmsServerRequestValidateGetKlass()
+XMLSEC_EXPORT xmlSecXkmsServerRequestId xmlSecXkmsServerRequestValidateGetKlass(void);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/xmldsig.h b/include/xmlsec/xmldsig.h
index b262078..6c3a332 100644
--- a/include/xmlsec/xmldsig.h
+++ b/include/xmlsec/xmldsig.h
@@ -31,14 +31,14 @@ extern "C" {
#include <xmlsec/keyinfo.h>
#include <xmlsec/transforms.h>
-typedef struct _xmlSecDSigReferenceCtx xmlSecDSigReferenceCtx,
- *xmlSecDSigReferenceCtxPtr;
+typedef struct _xmlSecDSigReferenceCtx xmlSecDSigReferenceCtx,
+ *xmlSecDSigReferenceCtxPtr;
/**
* xmlSecDSigStatus:
- * @xmlSecDSigStatusUnknown: the status is unknow.
- * @xmlSecDSigStatusSucceeded: the processing succeeded.
- * @xmlSecDSigStatusInvalid: the processing failed.
+ * @xmlSecDSigStatusUnknown: the status is unknow.
+ * @xmlSecDSigStatusSucceeded: the processing succeeded.
+ * @xmlSecDSigStatusInvalid: the processing failed.
*
* XML Digital signature processing status.
*/
@@ -59,7 +59,7 @@ typedef enum {
*
* If this flag is set then <dsig:Manifests/> nodes will not be processed.
*/
-#define XMLSEC_DSIG_FLAGS_IGNORE_MANIFESTS 0x00000001
+#define XMLSEC_DSIG_FLAGS_IGNORE_MANIFESTS 0x00000001
/**
* XMLSEC_DSIG_FLAGS_STORE_SIGNEDINFO_REFERENCES:
@@ -67,7 +67,7 @@ typedef enum {
* If this flag is set then pre-digest buffer for <dsig:Reference/> child
* of <dsig:KeyInfo/> element will be stored in #xmlSecDSigCtx.
*/
-#define XMLSEC_DSIG_FLAGS_STORE_SIGNEDINFO_REFERENCES 0x00000002
+#define XMLSEC_DSIG_FLAGS_STORE_SIGNEDINFO_REFERENCES 0x00000002
/**
* XMLSEC_DSIG_FLAGS_STORE_MANIFEST_REFERENCES:
@@ -75,7 +75,7 @@ typedef enum {
* If this flag is set then pre-digest buffer for <dsig:Reference/> child
* of <dsig:Manifest/> element will be stored in #xmlSecDSigCtx.
*/
-#define XMLSEC_DSIG_FLAGS_STORE_MANIFEST_REFERENCES 0x00000004
+#define XMLSEC_DSIG_FLAGS_STORE_MANIFEST_REFERENCES 0x00000004
/**
* XMLSEC_DSIG_FLAGS_STORE_SIGNATURE:
@@ -83,7 +83,7 @@ typedef enum {
* If this flag is set then pre-signature buffer for <dsig:SignedInfo/>
* element processing will be stored in #xmlSecDSigCtx.
*/
-#define XMLSEC_DSIG_FLAGS_STORE_SIGNATURE 0x00000008
+#define XMLSEC_DSIG_FLAGS_STORE_SIGNATURE 0x00000008
/**
* XMLSEC_DSIG_FLAGS_USE_VISA3D_HACK:
@@ -92,94 +92,94 @@ typedef enum {
* without using XPointers. This allows one to sign/verify Visa3D
* documents that don't follow XML, XPointer and XML DSig specifications.
*/
-#define XMLSEC_DSIG_FLAGS_USE_VISA3D_HACK 0x00000010
+#define XMLSEC_DSIG_FLAGS_USE_VISA3D_HACK 0x00000010
/**
* xmlSecDSigCtx:
- * @userData: the pointer to user data (xmlsec and xmlsec-crypto libraries
- * never touches this).
- * @flags: the XML Digital Signature processing flags.
- * @flags2: the XML Digital Signature processing flags.
- * @keyInfoReadCtx: the reading key context.
- * @keyInfoWriteCtx: the writing key context (not used for signature verification).
- * @transformCtx: the <dsig:SignedInfo/> node processing context.
- * @enabledReferenceUris: the URI types allowed for <dsig:Reference/> node.
- * @enabledReferenceTransforms: the list of transforms allowed in <dsig:Reference/> node.
+ * @userData: the pointer to user data (xmlsec and xmlsec-crypto libraries
+ * never touches this).
+ * @flags: the XML Digital Signature processing flags.
+ * @flags2: the XML Digital Signature processing flags.
+ * @keyInfoReadCtx: the reading key context.
+ * @keyInfoWriteCtx: the writing key context (not used for signature verification).
+ * @transformCtx: the <dsig:SignedInfo/> node processing context.
+ * @enabledReferenceUris: the URI types allowed for <dsig:Reference/> node.
+ * @enabledReferenceTransforms: the list of transforms allowed in <dsig:Reference/> node.
* @referencePreExecuteCallback:the callback for <dsig:Reference/> node processing.
- * @defSignMethodId: the default signing method klass.
- * @defC14NMethodId: the default c14n method klass.
- * @defDigestMethodId: the default digest method klass.
- * @signKey: the signature key; application may set #signKey
- * before calling #xmlSecDSigCtxSign or #xmlSecDSigCtxVerify
- * functions.
- * @operation: the operation: sign or verify.
- * @result: the pointer to signature (not valid for signature verificaction).
- * @status: the <dsig:Signatuire/> procesisng status.
- * @signMethod: the pointer to signature transform.
- * @c14nMethod: the pointer to c14n transform.
- * @preSignMemBufMethod: the pointer to binary buffer right before signature
- * (valid only if #XMLSEC_DSIG_FLAGS_STORE_SIGNATURE flag is set).
- * @signValueNode: the pointer to <dsig:SignatureValue/> node.
- * @id: the pointer to Id attribute of <dsig:Signature/> node.
- * @signedInfoReferences: the list of references in <dsig:SignedInfo/> node.
- * @manifestReferences: the list of references in <dsig:Manifest/> nodes.
- * @reserved0: reserved for the future.
- * @reserved1: reserved for the future.
+ * @defSignMethodId: the default signing method klass.
+ * @defC14NMethodId: the default c14n method klass.
+ * @defDigestMethodId: the default digest method klass.
+ * @signKey: the signature key; application may set #signKey
+ * before calling #xmlSecDSigCtxSign or #xmlSecDSigCtxVerify
+ * functions.
+ * @operation: the operation: sign or verify.
+ * @result: the pointer to signature (not valid for signature verificaction).
+ * @status: the <dsig:Signatuire/> procesisng status.
+ * @signMethod: the pointer to signature transform.
+ * @c14nMethod: the pointer to c14n transform.
+ * @preSignMemBufMethod: the pointer to binary buffer right before signature
+ * (valid only if #XMLSEC_DSIG_FLAGS_STORE_SIGNATURE flag is set).
+ * @signValueNode: the pointer to <dsig:SignatureValue/> node.
+ * @id: the pointer to Id attribute of <dsig:Signature/> node.
+ * @signedInfoReferences: the list of references in <dsig:SignedInfo/> node.
+ * @manifestReferences: the list of references in <dsig:Manifest/> nodes.
+ * @reserved0: reserved for the future.
+ * @reserved1: reserved for the future.
*
* XML DSig processing context.
*/
struct _xmlSecDSigCtx {
/* these data user can set before performing the operation */
- void* userData;
- unsigned int flags;
- unsigned int flags2;
- xmlSecKeyInfoCtx keyInfoReadCtx;
- xmlSecKeyInfoCtx keyInfoWriteCtx;
- xmlSecTransformCtx transformCtx;
- xmlSecTransformUriType enabledReferenceUris;
- xmlSecPtrListPtr enabledReferenceTransforms;
+ void* userData;
+ unsigned int flags;
+ unsigned int flags2;
+ xmlSecKeyInfoCtx keyInfoReadCtx;
+ xmlSecKeyInfoCtx keyInfoWriteCtx;
+ xmlSecTransformCtx transformCtx;
+ xmlSecTransformUriType enabledReferenceUris;
+ xmlSecPtrListPtr enabledReferenceTransforms;
xmlSecTransformCtxPreExecuteCallback referencePreExecuteCallback;
- xmlSecTransformId defSignMethodId;
- xmlSecTransformId defC14NMethodId;
- xmlSecTransformId defDigestMethodId;
+ xmlSecTransformId defSignMethodId;
+ xmlSecTransformId defC14NMethodId;
+ xmlSecTransformId defDigestMethodId;
/* these data are returned */
- xmlSecKeyPtr signKey;
- xmlSecTransformOperation operation;
- xmlSecBufferPtr result;
- xmlSecDSigStatus status;
- xmlSecTransformPtr signMethod;
- xmlSecTransformPtr c14nMethod;
- xmlSecTransformPtr preSignMemBufMethod;
- xmlNodePtr signValueNode;
- xmlChar* id;
- xmlSecPtrList signedInfoReferences;
- xmlSecPtrList manifestReferences;
+ xmlSecKeyPtr signKey;
+ xmlSecTransformOperation operation;
+ xmlSecBufferPtr result;
+ xmlSecDSigStatus status;
+ xmlSecTransformPtr signMethod;
+ xmlSecTransformPtr c14nMethod;
+ xmlSecTransformPtr preSignMemBufMethod;
+ xmlNodePtr signValueNode;
+ xmlChar* id;
+ xmlSecPtrList signedInfoReferences;
+ xmlSecPtrList manifestReferences;
/* reserved for future */
- void* reserved0;
- void* reserved1;
-};
+ void* reserved0;
+ void* reserved1;
+};
/* constructor/destructor */
-XMLSEC_EXPORT xmlSecDSigCtxPtr xmlSecDSigCtxCreate (xmlSecKeysMngrPtr keysMngr);
-XMLSEC_EXPORT void xmlSecDSigCtxDestroy (xmlSecDSigCtxPtr dsigCtx);
-XMLSEC_EXPORT int xmlSecDSigCtxInitialize (xmlSecDSigCtxPtr dsigCtx,
- xmlSecKeysMngrPtr keysMngr);
-XMLSEC_EXPORT void xmlSecDSigCtxFinalize (xmlSecDSigCtxPtr dsigCtx);
-XMLSEC_EXPORT int xmlSecDSigCtxSign (xmlSecDSigCtxPtr dsigCtx,
- xmlNodePtr tmpl);
-XMLSEC_EXPORT int xmlSecDSigCtxVerify (xmlSecDSigCtxPtr dsigCtx,
- xmlNodePtr node);
-XMLSEC_EXPORT int xmlSecDSigCtxEnableReferenceTransform(xmlSecDSigCtxPtr dsigCtx,
- xmlSecTransformId transformId);
-XMLSEC_EXPORT int xmlSecDSigCtxEnableSignatureTransform(xmlSecDSigCtxPtr dsigCtx,
- xmlSecTransformId transformId);
-XMLSEC_EXPORT xmlSecBufferPtr xmlSecDSigCtxGetPreSignBuffer (xmlSecDSigCtxPtr dsigCtx);
-XMLSEC_EXPORT void xmlSecDSigCtxDebugDump (xmlSecDSigCtxPtr dsigCtx,
- FILE* output);
-XMLSEC_EXPORT void xmlSecDSigCtxDebugXmlDump (xmlSecDSigCtxPtr dsigCtx,
- FILE* output);
+XMLSEC_EXPORT xmlSecDSigCtxPtr xmlSecDSigCtxCreate (xmlSecKeysMngrPtr keysMngr);
+XMLSEC_EXPORT void xmlSecDSigCtxDestroy (xmlSecDSigCtxPtr dsigCtx);
+XMLSEC_EXPORT int xmlSecDSigCtxInitialize (xmlSecDSigCtxPtr dsigCtx,
+ xmlSecKeysMngrPtr keysMngr);
+XMLSEC_EXPORT void xmlSecDSigCtxFinalize (xmlSecDSigCtxPtr dsigCtx);
+XMLSEC_EXPORT int xmlSecDSigCtxSign (xmlSecDSigCtxPtr dsigCtx,
+ xmlNodePtr tmpl);
+XMLSEC_EXPORT int xmlSecDSigCtxVerify (xmlSecDSigCtxPtr dsigCtx,
+ xmlNodePtr node);
+XMLSEC_EXPORT int xmlSecDSigCtxEnableReferenceTransform(xmlSecDSigCtxPtr dsigCtx,
+ xmlSecTransformId transformId);
+XMLSEC_EXPORT int xmlSecDSigCtxEnableSignatureTransform(xmlSecDSigCtxPtr dsigCtx,
+ xmlSecTransformId transformId);
+XMLSEC_EXPORT xmlSecBufferPtr xmlSecDSigCtxGetPreSignBuffer (xmlSecDSigCtxPtr dsigCtx);
+XMLSEC_EXPORT void xmlSecDSigCtxDebugDump (xmlSecDSigCtxPtr dsigCtx,
+ FILE* output);
+XMLSEC_EXPORT void xmlSecDSigCtxDebugXmlDump (xmlSecDSigCtxPtr dsigCtx,
+ FILE* output);
/**************************************************************************
@@ -190,7 +190,7 @@ XMLSEC_EXPORT void xmlSecDSigCtxDebugXmlDump (xmlSecDSigCtxPtr dsigCtx,
/**
* xmlSecDSigReferenceOrigin:
* @xmlSecDSigReferenceOriginSignedInfo:reference in <dsig:SignedInfo> node.
- * @xmlSecDSigReferenceOriginManifest: reference <dsig:Manifest> node.
+ * @xmlSecDSigReferenceOriginManifest: reference <dsig:Manifest> node.
*
* The possible <dsig:Reference/> node locations: in the <dsig:SignedInfo/>
* node or in the <dsig:Manifest/> node.
@@ -202,60 +202,60 @@ typedef enum {
/**
* xmlSecDSigReferenceCtx:
- * @userData: the pointer to user data (xmlsec and xmlsec-crypto libraries
- * never touches this).
- * @dsigCtx: the pointer to "parent" <dsig:Signature/> processing context.
- * @origin: the signature origin (<dsig:SignedInfo/> or <dsig:Manifest/>).
- * @transformCtx: the reference processing transforms context.
- * @digestMethod: the pointer to digest transform.
- * @result: the pointer to digest result.
- * @status: the reference processing status.
- * @preDigestMemBufMethod: the pointer to binary buffer right before digest
- * (valid only if either
- * #XMLSEC_DSIG_FLAGS_STORE_SIGNEDINFO_REFERENCES or
- * #XMLSEC_DSIG_FLAGS_STORE_MANIFEST_REFERENCES flags are set).
- * @id: the <dsig:Reference/> node ID attribute.
- * @uri: the <dsig:Reference/> node URI attribute.
- * @type: the <dsig:Reference/> node Type attribute.
- * @reserved0: reserved for the future.
- * @reserved1: reserved for the future.
+ * @userData: the pointer to user data (xmlsec and xmlsec-crypto libraries
+ * never touches this).
+ * @dsigCtx: the pointer to "parent" <dsig:Signature/> processing context.
+ * @origin: the signature origin (<dsig:SignedInfo/> or <dsig:Manifest/>).
+ * @transformCtx: the reference processing transforms context.
+ * @digestMethod: the pointer to digest transform.
+ * @result: the pointer to digest result.
+ * @status: the reference processing status.
+ * @preDigestMemBufMethod: the pointer to binary buffer right before digest
+ * (valid only if either
+ * #XMLSEC_DSIG_FLAGS_STORE_SIGNEDINFO_REFERENCES or
+ * #XMLSEC_DSIG_FLAGS_STORE_MANIFEST_REFERENCES flags are set).
+ * @id: the <dsig:Reference/> node ID attribute.
+ * @uri: the <dsig:Reference/> node URI attribute.
+ * @type: the <dsig:Reference/> node Type attribute.
+ * @reserved0: reserved for the future.
+ * @reserved1: reserved for the future.
*
* The <dsig:Reference/> processing context.
*/
struct _xmlSecDSigReferenceCtx {
- void* userData;
- xmlSecDSigCtxPtr dsigCtx;
- xmlSecDSigReferenceOrigin origin;
- xmlSecTransformCtx transformCtx;
- xmlSecTransformPtr digestMethod;
+ void* userData;
+ xmlSecDSigCtxPtr dsigCtx;
+ xmlSecDSigReferenceOrigin origin;
+ xmlSecTransformCtx transformCtx;
+ xmlSecTransformPtr digestMethod;
- xmlSecBufferPtr result;
- xmlSecDSigStatus status;
- xmlSecTransformPtr preDigestMemBufMethod;
- xmlChar* id;
- xmlChar* uri;
- xmlChar* type;
+ xmlSecBufferPtr result;
+ xmlSecDSigStatus status;
+ xmlSecTransformPtr preDigestMemBufMethod;
+ xmlChar* id;
+ xmlChar* uri;
+ xmlChar* type;
/* reserved for future */
- void* reserved0;
- void* reserved1;
+ void* reserved0;
+ void* reserved1;
};
-XMLSEC_EXPORT xmlSecDSigReferenceCtxPtr xmlSecDSigReferenceCtxCreate(xmlSecDSigCtxPtr dsigCtx,
- xmlSecDSigReferenceOrigin origin);
-XMLSEC_EXPORT void xmlSecDSigReferenceCtxDestroy (xmlSecDSigReferenceCtxPtr dsigRefCtx);
-XMLSEC_EXPORT int xmlSecDSigReferenceCtxInitialize(xmlSecDSigReferenceCtxPtr dsigRefCtx,
- xmlSecDSigCtxPtr dsigCtx,
- xmlSecDSigReferenceOrigin origin);
-XMLSEC_EXPORT void xmlSecDSigReferenceCtxFinalize (xmlSecDSigReferenceCtxPtr dsigRefCtx);
-XMLSEC_EXPORT int xmlSecDSigReferenceCtxProcessNode(xmlSecDSigReferenceCtxPtr dsigRefCtx,
- xmlNodePtr node);
-XMLSEC_EXPORT xmlSecBufferPtr xmlSecDSigReferenceCtxGetPreDigestBuffer
- (xmlSecDSigReferenceCtxPtr dsigRefCtx);
-XMLSEC_EXPORT void xmlSecDSigReferenceCtxDebugDump (xmlSecDSigReferenceCtxPtr dsigRefCtx,
- FILE* output);
-XMLSEC_EXPORT void xmlSecDSigReferenceCtxDebugXmlDump(xmlSecDSigReferenceCtxPtr dsigRefCtx,
- FILE* output);
+XMLSEC_EXPORT xmlSecDSigReferenceCtxPtr xmlSecDSigReferenceCtxCreate(xmlSecDSigCtxPtr dsigCtx,
+ xmlSecDSigReferenceOrigin origin);
+XMLSEC_EXPORT void xmlSecDSigReferenceCtxDestroy (xmlSecDSigReferenceCtxPtr dsigRefCtx);
+XMLSEC_EXPORT int xmlSecDSigReferenceCtxInitialize(xmlSecDSigReferenceCtxPtr dsigRefCtx,
+ xmlSecDSigCtxPtr dsigCtx,
+ xmlSecDSigReferenceOrigin origin);
+XMLSEC_EXPORT void xmlSecDSigReferenceCtxFinalize (xmlSecDSigReferenceCtxPtr dsigRefCtx);
+XMLSEC_EXPORT int xmlSecDSigReferenceCtxProcessNode(xmlSecDSigReferenceCtxPtr dsigRefCtx,
+ xmlNodePtr node);
+XMLSEC_EXPORT xmlSecBufferPtr xmlSecDSigReferenceCtxGetPreDigestBuffer
+ (xmlSecDSigReferenceCtxPtr dsigRefCtx);
+XMLSEC_EXPORT void xmlSecDSigReferenceCtxDebugDump (xmlSecDSigReferenceCtxPtr dsigRefCtx,
+ FILE* output);
+XMLSEC_EXPORT void xmlSecDSigReferenceCtxDebugXmlDump(xmlSecDSigReferenceCtxPtr dsigRefCtx,
+ FILE* output);
/**************************************************************************
*
@@ -268,8 +268,8 @@ XMLSEC_EXPORT void xmlSecDSigReferenceCtxDebugXmlDump(xmlSecDSigReferenceCtxPtr
* The references list klass.
*/
#define xmlSecDSigReferenceCtxListId \
- xmlSecDSigReferenceCtxListGetKlass()
-XMLSEC_EXPORT xmlSecPtrListId xmlSecDSigReferenceCtxListGetKlass(void);
+ xmlSecDSigReferenceCtxListGetKlass()
+XMLSEC_EXPORT xmlSecPtrListId xmlSecDSigReferenceCtxListGetKlass(void);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/xmlenc.h b/include/xmlsec/xmlenc.h
index dc6805a..a21fe99 100644
--- a/include/xmlsec/xmlenc.h
+++ b/include/xmlsec/xmlenc.h
@@ -13,11 +13,11 @@
#define __XMLSEC_XMLENC_H__
#ifndef XMLSEC_NO_XMLENC
-
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <stdio.h>
+#include <stdio.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
@@ -31,8 +31,8 @@ extern "C" {
/**
* xmlEncCtxMode:
- * @xmlEncCtxModeEncryptedData: the <enc:EncryptedData/> element procesing.
- * @xmlEncCtxModeEncryptedKey: the <enc:EncryptedKey/> element processing.
+ * @xmlEncCtxModeEncryptedData: the <enc:EncryptedData/> element procesing.
+ * @xmlEncCtxModeEncryptedKey: the <enc:EncryptedKey/> element processing.
*
* The #xmlSecEncCtx mode.
*/
@@ -47,111 +47,111 @@ typedef enum {
*
* If this flag is set, then the replaced node will be returned in the replacedNodeList
*/
-#define XMLSEC_ENC_RETURN_REPLACED_NODE 0x00000001
+#define XMLSEC_ENC_RETURN_REPLACED_NODE 0x00000001
/**
* xmlSecEncCtx:
- * @userData: the pointer to user data (xmlsec and xmlsec-crypto libraries
- * never touches this).
- * @flags: the XML Encryption processing flags.
- * @flags2: the XML Encryption processing flags.
- * @mode: the mode.
- * @keyInfoReadCtx: the reading key context.
- * @keyInfoWriteCtx: the writing key context (not used for signature verification).
- * @transformCtx: the transforms processing context.
- * @defEncMethodId: the default encryption method (used if
- * <enc:EncryptionMethod/> node is not present).
- * @encKey: the signature key; application may set #encKey
- * before calling encryption/decryption functions.
- * @operation: the operation: encrypt or decrypt.
- * @result: the pointer to signature (not valid for signature verificaction).
- * @resultBase64Encoded: the flag: if set then result in #result is base64 encoded.
- * @resultReplaced: the flag: if set then resulted <enc:EncryptedData/>
- * or <enc:EncryptedKey/> node is added to the document.
- * @encMethod: the pointer to encryption transform.
+ * @userData: the pointer to user data (xmlsec and xmlsec-crypto libraries
+ * never touches this).
+ * @flags: the XML Encryption processing flags.
+ * @flags2: the XML Encryption processing flags.
+ * @mode: the mode.
+ * @keyInfoReadCtx: the reading key context.
+ * @keyInfoWriteCtx: the writing key context (not used for signature verification).
+ * @transformCtx: the transforms processing context.
+ * @defEncMethodId: the default encryption method (used if
+ * <enc:EncryptionMethod/> node is not present).
+ * @encKey: the signature key; application may set #encKey
+ * before calling encryption/decryption functions.
+ * @operation: the operation: encrypt or decrypt.
+ * @result: the pointer to signature (not valid for signature verificaction).
+ * @resultBase64Encoded: the flag: if set then result in #result is base64 encoded.
+ * @resultReplaced: the flag: if set then resulted <enc:EncryptedData/>
+ * or <enc:EncryptedKey/> node is added to the document.
+ * @encMethod: the pointer to encryption transform.
* @replacedNodeList: the first node of the list of replaced nodes depending on the nodeReplacementMode
- * @id: the ID attribute of <enc:EncryptedData/>
- * or <enc:EncryptedKey/> node.
- * @type: the Type attribute of <enc:EncryptedData/>
- * or <enc:EncryptedKey/> node.
- * @mimeType: the MimeType attribute of <enc:EncryptedData/>
- * or <enc:EncryptedKey/> node.
- * @encoding: the Encoding attributeof <enc:EncryptedData/>
- * or <enc:EncryptedKey/> node.
- * @recipient: the Recipient attribute of <enc:EncryptedKey/> node..
- * @carriedKeyName: the CarriedKeyName attribute of <enc:EncryptedKey/> node.
- * @encDataNode: the pointer to <enc:EncryptedData/>
- * or <enc:EncryptedKey/> node.
- * @encMethodNode: the pointer to <enc:EncryptionMethod/> node.
- * @keyInfoNode: the pointer to <enc:KeyInfo/> node.
- * @cipherValueNode: the pointer to <enc:CipherValue/> node.
- * @reserved1: reserved for the future.
+ * @id: the ID attribute of <enc:EncryptedData/>
+ * or <enc:EncryptedKey/> node.
+ * @type: the Type attribute of <enc:EncryptedData/>
+ * or <enc:EncryptedKey/> node.
+ * @mimeType: the MimeType attribute of <enc:EncryptedData/>
+ * or <enc:EncryptedKey/> node.
+ * @encoding: the Encoding attributeof <enc:EncryptedData/>
+ * or <enc:EncryptedKey/> node.
+ * @recipient: the Recipient attribute of <enc:EncryptedKey/> node..
+ * @carriedKeyName: the CarriedKeyName attribute of <enc:EncryptedKey/> node.
+ * @encDataNode: the pointer to <enc:EncryptedData/>
+ * or <enc:EncryptedKey/> node.
+ * @encMethodNode: the pointer to <enc:EncryptionMethod/> node.
+ * @keyInfoNode: the pointer to <enc:KeyInfo/> node.
+ * @cipherValueNode: the pointer to <enc:CipherValue/> node.
+ * @reserved1: reserved for the future.
*
* XML Encrypiton context.
*/
struct _xmlSecEncCtx {
/* these data user can set before performing the operation */
- void* userData;
- unsigned int flags;
- unsigned int flags2;
- xmlEncCtxMode mode;
- xmlSecKeyInfoCtx keyInfoReadCtx;
- xmlSecKeyInfoCtx keyInfoWriteCtx;
- xmlSecTransformCtx transformCtx;
- xmlSecTransformId defEncMethodId;
+ void* userData;
+ unsigned int flags;
+ unsigned int flags2;
+ xmlEncCtxMode mode;
+ xmlSecKeyInfoCtx keyInfoReadCtx;
+ xmlSecKeyInfoCtx keyInfoWriteCtx;
+ xmlSecTransformCtx transformCtx;
+ xmlSecTransformId defEncMethodId;
/* these data are returned */
- xmlSecKeyPtr encKey;
- xmlSecTransformOperation operation;
- xmlSecBufferPtr result;
- int resultBase64Encoded;
- int resultReplaced;
- xmlSecTransformPtr encMethod;
-
+ xmlSecKeyPtr encKey;
+ xmlSecTransformOperation operation;
+ xmlSecBufferPtr result;
+ int resultBase64Encoded;
+ int resultReplaced;
+ xmlSecTransformPtr encMethod;
+
/* attributes from EncryptedData or EncryptedKey */
- xmlChar* id;
- xmlChar* type;
- xmlChar* mimeType;
- xmlChar* encoding;
- xmlChar* recipient;
- xmlChar* carriedKeyName;
+ xmlChar* id;
+ xmlChar* type;
+ xmlChar* mimeType;
+ xmlChar* encoding;
+ xmlChar* recipient;
+ xmlChar* carriedKeyName;
/* these are internal data, nobody should change that except us */
- xmlNodePtr encDataNode;
- xmlNodePtr encMethodNode;
- xmlNodePtr keyInfoNode;
- xmlNodePtr cipherValueNode;
+ xmlNodePtr encDataNode;
+ xmlNodePtr encMethodNode;
+ xmlNodePtr keyInfoNode;
+ xmlNodePtr cipherValueNode;
- xmlNodePtr replacedNodeList; /* the pointer to the replaced node */
- void* reserved1; /* reserved for future */
+ xmlNodePtr replacedNodeList; /* the pointer to the replaced node */
+ void* reserved1; /* reserved for future */
};
-XMLSEC_EXPORT xmlSecEncCtxPtr xmlSecEncCtxCreate (xmlSecKeysMngrPtr keysMngr);
-XMLSEC_EXPORT void xmlSecEncCtxDestroy (xmlSecEncCtxPtr encCtx);
-XMLSEC_EXPORT int xmlSecEncCtxInitialize (xmlSecEncCtxPtr encCtx,
- xmlSecKeysMngrPtr keysMngr);
-XMLSEC_EXPORT void xmlSecEncCtxFinalize (xmlSecEncCtxPtr encCtx);
-XMLSEC_EXPORT int xmlSecEncCtxCopyUserPref (xmlSecEncCtxPtr dst,
- xmlSecEncCtxPtr src);
-XMLSEC_EXPORT void xmlSecEncCtxReset (xmlSecEncCtxPtr encCtx);
-XMLSEC_EXPORT int xmlSecEncCtxBinaryEncrypt (xmlSecEncCtxPtr encCtx,
- xmlNodePtr tmpl,
- const xmlSecByte* data,
- xmlSecSize dataSize);
-XMLSEC_EXPORT int xmlSecEncCtxXmlEncrypt (xmlSecEncCtxPtr encCtx,
- xmlNodePtr tmpl,
- xmlNodePtr node);
-XMLSEC_EXPORT int xmlSecEncCtxUriEncrypt (xmlSecEncCtxPtr encCtx,
- xmlNodePtr tmpl,
- const xmlChar *uri);
-XMLSEC_EXPORT int xmlSecEncCtxDecrypt (xmlSecEncCtxPtr encCtx,
- xmlNodePtr node);
-XMLSEC_EXPORT xmlSecBufferPtr xmlSecEncCtxDecryptToBuffer (xmlSecEncCtxPtr encCtx,
- xmlNodePtr node );
-XMLSEC_EXPORT void xmlSecEncCtxDebugDump (xmlSecEncCtxPtr encCtx,
- FILE* output);
-XMLSEC_EXPORT void xmlSecEncCtxDebugXmlDump (xmlSecEncCtxPtr encCtx,
- FILE* output);
+XMLSEC_EXPORT xmlSecEncCtxPtr xmlSecEncCtxCreate (xmlSecKeysMngrPtr keysMngr);
+XMLSEC_EXPORT void xmlSecEncCtxDestroy (xmlSecEncCtxPtr encCtx);
+XMLSEC_EXPORT int xmlSecEncCtxInitialize (xmlSecEncCtxPtr encCtx,
+ xmlSecKeysMngrPtr keysMngr);
+XMLSEC_EXPORT void xmlSecEncCtxFinalize (xmlSecEncCtxPtr encCtx);
+XMLSEC_EXPORT int xmlSecEncCtxCopyUserPref (xmlSecEncCtxPtr dst,
+ xmlSecEncCtxPtr src);
+XMLSEC_EXPORT void xmlSecEncCtxReset (xmlSecEncCtxPtr encCtx);
+XMLSEC_EXPORT int xmlSecEncCtxBinaryEncrypt (xmlSecEncCtxPtr encCtx,
+ xmlNodePtr tmpl,
+ const xmlSecByte* data,
+ xmlSecSize dataSize);
+XMLSEC_EXPORT int xmlSecEncCtxXmlEncrypt (xmlSecEncCtxPtr encCtx,
+ xmlNodePtr tmpl,
+ xmlNodePtr node);
+XMLSEC_EXPORT int xmlSecEncCtxUriEncrypt (xmlSecEncCtxPtr encCtx,
+ xmlNodePtr tmpl,
+ const xmlChar *uri);
+XMLSEC_EXPORT int xmlSecEncCtxDecrypt (xmlSecEncCtxPtr encCtx,
+ xmlNodePtr node);
+XMLSEC_EXPORT xmlSecBufferPtr xmlSecEncCtxDecryptToBuffer (xmlSecEncCtxPtr encCtx,
+ xmlNodePtr node );
+XMLSEC_EXPORT void xmlSecEncCtxDebugDump (xmlSecEncCtxPtr encCtx,
+ FILE* output);
+XMLSEC_EXPORT void xmlSecEncCtxDebugXmlDump (xmlSecEncCtxPtr encCtx,
+ FILE* output);
#ifdef __cplusplus
}
diff --git a/include/xmlsec/xmlsec.h b/include/xmlsec/xmlsec.h
index f7c4a20..4c267f7 100644
--- a/include/xmlsec/xmlsec.h
+++ b/include/xmlsec/xmlsec.h
@@ -31,7 +31,7 @@ extern "C" {
*
* Void pointer.
*/
-typedef void* xmlSecPtr;
+typedef void* xmlSecPtr;
/**
* xmlSecSize:
@@ -40,9 +40,9 @@ typedef void* xmlSecPtr;
* but it will break ABI (todo).
*/
#ifdef XMLSEC_NO_SIZE_T
-#define xmlSecSize unsigned int
+#define xmlSecSize unsigned int
#else /* XMLSEC_NO_SIZE_T */
-#define xmlSecSize size_t
+#define xmlSecSize size_t
#endif /* XMLSEC_NO_SIZE_T */
/**
@@ -51,36 +51,36 @@ typedef void* xmlSecPtr;
* One byte. Should be typedef instead of define
* but it will break ABI (todo).
*/
-#define xmlSecByte unsigned char
+#define xmlSecByte unsigned char
/***********************************************************************
*
* Forward declarations
*
***********************************************************************/
-typedef struct _xmlSecKeyData xmlSecKeyData, *xmlSecKeyDataPtr;
-typedef struct _xmlSecKeyDataStore xmlSecKeyDataStore, *xmlSecKeyDataStorePtr;
-typedef struct _xmlSecKeyInfoCtx xmlSecKeyInfoCtx, *xmlSecKeyInfoCtxPtr;
-typedef struct _xmlSecKey xmlSecKey, *xmlSecKeyPtr;
-typedef struct _xmlSecKeyStore xmlSecKeyStore, *xmlSecKeyStorePtr;
-typedef struct _xmlSecKeysMngr xmlSecKeysMngr, *xmlSecKeysMngrPtr;
-typedef struct _xmlSecTransform xmlSecTransform, *xmlSecTransformPtr;
-typedef struct _xmlSecTransformCtx xmlSecTransformCtx, *xmlSecTransformCtxPtr;
+typedef struct _xmlSecKeyData xmlSecKeyData, *xmlSecKeyDataPtr;
+typedef struct _xmlSecKeyDataStore xmlSecKeyDataStore, *xmlSecKeyDataStorePtr;
+typedef struct _xmlSecKeyInfoCtx xmlSecKeyInfoCtx, *xmlSecKeyInfoCtxPtr;
+typedef struct _xmlSecKey xmlSecKey, *xmlSecKeyPtr;
+typedef struct _xmlSecKeyStore xmlSecKeyStore, *xmlSecKeyStorePtr;
+typedef struct _xmlSecKeysMngr xmlSecKeysMngr, *xmlSecKeysMngrPtr;
+typedef struct _xmlSecTransform xmlSecTransform, *xmlSecTransformPtr;
+typedef struct _xmlSecTransformCtx xmlSecTransformCtx, *xmlSecTransformCtxPtr;
#ifndef XMLSEC_NO_XMLDSIG
-typedef struct _xmlSecDSigCtx xmlSecDSigCtx, *xmlSecDSigCtxPtr;
+typedef struct _xmlSecDSigCtx xmlSecDSigCtx, *xmlSecDSigCtxPtr;
#endif /* XMLSEC_NO_XMLDSIG */
#ifndef XMLSEC_NO_XMLENC
-typedef struct _xmlSecEncCtx xmlSecEncCtx, *xmlSecEncCtxPtr;
+typedef struct _xmlSecEncCtx xmlSecEncCtx, *xmlSecEncCtxPtr;
#endif /* XMLSEC_NO_XMLENC */
#ifndef XMLSEC_NO_XKMS
-typedef struct _xmlSecXkmsServerCtx xmlSecXkmsServerCtx, *xmlSecXkmsServerCtxPtr;
+typedef struct _xmlSecXkmsServerCtx xmlSecXkmsServerCtx, *xmlSecXkmsServerCtxPtr;
#endif /* XMLSEC_NO_XKMS */
-XMLSEC_EXPORT int xmlSecInit (void);
-XMLSEC_EXPORT int xmlSecShutdown (void);
+XMLSEC_EXPORT int xmlSecInit (void);
+XMLSEC_EXPORT int xmlSecShutdown (void);
@@ -96,7 +96,7 @@ XMLSEC_EXPORT int xmlSecShutdown (void);
* the one used to compile the caller, 0 if it does not or a negative
* value if an error occurs.
*/
-#define xmlSecCheckVersionExact() \
+#define xmlSecCheckVersionExact() \
xmlSecCheckVersionExt(XMLSEC_VERSION_MAJOR, XMLSEC_VERSION_MINOR, XMLSEC_VERSION_SUBMINOR, xmlSecCheckVersionExactMatch)
/**
@@ -106,13 +106,13 @@ XMLSEC_EXPORT int xmlSecShutdown (void);
* the one used to compile the caller, 0 if it does not or a negative
* value if an error occurs.
*/
-#define xmlSecCheckVersion() \
+#define xmlSecCheckVersion() \
xmlSecCheckVersionExt(XMLSEC_VERSION_MAJOR, XMLSEC_VERSION_MINOR, XMLSEC_VERSION_SUBMINOR, xmlSecCheckVersionABICompatible)
/**
* xmlSecCheckVersionMode:
- * @xmlSecCheckVersionExactMatch: the version should match exactly.
- * @xmlSecCheckVersionABICompatible: the version should be ABI compatible.
+ * @xmlSecCheckVersionExactMatch: the version should match exactly.
+ * @xmlSecCheckVersionABICompatible: the version should be ABI compatible.
*
* The xmlsec library version mode.
*/
@@ -121,10 +121,10 @@ typedef enum {
xmlSecCheckVersionABICompatible
} xmlSecCheckVersionMode;
-XMLSEC_EXPORT int xmlSecCheckVersionExt (int major,
- int minor,
- int subminor,
- xmlSecCheckVersionMode mode);
+XMLSEC_EXPORT int xmlSecCheckVersionExt (int major,
+ int minor,
+ int subminor,
+ xmlSecCheckVersionMode mode);
/**
* ATTRIBUTE_UNUSED:
diff --git a/include/xmlsec/xmltree.h b/include/xmlsec/xmltree.h
index ffba25f..55a8df2 100644
--- a/include/xmlsec/xmltree.h
+++ b/include/xmlsec/xmltree.h
@@ -23,79 +23,79 @@ extern "C" {
/**
* xmlSecNodeGetName:
- * @node: the pointer to node.
+ * @node: the pointer to node.
*
* Macro. Returns node's name.
*/
#define xmlSecNodeGetName(node) \
(((node)) ? ((const char*)((node)->name)) : NULL)
-XMLSEC_EXPORT const xmlChar* xmlSecGetNodeNsHref (const xmlNodePtr cur);
-XMLSEC_EXPORT int xmlSecCheckNodeName (const xmlNodePtr cur,
- const xmlChar *name,
- const xmlChar *ns);
-XMLSEC_EXPORT xmlNodePtr xmlSecGetNextElementNode(xmlNodePtr cur);
-XMLSEC_EXPORT xmlNodePtr xmlSecFindChild (const xmlNodePtr parent,
- const xmlChar *name,
- const xmlChar *ns);
-XMLSEC_EXPORT xmlNodePtr xmlSecFindParent (const xmlNodePtr cur,
- const xmlChar *name,
- const xmlChar *ns);
-XMLSEC_EXPORT xmlNodePtr xmlSecFindNode (const xmlNodePtr parent,
- const xmlChar *name,
- const xmlChar *ns);
-XMLSEC_EXPORT xmlNodePtr xmlSecAddChild (xmlNodePtr parent,
- const xmlChar *name,
- const xmlChar *ns);
-XMLSEC_EXPORT xmlNodePtr xmlSecAddChildNode (xmlNodePtr parent,
- xmlNodePtr child);
-XMLSEC_EXPORT xmlNodePtr xmlSecAddNextSibling (xmlNodePtr node,
- const xmlChar *name,
- const xmlChar *ns);
-XMLSEC_EXPORT xmlNodePtr xmlSecAddPrevSibling (xmlNodePtr node,
- const xmlChar *name,
- const xmlChar *ns);
+XMLSEC_EXPORT const xmlChar* xmlSecGetNodeNsHref (const xmlNodePtr cur);
+XMLSEC_EXPORT int xmlSecCheckNodeName (const xmlNodePtr cur,
+ const xmlChar *name,
+ const xmlChar *ns);
+XMLSEC_EXPORT xmlNodePtr xmlSecGetNextElementNode(xmlNodePtr cur);
+XMLSEC_EXPORT xmlNodePtr xmlSecFindChild (const xmlNodePtr parent,
+ const xmlChar *name,
+ const xmlChar *ns);
+XMLSEC_EXPORT xmlNodePtr xmlSecFindParent (const xmlNodePtr cur,
+ const xmlChar *name,
+ const xmlChar *ns);
+XMLSEC_EXPORT xmlNodePtr xmlSecFindNode (const xmlNodePtr parent,
+ const xmlChar *name,
+ const xmlChar *ns);
+XMLSEC_EXPORT xmlNodePtr xmlSecAddChild (xmlNodePtr parent,
+ const xmlChar *name,
+ const xmlChar *ns);
+XMLSEC_EXPORT xmlNodePtr xmlSecAddChildNode (xmlNodePtr parent,
+ xmlNodePtr child);
+XMLSEC_EXPORT xmlNodePtr xmlSecAddNextSibling (xmlNodePtr node,
+ const xmlChar *name,
+ const xmlChar *ns);
+XMLSEC_EXPORT xmlNodePtr xmlSecAddPrevSibling (xmlNodePtr node,
+ const xmlChar *name,
+ const xmlChar *ns);
-XMLSEC_EXPORT int xmlSecReplaceNode (xmlNodePtr node,
- xmlNodePtr newNode);
-XMLSEC_EXPORT int xmlSecReplaceNodeAndReturn
- (xmlNodePtr node,
- xmlNodePtr newNode,
- xmlNodePtr* replaced);
-XMLSEC_EXPORT int xmlSecReplaceContent (xmlNodePtr node,
- xmlNodePtr newNode);
-XMLSEC_EXPORT int xmlSecReplaceContentAndReturn
- (xmlNodePtr node,
- xmlNodePtr newNode,
- xmlNodePtr* replaced);
-XMLSEC_EXPORT int xmlSecReplaceNodeBuffer (xmlNodePtr node,
- const xmlSecByte *buffer,
- xmlSecSize size);
-XMLSEC_EXPORT int xmlSecReplaceNodeBufferAndReturn
- (xmlNodePtr node,
- const xmlSecByte *buffer,
- xmlSecSize size,
- xmlNodePtr* replaced);
-XMLSEC_EXPORT int xmlSecNodeEncodeAndSetContent
- (xmlNodePtr node,
- const xmlChar *buffer);
-XMLSEC_EXPORT void xmlSecAddIDs (xmlDocPtr doc,
- xmlNodePtr cur,
- const xmlChar** ids);
-XMLSEC_EXPORT int xmlSecGenerateAndAddID (xmlNodePtr node,
- const xmlChar* attrName,
- const xmlChar* prefix,
- xmlSecSize len);
-XMLSEC_EXPORT xmlChar* xmlSecGenerateID (const xmlChar* prefix,
- xmlSecSize len);
+XMLSEC_EXPORT int xmlSecReplaceNode (xmlNodePtr node,
+ xmlNodePtr newNode);
+XMLSEC_EXPORT int xmlSecReplaceNodeAndReturn
+ (xmlNodePtr node,
+ xmlNodePtr newNode,
+ xmlNodePtr* replaced);
+XMLSEC_EXPORT int xmlSecReplaceContent (xmlNodePtr node,
+ xmlNodePtr newNode);
+XMLSEC_EXPORT int xmlSecReplaceContentAndReturn
+ (xmlNodePtr node,
+ xmlNodePtr newNode,
+ xmlNodePtr* replaced);
+XMLSEC_EXPORT int xmlSecReplaceNodeBuffer (xmlNodePtr node,
+ const xmlSecByte *buffer,
+ xmlSecSize size);
+XMLSEC_EXPORT int xmlSecReplaceNodeBufferAndReturn
+ (xmlNodePtr node,
+ const xmlSecByte *buffer,
+ xmlSecSize size,
+ xmlNodePtr* replaced);
+XMLSEC_EXPORT int xmlSecNodeEncodeAndSetContent
+ (xmlNodePtr node,
+ const xmlChar *buffer);
+XMLSEC_EXPORT void xmlSecAddIDs (xmlDocPtr doc,
+ xmlNodePtr cur,
+ const xmlChar** ids);
+XMLSEC_EXPORT int xmlSecGenerateAndAddID (xmlNodePtr node,
+ const xmlChar* attrName,
+ const xmlChar* prefix,
+ xmlSecSize len);
+XMLSEC_EXPORT xmlChar* xmlSecGenerateID (const xmlChar* prefix,
+ xmlSecSize len);
-XMLSEC_EXPORT xmlDocPtr xmlSecCreateTree (const xmlChar* rootNodeName,
- const xmlChar* rootNodeNs);
-XMLSEC_EXPORT int xmlSecIsEmptyNode (xmlNodePtr node);
-XMLSEC_EXPORT int xmlSecIsEmptyString (const xmlChar* str);
-XMLSEC_EXPORT xmlChar* xmlSecGetQName (xmlNodePtr node,
- const xmlChar* href,
- const xmlChar* local);
+XMLSEC_EXPORT xmlDocPtr xmlSecCreateTree (const xmlChar* rootNodeName,
+ const xmlChar* rootNodeNs);
+XMLSEC_EXPORT int xmlSecIsEmptyNode (xmlNodePtr node);
+XMLSEC_EXPORT int xmlSecIsEmptyString (const xmlChar* str);
+XMLSEC_EXPORT xmlChar* xmlSecGetQName (xmlNodePtr node,
+ const xmlChar* href,
+ const xmlChar* local);
XMLSEC_EXPORT int xmlSecPrintXmlString (FILE * fd,
@@ -103,7 +103,7 @@ XMLSEC_EXPORT int xmlSecPrintXmlString (FILE * fd,
/**
* xmlSecIsHex:
- * @c: the character.
+ * @c: the character.
*
* Macro. Returns 1 if @c is a hex digit or 0 other wise.
*/
@@ -114,7 +114,7 @@ XMLSEC_EXPORT int xmlSecPrintXmlString (FILE * fd,
/**
* xmlSecGetHex:
- * @c: the character,
+ * @c: the character,
*
* Macro. Returns the hex value of the @c.
*/
@@ -131,17 +131,17 @@ XMLSEC_EXPORT int xmlSecPrintXmlString (FILE * fd,
/**
* xmlSecQName2IntegerInfo:
- * @qnameHref: the QName href
- * @qnameLocalPart: the QName local
- * @intValue: the integer value
+ * @qnameHref: the QName href
+ * @qnameLocalPart: the QName local
+ * @intValue: the integer value
*
* QName <-> Integer conversion definition.
*/
-typedef struct _xmlSecQName2IntegerInfo xmlSecQName2IntegerInfo, *xmlSecQName2IntegerInfoPtr;
+typedef struct _xmlSecQName2IntegerInfo xmlSecQName2IntegerInfo, *xmlSecQName2IntegerInfoPtr;
struct _xmlSecQName2IntegerInfo {
const xmlChar* qnameHref;
const xmlChar* qnameLocalPart;
- int intValue;
+ int intValue;
};
/**
@@ -149,48 +149,48 @@ struct _xmlSecQName2IntegerInfo {
*
* Pointer to constant QName <-> Integer conversion definition.
*/
-typedef const xmlSecQName2IntegerInfo * xmlSecQName2IntegerInfoConstPtr;
+typedef const xmlSecQName2IntegerInfo * xmlSecQName2IntegerInfoConstPtr;
-XMLSEC_EXPORT xmlSecQName2IntegerInfoConstPtr xmlSecQName2IntegerGetInfo
- (xmlSecQName2IntegerInfoConstPtr info,
- int intValue);
-XMLSEC_EXPORT int xmlSecQName2IntegerGetInteger (xmlSecQName2IntegerInfoConstPtr info,
- const xmlChar* qnameHref,
- const xmlChar* qnameLocalPart,
- int* intValue);
-XMLSEC_EXPORT int xmlSecQName2IntegerGetIntegerFromString
- (xmlSecQName2IntegerInfoConstPtr info,
- xmlNodePtr node,
- const xmlChar* qname,
- int* intValue);
-XMLSEC_EXPORT xmlChar* xmlSecQName2IntegerGetStringFromInteger
- (xmlSecQName2IntegerInfoConstPtr info,
- xmlNodePtr node,
- int intValue);
-XMLSEC_EXPORT int xmlSecQName2IntegerNodeRead (xmlSecQName2IntegerInfoConstPtr info,
- xmlNodePtr node,
- int* intValue);
-XMLSEC_EXPORT int xmlSecQName2IntegerNodeWrite (xmlSecQName2IntegerInfoConstPtr info,
- xmlNodePtr node,
- const xmlChar* nodeName,
- const xmlChar* nodeNs,
- int intValue);
-XMLSEC_EXPORT int xmlSecQName2IntegerAttributeRead(xmlSecQName2IntegerInfoConstPtr info,
- xmlNodePtr node,
- const xmlChar* attrName,
- int* intValue);
-XMLSEC_EXPORT int xmlSecQName2IntegerAttributeWrite(xmlSecQName2IntegerInfoConstPtr info,
- xmlNodePtr node,
- const xmlChar* attrName,
- int intValue);
-XMLSEC_EXPORT void xmlSecQName2IntegerDebugDump (xmlSecQName2IntegerInfoConstPtr info,
- int intValue,
- const xmlChar* name,
- FILE* output);
-XMLSEC_EXPORT void xmlSecQName2IntegerDebugXmlDump(xmlSecQName2IntegerInfoConstPtr info,
- int intValue,
- const xmlChar* name,
- FILE* output);
+XMLSEC_EXPORT xmlSecQName2IntegerInfoConstPtr xmlSecQName2IntegerGetInfo
+ (xmlSecQName2IntegerInfoConstPtr info,
+ int intValue);
+XMLSEC_EXPORT int xmlSecQName2IntegerGetInteger (xmlSecQName2IntegerInfoConstPtr info,
+ const xmlChar* qnameHref,
+ const xmlChar* qnameLocalPart,
+ int* intValue);
+XMLSEC_EXPORT int xmlSecQName2IntegerGetIntegerFromString
+ (xmlSecQName2IntegerInfoConstPtr info,
+ xmlNodePtr node,
+ const xmlChar* qname,
+ int* intValue);
+XMLSEC_EXPORT xmlChar* xmlSecQName2IntegerGetStringFromInteger
+ (xmlSecQName2IntegerInfoConstPtr info,
+ xmlNodePtr node,
+ int intValue);
+XMLSEC_EXPORT int xmlSecQName2IntegerNodeRead (xmlSecQName2IntegerInfoConstPtr info,
+ xmlNodePtr node,
+ int* intValue);
+XMLSEC_EXPORT int xmlSecQName2IntegerNodeWrite (xmlSecQName2IntegerInfoConstPtr info,
+ xmlNodePtr node,
+ const xmlChar* nodeName,
+ const xmlChar* nodeNs,
+ int intValue);
+XMLSEC_EXPORT int xmlSecQName2IntegerAttributeRead(xmlSecQName2IntegerInfoConstPtr info,
+ xmlNodePtr node,
+ const xmlChar* attrName,
+ int* intValue);
+XMLSEC_EXPORT int xmlSecQName2IntegerAttributeWrite(xmlSecQName2IntegerInfoConstPtr info,
+ xmlNodePtr node,
+ const xmlChar* attrName,
+ int intValue);
+XMLSEC_EXPORT void xmlSecQName2IntegerDebugDump (xmlSecQName2IntegerInfoConstPtr info,
+ int intValue,
+ const xmlChar* name,
+ FILE* output);
+XMLSEC_EXPORT void xmlSecQName2IntegerDebugXmlDump(xmlSecQName2IntegerInfoConstPtr info,
+ int intValue,
+ const xmlChar* name,
+ FILE* output);
/*************************************************************************
*
@@ -203,17 +203,17 @@ XMLSEC_EXPORT void xmlSecQName2IntegerDebugXmlDump(xmlSecQName2IntegerInfoConst
*
* Bitmask datatype.
*/
-typedef unsigned int xmlSecBitMask;
+typedef unsigned int xmlSecBitMask;
/**
* xmlSecQName2BitMaskInfo:
- * @qnameHref: the QName href
- * @qnameLocalPart: the QName local
- * @mask: the bitmask value
+ * @qnameHref: the QName href
+ * @qnameLocalPart: the QName local
+ * @mask: the bitmask value
*
* QName <-> Bitmask conversion definition.
*/
-typedef struct _xmlSecQName2BitMaskInfo xmlSecQName2BitMaskInfo, *xmlSecQName2BitMaskInfoPtr;
+typedef struct _xmlSecQName2BitMaskInfo xmlSecQName2BitMaskInfo, *xmlSecQName2BitMaskInfoPtr;
struct _xmlSecQName2BitMaskInfo {
const xmlChar* qnameHref;
@@ -226,45 +226,45 @@ struct _xmlSecQName2BitMaskInfo {
*
* Pointer to constant QName <-> Bitmask conversion definition.
*/
-typedef const xmlSecQName2BitMaskInfo* xmlSecQName2BitMaskInfoConstPtr;
+typedef const xmlSecQName2BitMaskInfo* xmlSecQName2BitMaskInfoConstPtr;
-XMLSEC_EXPORT xmlSecQName2BitMaskInfoConstPtr xmlSecQName2BitMaskGetInfo
- (xmlSecQName2BitMaskInfoConstPtr info,
- xmlSecBitMask mask);
-XMLSEC_EXPORT int xmlSecQName2BitMaskGetBitMask (xmlSecQName2BitMaskInfoConstPtr info,
- const xmlChar* qnameLocalPart,
- const xmlChar* qnameHref,
- xmlSecBitMask* mask);
-XMLSEC_EXPORT int xmlSecQName2BitMaskNodesRead (xmlSecQName2BitMaskInfoConstPtr info,
- xmlNodePtr* node,
- const xmlChar* nodeName,
- const xmlChar* nodeNs,
- int stopOnUnknown,
- xmlSecBitMask* mask);
-XMLSEC_EXPORT int xmlSecQName2BitMaskGetBitMaskFromString
- (xmlSecQName2BitMaskInfoConstPtr info,
- xmlNodePtr node,
- const xmlChar* qname,
- xmlSecBitMask* mask);
-XMLSEC_EXPORT xmlChar* xmlSecQName2BitMaskGetStringFromBitMask
- (xmlSecQName2BitMaskInfoConstPtr info,
- xmlNodePtr node,
- xmlSecBitMask mask);
-XMLSEC_EXPORT int xmlSecQName2BitMaskNodesWrite (xmlSecQName2BitMaskInfoConstPtr info,
- xmlNodePtr node,
- const xmlChar* nodeName,
- const xmlChar* nodeNs,
- xmlSecBitMask mask);
-XMLSEC_EXPORT void xmlSecQName2BitMaskDebugDump (xmlSecQName2BitMaskInfoConstPtr info,
- xmlSecBitMask mask,
- const xmlChar* name,
- FILE* output);
-XMLSEC_EXPORT void xmlSecQName2BitMaskDebugXmlDump(xmlSecQName2BitMaskInfoConstPtr info,
- xmlSecBitMask mask,
- const xmlChar* name,
- FILE* output);
+XMLSEC_EXPORT xmlSecQName2BitMaskInfoConstPtr xmlSecQName2BitMaskGetInfo
+ (xmlSecQName2BitMaskInfoConstPtr info,
+ xmlSecBitMask mask);
+XMLSEC_EXPORT int xmlSecQName2BitMaskGetBitMask (xmlSecQName2BitMaskInfoConstPtr info,
+ const xmlChar* qnameLocalPart,
+ const xmlChar* qnameHref,
+ xmlSecBitMask* mask);
+XMLSEC_EXPORT int xmlSecQName2BitMaskNodesRead (xmlSecQName2BitMaskInfoConstPtr info,
+ xmlNodePtr* node,
+ const xmlChar* nodeName,
+ const xmlChar* nodeNs,
+ int stopOnUnknown,
+ xmlSecBitMask* mask);
+XMLSEC_EXPORT int xmlSecQName2BitMaskGetBitMaskFromString
+ (xmlSecQName2BitMaskInfoConstPtr info,
+ xmlNodePtr node,
+ const xmlChar* qname,
+ xmlSecBitMask* mask);
+XMLSEC_EXPORT xmlChar* xmlSecQName2BitMaskGetStringFromBitMask
+ (xmlSecQName2BitMaskInfoConstPtr info,
+ xmlNodePtr node,
+ xmlSecBitMask mask);
+XMLSEC_EXPORT int xmlSecQName2BitMaskNodesWrite (xmlSecQName2BitMaskInfoConstPtr info,
+ xmlNodePtr node,
+ const xmlChar* nodeName,
+ const xmlChar* nodeNs,
+ xmlSecBitMask mask);
+XMLSEC_EXPORT void xmlSecQName2BitMaskDebugDump (xmlSecQName2BitMaskInfoConstPtr info,
+ xmlSecBitMask mask,
+ const xmlChar* name,
+ FILE* output);
+XMLSEC_EXPORT void xmlSecQName2BitMaskDebugXmlDump(xmlSecQName2BitMaskInfoConstPtr info,
+ xmlSecBitMask mask,
+ const xmlChar* name,
+ FILE* output);
-
+
#ifdef __cplusplus
diff --git a/src/app.c b/src/app.c
index ca09f62..61d3c27 100644
--- a/src/app.c
+++ b/src/app.c
@@ -29,7 +29,7 @@
#include <xmlsec/private.h>
#include <xmlsec/errors.h>
-
+
/******************************************************************************
*
* Crypto Init/shutdown
@@ -45,11 +45,11 @@
int
xmlSecCryptoInit(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoInit == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "cryptoInit",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "cryptoInit",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -66,11 +66,11 @@ xmlSecCryptoInit(void) {
int
xmlSecCryptoShutdown(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoShutdown == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "cryptoShutdown",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "cryptoShutdown",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -79,7 +79,7 @@ xmlSecCryptoShutdown(void) {
/**
* xmlSecCryptoKeysMngrInit:
- * @mngr: the pointer to keys manager.
+ * @mngr: the pointer to keys manager.
*
* Adds crypto specific key data stores in keys manager.
*
@@ -88,11 +88,11 @@ xmlSecCryptoShutdown(void) {
int
xmlSecCryptoKeysMngrInit(xmlSecKeysMngrPtr mngr) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoKeysMngrInit == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "cryptoKeysMngrInit",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "cryptoKeysMngrInit",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -116,11 +116,11 @@ xmlSecCryptoKeysMngrInit(xmlSecKeysMngrPtr mngr) {
xmlSecKeyDataId
xmlSecKeyDataAesGetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataAesGetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "keyDataAesId",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "keyDataAesId",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecKeyDataIdUnknown);
}
@@ -139,11 +139,11 @@ xmlSecKeyDataAesGetKlass(void) {
xmlSecKeyDataId
xmlSecKeyDataDesGetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataDesGetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "keyDataDesId",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "keyDataDesId",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecKeyDataIdUnknown);
}
@@ -159,14 +159,14 @@ xmlSecKeyDataDesGetKlass(void) {
* (xmlsec-crypto library is not loaded or the DSA key data
* klass is not implemented).
*/
-xmlSecKeyDataId
+xmlSecKeyDataId
xmlSecKeyDataDsaGetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataDsaGetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "keyDataDsaId",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "keyDataDsaId",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecKeyDataIdUnknown);
}
@@ -182,14 +182,14 @@ xmlSecKeyDataDsaGetKlass(void) {
* (xmlsec-crypto library is not loaded or the GOST2001 key data
* klass is not implemented).
*/
-xmlSecKeyDataId
+xmlSecKeyDataId
xmlSecKeyDataGost2001GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataGost2001GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "keyDataGost2001Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "keyDataGost2001Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecKeyDataIdUnknown);
}
@@ -205,14 +205,14 @@ xmlSecKeyDataGost2001GetKlass(void) {
* (xmlsec-crypto library is not loaded or the HMAC key data
* klass is not implemented).
*/
-xmlSecKeyDataId
+xmlSecKeyDataId
xmlSecKeyDataHmacGetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataHmacGetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "keyDataHmacId",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "keyDataHmacId",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecKeyDataIdUnknown);
}
@@ -228,14 +228,14 @@ xmlSecKeyDataHmacGetKlass(void) {
* (xmlsec-crypto library is not loaded or the RSA key data
* klass is not implemented).
*/
-xmlSecKeyDataId
+xmlSecKeyDataId
xmlSecKeyDataRsaGetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataRsaGetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "keyDataRsaId",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "keyDataRsaId",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecKeyDataIdUnknown);
}
@@ -251,14 +251,14 @@ xmlSecKeyDataRsaGetKlass(void) {
* (xmlsec-crypto library is not loaded or the X509 key data
* klass is not implemented).
*/
-xmlSecKeyDataId
+xmlSecKeyDataId
xmlSecKeyDataX509GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataX509GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "keyDataX509Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "keyDataX509Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecKeyDataIdUnknown);
}
@@ -274,14 +274,14 @@ xmlSecKeyDataX509GetKlass(void) {
* (xmlsec-crypto library is not loaded or the raw X509 cert key data
* klass is not implemented).
*/
-xmlSecKeyDataId
+xmlSecKeyDataId
xmlSecKeyDataRawX509CertGetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->keyDataRawX509CertGetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "keyDataRawX509CertId",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "keyDataRawX509CertId",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecKeyDataIdUnknown);
}
@@ -305,11 +305,11 @@ xmlSecKeyDataRawX509CertGetKlass(void) {
xmlSecKeyDataStoreId
xmlSecX509StoreGetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->x509StoreGetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "x509StoreId",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "x509StoreId",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecKeyStoreIdUnknown);
}
@@ -333,11 +333,11 @@ xmlSecX509StoreGetKlass(void) {
xmlSecTransformId
xmlSecTransformAes128CbcGetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformAes128CbcGetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformAes128CbcId",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformAes128CbcId",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -356,11 +356,11 @@ xmlSecTransformAes128CbcGetKlass(void) {
xmlSecTransformId
xmlSecTransformAes192CbcGetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformAes192CbcGetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformAes192CbcId",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformAes192CbcId",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -379,11 +379,11 @@ xmlSecTransformAes192CbcGetKlass(void) {
xmlSecTransformId
xmlSecTransformAes256CbcGetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformAes256CbcGetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformAes256CbcId",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformAes256CbcId",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -400,13 +400,13 @@ xmlSecTransformAes256CbcGetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformKWAes128GetKlass(void) {
+xmlSecTransformKWAes128GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformKWAes128GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformKWAes128Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformKWAes128Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -423,13 +423,13 @@ xmlSecTransformKWAes128GetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformKWAes192GetKlass(void) {
+xmlSecTransformKWAes192GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformKWAes192GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformKWAes192Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformKWAes192Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -446,13 +446,13 @@ xmlSecTransformKWAes192GetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformKWAes256GetKlass(void) {
+xmlSecTransformKWAes256GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformKWAes256GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformKWAes256Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformKWAes256Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -469,13 +469,13 @@ xmlSecTransformKWAes256GetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformDes3CbcGetKlass(void) {
+xmlSecTransformDes3CbcGetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformDes3CbcGetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformDes3CbcId",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformDes3CbcId",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -494,11 +494,11 @@ xmlSecTransformDes3CbcGetKlass(void) {
xmlSecTransformId
xmlSecTransformKWDes3GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformKWDes3GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformKWDes3Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformKWDes3Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -515,13 +515,13 @@ xmlSecTransformKWDes3GetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformDsaSha1GetKlass(void) {
+xmlSecTransformDsaSha1GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformDsaSha1GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformDsaSha1Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformDsaSha1Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -538,13 +538,13 @@ xmlSecTransformDsaSha1GetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformGost2001GostR3411_94GetKlass(void) {
+xmlSecTransformGost2001GostR3411_94GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformGost2001GostR3411_94GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformGost2001GostR3411_94Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformGost2001GostR3411_94Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -561,13 +561,13 @@ xmlSecTransformGost2001GostR3411_94GetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformHmacMd5GetKlass(void) {
+xmlSecTransformHmacMd5GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacMd5GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformHmacMd5Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformHmacMd5Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -586,11 +586,11 @@ xmlSecTransformHmacMd5GetKlass(void) {
xmlSecTransformId
xmlSecTransformHmacRipemd160GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacRipemd160GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformHmacRipemd160Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformHmacRipemd160Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -607,13 +607,13 @@ xmlSecTransformHmacRipemd160GetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformHmacSha1GetKlass(void) {
+xmlSecTransformHmacSha1GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacSha1GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformHmacSha1Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformHmacSha1Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -630,13 +630,13 @@ xmlSecTransformHmacSha1GetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformHmacSha224GetKlass(void) {
+xmlSecTransformHmacSha224GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacSha224GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformHmacSha224Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformHmacSha224Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -653,13 +653,13 @@ xmlSecTransformHmacSha224GetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformHmacSha256GetKlass(void) {
+xmlSecTransformHmacSha256GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacSha256GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformHmacSha256Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformHmacSha256Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -676,13 +676,13 @@ xmlSecTransformHmacSha256GetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformHmacSha384GetKlass(void) {
+xmlSecTransformHmacSha384GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacSha384GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformHmacSha384Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformHmacSha384Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -699,13 +699,13 @@ xmlSecTransformHmacSha384GetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformHmacSha512GetKlass(void) {
+xmlSecTransformHmacSha512GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformHmacSha512GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformHmacSha512Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformHmacSha512Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -724,11 +724,11 @@ xmlSecTransformHmacSha512GetKlass(void) {
xmlSecTransformId
xmlSecTransformMd5GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformMd5GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformMd5Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformMd5Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -747,11 +747,11 @@ xmlSecTransformMd5GetKlass(void) {
xmlSecTransformId
xmlSecTransformRipemd160GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRipemd160GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformRipemd160Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformRipemd160Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -768,13 +768,13 @@ xmlSecTransformRipemd160GetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformRsaMd5GetKlass(void) {
+xmlSecTransformRsaMd5GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaMd5GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformRsaMd5Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformRsaMd5Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -791,13 +791,13 @@ xmlSecTransformRsaMd5GetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformRsaRipemd160GetKlass(void) {
+xmlSecTransformRsaRipemd160GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaRipemd160GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformRsaRipemd160Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformRsaRipemd160Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -814,13 +814,13 @@ xmlSecTransformRsaRipemd160GetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformRsaSha1GetKlass(void) {
+xmlSecTransformRsaSha1GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaSha1GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformRsaSha1Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformRsaSha1Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -837,13 +837,13 @@ xmlSecTransformRsaSha1GetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformRsaSha224GetKlass(void) {
+xmlSecTransformRsaSha224GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaSha224GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformRsaSha224Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformRsaSha224Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -860,13 +860,13 @@ xmlSecTransformRsaSha224GetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformRsaSha256GetKlass(void) {
+xmlSecTransformRsaSha256GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaSha256GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformRsaSha256Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformRsaSha256Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -883,13 +883,13 @@ xmlSecTransformRsaSha256GetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformRsaSha384GetKlass(void) {
+xmlSecTransformRsaSha384GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaSha384GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformRsaSha384Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformRsaSha384Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -906,13 +906,13 @@ xmlSecTransformRsaSha384GetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformRsaSha512GetKlass(void) {
+xmlSecTransformRsaSha512GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaSha512GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformRsaSha512Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformRsaSha512Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -929,13 +929,13 @@ xmlSecTransformRsaSha512GetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformRsaPkcs1GetKlass(void) {
+xmlSecTransformRsaPkcs1GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaPkcs1GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformRsaPkcs1Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformRsaPkcs1Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -952,13 +952,13 @@ xmlSecTransformRsaPkcs1GetKlass(void) {
* implemented).
*/
xmlSecTransformId
-xmlSecTransformRsaOaepGetKlass(void) {
+xmlSecTransformRsaOaepGetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformRsaOaepGetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformRsaOaepId",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformRsaOaepId",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -977,11 +977,11 @@ xmlSecTransformRsaOaepGetKlass(void) {
xmlSecTransformId
xmlSecTransformGostR3411_94GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformGostR3411_94GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformGostR3411_94Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformGostR3411_94Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -1001,11 +1001,11 @@ xmlSecTransformGostR3411_94GetKlass(void) {
xmlSecTransformId
xmlSecTransformSha1GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformSha1GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformSha1Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformSha1Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -1024,11 +1024,11 @@ xmlSecTransformSha1GetKlass(void) {
xmlSecTransformId
xmlSecTransformSha224GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformSha224GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformSha224Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformSha224Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -1047,11 +1047,11 @@ xmlSecTransformSha224GetKlass(void) {
xmlSecTransformId
xmlSecTransformSha256GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformSha256GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformSha256Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformSha256Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -1070,11 +1070,11 @@ xmlSecTransformSha256GetKlass(void) {
xmlSecTransformId
xmlSecTransformSha384GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformSha384GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformSha384Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformSha384Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -1093,11 +1093,11 @@ xmlSecTransformSha384GetKlass(void) {
xmlSecTransformId
xmlSecTransformSha512GetKlass(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->transformSha512GetKlass == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "transformSha512Id",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "transformSha512Id",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(xmlSecTransformIdUnknown);
}
@@ -1111,7 +1111,7 @@ xmlSecTransformSha512GetKlass(void) {
*****************************************************************************/
/**
* xmlSecCryptoAppInit:
- * @config: the path to crypto library configuration.
+ * @config: the path to crypto library configuration.
*
* General crypto engine initialization. This function is used
* by XMLSec command line utility and called before
@@ -1122,11 +1122,11 @@ xmlSecTransformSha512GetKlass(void) {
int
xmlSecCryptoAppInit(const char* config) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppInit == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "cryptoAppInit",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "cryptoAppInit",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -1146,11 +1146,11 @@ xmlSecCryptoAppInit(const char* config) {
int
xmlSecCryptoAppShutdown(void) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppShutdown == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "cryptoAppShutdown",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "cryptoAppShutdown",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -1159,7 +1159,7 @@ xmlSecCryptoAppShutdown(void) {
/**
* xmlSecCryptoAppDefaultKeysMngrInit:
- * @mngr: the pointer to keys manager.
+ * @mngr: the pointer to keys manager.
*
* Initializes @mngr with simple keys store #xmlSecSimpleKeysStoreId
* and a default crypto key data stores.
@@ -1169,11 +1169,11 @@ xmlSecCryptoAppShutdown(void) {
int
xmlSecCryptoAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppDefaultKeysMngrInit == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "cryptoAppDefaultKeysMngrInit",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "cryptoAppDefaultKeysMngrInit",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -1182,8 +1182,8 @@ xmlSecCryptoAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
/**
* xmlSecCryptoAppDefaultKeysMngrAdoptKey:
- * @mngr: the pointer to keys manager.
- * @key: the pointer to key.
+ * @mngr: the pointer to keys manager.
+ * @key: the pointer to key.
*
* Adds @key to the keys manager @mngr created with #xmlSecCryptoAppDefaultKeysMngrInit
* function.
@@ -1193,11 +1193,11 @@ xmlSecCryptoAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
int
xmlSecCryptoAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppDefaultKeysMngrAdoptKey == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "cryptoAppDefaultKeysMngrAdoptKey",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "cryptoAppDefaultKeysMngrAdoptKey",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -1206,8 +1206,8 @@ xmlSecCryptoAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key)
/**
* xmlSecCryptoAppDefaultKeysMngrLoad:
- * @mngr: the pointer to keys manager.
- * @uri: the uri.
+ * @mngr: the pointer to keys manager.
+ * @uri: the uri.
*
* Loads XML keys file from @uri to the keys manager @mngr created
* with #xmlSecCryptoAppDefaultKeysMngrInit function.
@@ -1217,11 +1217,11 @@ xmlSecCryptoAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key)
int
xmlSecCryptoAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppDefaultKeysMngrLoad == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "cryptoAppDefaultKeysMngrLoad",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "cryptoAppDefaultKeysMngrLoad",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -1230,9 +1230,9 @@ xmlSecCryptoAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
/**
* xmlSecCryptoAppDefaultKeysMngrSave:
- * @mngr: the pointer to keys manager.
- * @filename: the destination filename.
- * @type: the type of keys to save (public/private/symmetric).
+ * @mngr: the pointer to keys manager.
+ * @filename: the destination filename.
+ * @type: the type of keys to save (public/private/symmetric).
*
* Saves keys from @mngr to XML keys file.
*
@@ -1240,13 +1240,13 @@ xmlSecCryptoAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
*/
int
xmlSecCryptoAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename,
- xmlSecKeyDataType type) {
+ xmlSecKeyDataType type) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppDefaultKeysMngrSave == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "cryptoAppDefaultKeysMngrSave",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "cryptoAppDefaultKeysMngrSave",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -1255,11 +1255,11 @@ xmlSecCryptoAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename,
/**
* xmlSecCryptoAppKeysMngrCertLoad:
- * @mngr: the keys manager.
- * @filename: the certificate file.
- * @format: the certificate file format.
- * @type: the flag that indicates is the certificate in @filename
- * trusted or not.
+ * @mngr: the keys manager.
+ * @filename: the certificate file.
+ * @format: the certificate file format.
+ * @type: the flag that indicates is the certificate in @filename
+ * trusted or not.
*
* Reads cert from @filename and adds to the list of trusted or known
* untrusted certs in @store.
@@ -1268,13 +1268,13 @@ xmlSecCryptoAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename,
*/
int
xmlSecCryptoAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
- xmlSecKeyDataFormat format, xmlSecKeyDataType type) {
+ xmlSecKeyDataFormat format, xmlSecKeyDataType type) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppKeysMngrCertLoad == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "cryptoAppKeysMngrCertLoad",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "cryptoAppKeysMngrCertLoad",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -1283,11 +1283,11 @@ xmlSecCryptoAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
/**
* xmlSecCryptoAppKeysMngrCertLoadMemory:
- * @mngr: the keys manager.
- * @data: the certificate binary data.
- * @dataSize: the certificate binary data size.
- * @format: the certificate file format.
- * @type: the flag that indicates is the certificate trusted or not.
+ * @mngr: the keys manager.
+ * @data: the certificate binary data.
+ * @dataSize: the certificate binary data size.
+ * @format: the certificate file format.
+ * @type: the flag that indicates is the certificate trusted or not.
*
* Reads cert from binary buffer @data and adds to the list of trusted or known
* untrusted certs in @store.
@@ -1296,14 +1296,14 @@ xmlSecCryptoAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
*/
int
xmlSecCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* data,
- xmlSecSize dataSize, xmlSecKeyDataFormat format,
- xmlSecKeyDataType type) {
+ xmlSecSize dataSize, xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppKeysMngrCertLoadMemory == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "cryptoAppKeysMngrCertLoadMemory",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "cryptoAppKeysMngrCertLoadMemory",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -1312,11 +1312,11 @@ xmlSecCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte*
/**
* xmlSecCryptoAppKeyLoad:
- * @filename: the key filename.
- * @format: the key file format.
- * @pwd: the key file password.
- * @pwdCallback: the key password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @filename: the key filename.
+ * @format: the key file format.
+ * @pwd: the key file password.
+ * @pwdCallback: the key password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key from the a file.
*
@@ -1324,13 +1324,13 @@ xmlSecCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte*
*/
xmlSecKeyPtr
xmlSecCryptoAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
- const char *pwd, void* pwdCallback, void* pwdCallbackCtx) {
+ const char *pwd, void* pwdCallback, void* pwdCallbackCtx) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppKeyLoad == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "cryptoAppKeyLoad",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "cryptoAppKeyLoad",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(NULL);
}
@@ -1339,12 +1339,12 @@ xmlSecCryptoAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
/**
* xmlSecCryptoAppKeyLoadMemory:
- * @data: the binary key data.
- * @dataSize: the size of binary key.
- * @format: the key file format.
- * @pwd: the key file password.
- * @pwdCallback: the key password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @data: the binary key data.
+ * @dataSize: the size of binary key.
+ * @format: the key file format.
+ * @pwd: the key file password.
+ * @pwdCallback: the key password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key from the memory buffer.
*
@@ -1352,25 +1352,25 @@ xmlSecCryptoAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
*/
xmlSecKeyPtr
xmlSecCryptoAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlSecKeyDataFormat format,
- const char *pwd, void* pwdCallback, void* pwdCallbackCtx) {
+ const char *pwd, void* pwdCallback, void* pwdCallbackCtx) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppKeyLoadMemory == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "cryptoAppKeyLoadMemory",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "cryptoAppKeyLoadMemory",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(NULL);
}
return(xmlSecCryptoDLGetFunctions()->cryptoAppKeyLoadMemory(data, dataSize, format, pwd, pwdCallback, pwdCallbackCtx));
}
-
+
/**
* xmlSecCryptoAppPkcs12Load:
- * @filename: the PKCS12 key filename.
- * @pwd: the PKCS12 file password.
- * @pwdCallback: the password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @filename: the PKCS12 key filename.
+ * @pwd: the PKCS12 file password.
+ * @pwdCallback: the password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key and all associated certificates from the PKCS12 file.
* For uniformity, call xmlSecCryptoAppKeyLoad instead of this function. Pass
@@ -1380,13 +1380,13 @@ xmlSecCryptoAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlSec
*/
xmlSecKeyPtr
xmlSecCryptoAppPkcs12Load(const char* filename, const char* pwd, void* pwdCallback,
- void* pwdCallbackCtx) {
+ void* pwdCallbackCtx) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppPkcs12Load == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "cryptoAppPkcs12Load",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "cryptoAppPkcs12Load",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(NULL);
}
@@ -1395,11 +1395,11 @@ xmlSecCryptoAppPkcs12Load(const char* filename, const char* pwd, void* pwdCallba
/**
* xmlSecCryptoAppPkcs12LoadMemory:
- * @data: the PKCS12 binary data.
- * @dataSize: the PKCS12 binary data size.
- * @pwd: the PKCS12 file password.
- * @pwdCallback: the password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @data: the PKCS12 binary data.
+ * @dataSize: the PKCS12 binary data size.
+ * @pwd: the PKCS12 file password.
+ * @pwdCallback: the password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key and all associated certificates from the PKCS12 data in memory buffer.
* For uniformity, call xmlSecCryptoAppKeyLoadMemory instead of this function. Pass
@@ -1407,16 +1407,16 @@ xmlSecCryptoAppPkcs12Load(const char* filename, const char* pwd, void* pwdCallba
*
* Returns: pointer to the key or NULL if an error occurs.
*/
-xmlSecKeyPtr
+xmlSecKeyPtr
xmlSecCryptoAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
- const char *pwd, void* pwdCallback,
- void* pwdCallbackCtx) {
+ const char *pwd, void* pwdCallback,
+ void* pwdCallbackCtx) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppPkcs12LoadMemory == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "cryptoAppPkcs12LoadMemory",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "cryptoAppPkcs12LoadMemory",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(NULL);
}
@@ -1425,9 +1425,9 @@ xmlSecCryptoAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
/**
* xmlSecCryptoAppKeyCertLoad:
- * @key: the pointer to key.
- * @filename: the certificate filename.
- * @format: the certificate file format.
+ * @key: the pointer to key.
+ * @filename: the certificate filename.
+ * @format: the certificate file format.
*
* Reads the certificate from $ filename and adds it to key.
*
@@ -1436,11 +1436,11 @@ xmlSecCryptoAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
int
xmlSecCryptoAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, xmlSecKeyDataFormat format) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppKeyCertLoad == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "cryptoAppKeyCertLoad",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "cryptoAppKeyCertLoad",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -1449,24 +1449,24 @@ xmlSecCryptoAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, xmlSecKeyData
/**
* xmlSecCryptoAppKeyCertLoadMemory:
- * @key: the pointer to key.
- * @data: the certificate binary data.
- * @dataSize: the certificate binary data size.
- * @format: the certificate file format.
+ * @key: the pointer to key.
+ * @data: the certificate binary data.
+ * @dataSize: the certificate binary data size.
+ * @format: the certificate file format.
*
* Reads the certificate from memory buffer and adds it to key.
*
* Returns: 0 on success or a negative value otherwise.
*/
-int
+int
xmlSecCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSize dataSize,
- xmlSecKeyDataFormat format) {
+ xmlSecKeyDataFormat format) {
if((xmlSecCryptoDLGetFunctions() == NULL) || (xmlSecCryptoDLGetFunctions()->cryptoAppKeyCertLoadMemory == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "cryptoAppKeyCertLoadMemory",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "cryptoAppKeyCertLoadMemory",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -1483,11 +1483,11 @@ xmlSecCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSe
void*
xmlSecCryptoAppGetDefaultPwdCallback(void) {
if(xmlSecCryptoDLGetFunctions() == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(NULL);
}
diff --git a/src/base64.c b/src/base64.c
index 73b9e50..33565e0 100644
--- a/src/base64.c
+++ b/src/base64.c
@@ -40,21 +40,21 @@ static const xmlSecByte base64[] =
/* few macros to simplify the code */
-#define xmlSecBase64Encode1(a) (((a) >> 2) & 0x3F)
-#define xmlSecBase64Encode2(a, b) ((((a) << 4) & 0x30) + (((b) >> 4) & 0x0F))
-#define xmlSecBase64Encode3(b, c) ((((b) << 2) & 0x3c) + (((c) >> 6) & 0x03))
-#define xmlSecBase64Encode4(c) ((c) & 0x3F)
-
-#define xmlSecBase64Decode1(a, b) (((a) << 2) | (((b) & 0x3F) >> 4))
-#define xmlSecBase64Decode2(b, c) (((b) << 4) | (((c) & 0x3F) >> 2))
-#define xmlSecBase64Decode3(c, d) (((c) << 6) | ((d) & 0x3F))
-
-#define xmlSecIsBase64Char(ch) ((((ch) >= 'A') && ((ch) <= 'Z')) || \
- (((ch) >= 'a') && ((ch) <= 'z')) || \
- (((ch) >= '0') && ((ch) <= '9')) || \
- ((ch) == '+') || ((ch) == '/'))
-#define xmlSecIsBase64Space(ch) (((ch) == ' ') || ((ch) == '\t') || \
- ((ch) == '\x0d') || ((ch) == '\x0a'))
+#define xmlSecBase64Encode1(a) (((a) >> 2) & 0x3F)
+#define xmlSecBase64Encode2(a, b) ((((a) << 4) & 0x30) + (((b) >> 4) & 0x0F))
+#define xmlSecBase64Encode3(b, c) ((((b) << 2) & 0x3c) + (((c) >> 6) & 0x03))
+#define xmlSecBase64Encode4(c) ((c) & 0x3F)
+
+#define xmlSecBase64Decode1(a, b) (((a) << 2) | (((b) & 0x3F) >> 4))
+#define xmlSecBase64Decode2(b, c) (((b) << 4) | (((c) & 0x3F) >> 2))
+#define xmlSecBase64Decode3(c, d) (((c) << 6) | ((d) & 0x3F))
+
+#define xmlSecIsBase64Char(ch) ((((ch) >= 'A') && ((ch) <= 'Z')) || \
+ (((ch) >= 'a') && ((ch) <= 'z')) || \
+ (((ch) >= '0') && ((ch) <= '9')) || \
+ ((ch) == '+') || ((ch) == '/'))
+#define xmlSecIsBase64Space(ch) (((ch) == ' ') || ((ch) == '\t') || \
+ ((ch) == '\x0d') || ((ch) == '\x0a'))
@@ -72,41 +72,41 @@ typedef enum {
} xmlSecBase64Status;
struct _xmlSecBase64Ctx {
- int encode;
+ int encode;
int inByte;
int inPos;
- xmlSecSize linePos;
- xmlSecSize columns;
+ xmlSecSize linePos;
+ xmlSecSize columns;
int finished;
};
-static xmlSecBase64Status xmlSecBase64CtxEncodeByte (xmlSecBase64CtxPtr ctx,
- xmlSecByte inByte,
- xmlSecByte* outByte);
-static xmlSecBase64Status xmlSecBase64CtxEncodeByteFinal (xmlSecBase64CtxPtr ctx,
- xmlSecByte* outByte);
-static xmlSecBase64Status xmlSecBase64CtxDecodeByte (xmlSecBase64CtxPtr ctx,
- xmlSecByte inByte,
- xmlSecByte* outByte);
-static int xmlSecBase64CtxEncode (xmlSecBase64CtxPtr ctx,
- const xmlSecByte* inBuf,
- xmlSecSize inBufSize,
- xmlSecSize* inBufResSize,
- xmlSecByte* outBuf,
- xmlSecSize outBufSize,
- xmlSecSize* outBufResSize);
-static int xmlSecBase64CtxEncodeFinal (xmlSecBase64CtxPtr ctx,
- xmlSecByte* outBuf,
- xmlSecSize outBufSize,
- xmlSecSize* outBufResSize);
-static int xmlSecBase64CtxDecode (xmlSecBase64CtxPtr ctx,
- const xmlSecByte* inBuf,
- xmlSecSize inBufSize,
- xmlSecSize* inBufResSize,
- xmlSecByte* outBuf,
- xmlSecSize outBufSize,
- xmlSecSize* outBufResSize);
-static int xmlSecBase64CtxDecodeIsFinished (xmlSecBase64CtxPtr ctx);
+static xmlSecBase64Status xmlSecBase64CtxEncodeByte (xmlSecBase64CtxPtr ctx,
+ xmlSecByte inByte,
+ xmlSecByte* outByte);
+static xmlSecBase64Status xmlSecBase64CtxEncodeByteFinal (xmlSecBase64CtxPtr ctx,
+ xmlSecByte* outByte);
+static xmlSecBase64Status xmlSecBase64CtxDecodeByte (xmlSecBase64CtxPtr ctx,
+ xmlSecByte inByte,
+ xmlSecByte* outByte);
+static int xmlSecBase64CtxEncode (xmlSecBase64CtxPtr ctx,
+ const xmlSecByte* inBuf,
+ xmlSecSize inBufSize,
+ xmlSecSize* inBufResSize,
+ xmlSecByte* outBuf,
+ xmlSecSize outBufSize,
+ xmlSecSize* outBufResSize);
+static int xmlSecBase64CtxEncodeFinal (xmlSecBase64CtxPtr ctx,
+ xmlSecByte* outBuf,
+ xmlSecSize outBufSize,
+ xmlSecSize* outBufResSize);
+static int xmlSecBase64CtxDecode (xmlSecBase64CtxPtr ctx,
+ const xmlSecByte* inBuf,
+ xmlSecSize inBufSize,
+ xmlSecSize* inBufResSize,
+ xmlSecByte* outBuf,
+ xmlSecSize outBufSize,
+ xmlSecSize* outBufResSize);
+static int xmlSecBase64CtxDecodeIsFinished (xmlSecBase64CtxPtr ctx);
static int g_xmlsec_base64_default_line_size = XMLSEC_BASE64_LINESIZE;
@@ -138,15 +138,15 @@ xmlSecBase64SetDefaultLineSize(int columns)
/**
* xmlSecBase64CtxCreate:
- * @encode: the encode/decode flag (1 - encode, 0 - decode)
- * @columns: the max line length.
+ * @encode: the encode/decode flag (1 - encode, 0 - decode)
+ * @columns: the max line length.
*
* Allocates and initializes new base64 context.
*
* Returns: a pointer to newly created #xmlSecBase64Ctx structure
* or NULL if an error occurs.
*/
-xmlSecBase64CtxPtr
+xmlSecBase64CtxPtr
xmlSecBase64CtxCreate(int encode, int columns) {
xmlSecBase64CtxPtr ctx;
int ret;
@@ -156,31 +156,31 @@ xmlSecBase64CtxCreate(int encode, int columns) {
*/
ctx = (xmlSecBase64CtxPtr) xmlMalloc(sizeof(xmlSecBase64Ctx));
if (ctx == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "sizeof(xmlSecBase64Ctx)=%d",
- sizeof(xmlSecBase64Ctx));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "sizeof(xmlSecBase64Ctx)=%d",
+ sizeof(xmlSecBase64Ctx));
+ return(NULL);
}
ret = xmlSecBase64CtxInitialize(ctx, encode, columns);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64CtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBase64CtxDestroy(ctx);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64CtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBase64CtxDestroy(ctx);
+ return(NULL);
}
return(ctx);
}
/**
* xmlSecBase64CtxDestroy:
- * @ctx: the pointer to #xmlSecBase64Ctx structure.
+ * @ctx: the pointer to #xmlSecBase64Ctx structure.
*
* Destroys base64 context.
*/
@@ -194,9 +194,9 @@ xmlSecBase64CtxDestroy(xmlSecBase64CtxPtr ctx) {
/**
* xmlSecBase64CtxInitialize:
- * @ctx: the pointer to #xmlSecBase64Ctx structure,
- * @encode: the encode/decode flag (1 - encode, 0 - decode)
- * @columns: the max line length.
+ * @ctx: the pointer to #xmlSecBase64Ctx structure,
+ * @encode: the encode/decode flag (1 - encode, 0 - decode)
+ * @columns: the max line length.
*
* Initializes new base64 context.
*
@@ -215,7 +215,7 @@ xmlSecBase64CtxInitialize(xmlSecBase64CtxPtr ctx, int encode, int columns) {
/**
* xmlSecBase64CtxFinalize:
- * @ctx: the pointer to #xmlSecBase64Ctx structure,
+ * @ctx: the pointer to #xmlSecBase64Ctx structure,
*
* Frees all the resources allocated by @ctx.
*/
@@ -224,15 +224,15 @@ xmlSecBase64CtxFinalize(xmlSecBase64CtxPtr ctx) {
xmlSecAssert(ctx != NULL);
memset(ctx, 0, sizeof(xmlSecBase64Ctx));
-}
+}
/**
* xmlSecBase64CtxUpdate:
- * @ctx: the pointer to #xmlSecBase64Ctx structure
- * @in: the input buffer
- * @inSize: the input buffer size
- * @out: the output buffer
- * @outSize: the output buffer size
+ * @ctx: the pointer to #xmlSecBase64Ctx structure
+ * @in: the input buffer
+ * @inSize: the input buffer size
+ * @out: the output buffer
+ * @outSize: the output buffer size
*
* Encodes or decodes the next piece of data from input buffer.
*
@@ -241,8 +241,8 @@ xmlSecBase64CtxFinalize(xmlSecBase64CtxPtr ctx) {
*/
int
xmlSecBase64CtxUpdate(xmlSecBase64CtxPtr ctx,
- const xmlSecByte *in, xmlSecSize inSize,
- xmlSecByte *out, xmlSecSize outSize) {
+ const xmlSecByte *in, xmlSecSize inSize,
+ xmlSecByte *out, xmlSecSize outSize) {
xmlSecSize inResSize = 0, outResSize = 0;
int ret;
@@ -251,27 +251,27 @@ xmlSecBase64CtxUpdate(xmlSecBase64CtxPtr ctx,
xmlSecAssert2(out != NULL, -1);
if(ctx->encode != 0) {
- ret = xmlSecBase64CtxEncode(ctx, in, inSize, &inResSize,
- out, outSize, &outResSize);
- if((ret < 0) || (inResSize != inSize)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64CtxEncode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ret = xmlSecBase64CtxEncode(ctx, in, inSize, &inResSize,
+ out, outSize, &outResSize);
+ if((ret < 0) || (inResSize != inSize)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64CtxEncode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
} else {
- ret = xmlSecBase64CtxDecode(ctx, in, inSize, &inResSize,
- out, outSize, &outResSize);
- if((ret < 0) || (inResSize != inSize)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64CtxDecode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ret = xmlSecBase64CtxDecode(ctx, in, inSize, &inResSize,
+ out, outSize, &outResSize);
+ if((ret < 0) || (inResSize != inSize)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64CtxDecode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
return(outResSize);
@@ -279,9 +279,9 @@ xmlSecBase64CtxUpdate(xmlSecBase64CtxPtr ctx,
/**
* xmlSecBase64CtxFinal:
- * @ctx: the pointer to #xmlSecBase64Ctx structure
- * @out: the output buffer
- * @outSize: the output buffer size
+ * @ctx: the pointer to #xmlSecBase64Ctx structure
+ * @out: the output buffer
+ * @outSize: the output buffer size
*
* Encodes or decodes the last piece of data stored in the context
* and finalizes the result.
@@ -291,7 +291,7 @@ xmlSecBase64CtxUpdate(xmlSecBase64CtxPtr ctx,
*/
int
xmlSecBase64CtxFinal(xmlSecBase64CtxPtr ctx,
- xmlSecByte *out, xmlSecSize outSize) {
+ xmlSecByte *out, xmlSecSize outSize) {
xmlSecSize outResSize = 0;
int ret;
@@ -300,29 +300,29 @@ xmlSecBase64CtxFinal(xmlSecBase64CtxPtr ctx,
xmlSecAssert2(outSize > 0, -1);
if(ctx->encode != 0) {
- ret = xmlSecBase64CtxEncodeFinal(ctx, out, outSize, &outResSize);
+ ret = xmlSecBase64CtxEncodeFinal(ctx, out, outSize, &outResSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64CtxEncodeFinal",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "outSize=%d", outSize);
- return(-1);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64CtxEncodeFinal",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "outSize=%d", outSize);
+ return(-1);
+ }
} else {
- if(!xmlSecBase64CtxDecodeIsFinished(ctx)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64CtxIsFinished",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ if(!xmlSecBase64CtxDecodeIsFinished(ctx)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64CtxIsFinished",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
/* add \0 */
if((outResSize + 1) < outSize) {
- out[outResSize] = '\0';
+ out[outResSize] = '\0';
}
return(outResSize);
}
@@ -338,25 +338,25 @@ xmlSecBase64CtxEncodeByte(xmlSecBase64CtxPtr ctx, xmlSecByte inByte, xmlSecByte*
return(xmlSecBase64StatusConsumeAndRepeat);
} else if(ctx->inPos == 0) {
/* we just started new block */
- (*outByte) = base64[xmlSecBase64Encode1(inByte)];
+ (*outByte) = base64[xmlSecBase64Encode1(inByte)];
ctx->inByte = inByte;
++ctx->linePos;
++ctx->inPos;
return(xmlSecBase64StatusConsumeAndNext);
} else if(ctx->inPos == 1) {
- (*outByte) = base64[xmlSecBase64Encode2(ctx->inByte, inByte)];
+ (*outByte) = base64[xmlSecBase64Encode2(ctx->inByte, inByte)];
ctx->inByte = inByte;
++ctx->linePos;
++ctx->inPos;
return(xmlSecBase64StatusConsumeAndNext);
} else if(ctx->inPos == 2) {
- (*outByte) = base64[xmlSecBase64Encode3(ctx->inByte, inByte)];
+ (*outByte) = base64[xmlSecBase64Encode3(ctx->inByte, inByte)];
ctx->inByte = inByte;
++ctx->linePos;
++ctx->inPos;
return(xmlSecBase64StatusConsumeAndRepeat);
} else if(ctx->inPos == 3) {
- (*outByte) = base64[xmlSecBase64Encode4(ctx->inByte)];
+ (*outByte) = base64[xmlSecBase64Encode4(ctx->inByte)];
++ctx->linePos;
ctx->inByte = 0;
ctx->inPos = 0;
@@ -364,10 +364,10 @@ xmlSecBase64CtxEncodeByte(xmlSecBase64CtxPtr ctx, xmlSecByte inByte, xmlSecByte*
}
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "ctx->inPos=%d", ctx->inPos);
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "ctx->inPos=%d", ctx->inPos);
return(xmlSecBase64StatusFailed);
}
@@ -398,10 +398,10 @@ xmlSecBase64CtxEncodeByteFinal(xmlSecBase64CtxPtr ctx, xmlSecByte* outByte) {
}
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "ctx->inPos=%d", ctx->inPos);
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "ctx->inPos=%d", ctx->inPos);
return(xmlSecBase64StatusFailed);
}
@@ -415,11 +415,11 @@ xmlSecBase64CtxDecodeByte(xmlSecBase64CtxPtr ctx, xmlSecByte inByte, xmlSecByte*
} if(inByte == '=') {
ctx->finished = 1;
if(ctx->inPos < 2) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "ctx->inPos=%d", ctx->inPos);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "ctx->inPos=%d", ctx->inPos);
return(xmlSecBase64StatusFailed);
} else if(ctx->inPos == 2) {
++ctx->inPos;
@@ -428,35 +428,35 @@ xmlSecBase64CtxDecodeByte(xmlSecBase64CtxPtr ctx, xmlSecByte inByte, xmlSecByte*
ctx->inPos = 0;
return(xmlSecBase64StatusNext);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "ctx->inPos=%d", ctx->inPos);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "ctx->inPos=%d", ctx->inPos);
return(xmlSecBase64StatusFailed);
}
} else if(xmlSecIsBase64Space(inByte)) {
return(xmlSecBase64StatusNext);
} else if(!xmlSecIsBase64Char(inByte) || (ctx->finished != 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "inByte=0x%02x", inByte);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "inByte=0x%02x", inByte);
return(xmlSecBase64StatusFailed);
}
/* convert from character to position in base64 array */
if((inByte >= 'A') && (inByte <= 'Z')) {
- inByte = (inByte - 'A');
+ inByte = (inByte - 'A');
} else if((inByte >= 'a') && (inByte <= 'z')) {
- inByte = 26 + (inByte - 'a');
+ inByte = 26 + (inByte - 'a');
} else if((inByte >= '0') && (inByte <= '9')) {
- inByte = 52 + (inByte - '0');
+ inByte = 52 + (inByte - '0');
} else if(inByte == '+') {
- inByte = 62;
+ inByte = 62;
} else if(inByte == '/') {
- inByte = 63;
+ inByte = 63;
}
if(ctx->inPos == 0) {
@@ -481,10 +481,10 @@ xmlSecBase64CtxDecodeByte(xmlSecBase64CtxPtr ctx, xmlSecByte inByte, xmlSecByte*
}
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "ctx->inPos=%d", ctx->inPos);
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "ctx->inPos=%d", ctx->inPos);
return(xmlSecBase64StatusFailed);
}
@@ -516,11 +516,11 @@ xmlSecBase64CtxEncode(xmlSecBase64CtxPtr ctx,
case xmlSecBase64StatusNext:
case xmlSecBase64StatusDone:
case xmlSecBase64StatusFailed:
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64CtxEncodeByte",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "status=%d", status);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64CtxEncodeByte",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "status=%d", status);
return(-1);
}
}
@@ -553,21 +553,21 @@ xmlSecBase64CtxEncodeFinal(xmlSecBase64CtxPtr ctx,
break;
case xmlSecBase64StatusNext:
case xmlSecBase64StatusFailed:
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64CtxEncodeByteFinal",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "status=%d", status);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64CtxEncodeByteFinal",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "status=%d", status);
return(-1);
}
}
if(status != xmlSecBase64StatusDone) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "outBufSize=%d", outBufSize);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "outBufSize=%d", outBufSize);
return(-1);
}
if(outPos < outBufSize) {
@@ -609,11 +609,11 @@ xmlSecBase64CtxDecode(xmlSecBase64CtxPtr ctx,
case xmlSecBase64StatusDone:
break;
case xmlSecBase64StatusFailed:
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64CtxDecodeByte",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "status=%d", status);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64CtxDecodeByte",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "status=%d", status);
return(-1);
}
}
@@ -638,10 +638,10 @@ xmlSecBase64CtxDecodeIsFinished(xmlSecBase64CtxPtr ctx) {
/**
* xmlSecBase64Encode:
- * @buf: the input buffer.
- * @len: the input buffer size.
- * @columns: the output max line length (if 0 then no line breaks
- * would be inserted)
+ * @buf: the input buffer.
+ * @len: the input buffer size.
+ * @columns: the output max line length (if 0 then no line breaks
+ * would be inserted)
*
* Encodes the data from input buffer and allocates the string for the result.
* The caller is responsible for freeing returned buffer using
@@ -662,53 +662,53 @@ xmlSecBase64Encode(const xmlSecByte *buf, xmlSecSize len, int columns) {
ret = xmlSecBase64CtxInitialize(&ctx, 1, columns);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64CtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64CtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
/* create result buffer */
size = (4 * len) / 3 + 4;
if(columns > 0) {
- size += (size / columns) + 4;
+ size += (size / columns) + 4;
}
ptr = (xmlChar*) xmlMalloc(size);
if(ptr == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "size=%d", size);
- xmlSecBase64CtxFinalize(&ctx);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "size=%d", size);
+ xmlSecBase64CtxFinalize(&ctx);
+ return(NULL);
}
ret = xmlSecBase64CtxUpdate(&ctx, buf, len, (xmlSecByte*)ptr, size);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64CtxUpdate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "len=%d", len);
- xmlFree(ptr);
- xmlSecBase64CtxFinalize(&ctx);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64CtxUpdate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "len=%d", len);
+ xmlFree(ptr);
+ xmlSecBase64CtxFinalize(&ctx);
+ return(NULL);
}
size_update = ret;
ret = xmlSecBase64CtxFinal(&ctx, ((xmlSecByte*)ptr) + size_update, size - size_update);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64CtxFinal",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(ptr);
- xmlSecBase64CtxFinalize(&ctx);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64CtxFinal",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(ptr);
+ xmlSecBase64CtxFinalize(&ctx);
+ return(NULL);
}
size_final = ret;
ptr[size_update + size_final] = '\0';
@@ -719,9 +719,9 @@ xmlSecBase64Encode(const xmlSecByte *buf, xmlSecSize len, int columns) {
/**
* xmlSecBase64Decode:
- * @str: the input buffer with base64 encoded string
- * @buf: the output buffer
- * @len: the output buffer size
+ * @str: the input buffer with base64 encoded string
+ * @buf: the output buffer
+ * @len: the output buffer size
*
* Decodes input base64 encoded string and puts result into
* the output buffer.
@@ -741,35 +741,35 @@ xmlSecBase64Decode(const xmlChar* str, xmlSecByte *buf, xmlSecSize len) {
ret = xmlSecBase64CtxInitialize(&ctx, 0, 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64CtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64CtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecBase64CtxUpdate(&ctx, (const xmlSecByte*)str, xmlStrlen(str), buf, len);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64CtxUpdate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBase64CtxFinalize(&ctx);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64CtxUpdate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBase64CtxFinalize(&ctx);
+ return(-1);
}
size_update = ret;
ret = xmlSecBase64CtxFinal(&ctx, buf + size_update, len - size_update);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64CtxFinal",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBase64CtxFinalize(&ctx);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64CtxFinal",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBase64CtxFinalize(&ctx);
+ return(-1);
}
size_final = ret;
@@ -785,43 +785,43 @@ xmlSecBase64Decode(const xmlChar* str, xmlSecByte *buf, xmlSecSize len) {
*
**************************************************************/
#define xmlSecBase64Size \
- (sizeof(xmlSecTransform) + sizeof(xmlSecBase64Ctx))
+ (sizeof(xmlSecTransform) + sizeof(xmlSecBase64Ctx))
#define xmlSecBase64GetCtx(transform) \
((xmlSecTransformCheckSize((transform), xmlSecBase64Size)) ? \
- (xmlSecBase64CtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)) : \
- (xmlSecBase64CtxPtr)NULL)
+ (xmlSecBase64CtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)) : \
+ (xmlSecBase64CtxPtr)NULL)
-static int xmlSecBase64Initialize (xmlSecTransformPtr transform);
-static void xmlSecBase64Finalize (xmlSecTransformPtr transform);
-static int xmlSecBase64Execute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecBase64Initialize (xmlSecTransformPtr transform);
+static void xmlSecBase64Finalize (xmlSecTransformPtr transform);
+static int xmlSecBase64Execute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
static xmlSecTransformKlass xmlSecBase64Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecBase64Size, /* xmlSecSize objSize */
-
- xmlSecNameBase64, /* const xmlChar* name; */
- xmlSecHrefBase64, /* const xmlChar* href; */
- xmlSecTransformUsageDSigTransform, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecBase64Initialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecBase64Finalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecBase64Execute, /* xmlSecTransformExecuteMethod execute; */
-
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecBase64Size, /* xmlSecSize objSize */
+
+ xmlSecNameBase64, /* const xmlChar* name; */
+ xmlSecHrefBase64, /* const xmlChar* href; */
+ xmlSecTransformUsageDSigTransform, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecBase64Initialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecBase64Finalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecBase64Execute, /* xmlSecTransformExecuteMethod execute; */
+
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -843,8 +843,8 @@ xmlSecTransformBase64GetKlass(void) {
/**
* xmlSecTransformBase64SetLineSize:
- * @transform: the pointer to BASE64 encode transform.
- * @lineSize: the new max line size.
+ * @transform: the pointer to BASE64 encode transform.
+ * @lineSize: the new max line size.
*
* Sets the max line size to @lineSize.
*/
@@ -873,12 +873,12 @@ xmlSecBase64Initialize(xmlSecTransformPtr transform) {
transform->operation = xmlSecTransformOperationDecode;
ret = xmlSecBase64CtxInitialize(ctx, 0, xmlSecBase64GetDefaultLineSize());
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBase64CtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBase64CtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -914,119 +914,119 @@ xmlSecBase64Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPt
out = &(transform->outBuf);
if(transform->status == xmlSecTransformStatusNone) {
- ctx->encode = (transform->operation == xmlSecTransformOperationEncode) ? 1 : 0;
- transform->status = xmlSecTransformStatusWorking;
+ ctx->encode = (transform->operation == xmlSecTransformOperationEncode) ? 1 : 0;
+ transform->status = xmlSecTransformStatusWorking;
}
switch(transform->status) {
- case xmlSecTransformStatusWorking:
- inSize = xmlSecBufferGetSize(in);
- outSize = xmlSecBufferGetSize(out);
- if(inSize > 0) {
- if(ctx->encode != 0) {
- outLen = 4 * inSize / 3 + 8;
- if(ctx->columns > 0) {
- outLen += inSize / ctx->columns + 4;
- }
- } else {
- outLen = 3 * inSize / 4 + 8;
- }
- ret = xmlSecBufferSetMaxSize(out, outSize + outLen);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + outLen);
- return(-1);
- }
-
- /* encode/decode the next chunk */
- ret = xmlSecBase64CtxUpdate(ctx, xmlSecBufferGetData(in), inSize,
- xmlSecBufferGetData(out) + outSize,
- outLen);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBase64CtxUpdate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- outLen = ret;
-
- /* set correct size */
- ret = xmlSecBufferSetSize(out, outSize + outLen);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + outLen);
- return(-1);
- }
-
- /* remove chunk from input */
- ret = xmlSecBufferRemoveHead(in, inSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
- }
- }
-
- if(last) {
- outSize = xmlSecBufferGetSize(out);
-
- ret = xmlSecBufferSetMaxSize(out, outSize + 16);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + 16);
- return(-1);
- }
-
- /* add from ctx buffer */
- ret = xmlSecBase64CtxFinal(ctx, xmlSecBufferGetData(out) + outSize, 16);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBase64CtxFinal",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- outLen = ret;
-
- /* set correct size */
- ret = xmlSecBufferSetSize(out, outSize + outLen);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + outLen);
- return(-1);
- }
- transform->status = xmlSecTransformStatusFinished;
- }
- break;
- case xmlSecTransformStatusFinished:
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
- break;
- default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ case xmlSecTransformStatusWorking:
+ inSize = xmlSecBufferGetSize(in);
+ outSize = xmlSecBufferGetSize(out);
+ if(inSize > 0) {
+ if(ctx->encode != 0) {
+ outLen = 4 * inSize / 3 + 8;
+ if(ctx->columns > 0) {
+ outLen += inSize / ctx->columns + 4;
+ }
+ } else {
+ outLen = 3 * inSize / 4 + 8;
+ }
+ ret = xmlSecBufferSetMaxSize(out, outSize + outLen);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + outLen);
+ return(-1);
+ }
+
+ /* encode/decode the next chunk */
+ ret = xmlSecBase64CtxUpdate(ctx, xmlSecBufferGetData(in), inSize,
+ xmlSecBufferGetData(out) + outSize,
+ outLen);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBase64CtxUpdate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ outLen = ret;
+
+ /* set correct size */
+ ret = xmlSecBufferSetSize(out, outSize + outLen);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + outLen);
+ return(-1);
+ }
+
+ /* remove chunk from input */
+ ret = xmlSecBufferRemoveHead(in, inSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
+ }
+ }
+
+ if(last) {
+ outSize = xmlSecBufferGetSize(out);
+
+ ret = xmlSecBufferSetMaxSize(out, outSize + 16);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + 16);
+ return(-1);
+ }
+
+ /* add from ctx buffer */
+ ret = xmlSecBase64CtxFinal(ctx, xmlSecBufferGetData(out) + outSize, 16);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBase64CtxFinal",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ outLen = ret;
+
+ /* set correct size */
+ ret = xmlSecBufferSetSize(out, outSize + outLen);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + outLen);
+ return(-1);
+ }
+ transform->status = xmlSecTransformStatusFinished;
+ }
+ break;
+ case xmlSecTransformStatusFinished:
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
+ break;
+ default:
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
}
diff --git a/src/bn.c b/src/bn.c
index 58def52..d7b5582 100644
--- a/src/bn.c
+++ b/src/bn.c
@@ -57,7 +57,7 @@ static const char xmlSecBnRevLookupTable[] =
****************************************************************************/
/**
* xmlSecBnCreate:
- * @size: the initial allocated BN size.
+ * @size: the initial allocated BN size.
*
* Creates a new BN object. Caller is responsible for destroying it
* by calling @xmlSecBnDestroy function.
@@ -71,7 +71,7 @@ xmlSecBnCreate(xmlSecSize size) {
/**
* xmlSecBnDestroy:
- * @bn: the pointer to BN.
+ * @bn: the pointer to BN.
*
* Destroys @bn object created with @xmlSecBnCreate function.
*/
@@ -82,8 +82,8 @@ xmlSecBnDestroy(xmlSecBnPtr bn) {
/**
* xmlSecBnInitialize:
- * @bn: the pointer to BN.
- * @size: the initial allocated BN size.
+ * @bn: the pointer to BN.
+ * @size: the initial allocated BN size.
*
* Initializes a BN object. Caller is responsible for destroying it
* by calling @xmlSecBnFinalize function.
@@ -97,7 +97,7 @@ xmlSecBnInitialize(xmlSecBnPtr bn, xmlSecSize size) {
/**
* xmlSecBnFinalize:
- * @bn: the pointer to BN.
+ * @bn: the pointer to BN.
*
* Destroys @bn object created with @xmlSecBnInitialize function.
*/
@@ -108,7 +108,7 @@ xmlSecBnFinalize(xmlSecBnPtr bn) {
/**
* xmlSecBnGetData:
- * @bn: the pointer to BN.
+ * @bn: the pointer to BN.
*
* Gets pointer to the binary @bn representation.
*
@@ -121,9 +121,9 @@ xmlSecBnGetData(xmlSecBnPtr bn) {
/**
* xmlSecBnSetData:
- * @bn: the pointer to BN.
- * @data: the pointer to new BN binary data.
- * @size: the size of new BN data.
+ * @bn: the pointer to BN.
+ * @data: the pointer to new BN binary data.
+ * @size: the size of new BN data.
*
* Sets the value of @bn to @data.
*
@@ -136,7 +136,7 @@ xmlSecBnSetData(xmlSecBnPtr bn, const xmlSecByte* data, xmlSecSize size) {
/**
* xmlSecBnGetSize:
- * @bn: the pointer to BN.
+ * @bn: the pointer to BN.
*
* Gets the size of binary data in @bn.
*
@@ -149,7 +149,7 @@ xmlSecBnGetSize(xmlSecBnPtr bn) {
/**
* xmlSecBnZero:
- * @bn: the pointer to BN.
+ * @bn: the pointer to BN.
*
* Sets the value of @bn to zero.
*/
@@ -160,9 +160,9 @@ xmlSecBnZero(xmlSecBnPtr bn) {
/**
* xmlSecBnFromString:
- * @bn: the pointer to BN.
- * @str: the string with BN.
- * @base: the base for @str.
+ * @bn: the pointer to BN.
+ * @str: the string with BN.
+ * @base: the base for @str.
*
* Reads @bn from string @str assuming it has base @base.
*
@@ -198,10 +198,10 @@ xmlSecBnFromString(xmlSecBnPtr bn, const xmlChar* str, xmlSecSize base) {
ret = xmlSecBufferSetMaxSize(bn, xmlSecBufferGetSize(bn) + len / 2 + 1 + 1);
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBnRevLookupTable",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", len / 2 + 1);
+ NULL,
+ "xmlSecBnRevLookupTable",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", len / 2 + 1);
return (-1);
}
@@ -213,7 +213,7 @@ xmlSecBnFromString(xmlSecBnPtr bn, const xmlChar* str, xmlSecSize base) {
/* skip spaces */
if(isspace(ch)) {
- continue;
+ continue;
}
/* check if it is + or - */
@@ -235,13 +235,13 @@ xmlSecBnFromString(xmlSecBnPtr bn, const xmlChar* str, xmlSecSize base) {
--i; /* make sure that we will look at this character in next loop */
break;
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "char=%c;base=%d",
- ch, base);
- return (-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "char=%c;base=%d",
+ ch, base);
+ return (-1);
}
}
@@ -249,40 +249,40 @@ xmlSecBnFromString(xmlSecBnPtr bn, const xmlChar* str, xmlSecSize base) {
while(i < len) {
ch = str[i++];
if(isspace(ch)) {
- continue;
+ continue;
}
xmlSecAssert2(ch <= sizeof(xmlSecBnLookupTable), -1);
nn = xmlSecBnLookupTable[ch];
if((nn < 0) || ((xmlSecSize)nn > base)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "char=%c;base=%d",
- ch, base);
- return (-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "char=%c;base=%d",
+ ch, base);
+ return (-1);
}
ret = xmlSecBnMul(bn, base);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBnMul",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "base=%d", base);
- return (-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBnMul",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "base=%d", base);
+ return (-1);
}
ret = xmlSecBnAdd(bn, nn);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBnAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "base=%d", base);
- return (-1);
-}
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBnAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "base=%d", base);
+ return (-1);
+}
}
/* check if we need to add 00 prefix, do this for empty bn too */
@@ -325,8 +325,8 @@ xmlSecBnFromString(xmlSecBnPtr bn, const xmlChar* str, xmlSecSize base) {
/**
* xmlSecBnToString:
- * @bn: the pointer to BN.
- * @base: the base for returned string.
+ * @bn: the pointer to BN.
+ * @base: the base for returned string.
*
* Writes @bn to string with base @base. Caller is responsible for
* freeing returned string with @xmlFree.
@@ -398,18 +398,18 @@ xmlSecBnToString(xmlSecBnPtr bn, xmlSecSize base) {
}
/* Result string len is
- * len = log base (256) * <bn size>
+ * len = log base (256) * <bn size>
* Since the smallest base == 2 then we can get away with
- * len = 8 * <bn size>
+ * len = 8 * <bn size>
*/
len = 8 * size + 1 + 1;
res = (xmlChar*)xmlMalloc(len + 1);
if(res == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "len=%d", len);
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "len=%d", len);
xmlSecBnFinalize(&bn2);
return (NULL);
}
@@ -454,8 +454,8 @@ xmlSecBnToString(xmlSecBnPtr bn, xmlSecSize base) {
/**
* xmlSecBnFromHexString:
- * @bn: the pointer to BN.
- * @str: the string with BN.
+ * @bn: the pointer to BN.
+ * @str: the string with BN.
*
* Reads @bn from hex string @str.
*
@@ -468,7 +468,7 @@ xmlSecBnFromHexString(xmlSecBnPtr bn, const xmlChar* str) {
/**
* xmlSecBnToHexString:
- * @bn: the pointer to BN.
+ * @bn: the pointer to BN.
*
* Writes @bn to hex string. Caller is responsible for
* freeing returned string with @xmlFree.
@@ -482,8 +482,8 @@ xmlSecBnToHexString(xmlSecBnPtr bn) {
/**
* xmlSecBnFromDecString:
- * @bn: the pointer to BN.
- * @str: the string with BN.
+ * @bn: the pointer to BN.
+ * @str: the string with BN.
*
* Reads @bn from decimal string @str.
*
@@ -496,7 +496,7 @@ xmlSecBnFromDecString(xmlSecBnPtr bn, const xmlChar* str) {
/**
* xmlSecBnToDecString:
- * @bn: the pointer to BN.
+ * @bn: the pointer to BN.
*
* Writes @bn to decimal string. Caller is responsible for
* freeing returned string with @xmlFree.
@@ -510,8 +510,8 @@ xmlSecBnToDecString(xmlSecBnPtr bn) {
/**
* xmlSecBnMul:
- * @bn: the pointer to BN.
- * @multiplier: the multiplier.
+ * @bn: the pointer to BN.
+ * @multiplier: the multiplier.
*
* Multiplies @bn with @multiplier.
*
@@ -529,33 +529,33 @@ xmlSecBnMul(xmlSecBnPtr bn, int multiplier) {
xmlSecAssert2(multiplier > 0, -1);
if(multiplier == 1) {
- return(0);
+ return(0);
}
data = xmlSecBufferGetData(bn);
i = xmlSecBufferGetSize(bn);
over = 0;
while(i > 0) {
- xmlSecAssert2(data != NULL, -1);
+ xmlSecAssert2(data != NULL, -1);
- over = over + multiplier * data[--i];
- data[i] = over % 256;
- over = over / 256;
+ over = over + multiplier * data[--i];
+ data[i] = over % 256;
+ over = over / 256;
}
while(over > 0) {
- ch = over % 256;
- over = over / 256;
-
- ret = xmlSecBufferPrepend(bn, &ch, 1);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferPrepend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=1");
- return (-1);
- }
+ ch = over % 256;
+ over = over / 256;
+
+ ret = xmlSecBufferPrepend(bn, &ch, 1);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferPrepend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=1");
+ return (-1);
+ }
}
return(0);
@@ -563,9 +563,9 @@ xmlSecBnMul(xmlSecBnPtr bn, int multiplier) {
/**
* xmlSecBnDiv:
- * @bn: the pointer to BN.
- * @divider: the divider
- * @mod: the pointer for modulus result.
+ * @bn: the pointer to BN.
+ * @divider: the divider
+ * @mod: the pointer for modulus result.
*
* Divides @bn by @divider and places modulus into @mod.
*
@@ -583,46 +583,46 @@ xmlSecBnDiv(xmlSecBnPtr bn, int divider, int* mod) {
xmlSecAssert2(mod != NULL, -1);
if(divider == 1) {
- return(0);
+ return(0);
}
data = xmlSecBufferGetData(bn);
size = xmlSecBufferGetSize(bn);
for(over = 0, i = 0; i < size; i++) {
- xmlSecAssert2(data != NULL, -1);
+ xmlSecAssert2(data != NULL, -1);
- over = over * 256 + data[i];
- data[i] = over / divider;
- over = over % divider;
+ over = over * 256 + data[i];
+ data[i] = over / divider;
+ over = over % divider;
}
(*mod) = over;
/* remove leading zeros */
for(i = 0; i < size; i++) {
- xmlSecAssert2(data != NULL, -1);
+ xmlSecAssert2(data != NULL, -1);
- if(data[i] != 0) {
- break;
- }
+ if(data[i] != 0) {
+ break;
+ }
}
if(i > 0) {
- ret = xmlSecBufferRemoveHead(bn, i);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", i);
- return (-1);
- }
+ ret = xmlSecBufferRemoveHead(bn, i);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", i);
+ return (-1);
+ }
}
return(0);
}
/**
* xmlSecBnAdd:
- * @bn: the pointer to BN.
- * @delta: the delta.
+ * @bn: the pointer to BN.
+ * @delta: the delta.
*
* Adds @delta to @bn.
*
@@ -639,41 +639,41 @@ xmlSecBnAdd(xmlSecBnPtr bn, int delta) {
xmlSecAssert2(bn != NULL, -1);
if(delta == 0) {
- return(0);
+ return(0);
}
data = xmlSecBufferGetData(bn);
if(delta > 0) {
for(over = delta, i = xmlSecBufferGetSize(bn); (i > 0) && (over > 0) ;) {
- xmlSecAssert2(data != NULL, -1);
-
+ xmlSecAssert2(data != NULL, -1);
+
tmp = data[--i];
- over += tmp;
- data[i] = over % 256;
- over = over / 256;
+ over += tmp;
+ data[i] = over % 256;
+ over = over / 256;
}
while(over > 0) {
- ch = over % 256;
- over = over / 256;
-
- ret = xmlSecBufferPrepend(bn, &ch, 1);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferPrepend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=1");
- return (-1);
- }
+ ch = over % 256;
+ over = over / 256;
+
+ ret = xmlSecBufferPrepend(bn, &ch, 1);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferPrepend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=1");
+ return (-1);
+ }
}
} else {
for(over = -delta, i = xmlSecBufferGetSize(bn); (i > 0) && (over > 0);) {
- xmlSecAssert2(data != NULL, -1);
-
+ xmlSecAssert2(data != NULL, -1);
+
tmp = data[--i];
if(tmp < over) {
- data[i] = 0;
+ data[i] = 0;
over = (over - tmp) / 256;
} else {
data[i] = tmp - over;
@@ -686,7 +686,7 @@ xmlSecBnAdd(xmlSecBnPtr bn, int delta) {
/**
* xmlSecBnReverse:
- * @bn: the pointer to BN.
+ * @bn: the pointer to BN.
*
* Reverses bytes order in @bn.
*
@@ -703,11 +703,11 @@ xmlSecBnReverse(xmlSecBnPtr bn) {
data = xmlSecBufferGetData(bn);
size = xmlSecBufferGetSize(bn);
for(i = 0, j = size - 1; i < size / 2; ++i, --j) {
- xmlSecAssert2(data != NULL, -1);
+ xmlSecAssert2(data != NULL, -1);
- ch = data[i];
- data[i] = data[j];
- data[j] = ch;
+ ch = data[i];
+ data[i] = data[j];
+ data[j] = ch;
}
return(0);
@@ -715,9 +715,9 @@ xmlSecBnReverse(xmlSecBnPtr bn) {
/**
* xmlSecBnCompare:
- * @bn: the pointer to BN.
- * @data: the data to compare BN to.
- * @dataSize: the @data size.
+ * @bn: the pointer to BN.
+ * @data: the data to compare BN to.
+ * @dataSize: the @data size.
*
* Compares the @bn with @data.
*
@@ -736,24 +736,24 @@ xmlSecBnCompare(xmlSecBnPtr bn, const xmlSecByte* data, xmlSecSize dataSize) {
/* skip zeros in the beggining */
while((dataSize > 0) && (data != 0) && (data[0] == 0)) {
- ++data;
- --dataSize;
+ ++data;
+ --dataSize;
}
while((bnSize > 0) && (bnData != 0) && (bnData[0] == 0)) {
- ++bnData;
- --bnSize;
+ ++bnData;
+ --bnSize;
}
if(((bnData == NULL) || (bnSize == 0)) && ((data == NULL) || (dataSize == 0))) {
- return(0);
+ return(0);
} else if((bnData == NULL) || (bnSize == 0)) {
- return(-1);
+ return(-1);
} else if((data == NULL) || (dataSize == 0)) {
- return(1);
+ return(1);
} else if(bnSize < dataSize) {
- return(-1);
+ return(-1);
} else if(bnSize > dataSize) {
- return(-1);
+ return(-1);
}
xmlSecAssert2(bnData != NULL, -1);
@@ -765,9 +765,9 @@ xmlSecBnCompare(xmlSecBnPtr bn, const xmlSecByte* data, xmlSecSize dataSize) {
/**
* xmlSecBnCompareReverse:
- * @bn: the pointer to BN.
- * @data: the data to compare BN to.
- * @dataSize: the @data size.
+ * @bn: the pointer to BN.
+ * @data: the data to compare BN to.
+ * @dataSize: the @data size.
*
* Compares the @bn with reverse @data.
*
@@ -787,34 +787,34 @@ xmlSecBnCompareReverse(xmlSecBnPtr bn, const xmlSecByte* data, xmlSecSize dataSi
/* skip zeros in the beggining */
while((dataSize > 0) && (data != 0) && (data[dataSize - 1] == 0)) {
- --dataSize;
+ --dataSize;
}
while((bnSize > 0) && (bnData != 0) && (bnData[0] == 0)) {
- ++bnData;
- --bnSize;
+ ++bnData;
+ --bnSize;
}
if(((bnData == NULL) || (bnSize == 0)) && ((data == NULL) || (dataSize == 0))) {
- return(0);
+ return(0);
} else if((bnData == NULL) || (bnSize == 0)) {
- return(-1);
+ return(-1);
} else if((data == NULL) || (dataSize == 0)) {
- return(1);
+ return(1);
} else if(bnSize < dataSize) {
- return(-1);
+ return(-1);
} else if(bnSize > dataSize) {
- return(-1);
+ return(-1);
}
xmlSecAssert2(bnData != NULL, -1);
xmlSecAssert2(data != NULL, -1);
xmlSecAssert2(bnSize == dataSize, -1);
for(i = 0, j = dataSize - 1; i < dataSize; ++i, --j) {
- if(bnData[i] < data[j]) {
- return(-1);
- } else if(data[j] < bnData[i]) {
- return(1);
- }
+ if(bnData[i] < data[j]) {
+ return(-1);
+ } else if(data[j] < bnData[i]) {
+ return(1);
+ }
}
return(0);
@@ -822,10 +822,10 @@ xmlSecBnCompareReverse(xmlSecBnPtr bn, const xmlSecByte* data, xmlSecSize dataSi
/**
* xmlSecBnGetNodeValue:
- * @bn: the pointer to BN.
- * @cur: the poitner to an XML node.
- * @format: the BN format.
- * @reverse: if set then reverse read buffer after reading.
+ * @bn: the pointer to BN.
+ * @cur: the poitner to an XML node.
+ * @format: the BN format.
+ * @reverse: if set then reverse read buffer after reading.
*
* Converts the node content from @format to @bn.
*
@@ -841,83 +841,83 @@ xmlSecBnGetNodeValue(xmlSecBnPtr bn, xmlNodePtr cur, xmlSecBnFormat format, int
switch(format) {
case xmlSecBnBase64:
- ret = xmlSecBufferBase64NodeContentRead(bn, cur);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferBase64NodeContentRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- break;
+ ret = xmlSecBufferBase64NodeContentRead(bn, cur);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferBase64NodeContentRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ break;
case xmlSecBnHex:
- content = xmlNodeGetContent(cur);
- if(content == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNodeGetContent",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- ret = xmlSecBnFromHexString(bn, content);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBnFromHexString",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(content);
- return(-1);
- }
- xmlFree(content);
- break;
+ content = xmlNodeGetContent(cur);
+ if(content == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNodeGetContent",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ ret = xmlSecBnFromHexString(bn, content);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBnFromHexString",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(content);
+ return(-1);
+ }
+ xmlFree(content);
+ break;
case xmlSecBnDec:
- content = xmlNodeGetContent(cur);
- if(content == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNodeGetContent",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- ret = xmlSecBnFromDecString(bn, content);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBnFromDecString",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(content);
- return(-1);
- }
- xmlFree(content);
- break;
+ content = xmlNodeGetContent(cur);
+ if(content == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNodeGetContent",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ ret = xmlSecBnFromDecString(bn, content);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBnFromDecString",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(content);
+ return(-1);
+ }
+ xmlFree(content);
+ break;
}
if(reverse != 0) {
- ret = xmlSecBnReverse(bn);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBnReverse",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ret = xmlSecBnReverse(bn);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBnReverse",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
return(0);
}
/**
* xmlSecBnSetNodeValue:
- * @bn: the pointer to BN.
- * @cur: the poitner to an XML node.
- * @format: the BN format.
- * @reverse: the flag that indicates whether to reverse the buffer before writing.
- * @addLineBreaks: the flag; it is equal to 1 then linebreaks will be added before and after new buffer content.
+ * @bn: the pointer to BN.
+ * @cur: the poitner to an XML node.
+ * @format: the BN format.
+ * @reverse: the flag that indicates whether to reverse the buffer before writing.
+ * @addLineBreaks: the flag; it is equal to 1 then linebreaks will be added before and after new buffer content.
*
* Converts the @bn and sets it to node content.
*
@@ -932,65 +932,65 @@ xmlSecBnSetNodeValue(xmlSecBnPtr bn, xmlNodePtr cur, xmlSecBnFormat format, int
xmlSecAssert2(cur != NULL, -1);
if(reverse != 0) {
- ret = xmlSecBnReverse(bn);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBnReverse",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ret = xmlSecBnReverse(bn);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBnReverse",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
if(addLineBreaks) {
- xmlNodeAddContent(cur, xmlSecStringCR);
+ xmlNodeAddContent(cur, xmlSecStringCR);
}
switch(format) {
case xmlSecBnBase64:
- ret = xmlSecBufferBase64NodeContentWrite(bn, cur, xmlSecBase64GetDefaultLineSize());
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferBase64NodeContentWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- break;
+ ret = xmlSecBufferBase64NodeContentWrite(bn, cur, xmlSecBase64GetDefaultLineSize());
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferBase64NodeContentWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ break;
case xmlSecBnHex:
- content = xmlSecBnToHexString(bn);
- if(content == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBnToHexString",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(content);
- return(-1);
- }
- xmlNodeSetContent(cur, content);
- xmlFree(content);
- break;
+ content = xmlSecBnToHexString(bn);
+ if(content == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBnToHexString",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(content);
+ return(-1);
+ }
+ xmlNodeSetContent(cur, content);
+ xmlFree(content);
+ break;
case xmlSecBnDec:
- content = xmlSecBnToDecString(bn);
- if(content == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBnToDecString",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(content);
- return(-1);
- }
- xmlNodeSetContent(cur, content);
- xmlFree(content);
- break;
+ content = xmlSecBnToDecString(bn);
+ if(content == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBnToDecString",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(content);
+ return(-1);
+ }
+ xmlNodeSetContent(cur, content);
+ xmlFree(content);
+ break;
}
if(addLineBreaks) {
- xmlNodeAddContent(cur, xmlSecStringCR);
+ xmlNodeAddContent(cur, xmlSecStringCR);
}
return(0);
@@ -998,14 +998,14 @@ xmlSecBnSetNodeValue(xmlSecBnPtr bn, xmlNodePtr cur, xmlSecBnFormat format, int
/**
* xmlSecBnBlobSetNodeValue:
- * @data: the pointer to BN blob.
- * @dataSize: the size of BN blob.
- * @cur: the poitner to an XML node.
- * @format: the BN format.
- * @reverse: the flag that indicates whether to reverse the buffer before writing.
+ * @data: the pointer to BN blob.
+ * @dataSize: the size of BN blob.
+ * @cur: the poitner to an XML node.
+ * @format: the BN format.
+ * @reverse: the flag that indicates whether to reverse the buffer before writing.
* @addLineBreaks: if the flag is equal to 1 then
- * linebreaks will be added before and after
- * new buffer content.
+ * linebreaks will be added before and after
+ * new buffer content.
*
* Converts the @blob and sets it to node content.
*
@@ -1013,8 +1013,8 @@ xmlSecBnSetNodeValue(xmlSecBnPtr bn, xmlNodePtr cur, xmlSecBnFormat format, int
*/
int
xmlSecBnBlobSetNodeValue(const xmlSecByte* data, xmlSecSize dataSize,
- xmlNodePtr cur, xmlSecBnFormat format, int reverse,
- int addLineBreaks) {
+ xmlNodePtr cur, xmlSecBnFormat format, int reverse,
+ int addLineBreaks) {
xmlSecBn bn;
int ret;
@@ -1023,34 +1023,34 @@ xmlSecBnBlobSetNodeValue(const xmlSecByte* data, xmlSecSize dataSize,
ret = xmlSecBnInitialize(&bn, dataSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBnInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBnInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecBnSetData(&bn, data, dataSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBnSetData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBnFinalize(&bn);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBnSetData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBnFinalize(&bn);
+ return(-1);
}
ret = xmlSecBnSetNodeValue(&bn, cur, format, reverse, addLineBreaks);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBnSetNodeValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBnFinalize(&bn);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBnSetNodeValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBnFinalize(&bn);
+ return(-1);
}
xmlSecBnFinalize(&bn);
diff --git a/src/buffer.c b/src/buffer.c
index c13fe44..e993695 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -33,8 +33,8 @@ static xmlSecSize gInitialSize = 1024;
/**
* xmlSecBufferSetDefaultAllocMode:
- * @defAllocMode: the new default buffer allocation mode.
- * @defInitialSize: the new default buffer minimal intial size.
+ * @defAllocMode: the new default buffer allocation mode.
+ * @defInitialSize: the new default buffer minimal intial size.
*
* Sets new global default allocation mode and minimal intial size.
*/
@@ -48,7 +48,7 @@ xmlSecBufferSetDefaultAllocMode(xmlSecAllocMode defAllocMode, xmlSecSize defInit
/**
* xmlSecBufferCreate:
- * @size: the intial size.
+ * @size: the intial size.
*
* Allocates and initalizes new memory buffer with given size.
* Caller is responsible for calling #xmlSecBufferDestroy function
@@ -63,30 +63,30 @@ xmlSecBufferCreate(xmlSecSize size) {
buf = (xmlSecBufferPtr)xmlMalloc(sizeof(xmlSecBuffer));
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "sizeof(xmlSecBuffer)=%d", sizeof(xmlSecBuffer));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "sizeof(xmlSecBuffer)=%d", sizeof(xmlSecBuffer));
+ return(NULL);
}
ret = xmlSecBufferInitialize(buf, size);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", size);
- xmlSecBufferDestroy(buf);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", size);
+ xmlSecBufferDestroy(buf);
+ return(NULL);
}
return(buf);
}
/**
* xmlSecBufferDestroy:
- * @buf: the pointer to buffer object.
+ * @buf: the pointer to buffer object.
*
* Desrtoys buffer object created with #xmlSecBufferCreate function.
*/
@@ -100,8 +100,8 @@ xmlSecBufferDestroy(xmlSecBufferPtr buf) {
/**
* xmlSecBufferInitialize:
- * @buf: the pointer to buffer object.
- * @size: the initial buffer size.
+ * @buf: the pointer to buffer object.
+ * @size: the initial buffer size.
*
* Initializes buffer object @buf. Caller is responsible for calling
* #xmlSecBufferFinalize function to free allocated resources.
@@ -121,7 +121,7 @@ xmlSecBufferInitialize(xmlSecBufferPtr buf, xmlSecSize size) {
/**
* xmlSecBufferFinalize:
- * @buf: the pointer to buffer object.
+ * @buf: the pointer to buffer object.
*
* Frees allocated resource for a buffer intialized with #xmlSecBufferInitialize
* function.
@@ -132,7 +132,7 @@ xmlSecBufferFinalize(xmlSecBufferPtr buf) {
xmlSecBufferEmpty(buf);
if(buf->data != 0) {
- xmlFree(buf->data);
+ xmlFree(buf->data);
}
buf->data = NULL;
buf->size = buf->maxSize = 0;
@@ -140,7 +140,7 @@ xmlSecBufferFinalize(xmlSecBufferPtr buf) {
/**
* xmlSecBufferEmpty:
- * @buf: the pointer to buffer object.
+ * @buf: the pointer to buffer object.
*
* Empties the buffer.
*/
@@ -149,16 +149,16 @@ xmlSecBufferEmpty(xmlSecBufferPtr buf) {
xmlSecAssert(buf != NULL);
if(buf->data != 0) {
- xmlSecAssert(buf->maxSize > 0);
+ xmlSecAssert(buf->maxSize > 0);
- memset(buf->data, 0, buf->maxSize);
+ memset(buf->data, 0, buf->maxSize);
}
buf->size = 0;
}
/**
* xmlSecBufferGetData:
- * @buf: the pointer to buffer object.
+ * @buf: the pointer to buffer object.
*
* Gets pointer to buffer's data.
*
@@ -173,9 +173,9 @@ xmlSecBufferGetData(xmlSecBufferPtr buf) {
/**
* xmlSecBufferSetData:
- * @buf: the pointer to buffer object.
- * @data: the data.
- * @size: the data size.
+ * @buf: the pointer to buffer object.
+ * @data: the data.
+ * @size: the data size.
*
* Sets the value of the buffer to @data.
*
@@ -189,19 +189,19 @@ xmlSecBufferSetData(xmlSecBufferPtr buf, const xmlSecByte* data, xmlSecSize size
xmlSecBufferEmpty(buf);
if(size > 0) {
- xmlSecAssert2(data != NULL, -1);
-
- ret = xmlSecBufferSetMaxSize(buf, size);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", size);
- return(-1);
+ xmlSecAssert2(data != NULL, -1);
+
+ ret = xmlSecBufferSetMaxSize(buf, size);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", size);
+ return(-1);
}
-
- memcpy(buf->data, data, size);
+
+ memcpy(buf->data, data, size);
}
buf->size = size;
@@ -210,7 +210,7 @@ xmlSecBufferSetData(xmlSecBufferPtr buf, const xmlSecByte* data, xmlSecSize size
/**
* xmlSecBufferGetSize:
- * @buf: the pointer to buffer object.
+ * @buf: the pointer to buffer object.
*
* Gets the current buffer data size.
*
@@ -225,8 +225,8 @@ xmlSecBufferGetSize(xmlSecBufferPtr buf) {
/**
* xmlSecBufferSetSize:
- * @buf: the pointer to buffer object.
- * @size: the new data size.
+ * @buf: the pointer to buffer object.
+ * @size: the new data size.
*
* Sets new buffer data size. If necessary, buffer grows to
* have at least @size bytes.
@@ -241,12 +241,12 @@ xmlSecBufferSetSize(xmlSecBufferPtr buf, xmlSecSize size) {
ret = xmlSecBufferSetMaxSize(buf, size);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", size);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", size);
+ return(-1);
}
@@ -256,7 +256,7 @@ xmlSecBufferSetSize(xmlSecBufferPtr buf, xmlSecSize size) {
/**
* xmlSecBufferGetMaxSize:
- * @buf: the pointer to buffer object.
+ * @buf: the pointer to buffer object.
*
* Gets the maximum (allocated) buffer size.
*
@@ -271,8 +271,8 @@ xmlSecBufferGetMaxSize(xmlSecBufferPtr buf) {
/**
* xmlSecBufferSetMaxSize:
- * @buf: the pointer to buffer object.
- * @size: the new maximum size.
+ * @buf: the pointer to buffer object.
+ * @size: the new maximum size.
*
* Sets new buffer maximum size. If necessary, buffer grows to
* have at least @size bytes.
@@ -286,43 +286,43 @@ xmlSecBufferSetMaxSize(xmlSecBufferPtr buf, xmlSecSize size) {
xmlSecAssert2(buf != NULL, -1);
if(size <= buf->maxSize) {
- return(0);
+ return(0);
}
switch(buf->allocMode) {
- case xmlSecAllocModeExact:
- newSize = size + 8;
- break;
- case xmlSecAllocModeDouble:
- newSize = 2 * size + 32;
- break;
+ case xmlSecAllocModeExact:
+ newSize = size + 8;
+ break;
+ case xmlSecAllocModeDouble:
+ newSize = 2 * size + 32;
+ break;
}
if(newSize < gInitialSize) {
- newSize = gInitialSize;
+ newSize = gInitialSize;
}
if(buf->data != NULL) {
- newData = (xmlSecByte*)xmlRealloc(buf->data, newSize);
+ newData = (xmlSecByte*)xmlRealloc(buf->data, newSize);
} else {
- newData = (xmlSecByte*)xmlMalloc(newSize);
+ newData = (xmlSecByte*)xmlMalloc(newSize);
}
if(newData == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "size=%d", newSize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "size=%d", newSize);
+ return(-1);
}
buf->data = newData;
buf->maxSize = newSize;
if(buf->size < buf->maxSize) {
- xmlSecAssert2(buf->data != NULL, -1);
- memset(buf->data + buf->size, 0, buf->maxSize - buf->size);
+ xmlSecAssert2(buf->data != NULL, -1);
+ memset(buf->data + buf->size, 0, buf->maxSize - buf->size);
}
return(0);
@@ -330,9 +330,9 @@ xmlSecBufferSetMaxSize(xmlSecBufferPtr buf, xmlSecSize size) {
/**
* xmlSecBufferAppend:
- * @buf: the pointer to buffer object.
- * @data: the data.
- * @size: the data size.
+ * @buf: the pointer to buffer object.
+ * @data: the data.
+ * @size: the data size.
*
* Appends the @data after the current data stored in the buffer.
*
@@ -345,20 +345,20 @@ xmlSecBufferAppend(xmlSecBufferPtr buf, const xmlSecByte* data, xmlSecSize size)
xmlSecAssert2(buf != NULL, -1);
if(size > 0) {
- xmlSecAssert2(data != NULL, -1);
+ xmlSecAssert2(data != NULL, -1);
ret = xmlSecBufferSetMaxSize(buf, buf->size + size);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", buf->size + size);
- return(-1);
- }
-
- memcpy(buf->data + buf->size, data, size);
- buf->size += size;
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", buf->size + size);
+ return(-1);
+ }
+
+ memcpy(buf->data + buf->size, data, size);
+ buf->size += size;
}
return(0);
@@ -366,9 +366,9 @@ xmlSecBufferAppend(xmlSecBufferPtr buf, const xmlSecByte* data, xmlSecSize size)
/**
* xmlSecBufferPrepend:
- * @buf: the pointer to buffer object.
- * @data: the data.
- * @size: the data size.
+ * @buf: the pointer to buffer object.
+ * @data: the data.
+ * @size: the data size.
*
* Prepends the @data before the current data stored in the buffer.
*
@@ -381,21 +381,21 @@ xmlSecBufferPrepend(xmlSecBufferPtr buf, const xmlSecByte* data, xmlSecSize size
xmlSecAssert2(buf != NULL, -1);
if(size > 0) {
- xmlSecAssert2(data != NULL, -1);
-
- ret = xmlSecBufferSetMaxSize(buf, buf->size + size);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", buf->size + size);
- return(-1);
- }
-
- memmove(buf->data + size, buf->data, buf->size);
- memcpy(buf->data, data, size);
- buf->size += size;
+ xmlSecAssert2(data != NULL, -1);
+
+ ret = xmlSecBufferSetMaxSize(buf, buf->size + size);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", buf->size + size);
+ return(-1);
+ }
+
+ memmove(buf->data + size, buf->data, buf->size);
+ memcpy(buf->data, data, size);
+ buf->size += size;
}
return(0);
@@ -403,8 +403,8 @@ xmlSecBufferPrepend(xmlSecBufferPtr buf, const xmlSecByte* data, xmlSecSize size
/**
* xmlSecBufferRemoveHead:
- * @buf: the pointer to buffer object.
- * @size: the number of bytes to be removed.
+ * @buf: the pointer to buffer object.
+ * @size: the number of bytes to be removed.
*
* Removes @size bytes from the beginning of the current buffer.
*
@@ -415,24 +415,24 @@ xmlSecBufferRemoveHead(xmlSecBufferPtr buf, xmlSecSize size) {
xmlSecAssert2(buf != NULL, -1);
if(size < buf->size) {
- xmlSecAssert2(buf->data != NULL, -1);
-
- buf->size -= size;
- memmove(buf->data, buf->data + size, buf->size);
+ xmlSecAssert2(buf->data != NULL, -1);
+
+ buf->size -= size;
+ memmove(buf->data, buf->data + size, buf->size);
} else {
- buf->size = 0;
+ buf->size = 0;
}
if(buf->size < buf->maxSize) {
- xmlSecAssert2(buf->data != NULL, -1);
- memset(buf->data + buf->size, 0, buf->maxSize - buf->size);
+ xmlSecAssert2(buf->data != NULL, -1);
+ memset(buf->data + buf->size, 0, buf->maxSize - buf->size);
}
return(0);
}
/**
* xmlSecBufferRemoveTail:
- * @buf: the pointer to buffer object.
- * @size: the number of bytes to be removed.
+ * @buf: the pointer to buffer object.
+ * @size: the number of bytes to be removed.
*
* Removes @size bytes from the end of current buffer.
*
@@ -443,21 +443,21 @@ xmlSecBufferRemoveTail(xmlSecBufferPtr buf, xmlSecSize size) {
xmlSecAssert2(buf != NULL, -1);
if(size < buf->size) {
- buf->size -= size;
+ buf->size -= size;
} else {
- buf->size = 0;
+ buf->size = 0;
}
if(buf->size < buf->maxSize) {
- xmlSecAssert2(buf->data != NULL, -1);
- memset(buf->data + buf->size, 0, buf->maxSize - buf->size);
+ xmlSecAssert2(buf->data != NULL, -1);
+ memset(buf->data + buf->size, 0, buf->maxSize - buf->size);
}
return(0);
}
/**
* xmlSecBufferReadFile:
- * @buf: the pointer to buffer object.
- * @filename: the filename.
+ * @buf: the pointer to buffer object.
+ * @filename: the filename.
*
* Reads the content of the file @filename in the buffer.
*
@@ -474,19 +474,19 @@ xmlSecBufferReadFile(xmlSecBufferPtr buf, const char* filename) {
f = fopen(filename, "rb");
if(f == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "fopen",
- XMLSEC_ERRORS_R_IO_FAILED,
- "filename=%s;errno=%d",
- xmlSecErrorsSafeString(filename),
- errno);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "fopen",
+ XMLSEC_ERRORS_R_IO_FAILED,
+ "filename=%s;errno=%d",
+ xmlSecErrorsSafeString(filename),
+ errno);
+ return(-1);
}
while(1) {
len = fread(buffer, 1, sizeof(buffer), f);
- if(len == 0) {
+ if(len == 0) {
break;
}else if(len < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
@@ -495,13 +495,13 @@ xmlSecBufferReadFile(xmlSecBufferPtr buf, const char* filename) {
XMLSEC_ERRORS_R_IO_FAILED,
"filename=%s;errno=%d",
xmlSecErrorsSafeString(filename),
- errno);
+ errno);
fclose(f);
return(-1);
}
- ret = xmlSecBufferAppend(buf, buffer, len);
- if(ret < 0) {
+ ret = xmlSecBufferAppend(buf, buffer, len);
+ if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
"xmlSecBufferAppend",
@@ -519,8 +519,8 @@ xmlSecBufferReadFile(xmlSecBufferPtr buf, const char* filename) {
/**
* xmlSecBufferBase64NodeContentRead:
- * @buf: the pointer to buffer object.
- * @node: the pointer to node.
+ * @buf: the pointer to buffer object.
+ * @node: the pointer to node.
*
* Reads the content of the @node, base64 decodes it and stores the
* result in the buffer.
@@ -538,47 +538,47 @@ xmlSecBufferBase64NodeContentRead(xmlSecBufferPtr buf, xmlNodePtr node) {
content = xmlNodeGetContent(node);
if(content == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* base64 decode size is less than input size */
ret = xmlSecBufferSetMaxSize(buf, xmlStrlen(content));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(content);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(content);
+ return(-1);
}
ret = xmlSecBase64Decode(content, xmlSecBufferGetData(buf), xmlSecBufferGetMaxSize(buf));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64Decode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(content);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64Decode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(content);
+ return(-1);
}
size = ret;
ret = xmlSecBufferSetSize(buf, size);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", size);
- xmlFree(content);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", size);
+ xmlFree(content);
+ return(-1);
}
xmlFree(content);
@@ -587,9 +587,9 @@ xmlSecBufferBase64NodeContentRead(xmlSecBufferPtr buf, xmlNodePtr node) {
/**
* xmlSecBufferBase64NodeContentWrite:
- * @buf: the pointer to buffer object.
- * @node: the pointer to a node.
- * @columns: the max line size fro base64 encoded data.
+ * @buf: the pointer to buffer object.
+ * @node: the pointer to a node.
+ * @columns: the max line size fro base64 encoded data.
*
* Sets the content of the @node to the base64 encoded buffer data.
*
@@ -604,12 +604,12 @@ xmlSecBufferBase64NodeContentWrite(xmlSecBufferPtr buf, xmlNodePtr node, int col
content = xmlSecBase64Encode(xmlSecBufferGetData(buf), xmlSecBufferGetSize(buf), columns);
if(content == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64Encode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64Encode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
xmlNodeAddContent(node, content);
xmlFree(content);
@@ -622,14 +622,14 @@ xmlSecBufferBase64NodeContentWrite(xmlSecBufferPtr buf, xmlNodePtr node, int col
* IO buffer
*
************************************************************************/
-static int xmlSecBufferIOWrite (xmlSecBufferPtr buf,
- const xmlSecByte *data,
- xmlSecSize size);
-static int xmlSecBufferIOClose (xmlSecBufferPtr buf);
+static int xmlSecBufferIOWrite (xmlSecBufferPtr buf,
+ const xmlSecByte *data,
+ xmlSecSize size);
+static int xmlSecBufferIOClose (xmlSecBufferPtr buf);
/**
* xmlSecBufferCreateOutputBuffer:
- * @buf: the pointer to buffer.
+ * @buf: the pointer to buffer.
*
* Creates new LibXML output buffer to store data in the @buf. Caller is
* responsible for destroying @buf when processing is done.
@@ -640,9 +640,9 @@ static int xmlSecBufferIOClose (xmlSecBufferPtr buf);
xmlOutputBufferPtr
xmlSecBufferCreateOutputBuffer(xmlSecBufferPtr buf) {
return(xmlOutputBufferCreateIO((xmlOutputWriteCallback)xmlSecBufferIOWrite,
- (xmlOutputCloseCallback)xmlSecBufferIOClose,
- buf,
- NULL));
+ (xmlOutputCloseCallback)xmlSecBufferIOClose,
+ buf,
+ NULL));
}
static int
@@ -654,12 +654,12 @@ xmlSecBufferIOWrite(xmlSecBufferPtr buf, const xmlSecByte *data, xmlSecSize size
ret = xmlSecBufferAppend(buf, data, size);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", size);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", size);
+ return(-1);
}
return(size);
diff --git a/src/c14n.c b/src/c14n.c
index 384e2d8..2025793 100644
--- a/src/c14n.c
+++ b/src/c14n.c
@@ -32,12 +32,12 @@
* after xmlSecTransform structure
*
*****************************************************************************/
-#define xmlSecTransformC14NSize \
+#define xmlSecTransformC14NSize \
(sizeof(xmlSecTransform) + sizeof(xmlSecPtrList))
#define xmlSecTransformC14NGetNsList(transform) \
((xmlSecTransformCheckSize((transform), xmlSecTransformC14NSize)) ? \
- (xmlSecPtrListPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)) : \
- (xmlSecPtrListPtr)NULL)
+ (xmlSecPtrListPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)) : \
+ (xmlSecPtrListPtr)NULL)
#define xmlSecTransformC14NCheckId(transform) \
(xmlSecTransformInclC14NCheckId((transform)) || \
@@ -55,23 +55,23 @@
xmlSecTransformCheckId((transform), xmlSecTransformExclC14NWithCommentsId) )
-static int xmlSecTransformC14NInitialize (xmlSecTransformPtr transform);
-static void xmlSecTransformC14NFinalize (xmlSecTransformPtr transform);
-static int xmlSecTransformC14NNodeRead (xmlSecTransformPtr transform,
- xmlNodePtr node,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecTransformC14NPushXml (xmlSecTransformPtr transform,
- xmlSecNodeSetPtr nodes,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecTransformC14NPopBin (xmlSecTransformPtr transform,
- xmlSecByte* data,
- xmlSecSize maxDataSize,
- xmlSecSize* dataSize,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecTransformC14NExecute (xmlSecTransformId id,
- xmlSecNodeSetPtr nodes,
- xmlChar** nsList,
- xmlOutputBufferPtr buf);
+static int xmlSecTransformC14NInitialize (xmlSecTransformPtr transform);
+static void xmlSecTransformC14NFinalize (xmlSecTransformPtr transform);
+static int xmlSecTransformC14NNodeRead (xmlSecTransformPtr transform,
+ xmlNodePtr node,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecTransformC14NPushXml (xmlSecTransformPtr transform,
+ xmlSecNodeSetPtr nodes,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecTransformC14NPopBin (xmlSecTransformPtr transform,
+ xmlSecByte* data,
+ xmlSecSize maxDataSize,
+ xmlSecSize* dataSize,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecTransformC14NExecute (xmlSecTransformId id,
+ xmlSecNodeSetPtr nodes,
+ xmlChar** nsList,
+ xmlOutputBufferPtr buf);
static int
xmlSecTransformC14NInitialize(xmlSecTransformPtr transform) {
xmlSecPtrListPtr nsList;
@@ -84,12 +84,12 @@ xmlSecTransformC14NInitialize(xmlSecTransformPtr transform) {
ret = xmlSecPtrListInitialize(nsList, xmlSecStringListId);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecPtrListInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecPtrListInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
@@ -126,80 +126,80 @@ xmlSecTransformC14NNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSe
/* there is only one optional node */
cur = xmlSecGetNextElementNode(node->children);
if(cur != NULL) {
- if(!xmlSecCheckNodeName(cur, xmlSecNodeInclusiveNamespaces, xmlSecNsExcC14N)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ if(!xmlSecCheckNodeName(cur, xmlSecNodeInclusiveNamespaces, xmlSecNsExcC14N)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
list = xmlGetProp(cur, xmlSecAttrPrefixList);
- if(list == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- xmlSecErrorsSafeString(xmlSecAttrPrefixList),
- XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
- }
+ if(list == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ xmlSecErrorsSafeString(xmlSecAttrPrefixList),
+ XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
+ }
/* the list of namespaces is space separated */
- for(p = n = list; ((p != NULL) && ((*p) != '\0')); p = n) {
- n = (xmlChar*)xmlStrchr(p, ' ');
- if(n != NULL) {
- *(n++) = '\0';
- }
-
- tmp = xmlStrdup(p);
- if(tmp == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_STRDUP_FAILED,
- "len=%d", xmlStrlen(p));
- xmlFree(list);
- return(-1);
- }
-
- ret = xmlSecPtrListAdd(nsList, tmp);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(tmp);
- xmlFree(list);
- return(-1);
- }
- }
+ for(p = n = list; ((p != NULL) && ((*p) != '\0')); p = n) {
+ n = (xmlChar*)xmlStrchr(p, ' ');
+ if(n != NULL) {
+ *(n++) = '\0';
+ }
+
+ tmp = xmlStrdup(p);
+ if(tmp == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_STRDUP_FAILED,
+ "len=%d", xmlStrlen(p));
+ xmlFree(list);
+ return(-1);
+ }
+
+ ret = xmlSecPtrListAdd(nsList, tmp);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(tmp);
+ xmlFree(list);
+ return(-1);
+ }
+ }
xmlFree(list);
- /* add NULL at the end */
+ /* add NULL at the end */
ret = xmlSecPtrListAdd(nsList, NULL);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- cur = xmlSecGetNextElementNode(cur->next);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* check that we have nothing else */
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -207,7 +207,7 @@ xmlSecTransformC14NNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSe
static int
xmlSecTransformC14NPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nodes,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecTransformCtxPtr transformCtx) {
xmlOutputBufferPtr buf;
xmlSecPtrListPtr nsList;
int ret;
@@ -220,42 +220,42 @@ xmlSecTransformC14NPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nodes,
/* check/update current transform status */
switch(transform->status) {
case xmlSecTransformStatusNone:
- transform->status = xmlSecTransformStatusWorking;
- break;
+ transform->status = xmlSecTransformStatusWorking;
+ break;
case xmlSecTransformStatusWorking:
case xmlSecTransformStatusFinished:
- return(0);
+ return(0);
default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
xmlSecAssert2(transform->status == xmlSecTransformStatusWorking, -1);
/* prepare output buffer: next transform or ourselves */
if(transform->next != NULL) {
- buf = xmlSecTransformCreateOutputBuffer(transform->next, transformCtx);
- if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformCreateOutputBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ buf = xmlSecTransformCreateOutputBuffer(transform->next, transformCtx);
+ if(buf == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecTransformCreateOutputBuffer",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
} else {
- buf = xmlSecBufferCreateOutputBuffer(&(transform->outBuf));
- if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferCreateOutputBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ buf = xmlSecBufferCreateOutputBuffer(&(transform->outBuf));
+ if(buf == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferCreateOutputBuffer",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
/* we are using a semi-hack here: we know that xmlSecPtrList keeps
@@ -265,23 +265,23 @@ xmlSecTransformC14NPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nodes,
ret = xmlSecTransformC14NExecute(transform->id, nodes, (xmlChar**)(nsList->data), buf);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformC14NExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlOutputBufferClose(buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecTransformC14NExecute",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlOutputBufferClose(buf);
+ return(-1);
}
ret = xmlOutputBufferClose(buf);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlOutputBufferClose",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlOutputBufferClose",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
transform->status = xmlSecTransformStatusFinished;
return(0);
@@ -289,8 +289,8 @@ xmlSecTransformC14NPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nodes,
static int
xmlSecTransformC14NPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
- xmlSecSize maxDataSize, xmlSecSize* dataSize,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecSize maxDataSize, xmlSecSize* dataSize,
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecPtrListPtr nsList;
xmlSecBufferPtr out;
int ret;
@@ -302,105 +302,105 @@ xmlSecTransformC14NPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
out = &(transform->outBuf);
if(transform->status == xmlSecTransformStatusNone) {
- xmlOutputBufferPtr buf;
-
- xmlSecAssert2(transform->inNodes == NULL, -1);
-
- /* todo: isn't it an error? */
- if(transform->prev == NULL) {
- (*dataSize) = 0;
- transform->status = xmlSecTransformStatusFinished;
- return(0);
- }
-
- /* get xml data from previous transform */
- ret = xmlSecTransformPopXml(transform->prev, &(transform->inNodes), transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformPopXml",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- /* dump everything to internal buffer */
- buf = xmlSecBufferCreateOutputBuffer(out);
- if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferCreateOutputBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- /* we are using a semi-hack here: we know that xmlSecPtrList keeps
- * all pointers in the big array */
- nsList = xmlSecTransformC14NGetNsList(transform);
- xmlSecAssert2(xmlSecPtrListCheckId(nsList, xmlSecStringListId), -1);
-
- ret = xmlSecTransformC14NExecute(transform->id, transform->inNodes, (xmlChar**)(nsList->data), buf);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformC14NExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlOutputBufferClose(buf);
- return(-1);
- }
- ret = xmlOutputBufferClose(buf);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlOutputBufferClose",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- transform->status = xmlSecTransformStatusWorking;
+ xmlOutputBufferPtr buf;
+
+ xmlSecAssert2(transform->inNodes == NULL, -1);
+
+ /* todo: isn't it an error? */
+ if(transform->prev == NULL) {
+ (*dataSize) = 0;
+ transform->status = xmlSecTransformStatusFinished;
+ return(0);
+ }
+
+ /* get xml data from previous transform */
+ ret = xmlSecTransformPopXml(transform->prev, &(transform->inNodes), transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecTransformPopXml",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ /* dump everything to internal buffer */
+ buf = xmlSecBufferCreateOutputBuffer(out);
+ if(buf == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferCreateOutputBuffer",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ /* we are using a semi-hack here: we know that xmlSecPtrList keeps
+ * all pointers in the big array */
+ nsList = xmlSecTransformC14NGetNsList(transform);
+ xmlSecAssert2(xmlSecPtrListCheckId(nsList, xmlSecStringListId), -1);
+
+ ret = xmlSecTransformC14NExecute(transform->id, transform->inNodes, (xmlChar**)(nsList->data), buf);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecTransformC14NExecute",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlOutputBufferClose(buf);
+ return(-1);
+ }
+ ret = xmlOutputBufferClose(buf);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlOutputBufferClose",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ transform->status = xmlSecTransformStatusWorking;
}
if(transform->status == xmlSecTransformStatusWorking) {
- xmlSecSize outSize;
-
- /* return chunk after chunk */
- outSize = xmlSecBufferGetSize(out);
- if(outSize > maxDataSize) {
- outSize = maxDataSize;
- }
- if(outSize > XMLSEC_TRANSFORM_BINARY_CHUNK) {
- outSize = XMLSEC_TRANSFORM_BINARY_CHUNK;
- }
- if(outSize > 0) {
- xmlSecAssert2(xmlSecBufferGetData(&(transform->outBuf)), -1);
-
- memcpy(data, xmlSecBufferGetData(&(transform->outBuf)), outSize);
- ret = xmlSecBufferRemoveHead(&(transform->outBuf), outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize);
- return(-1);
- }
- } else if(xmlSecBufferGetSize(out) == 0) {
- transform->status = xmlSecTransformStatusFinished;
- }
- (*dataSize) = outSize;
+ xmlSecSize outSize;
+
+ /* return chunk after chunk */
+ outSize = xmlSecBufferGetSize(out);
+ if(outSize > maxDataSize) {
+ outSize = maxDataSize;
+ }
+ if(outSize > XMLSEC_TRANSFORM_BINARY_CHUNK) {
+ outSize = XMLSEC_TRANSFORM_BINARY_CHUNK;
+ }
+ if(outSize > 0) {
+ xmlSecAssert2(xmlSecBufferGetData(&(transform->outBuf)), -1);
+
+ memcpy(data, xmlSecBufferGetData(&(transform->outBuf)), outSize);
+ ret = xmlSecBufferRemoveHead(&(transform->outBuf), outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize);
+ return(-1);
+ }
+ } else if(xmlSecBufferGetSize(out) == 0) {
+ transform->status = xmlSecTransformStatusFinished;
+ }
+ (*dataSize) = outSize;
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no output */
- xmlSecAssert2(xmlSecBufferGetSize(out) == 0, -1);
- (*dataSize) = 0;
+ /* the only way we can get here is if there is no output */
+ xmlSecAssert2(xmlSecBufferGetSize(out) == 0, -1);
+ (*dataSize) = 0;
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
@@ -408,7 +408,7 @@ xmlSecTransformC14NPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
static int
xmlSecTransformC14NExecute(xmlSecTransformId id, xmlSecNodeSetPtr nodes, xmlChar** nsList,
- xmlOutputBufferPtr buf) {
+ xmlOutputBufferPtr buf) {
int ret;
xmlSecAssert2(id != xmlSecTransformIdUnknown, -1);
@@ -418,48 +418,48 @@ xmlSecTransformC14NExecute(xmlSecTransformId id, xmlSecNodeSetPtr nodes, xmlChar
/* execute c14n transform */
if(id == xmlSecTransformInclC14NId) {
- ret = xmlC14NExecute(nodes->doc,
- (xmlC14NIsVisibleCallback)xmlSecNodeSetContains,
- nodes, XML_C14N_1_0, NULL, 0, buf);
+ ret = xmlC14NExecute(nodes->doc,
+ (xmlC14NIsVisibleCallback)xmlSecNodeSetContains,
+ nodes, XML_C14N_1_0, NULL, 0, buf);
} else if(id == xmlSecTransformInclC14NWithCommentsId) {
- ret = xmlC14NExecute(nodes->doc,
- (xmlC14NIsVisibleCallback)xmlSecNodeSetContains,
- nodes, XML_C14N_1_0, NULL, 1, buf);
+ ret = xmlC14NExecute(nodes->doc,
+ (xmlC14NIsVisibleCallback)xmlSecNodeSetContains,
+ nodes, XML_C14N_1_0, NULL, 1, buf);
} else if(id == xmlSecTransformInclC14N11Id) {
- ret = xmlC14NExecute(nodes->doc,
- (xmlC14NIsVisibleCallback)xmlSecNodeSetContains,
- nodes, XML_C14N_1_1, NULL, 0, buf);
+ ret = xmlC14NExecute(nodes->doc,
+ (xmlC14NIsVisibleCallback)xmlSecNodeSetContains,
+ nodes, XML_C14N_1_1, NULL, 0, buf);
} else if(id == xmlSecTransformInclC14N11WithCommentsId) {
- ret = xmlC14NExecute(nodes->doc,
- (xmlC14NIsVisibleCallback)xmlSecNodeSetContains,
- nodes, XML_C14N_1_1, NULL, 1, buf);
+ ret = xmlC14NExecute(nodes->doc,
+ (xmlC14NIsVisibleCallback)xmlSecNodeSetContains,
+ nodes, XML_C14N_1_1, NULL, 1, buf);
} else if(id == xmlSecTransformExclC14NId) {
- ret = xmlC14NExecute(nodes->doc,
- (xmlC14NIsVisibleCallback)xmlSecNodeSetContains,
- nodes, XML_C14N_EXCLUSIVE_1_0, nsList, 0, buf);
+ ret = xmlC14NExecute(nodes->doc,
+ (xmlC14NIsVisibleCallback)xmlSecNodeSetContains,
+ nodes, XML_C14N_EXCLUSIVE_1_0, nsList, 0, buf);
} else if(id == xmlSecTransformExclC14NWithCommentsId) {
- ret = xmlC14NExecute(nodes->doc,
- (xmlC14NIsVisibleCallback)xmlSecNodeSetContains,
- nodes, XML_C14N_EXCLUSIVE_1_0, nsList, 1, buf);
+ ret = xmlC14NExecute(nodes->doc,
+ (xmlC14NIsVisibleCallback)xmlSecNodeSetContains,
+ nodes, XML_C14N_EXCLUSIVE_1_0, nsList, 1, buf);
} else if(id == xmlSecTransformRemoveXmlTagsC14NId) {
- ret = xmlSecNodeSetDumpTextNodes(nodes, buf);
+ ret = xmlSecNodeSetDumpTextNodes(nodes, buf);
} else {
- /* shoudn't be possible to come here, actually */
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ /* shoudn't be possible to come here, actually */
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)),
- "xmlC14NExecute",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)),
+ "xmlC14NExecute",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -472,30 +472,30 @@ xmlSecTransformC14NExecute(xmlSecTransformId id, xmlSecNodeSetPtr nodes, xmlChar
***************************************************************************/
static xmlSecTransformKlass xmlSecTransformInclC14NKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecTransformC14NSize, /* xmlSecSize objSize */
-
- xmlSecNameC14N, /* const xmlChar* name; */
- xmlSecHrefC14N, /* const xmlChar* href; */
- xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
- /* xmlSecAlgorithmUsage usage; */
-
- xmlSecTransformC14NInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecTransformC14NFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- NULL, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformC14NPopBin, /* xmlSecTransformPopBinMethod popBin; */
- xmlSecTransformC14NPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- NULL, /* xmlSecTransformExecuteMethod execute; */
-
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecTransformC14NSize, /* xmlSecSize objSize */
+
+ xmlSecNameC14N, /* const xmlChar* name; */
+ xmlSecHrefC14N, /* const xmlChar* href; */
+ xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
+ /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecTransformC14NInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecTransformC14NFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ NULL, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformC14NPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ xmlSecTransformC14NPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ NULL, /* xmlSecTransformExecuteMethod execute; */
+
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -519,31 +519,31 @@ xmlSecTransformInclC14NGetKlass(void) {
***************************************************************************/
static xmlSecTransformKlass xmlSecTransformInclC14NWithCommentsKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecTransformC14NSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecTransformC14NSize, /* xmlSecSize objSize */
/* same as xmlSecTransformId */
- xmlSecNameC14NWithComments, /* const xmlChar* name; */
- xmlSecHrefC14NWithComments, /* const xmlChar* href; */
- xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
- /* xmlSecAlgorithmUsage usage; */
-
- xmlSecTransformC14NInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecTransformC14NFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod read; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- NULL, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformC14NPopBin, /* xmlSecTransformPopBinMethod popBin; */
- xmlSecTransformC14NPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- NULL, /* xmlSecTransformExecuteMethod execute; */
-
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ xmlSecNameC14NWithComments, /* const xmlChar* name; */
+ xmlSecHrefC14NWithComments, /* const xmlChar* href; */
+ xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
+ /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecTransformC14NInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecTransformC14NFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod read; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ NULL, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformC14NPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ xmlSecTransformC14NPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ NULL, /* xmlSecTransformExecuteMethod execute; */
+
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -567,30 +567,30 @@ xmlSecTransformInclC14NWithCommentsGetKlass(void) {
***************************************************************************/
static xmlSecTransformKlass xmlSecTransformInclC14N11Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecTransformC14NSize, /* xmlSecSize objSize */
-
- xmlSecNameC14N11, /* const xmlChar* name; */
- xmlSecHrefC14N11, /* const xmlChar* href; */
- xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
- /* xmlSecAlgorithmUsage usage; */
-
- xmlSecTransformC14NInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecTransformC14NFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- NULL, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformC14NPopBin, /* xmlSecTransformPopBinMethod popBin; */
- xmlSecTransformC14NPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- NULL, /* xmlSecTransformExecuteMethod execute; */
-
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecTransformC14NSize, /* xmlSecSize objSize */
+
+ xmlSecNameC14N11, /* const xmlChar* name; */
+ xmlSecHrefC14N11, /* const xmlChar* href; */
+ xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
+ /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecTransformC14NInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecTransformC14NFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ NULL, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformC14NPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ xmlSecTransformC14NPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ NULL, /* xmlSecTransformExecuteMethod execute; */
+
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -612,31 +612,31 @@ xmlSecTransformInclC14N11GetKlass(void) {
***************************************************************************/
static xmlSecTransformKlass xmlSecTransformInclC14N11WithCommentsKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecTransformC14NSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecTransformC14NSize, /* xmlSecSize objSize */
/* same as xmlSecTransformId */
- xmlSecNameC14N11WithComments, /* const xmlChar* name; */
- xmlSecHrefC14N11WithComments, /* const xmlChar* href; */
- xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
- /* xmlSecAlgorithmUsage usage; */
-
- xmlSecTransformC14NInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecTransformC14NFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod read; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- NULL, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformC14NPopBin, /* xmlSecTransformPopBinMethod popBin; */
- xmlSecTransformC14NPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- NULL, /* xmlSecTransformExecuteMethod execute; */
-
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ xmlSecNameC14N11WithComments, /* const xmlChar* name; */
+ xmlSecHrefC14N11WithComments, /* const xmlChar* href; */
+ xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
+ /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecTransformC14NInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecTransformC14NFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod read; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ NULL, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformC14NPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ xmlSecTransformC14NPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ NULL, /* xmlSecTransformExecuteMethod execute; */
+
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -659,30 +659,30 @@ xmlSecTransformInclC14N11WithCommentsGetKlass(void) {
***************************************************************************/
static xmlSecTransformKlass xmlSecTransformExclC14NKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecTransformC14NSize, /* xmlSecSize objSize */
-
- xmlSecNameExcC14N, /* const xmlChar* name; */
- xmlSecHrefExcC14N, /* const xmlChar* href; */
- xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
- /* xmlSecAlgorithmUsage usage; */
-
- xmlSecTransformC14NInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecTransformC14NFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- xmlSecTransformC14NNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- NULL, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformC14NPopBin, /* xmlSecTransformPopBinMethod popBin; */
- xmlSecTransformC14NPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- NULL, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecTransformC14NSize, /* xmlSecSize objSize */
+
+ xmlSecNameExcC14N, /* const xmlChar* name; */
+ xmlSecHrefExcC14N, /* const xmlChar* href; */
+ xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
+ /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecTransformC14NInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecTransformC14NFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ xmlSecTransformC14NNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ NULL, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformC14NPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ xmlSecTransformC14NPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ NULL, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -705,30 +705,30 @@ xmlSecTransformExclC14NGetKlass(void) {
***************************************************************************/
static xmlSecTransformKlass xmlSecTransformExclC14NWithCommentsKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecTransformC14NSize, /* xmlSecSize objSize */
-
- xmlSecNameExcC14NWithComments, /* const xmlChar* name; */
- xmlSecHrefExcC14NWithComments, /* const xmlChar* href; */
- xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
- /* xmlSecAlgorithmUsage usage; */
-
- xmlSecTransformC14NInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecTransformC14NFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- xmlSecTransformC14NNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- NULL, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformC14NPopBin, /* xmlSecTransformPopBinMethod popBin; */
- xmlSecTransformC14NPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- NULL, /* xmlSecTransformExecuteMethod execute; */
-
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecTransformC14NSize, /* xmlSecSize objSize */
+
+ xmlSecNameExcC14NWithComments, /* const xmlChar* name; */
+ xmlSecHrefExcC14NWithComments, /* const xmlChar* href; */
+ xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
+ /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecTransformC14NInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecTransformC14NFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ xmlSecTransformC14NNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ NULL, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformC14NPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ xmlSecTransformC14NPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ NULL, /* xmlSecTransformExecuteMethod execute; */
+
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -751,30 +751,30 @@ xmlSecTransformExclC14NWithCommentsGetKlass(void) {
***************************************************************************/
static xmlSecTransformKlass xmlSecTransformRemoveXmlTagsC14NKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecTransformC14NSize, /* xmlSecSize objSize */
-
- BAD_CAST "remove-xml-tags-transform", /* const xmlChar* name; */
- NULL, /* const xmlChar* href; */
- xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
- /* xmlSecAlgorithmUsage usage; */
-
- xmlSecTransformC14NInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecTransformC14NFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- NULL, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformC14NPopBin, /* xmlSecTransformPopBinMethod popBin; */
- xmlSecTransformC14NPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- NULL, /* xmlSecTransformExecuteMethod execute; */
-
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecTransformC14NSize, /* xmlSecSize objSize */
+
+ BAD_CAST "remove-xml-tags-transform", /* const xmlChar* name; */
+ NULL, /* const xmlChar* href; */
+ xmlSecTransformUsageC14NMethod | xmlSecTransformUsageDSigTransform,
+ /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecTransformC14NInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecTransformC14NFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ NULL, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformC14NPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ xmlSecTransformC14NPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ NULL, /* xmlSecTransformExecuteMethod execute; */
+
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
diff --git a/src/dl.c b/src/dl.c
index 6c0aa18..ba4c5fc 100644
--- a/src/dl.c
+++ b/src/dl.c
@@ -45,12 +45,12 @@
* loaded libraries list
*
**********************************************************************/
-typedef struct _xmlSecCryptoDLLibrary xmlSecCryptoDLLibrary,
- *xmlSecCryptoDLLibraryPtr;
+typedef struct _xmlSecCryptoDLLibrary xmlSecCryptoDLLibrary,
+ *xmlSecCryptoDLLibraryPtr;
struct _xmlSecCryptoDLLibrary {
- xmlChar* name;
- xmlChar* filename;
- xmlChar* getFunctionsName;
+ xmlChar* name;
+ xmlChar* filename;
+ xmlChar* getFunctionsName;
xmlSecCryptoDLFunctionsPtr functions;
#ifdef XMLSEC_DL_LIBLTDL
@@ -62,27 +62,27 @@ struct _xmlSecCryptoDLLibrary {
#endif /* XMLSEC_DL_WIN32 */
};
-static xmlSecCryptoDLLibraryPtr xmlSecCryptoDLLibraryCreate (const xmlChar* name);
-static void xmlSecCryptoDLLibraryDestroy (xmlSecCryptoDLLibraryPtr lib);
-static xmlSecCryptoDLLibraryPtr xmlSecCryptoDLLibraryDuplicate (xmlSecCryptoDLLibraryPtr lib);
-static xmlChar* xmlSecCryptoDLLibraryConstructFilename (const xmlChar* name);
-static xmlChar* xmlSecCryptoDLLibraryConstructGetFunctionsName(const xmlChar* name);
-
+static xmlSecCryptoDLLibraryPtr xmlSecCryptoDLLibraryCreate (const xmlChar* name);
+static void xmlSecCryptoDLLibraryDestroy (xmlSecCryptoDLLibraryPtr lib);
+static xmlSecCryptoDLLibraryPtr xmlSecCryptoDLLibraryDuplicate (xmlSecCryptoDLLibraryPtr lib);
+static xmlChar* xmlSecCryptoDLLibraryConstructFilename (const xmlChar* name);
+static xmlChar* xmlSecCryptoDLLibraryConstructGetFunctionsName(const xmlChar* name);
+
static xmlSecPtrListKlass xmlSecCryptoDLLibrariesListKlass = {
BAD_CAST "dl-libraries-list",
(xmlSecPtrDuplicateItemMethod)xmlSecCryptoDLLibraryDuplicate,/* xmlSecPtrDuplicateItemMethod duplicateItem; */
- (xmlSecPtrDestroyItemMethod)xmlSecCryptoDLLibraryDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */
- NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
- NULL, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
+ (xmlSecPtrDestroyItemMethod)xmlSecCryptoDLLibraryDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */
+ NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
+ NULL, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
};
-static xmlSecPtrListId xmlSecCryptoDLLibrariesListGetKlass (void);
-static int xmlSecCryptoDLLibrariesListFindByName (xmlSecPtrListPtr list,
- const xmlChar* name);
+static xmlSecPtrListId xmlSecCryptoDLLibrariesListGetKlass (void);
+static int xmlSecCryptoDLLibrariesListFindByName (xmlSecPtrListPtr list,
+ const xmlChar* name);
typedef xmlSecCryptoDLFunctionsPtr (*xmlSecCryptoGetFunctionsCallback)(void);
-static xmlSecCryptoDLLibraryPtr
+static xmlSecCryptoDLLibraryPtr
xmlSecCryptoDLLibraryCreate(const xmlChar* name) {
xmlSecCryptoDLLibraryPtr lib;
xmlSecCryptoGetFunctionsCallback getFunctions;
@@ -94,119 +94,119 @@ xmlSecCryptoDLLibraryCreate(const xmlChar* name) {
/* Allocate a new xmlSecCryptoDLLibrary and fill the fields. */
lib = (xmlSecCryptoDLLibraryPtr)xmlMalloc(sizeof(xmlSecCryptoDLLibrary));
if(lib == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "size=%d", sizeof(lib));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "size=%d", sizeof(lib));
+ return(NULL);
}
memset(lib, 0, sizeof(xmlSecCryptoDLLibrary));
lib->name = xmlStrdup(name);
if(lib->name == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- "xmlStrdup",
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecCryptoDLLibraryDestroy(lib);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ "xmlStrdup",
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecCryptoDLLibraryDestroy(lib);
+ return(NULL);
}
lib->filename = xmlSecCryptoDLLibraryConstructFilename(name);
if(lib->filename == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- "xmlSecCryptoDLLibraryConstructFilename",
- NULL,
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecCryptoDLLibraryDestroy(lib);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ "xmlSecCryptoDLLibraryConstructFilename",
+ NULL,
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecCryptoDLLibraryDestroy(lib);
+ return(NULL);
}
lib->getFunctionsName = xmlSecCryptoDLLibraryConstructGetFunctionsName(name);
if(lib->getFunctionsName == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- "xmlSecCryptoDLLibraryConstructGetFunctionsName",
- NULL,
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecCryptoDLLibraryDestroy(lib);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ "xmlSecCryptoDLLibraryConstructGetFunctionsName",
+ NULL,
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecCryptoDLLibraryDestroy(lib);
+ return(NULL);
}
#ifdef XMLSEC_DL_LIBLTDL
lib->handle = lt_dlopenext((char*)lib->filename);
if(lib->handle == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- "lt_dlopenext",
- NULL,
- XMLSEC_ERRORS_R_IO_FAILED,
- "filename=%s",
- xmlSecErrorsSafeString(lib->filename));
- xmlSecCryptoDLLibraryDestroy(lib);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ "lt_dlopenext",
+ NULL,
+ XMLSEC_ERRORS_R_IO_FAILED,
+ "filename=%s",
+ xmlSecErrorsSafeString(lib->filename));
+ xmlSecCryptoDLLibraryDestroy(lib);
+ return(NULL);
}
getFunctions = (xmlSecCryptoGetFunctionsCallback)lt_dlsym(lib->handle, (char*)lib->getFunctionsName);
if(getFunctions == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- "lt_dlsym",
- NULL,
- XMLSEC_ERRORS_R_IO_FAILED,
- "function=%s",
- xmlSecErrorsSafeString(lib->getFunctionsName));
- xmlSecCryptoDLLibraryDestroy(lib);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ "lt_dlsym",
+ NULL,
+ XMLSEC_ERRORS_R_IO_FAILED,
+ "function=%s",
+ xmlSecErrorsSafeString(lib->getFunctionsName));
+ xmlSecCryptoDLLibraryDestroy(lib);
+ return(NULL);
}
#endif /* XMLSEC_DL_LIBLTDL */
#ifdef XMLSEC_DL_WIN32
lib->handle = LoadLibraryA((char*)lib->filename);
if(lib->handle == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- "LoadLibraryA",
- NULL,
- XMLSEC_ERRORS_R_IO_FAILED,
- "filename=%s",
- xmlSecErrorsSafeString(lib->filename));
- xmlSecCryptoDLLibraryDestroy(lib);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ "LoadLibraryA",
+ NULL,
+ XMLSEC_ERRORS_R_IO_FAILED,
+ "filename=%s",
+ xmlSecErrorsSafeString(lib->filename));
+ xmlSecCryptoDLLibraryDestroy(lib);
+ return(NULL);
}
getFunctions = (xmlSecCryptoGetFunctionsCallback)GetProcAddress(lib->handle, (char*)lib->getFunctionsName);
if(getFunctions == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- "GetProcAddressA",
- NULL,
- XMLSEC_ERRORS_R_IO_FAILED,
- "function=%s",
- xmlSecErrorsSafeString(lib->getFunctionsName));
- xmlSecCryptoDLLibraryDestroy(lib);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ "GetProcAddressA",
+ NULL,
+ XMLSEC_ERRORS_R_IO_FAILED,
+ "function=%s",
+ xmlSecErrorsSafeString(lib->getFunctionsName));
+ xmlSecCryptoDLLibraryDestroy(lib);
+ return(NULL);
}
#endif /* XMLSEC_DL_WIN32 */
if(getFunctions == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "invalid configuration: no way to load library");
- xmlSecCryptoDLLibraryDestroy(lib);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "invalid configuration: no way to load library");
+ xmlSecCryptoDLLibraryDestroy(lib);
+ return(NULL);
}
lib->functions = getFunctions();
if(lib->functions == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- "getFunctions",
- NULL,
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecCryptoDLLibraryDestroy(lib);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ "getFunctions",
+ NULL,
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecCryptoDLLibraryDestroy(lib);
+ return(NULL);
}
/* fprintf (stderr, "library %s loaded\n", name); */
@@ -219,52 +219,52 @@ xmlSecCryptoDLLibraryDestroy(xmlSecCryptoDLLibraryPtr lib) {
/* fprintf (stderr, "unloading \"library %s\"...\n", lib->name); */
if(lib->name != NULL) {
- xmlFree(lib->name);
+ xmlFree(lib->name);
}
if(lib->filename != NULL) {
- xmlFree(lib->filename);
+ xmlFree(lib->filename);
}
if(lib->getFunctionsName != NULL) {
- xmlFree(lib->getFunctionsName);
+ xmlFree(lib->getFunctionsName);
}
#ifdef XMLSEC_DL_LIBLTDL
- if(lib->handle != NULL) {
- int ret;
-
- ret = lt_dlclose(lib->handle);
- if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- "lt_dlclose",
- NULL,
- XMLSEC_ERRORS_R_IO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- }
+ if(lib->handle != NULL) {
+ int ret;
+
+ ret = lt_dlclose(lib->handle);
+ if(ret != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ "lt_dlclose",
+ NULL,
+ XMLSEC_ERRORS_R_IO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ }
}
#endif /* XMLSEC_DL_LIBLTDL */
#ifdef XMLSEC_DL_WIN32
- if(lib->handle != NULL) {
- BOOL res;
-
- res = FreeLibrary(lib->handle);
- if(!res) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- "FreeLibrary",
- NULL,
- XMLSEC_ERRORS_R_IO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- }
- }
+ if(lib->handle != NULL) {
+ BOOL res;
+
+ res = FreeLibrary(lib->handle);
+ if(!res) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ "FreeLibrary",
+ NULL,
+ XMLSEC_ERRORS_R_IO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ }
+ }
#endif /* XMLSEC_DL_WIN32*/
memset(lib, 0, sizeof(xmlSecCryptoDLLibrary));
xmlFree(lib);
}
-static xmlSecCryptoDLLibraryPtr
+static xmlSecCryptoDLLibraryPtr
xmlSecCryptoDLLibraryDuplicate(xmlSecCryptoDLLibraryPtr lib) {
xmlSecAssert2(lib != NULL, NULL);
xmlSecAssert2(lib->name != NULL, NULL);
@@ -272,7 +272,7 @@ xmlSecCryptoDLLibraryDuplicate(xmlSecCryptoDLLibraryPtr lib) {
return(xmlSecCryptoDLLibraryCreate(lib->name));
}
-static xmlChar*
+static xmlChar*
xmlSecCryptoDLLibraryConstructFilename(const xmlChar* name) {
static xmlChar tmpl[] = "lib%s-%s";
xmlChar* res;
@@ -284,19 +284,19 @@ xmlSecCryptoDLLibraryConstructFilename(const xmlChar* name) {
len = xmlStrlen(BAD_CAST PACKAGE) + xmlStrlen(name) + xmlStrlen(tmpl) + 1;
res = (xmlChar*)xmlMalloc(len + 1);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "size=%d", len + 1);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "size=%d", len + 1);
+ return(NULL);
}
xmlSecStrPrintf(res, len, tmpl, PACKAGE, name);
return(res);
}
-static xmlChar*
+static xmlChar*
xmlSecCryptoDLLibraryConstructGetFunctionsName(const xmlChar* name) {
static xmlChar tmpl[] = "xmlSecCryptoGetFunctions_%s";
xmlChar* res;
@@ -307,12 +307,12 @@ xmlSecCryptoDLLibraryConstructGetFunctionsName(const xmlChar* name) {
len = xmlStrlen(name) + xmlStrlen(tmpl) + 1;
res = (xmlChar*)xmlMalloc(len + 1);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "size=%d", len + 1);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "size=%d", len + 1);
+ return(NULL);
}
xmlSecStrPrintf(res, len, tmpl, name);
@@ -334,10 +334,10 @@ xmlSecCryptoDLLibrariesListFindByName(xmlSecPtrListPtr list, const xmlChar* name
size = xmlSecPtrListGetSize(list);
for(i = 0; i < size; ++i) {
- lib = (xmlSecCryptoDLLibraryPtr)xmlSecPtrListGetItem(list, i);
- if((lib != NULL) && (lib->name != NULL) && (xmlStrcmp(lib->name, name) == 0)) {
- return(i);
- }
+ lib = (xmlSecCryptoDLLibraryPtr)xmlSecPtrListGetItem(list, i);
+ if((lib != NULL) && (lib->name != NULL) && (xmlStrcmp(lib->name, name) == 0)) {
+ return(i);
+ }
}
return(-1);
}
@@ -364,22 +364,22 @@ xmlSecCryptoDLInit(void) {
ret = xmlSecPtrListInitialize(&gXmlSecCryptoDLLibraries, xmlSecCryptoDLLibrariesListGetKlass());
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListPtrInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecCryptoDLLibrariesListGetKlass");
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListPtrInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecCryptoDLLibrariesListGetKlass");
return(-1);
}
#ifdef XMLSEC_DL_LIBLTDL
ret = lt_dlinit ();
if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "lt_dlinit",
- XMLSEC_ERRORS_R_IO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "lt_dlinit",
+ XMLSEC_ERRORS_R_IO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
#endif /* XMLSEC_DL_LIBLTDL */
@@ -405,11 +405,11 @@ xmlSecCryptoDLShutdown(void) {
#ifdef XMLSEC_DL_LIBLTDL
ret = lt_dlexit ();
if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "lt_dlexit",
- XMLSEC_ERRORS_R_IO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "lt_dlexit",
+ XMLSEC_ERRORS_R_IO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
}
#endif /* XMLSEC_DL_LIBLTDL */
@@ -418,7 +418,7 @@ xmlSecCryptoDLShutdown(void) {
/**
* xmlSecCryptoDLLoadLibrary:
- * @crypto: the desired crypto library name ("openssl", "nss", ...).
+ * @crypto: the desired crypto library name ("openssl", "nss", ...).
*
* Loads the xmlsec-<crypto> library. This function is NOT thread safe,
* application MUST NOT call #xmlSecCryptoDLLoadLibrary, #xmlSecCryptoDLGetLibraryFunctions,
@@ -436,28 +436,28 @@ xmlSecCryptoDLLoadLibrary(const xmlChar* crypto) {
functions = xmlSecCryptoDLGetLibraryFunctions(crypto);
if(functions == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoDLGetLibraryFunctions",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ NULL,
+ "xmlSecCryptoDLGetLibraryFunctions",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecCryptoDLSetFunctions(functions);
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoDLSetFunctions",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ NULL,
+ "xmlSecCryptoDLSetFunctions",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
/**
* xmlSecCryptoDLGetLibraryFunctions:
- * @crypto: the desired crypto library name ("openssl", "nss", ...).
+ * @crypto: the desired crypto library name ("openssl", "nss", ...).
*
* Loads the xmlsec-<crypto> library and gets global crypto functions/transforms/keys data/keys store
* table. This function is NOT thread safe, application MUST NOT call #xmlSecCryptoDLLoadLibrary,
@@ -476,33 +476,33 @@ xmlSecCryptoDLGetLibraryFunctions(const xmlChar* crypto) {
pos = xmlSecCryptoDLLibrariesListFindByName(&gXmlSecCryptoDLLibraries, crypto);
if(pos >= 0) {
lib = (xmlSecCryptoDLLibraryPtr)xmlSecPtrListGetItem(&gXmlSecCryptoDLLibraries, pos);
- xmlSecAssert2(lib != NULL, NULL);
- xmlSecAssert2(lib->functions != NULL, NULL);
-
- return(lib->functions);
+ xmlSecAssert2(lib != NULL, NULL);
+ xmlSecAssert2(lib->functions != NULL, NULL);
+
+ return(lib->functions);
}
lib = xmlSecCryptoDLLibraryCreate(crypto);
if(lib == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoDLLibraryCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "crypto=%s",
- xmlSecErrorsSafeString(crypto));
- return(NULL);
+ NULL,
+ "xmlSecCryptoDLLibraryCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "crypto=%s",
+ xmlSecErrorsSafeString(crypto));
+ return(NULL);
}
ret = xmlSecPtrListAdd(&gXmlSecCryptoDLLibraries, lib);
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "crypto=%s",
- xmlSecErrorsSafeString(crypto));
- xmlSecCryptoDLLibraryDestroy(lib);
- return(NULL);
+ NULL,
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "crypto=%s",
+ xmlSecErrorsSafeString(crypto));
+ xmlSecCryptoDLLibraryDestroy(lib);
+ return(NULL);
}
return(lib->functions);
@@ -510,7 +510,7 @@ xmlSecCryptoDLGetLibraryFunctions(const xmlChar* crypto) {
/**
* xmlSecCryptoDLUnloadLibrary:
- * @crypto: the desired crypto library name ("openssl", "nss", ...).
+ * @crypto: the desired crypto library name ("openssl", "nss", ...).
*
* Unloads the xmlsec-<crypto> library. All pointers to this library
* functions tables became invalid. This function is NOT thread safe,
@@ -529,23 +529,23 @@ xmlSecCryptoDLUnloadLibrary(const xmlChar* crypto) {
pos = xmlSecCryptoDLLibrariesListFindByName(&gXmlSecCryptoDLLibraries, crypto);
if(pos < 0) {
- /* todo: is it an error? */
- return(0);
+ /* todo: is it an error? */
+ return(0);
}
lib = (xmlSecCryptoDLLibraryPtr)xmlSecPtrListGetItem(&gXmlSecCryptoDLLibraries, pos);
if((lib != NULL) && (lib->functions == gXmlSecCryptoDLFunctions)) {
- gXmlSecCryptoDLFunctions = NULL;
+ gXmlSecCryptoDLFunctions = NULL;
}
ret = xmlSecPtrListRemove(&gXmlSecCryptoDLLibraries, pos);
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListRemove",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ NULL,
+ "xmlSecPtrListRemove",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -553,7 +553,7 @@ xmlSecCryptoDLUnloadLibrary(const xmlChar* crypto) {
/**
* xmlSecCryptoDLSetFunctions:
- * @functions: the new table
+ * @functions: the new table
*
* Sets global crypto functions/transforms/keys data/keys store table.
*
@@ -584,7 +584,7 @@ xmlSecCryptoDLGetFunctions(void) {
/**
* xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms:
- * @functions: the functions table.
+ * @functions: the functions table.
*
* Registers the key data and transforms klasses from @functions table in xmlsec.
*
@@ -598,68 +598,68 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
* Register keys
*/
if((functions->keyDataAesGetKlass != NULL) && (xmlSecKeyDataIdsRegister(functions->keyDataAesGetKlass()) < 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataAesGetKlass())),
- "xmlSecKeyDataIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataAesGetKlass())),
+ "xmlSecKeyDataIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->keyDataDesGetKlass != NULL) && (xmlSecKeyDataIdsRegister(functions->keyDataDesGetKlass()) < 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataDesGetKlass())),
- "xmlSecKeyDataIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataDesGetKlass())),
+ "xmlSecKeyDataIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->keyDataDsaGetKlass != NULL) && (xmlSecKeyDataIdsRegister(functions->keyDataDsaGetKlass()) < 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataDsaGetKlass())),
- "xmlSecKeyDataIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataDsaGetKlass())),
+ "xmlSecKeyDataIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->keyDataGost2001GetKlass != NULL) && (xmlSecKeyDataIdsRegister(functions->keyDataGost2001GetKlass()) < 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataGost2001GetKlass())),
- "xmlSecKeyDataIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataGost2001GetKlass())),
+ "xmlSecKeyDataIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->keyDataHmacGetKlass != NULL) && (xmlSecKeyDataIdsRegister(functions->keyDataHmacGetKlass()) < 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataHmacGetKlass())),
- "xmlSecKeyDataIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataHmacGetKlass())),
+ "xmlSecKeyDataIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->keyDataRsaGetKlass != NULL) && (xmlSecKeyDataIdsRegister(functions->keyDataRsaGetKlass()) < 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataRsaGetKlass())),
- "xmlSecKeyDataIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataRsaGetKlass())),
+ "xmlSecKeyDataIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->keyDataX509GetKlass != NULL) && (xmlSecKeyDataIdsRegister(functions->keyDataX509GetKlass()) < 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataX509GetKlass())),
- "xmlSecKeyDataIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataX509GetKlass())),
+ "xmlSecKeyDataIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->keyDataRawX509CertGetKlass != NULL) && (xmlSecKeyDataIdsRegister(functions->keyDataRawX509CertGetKlass()) < 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataRawX509CertGetKlass())),
- "xmlSecKeyDataIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(functions->keyDataRawX509CertGetKlass())),
+ "xmlSecKeyDataIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
@@ -667,309 +667,309 @@ xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(struct _xmlSecCryptoDLFuncti
* Register transforms
*/
if((functions->transformAes128CbcGetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformAes128CbcGetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformAes128CbcGetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformAes128CbcGetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformAes192CbcGetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformAes192CbcGetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformAes192CbcGetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformAes192CbcGetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformAes256CbcGetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformAes256CbcGetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformAes256CbcGetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformAes256CbcGetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformKWAes128GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformKWAes128GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformKWAes128GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformKWAes128GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformKWAes192GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformKWAes192GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformKWAes192GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformKWAes192GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformKWAes256GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformKWAes256GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformKWAes256GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformKWAes256GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformDes3CbcGetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformDes3CbcGetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformDes3CbcGetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformDes3CbcGetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformKWDes3GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformKWDes3GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformKWDes3GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformKWDes3GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformGost2001GostR3411_94GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformGost2001GostR3411_94GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformGost2001GostR3411_94GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformGost2001GostR3411_94GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformDsaSha1GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformDsaSha1GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformDsaSha1GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformDsaSha1GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformHmacMd5GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacMd5GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacMd5GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacMd5GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformHmacRipemd160GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacRipemd160GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacRipemd160GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacRipemd160GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformHmacSha1GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacSha1GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacSha1GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacSha1GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformHmacSha224GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacSha224GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacSha224GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacSha224GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformHmacSha256GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacSha256GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacSha256GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacSha256GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformHmacSha384GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacSha384GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacSha384GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacSha384GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformHmacSha512GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformHmacSha512GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacSha512GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformHmacSha512GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformMd5GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformMd5GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformMd5GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformMd5GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformRipemd160GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRipemd160GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRipemd160GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRipemd160GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformRsaMd5GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaMd5GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaMd5GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaMd5GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformRsaRipemd160GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaRipemd160GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaRipemd160GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaRipemd160GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformRsaSha1GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaSha1GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaSha1GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaSha1GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformRsaSha224GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaSha224GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaSha224GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaSha224GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformRsaSha256GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaSha256GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaSha256GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaSha256GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformRsaSha384GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaSha384GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaSha384GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaSha384GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformRsaSha512GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaSha512GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaSha512GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaSha512GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformRsaPkcs1GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaPkcs1GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaPkcs1GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaPkcs1GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformRsaOaepGetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformRsaOaepGetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaOaepGetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformRsaOaepGetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformGostR3411_94GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformGostR3411_94GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformGostR3411_94GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformGostR3411_94GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformSha1GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformSha1GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformSha1GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformSha1GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformSha224GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformSha224GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformSha224GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformSha224GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformSha256GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformSha256GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformSha256GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformSha256GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformSha384GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformSha384GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformSha384GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformSha384GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((functions->transformSha512GetKlass != NULL) && xmlSecTransformIdsRegister(functions->transformSha512GetKlass()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformSha512GetKlass())),
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(functions->transformSha512GetKlass())),
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
diff --git a/src/enveloped.c b/src/enveloped.c
index bea30a1..97a7a08 100644
--- a/src/enveloped.c
+++ b/src/enveloped.c
@@ -28,36 +28,36 @@
* Enveloped transform
*
*************************************************************************/
-static int xmlSecTransformEnvelopedExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecTransformEnvelopedExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
static xmlSecTransformKlass xmlSecTransformEnvelopedKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- sizeof(xmlSecTransform), /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ sizeof(xmlSecTransform), /* xmlSecSize objSize */
- xmlSecNameEnveloped, /* const xmlChar* name; */
- xmlSecHrefEnveloped, /* const xmlChar* href; */
- xmlSecTransformUsageDSigTransform, /* xmlSecTransformUsage usage; */
+ xmlSecNameEnveloped, /* const xmlChar* name; */
+ xmlSecHrefEnveloped, /* const xmlChar* href; */
+ xmlSecTransformUsageDSigTransform, /* xmlSecTransformUsage usage; */
- NULL, /* xmlSecTransformInitializeMethod initialize; */
- NULL, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- NULL, /* xmlSecTransformPushBinMethod pushBin; */
- NULL, /* xmlSecTransformPopBinMethod popBin; */
- xmlSecTransformDefaultPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
- xmlSecTransformDefaultPopXml, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecTransformEnvelopedExecute, /* xmlSecTransformExecuteMethod execute; */
+ NULL, /* xmlSecTransformInitializeMethod initialize; */
+ NULL, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ NULL, /* xmlSecTransformPushBinMethod pushBin; */
+ NULL, /* xmlSecTransformPopBinMethod popBin; */
+ xmlSecTransformDefaultPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
+ xmlSecTransformDefaultPopXml, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecTransformEnvelopedExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -94,7 +94,7 @@ xmlSecTransformEnvelopedGetKlass(void) {
static int
xmlSecTransformEnvelopedExecute(xmlSecTransformPtr transform, int last,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecTransformCtxPtr transformCtx) {
xmlNodePtr node;
xmlSecNodeSetPtr children;
@@ -105,46 +105,46 @@ xmlSecTransformEnvelopedExecute(xmlSecTransformPtr transform, int last,
xmlSecAssert2(transformCtx != NULL, -1);
if((transform->inNodes != NULL) && (transform->inNodes->doc != transform->hereNode->doc)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_TRANSFORM_SAME_DOCUMENT_REQUIRED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_TRANSFORM_SAME_DOCUMENT_REQUIRED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* find signature node and get all its children in the nodes set */
node = xmlSecFindParent(transform->hereNode, xmlSecNodeSignature, xmlSecDSigNs);
if(node == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- xmlSecErrorsSafeString(xmlSecNodeSignature),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ xmlSecErrorsSafeString(xmlSecNodeSignature),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
children = xmlSecNodeSetGetChildren(node->doc, node, 1, 1);
if(children == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecNodeSetGetChildren",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecNodeSetGetChildren",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
+ return(-1);
}
/* intersect <dsig:Signature/> node children with input nodes (if exist) */
transform->outNodes = xmlSecNodeSetAdd(transform->inNodes, children, xmlSecNodeSetIntersection);
if(transform->outNodes == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecNodeSetAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecNodeSetDestroy(children);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecNodeSetAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecNodeSetDestroy(children);
+ return(-1);
}
return(0);
diff --git a/src/errors.c b/src/errors.c
index 54e34e6..5609e1a 100644
--- a/src/errors.c
+++ b/src/errors.c
@@ -22,67 +22,67 @@
#include <xmlsec/private.h>
#include <xmlsec/errors.h>
-#define XMLSEC_ERRORS_BUFFER_SIZE 1024
+#define XMLSEC_ERRORS_BUFFER_SIZE 1024
-typedef struct _xmlSecErrorDescription xmlSecErrorDescription, *xmlSecErrorDescriptionPtr;
+typedef struct _xmlSecErrorDescription xmlSecErrorDescription, *xmlSecErrorDescriptionPtr;
struct _xmlSecErrorDescription {
- int errorCode;
- const char* errorMsg;
+ int errorCode;
+ const char* errorMsg;
};
static xmlSecErrorDescription xmlSecErrorsTable[XMLSEC_ERRORS_MAX_NUMBER + 1] = {
- { XMLSEC_ERRORS_R_XMLSEC_FAILED, "xmlsec library function failed" },
- { XMLSEC_ERRORS_R_MALLOC_FAILED, "malloc function failed" },
- { XMLSEC_ERRORS_R_STRDUP_FAILED, "strdup function failed" },
- { XMLSEC_ERRORS_R_CRYPTO_FAILED, "crypto library function failed" },
- { XMLSEC_ERRORS_R_XML_FAILED, "libxml2 library function failed" },
- { XMLSEC_ERRORS_R_XSLT_FAILED, "libxslt library function failed" },
- { XMLSEC_ERRORS_R_IO_FAILED, "io function failed" },
- { XMLSEC_ERRORS_R_DISABLED, "feature is disabled" },
- { XMLSEC_ERRORS_R_NOT_IMPLEMENTED, "feature is not implemented" },
- { XMLSEC_ERRORS_R_INVALID_SIZE, "invalid size" },
- { XMLSEC_ERRORS_R_INVALID_DATA, "invalid data" },
- { XMLSEC_ERRORS_R_INVALID_RESULT, "invalid result" },
- { XMLSEC_ERRORS_R_INVALID_TYPE, "invalid type" },
- { XMLSEC_ERRORS_R_INVALID_OPERATION, "invalid operation" },
- { XMLSEC_ERRORS_R_INVALID_STATUS, "invalid status" },
- { XMLSEC_ERRORS_R_INVALID_FORMAT, "invalid format" },
- { XMLSEC_ERRORS_R_DATA_NOT_MATCH, "data do not match" },
- { XMLSEC_ERRORS_R_INVALID_NODE, "invalid node" },
- { XMLSEC_ERRORS_R_INVALID_NODE_CONTENT, "invalid node content" },
- { XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE, "invalid node attribute" },
- { XMLSEC_ERRORS_R_MISSING_NODE_ATTRIBUTE, "missing node attribute" },
- { XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT, "node already present" },
- { XMLSEC_ERRORS_R_UNEXPECTED_NODE, "unexpected node" },
- { XMLSEC_ERRORS_R_NODE_NOT_FOUND, "node node found" },
- { XMLSEC_ERRORS_R_INVALID_TRANSFORM, "invalid transform" },
- { XMLSEC_ERRORS_R_INVALID_TRANSFORM_KEY, "invalid transform key" },
- { XMLSEC_ERRORS_R_INVALID_URI_TYPE, "invalid URI type" },
- { XMLSEC_ERRORS_R_TRANSFORM_SAME_DOCUMENT_REQUIRED, "same document is required for transform" },
- { XMLSEC_ERRORS_R_TRANSFORM_DISABLED, "transform is disabled" },
- { XMLSEC_ERRORS_R_INVALID_KEY_DATA, "invalid key data" },
- { XMLSEC_ERRORS_R_KEY_DATA_NOT_FOUND, "key data is not found" },
- { XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST, "key data already exist" },
- { XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE, "invalid key data size" },
- { XMLSEC_ERRORS_R_KEY_NOT_FOUND, "key is not found" },
- { XMLSEC_ERRORS_R_KEYDATA_DISABLED, "key data is disabled" },
- { XMLSEC_ERRORS_R_MAX_RETRIEVALS_LEVEL, "maximum key retrieval level" },
+ { XMLSEC_ERRORS_R_XMLSEC_FAILED, "xmlsec library function failed" },
+ { XMLSEC_ERRORS_R_MALLOC_FAILED, "malloc function failed" },
+ { XMLSEC_ERRORS_R_STRDUP_FAILED, "strdup function failed" },
+ { XMLSEC_ERRORS_R_CRYPTO_FAILED, "crypto library function failed" },
+ { XMLSEC_ERRORS_R_XML_FAILED, "libxml2 library function failed" },
+ { XMLSEC_ERRORS_R_XSLT_FAILED, "libxslt library function failed" },
+ { XMLSEC_ERRORS_R_IO_FAILED, "io function failed" },
+ { XMLSEC_ERRORS_R_DISABLED, "feature is disabled" },
+ { XMLSEC_ERRORS_R_NOT_IMPLEMENTED, "feature is not implemented" },
+ { XMLSEC_ERRORS_R_INVALID_SIZE, "invalid size" },
+ { XMLSEC_ERRORS_R_INVALID_DATA, "invalid data" },
+ { XMLSEC_ERRORS_R_INVALID_RESULT, "invalid result" },
+ { XMLSEC_ERRORS_R_INVALID_TYPE, "invalid type" },
+ { XMLSEC_ERRORS_R_INVALID_OPERATION, "invalid operation" },
+ { XMLSEC_ERRORS_R_INVALID_STATUS, "invalid status" },
+ { XMLSEC_ERRORS_R_INVALID_FORMAT, "invalid format" },
+ { XMLSEC_ERRORS_R_DATA_NOT_MATCH, "data do not match" },
+ { XMLSEC_ERRORS_R_INVALID_NODE, "invalid node" },
+ { XMLSEC_ERRORS_R_INVALID_NODE_CONTENT, "invalid node content" },
+ { XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE, "invalid node attribute" },
+ { XMLSEC_ERRORS_R_MISSING_NODE_ATTRIBUTE, "missing node attribute" },
+ { XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT, "node already present" },
+ { XMLSEC_ERRORS_R_UNEXPECTED_NODE, "unexpected node" },
+ { XMLSEC_ERRORS_R_NODE_NOT_FOUND, "node node found" },
+ { XMLSEC_ERRORS_R_INVALID_TRANSFORM, "invalid transform" },
+ { XMLSEC_ERRORS_R_INVALID_TRANSFORM_KEY, "invalid transform key" },
+ { XMLSEC_ERRORS_R_INVALID_URI_TYPE, "invalid URI type" },
+ { XMLSEC_ERRORS_R_TRANSFORM_SAME_DOCUMENT_REQUIRED, "same document is required for transform" },
+ { XMLSEC_ERRORS_R_TRANSFORM_DISABLED, "transform is disabled" },
+ { XMLSEC_ERRORS_R_INVALID_KEY_DATA, "invalid key data" },
+ { XMLSEC_ERRORS_R_KEY_DATA_NOT_FOUND, "key data is not found" },
+ { XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST, "key data already exist" },
+ { XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE, "invalid key data size" },
+ { XMLSEC_ERRORS_R_KEY_NOT_FOUND, "key is not found" },
+ { XMLSEC_ERRORS_R_KEYDATA_DISABLED, "key data is disabled" },
+ { XMLSEC_ERRORS_R_MAX_RETRIEVALS_LEVEL, "maximum key retrieval level" },
{ XMLSEC_ERRORS_R_MAX_RETRIEVAL_TYPE_MISMATCH,"key retrieval type mismatch" },
- { XMLSEC_ERRORS_R_MAX_ENCKEY_LEVEL, "maximum encrypted key level" },
- { XMLSEC_ERRORS_R_CERT_VERIFY_FAILED, "certificate verification failed" },
- { XMLSEC_ERRORS_R_CERT_NOT_FOUND, "certificate is not found" },
- { XMLSEC_ERRORS_R_CERT_REVOKED, "certificate is revoked" },
- { XMLSEC_ERRORS_R_CERT_ISSUER_FAILED, "certificate issuer check failed" },
- { XMLSEC_ERRORS_R_CERT_NOT_YET_VALID, "certificate is not yet valid" },
- { XMLSEC_ERRORS_R_CERT_HAS_EXPIRED, "certificate has expirred" },
- { XMLSEC_ERRORS_R_DSIG_NO_REFERENCES, "Reference nodes are not found" },
- { XMLSEC_ERRORS_R_DSIG_INVALID_REFERENCE, "Reference verification failed" },
- { XMLSEC_ERRORS_R_ASSERTION, "assertion" },
- { 0, NULL}
+ { XMLSEC_ERRORS_R_MAX_ENCKEY_LEVEL, "maximum encrypted key level" },
+ { XMLSEC_ERRORS_R_CERT_VERIFY_FAILED, "certificate verification failed" },
+ { XMLSEC_ERRORS_R_CERT_NOT_FOUND, "certificate is not found" },
+ { XMLSEC_ERRORS_R_CERT_REVOKED, "certificate is revoked" },
+ { XMLSEC_ERRORS_R_CERT_ISSUER_FAILED, "certificate issuer check failed" },
+ { XMLSEC_ERRORS_R_CERT_NOT_YET_VALID, "certificate is not yet valid" },
+ { XMLSEC_ERRORS_R_CERT_HAS_EXPIRED, "certificate has expirred" },
+ { XMLSEC_ERRORS_R_DSIG_NO_REFERENCES, "Reference nodes are not found" },
+ { XMLSEC_ERRORS_R_DSIG_INVALID_REFERENCE, "Reference verification failed" },
+ { XMLSEC_ERRORS_R_ASSERTION, "assertion" },
+ { 0, NULL}
};
static xmlSecErrorsCallback xmlSecErrorsClbk = xmlSecErrorsDefaultCallback;
-static int xmlSecPrintErrorMessages = 1; /* whether the error messages will be printed immidiatelly */
+static int xmlSecPrintErrorMessages = 1; /* whether the error messages will be printed immidiatelly */
/**
* xmlSecErrorsInit:
@@ -106,7 +106,7 @@ xmlSecErrorsShutdown(void) {
/**
* xmlSecErrorsSetCallback:
- * @callback: the new errors callback function.
+ * @callback: the new errors callback function.
*
* Sets the errors callback function to @callback that will be called
* every time an error occurs.
@@ -118,47 +118,47 @@ xmlSecErrorsSetCallback(xmlSecErrorsCallback callback) {
/**
* xmlSecErrorsDefaultCallback:
- * @file: the error location file name (__FILE__ macro).
- * @line: the error location line number (__LINE__ macro).
- * @func: the error location function name (__FUNCTION__ macro).
- * @errorObject: the error specific error object
- * @errorSubject: the error specific error subject.
- * @reason: the error code.
- * @msg: the additional error message.
+ * @file: the error location file name (__FILE__ macro).
+ * @line: the error location line number (__LINE__ macro).
+ * @func: the error location function name (__FUNCTION__ macro).
+ * @errorObject: the error specific error object
+ * @errorSubject: the error specific error subject.
+ * @reason: the error code.
+ * @msg: the additional error message.
*
* The default error reporting callback that utilizes LibXML
* error reporting #xmlGenericError function.
*/
void
xmlSecErrorsDefaultCallback(const char* file, int line, const char* func,
- const char* errorObject, const char* errorSubject,
- int reason, const char* msg) {
+ const char* errorObject, const char* errorSubject,
+ int reason, const char* msg) {
if(xmlSecPrintErrorMessages) {
- const char* error_msg = NULL;
- xmlSecSize i;
-
- for(i = 0; (i < XMLSEC_ERRORS_MAX_NUMBER) && (xmlSecErrorsGetMsg(i) != NULL); ++i) {
- if(xmlSecErrorsGetCode(i) == reason) {
- error_msg = xmlSecErrorsGetMsg(i);
- break;
- }
- }
- xmlGenericError(xmlGenericErrorContext,
- "func=%s:file=%s:line=%d:obj=%s:subj=%s:error=%d:%s:%s\n",
- (func != NULL) ? func : "unknown",
- (file != NULL) ? file : "unknown",
- line,
- (errorObject != NULL) ? errorObject : "unknown",
- (errorSubject != NULL) ? errorSubject : "unknown",
- reason,
- (error_msg != NULL) ? error_msg : "",
- (msg != NULL) ? msg : "");
+ const char* error_msg = NULL;
+ xmlSecSize i;
+
+ for(i = 0; (i < XMLSEC_ERRORS_MAX_NUMBER) && (xmlSecErrorsGetMsg(i) != NULL); ++i) {
+ if(xmlSecErrorsGetCode(i) == reason) {
+ error_msg = xmlSecErrorsGetMsg(i);
+ break;
+ }
+ }
+ xmlGenericError(xmlGenericErrorContext,
+ "func=%s:file=%s:line=%d:obj=%s:subj=%s:error=%d:%s:%s\n",
+ (func != NULL) ? func : "unknown",
+ (file != NULL) ? file : "unknown",
+ line,
+ (errorObject != NULL) ? errorObject : "unknown",
+ (errorSubject != NULL) ? errorSubject : "unknown",
+ reason,
+ (error_msg != NULL) ? error_msg : "",
+ (msg != NULL) ? msg : "");
}
}
/**
* xmlSecErrorsDefaultCallbackEnableOutput:
- * @enabled: the flag.
+ * @enabled: the flag.
*
* Enables or disables calling LibXML2 callback from the default
* errors callback.
@@ -170,7 +170,7 @@ xmlSecErrorsDefaultCallbackEnableOutput(int enabled) {
/**
* xmlSecErrorsGetCode:
- * @pos: the error position.
+ * @pos: the error position.
*
* Gets the known error code at position @pos.
*
@@ -181,14 +181,14 @@ int
xmlSecErrorsGetCode(xmlSecSize pos) {
/* could not use asserts here! */
if(pos < sizeof(xmlSecErrorsTable) / sizeof(xmlSecErrorsTable[0])) {
- return(xmlSecErrorsTable[pos].errorCode);
+ return(xmlSecErrorsTable[pos].errorCode);
}
return(0);
}
/**
* xmlSecErrorsGetMsg:
- * @pos: the error position.
+ * @pos: the error position.
*
* Gets the known error message at position @pos.
*
@@ -199,44 +199,44 @@ const char*
xmlSecErrorsGetMsg(xmlSecSize pos) {
/* could not use asserts here! */
if(pos < sizeof(xmlSecErrorsTable) / sizeof(xmlSecErrorsTable[0])) {
- return(xmlSecErrorsTable[pos].errorMsg);
+ return(xmlSecErrorsTable[pos].errorMsg);
}
return(NULL);
}
/**
* xmlSecError:
- * @file: the error location filename (__FILE__).
- * @line: the error location line number (__LINE__).
- * @func: the error location function (__FUNCTIION__).
- * @errorObject: the error specific error object
- * @errorSubject: the error specific error subject.
- * @reason: the error code.
- * @msg: the error message in printf format.
- * @...: the parameters for the @msg.
+ * @file: the error location filename (__FILE__).
+ * @line: the error location line number (__LINE__).
+ * @func: the error location function (__FUNCTIION__).
+ * @errorObject: the error specific error object
+ * @errorSubject: the error specific error subject.
+ * @reason: the error code.
+ * @msg: the error message in printf format.
+ * @...: the parameters for the @msg.
*
* Reports an error to the default (#xmlSecErrorsDefaultCallback) or
* application specific callback installed using #xmlSecErrorsSetCallback
* function.
*/
-void
+void
xmlSecError(const char* file, int line, const char* func,
- const char* errorObject, const char* errorSubject,
- int reason, const char* msg, ...) {
-
+ const char* errorObject, const char* errorSubject,
+ int reason, const char* msg, ...) {
+
if(xmlSecErrorsClbk != NULL) {
- xmlChar error_msg[XMLSEC_ERRORS_BUFFER_SIZE];
-
- if(msg != NULL) {
- va_list va;
-
- va_start(va, msg);
- xmlSecStrVPrintf(error_msg, sizeof(error_msg), BAD_CAST msg, va);
- error_msg[sizeof(error_msg) - 1] = '\0';
- va_end(va);
- } else {
- error_msg[0] = '\0';
- }
- xmlSecErrorsClbk(file, line, func, errorObject, errorSubject, reason, (char*)error_msg);
- }
+ xmlChar error_msg[XMLSEC_ERRORS_BUFFER_SIZE];
+
+ if(msg != NULL) {
+ va_list va;
+
+ va_start(va, msg);
+ xmlSecStrVPrintf(error_msg, sizeof(error_msg), BAD_CAST msg, va);
+ error_msg[sizeof(error_msg) - 1] = '\0';
+ va_end(va);
+ } else {
+ error_msg[0] = '\0';
+ }
+ xmlSecErrorsClbk(file, line, func, errorObject, errorSubject, reason, (char*)error_msg);
+ }
}
diff --git a/src/gnutls/app.c b/src/gnutls/app.c
index 54da199..349b388 100644
--- a/src/gnutls/app.c
+++ b/src/gnutls/app.c
@@ -22,7 +22,7 @@
/**
* xmlSecGnuTLSAppInit:
- * @config: the path to GnuTLS configuration (unused).
+ * @config: the path to GnuTLS configuration (unused).
*
* General crypto engine initialization. This function is used
* by XMLSec command line utility and called before
@@ -36,12 +36,12 @@ xmlSecGnuTLSAppInit(const char* config ATTRIBUTE_UNUSED) {
ret = gnutls_global_init();
if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "gnutls_global_init",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "ret=%d", ret);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "gnutls_global_init",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "ret=%d", ret);
+ return(-1);
}
return(0);
}
@@ -63,11 +63,11 @@ xmlSecGnuTLSAppShutdown(void) {
/**
* xmlSecGnuTLSAppKeyLoad:
- * @filename: the key filename.
- * @format: the key file format.
- * @pwd: the key file password.
- * @pwdCallback: the key password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @filename: the key filename.
+ * @format: the key file format.
+ * @pwd: the key file password.
+ * @pwdCallback: the key password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key from the a file (not implemented yet).
*
@@ -75,35 +75,35 @@ xmlSecGnuTLSAppShutdown(void) {
*/
xmlSecKeyPtr
xmlSecGnuTLSAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx) {
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx) {
xmlSecAssert2(filename != NULL, NULL);
xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, NULL);
if (format == xmlSecKeyDataFormatPkcs12) {
- return (xmlSecGnuTLSAppPkcs12Load(filename, pwd, pwdCallback,
- pwdCallbackCtx));
+ return (xmlSecGnuTLSAppPkcs12Load(filename, pwd, pwdCallback,
+ pwdCallbackCtx));
}
/* TODO */
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecGnuTLSAppKeyLoad",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlSecGnuTLSAppKeyLoad",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(NULL);
}
/**
* xmlSecGnuTLSAppKeyLoadMemory:
- * @data: the binary key data.
- * @dataSize: the size of binary key.
- * @format: the key file format.
- * @pwd: the key file password.
- * @pwdCallback: the key password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @data: the binary key data.
+ * @dataSize: the size of binary key.
+ * @format: the key file format.
+ * @pwd: the key file password.
+ * @pwdCallback: the key password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key from the memory buffer (not implemented yet).
*
@@ -111,86 +111,86 @@ xmlSecGnuTLSAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
*/
xmlSecKeyPtr
xmlSecGnuTLSAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
- xmlSecKeyDataFormat format, const char *pwd,
- void* pwdCallback, void* pwdCallbackCtx) {
+ xmlSecKeyDataFormat format, const char *pwd,
+ void* pwdCallback, void* pwdCallbackCtx) {
xmlSecAssert2(data != NULL, NULL);
xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, NULL);
if (format == xmlSecKeyDataFormatPkcs12) {
- return (xmlSecGnuTLSAppPkcs12LoadMemory(data, dataSize, pwd,
- pwdCallback, pwdCallbackCtx));
+ return (xmlSecGnuTLSAppPkcs12LoadMemory(data, dataSize, pwd,
+ pwdCallback, pwdCallbackCtx));
}
/* TODO */
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecGnuTLSAppKeyLoadMemory",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlSecGnuTLSAppKeyLoadMemory",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(NULL);
}
#ifndef XMLSEC_NO_X509
/**
* xmlSecGnuTLSAppKeyCertLoad:
- * @key: the pointer to key.
- * @filename: the certificate filename.
- * @format: the certificate file format.
+ * @key: the pointer to key.
+ * @filename: the certificate filename.
+ * @format: the certificate file format.
*
* Reads the certificate from $ filename and adds it to key
* (not implemented yet).
*
* Returns: 0 on success or a negative value otherwise.
*/
-int
+int
xmlSecGnuTLSAppKeyCertLoad(xmlSecKeyPtr key, const char* filename,
- xmlSecKeyDataFormat format) {
+ xmlSecKeyDataFormat format) {
xmlSecAssert2(key != NULL, -1);
xmlSecAssert2(filename != NULL, -1);
xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
/* TODO */
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecGnuTLSAppKeyCertLoad",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlSecGnuTLSAppKeyCertLoad",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
/**
* xmlSecGnuTLSAppKeyCertLoadMemory:
- * @key: the pointer to key.
- * @data: the certificate binary data.
- * @dataSize: the certificate binary data size.
- * @format: the certificate file format.
+ * @key: the pointer to key.
+ * @data: the certificate binary data.
+ * @dataSize: the certificate binary data size.
+ * @format: the certificate file format.
*
* Reads the certificate from memory buffer and adds it to key (not implemented yet).
*
* Returns: 0 on success or a negative value otherwise.
*/
-int
+int
xmlSecGnuTLSAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSize dataSize,
- xmlSecKeyDataFormat format) {
+ xmlSecKeyDataFormat format) {
xmlSecAssert2(key != NULL, -1);
xmlSecAssert2(data != NULL, -1);
xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
/* TODO */
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecGnuTLSAppKeyCertLoadMemory",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlSecGnuTLSAppKeyCertLoadMemory",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
/**
* xmlSecGnuTLSAppPkcs12Load:
- * @filename: the PKCS12 key filename.
- * @pwd: the PKCS12 file password.
- * @pwdCallback: the password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @filename: the PKCS12 key filename.
+ * @pwd: the PKCS12 file password.
+ * @pwdCallback: the password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key and all associated certificates from the PKCS12 file
* (not implemented yet).
@@ -199,29 +199,29 @@ xmlSecGnuTLSAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSe
*
* Returns: pointer to the key or NULL if an error occurs.
*/
-xmlSecKeyPtr
+xmlSecKeyPtr
xmlSecGnuTLSAppPkcs12Load(const char *filename,
- const char *pwd ATTRIBUTE_UNUSED,
- void* pwdCallback ATTRIBUTE_UNUSED,
- void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
+ const char *pwd ATTRIBUTE_UNUSED,
+ void* pwdCallback ATTRIBUTE_UNUSED,
+ void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
xmlSecAssert2(filename != NULL, NULL);
/* TODO */
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecGnuTLSAppPkcs12Load",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlSecGnuTLSAppPkcs12Load",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(NULL);
}
/**
* xmlSecGnuTLSAppPkcs12LoadMemory:
- * @data: the PKCS12 binary data.
- * @dataSize: the PKCS12 binary data size.
- * @pwd: the PKCS12 file password.
- * @pwdCallback: the password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @data: the PKCS12 binary data.
+ * @dataSize: the PKCS12 binary data size.
+ * @pwd: the PKCS12 file password.
+ * @pwdCallback: the password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key and all associated certificates from the PKCS12 data in memory buffer.
* For uniformity, call xmlSecGnuTLSAppKeyLoadMemory instead of this function. Pass
@@ -229,27 +229,27 @@ xmlSecGnuTLSAppPkcs12Load(const char *filename,
*
* Returns: pointer to the key or NULL if an error occurs.
*/
-xmlSecKeyPtr
+xmlSecKeyPtr
xmlSecGnuTLSAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
- const char *pwd, void* pwdCallback,
- void* pwdCallbackCtx) {
+ const char *pwd, void* pwdCallback,
+ void* pwdCallbackCtx) {
xmlSecAssert2(data != NULL, NULL);
/* TODO */
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecGnuTLSAppPkcs12LoadMemory",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlSecGnuTLSAppPkcs12LoadMemory",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(NULL);
}
/**
* xmlSecGnuTLSAppKeysMngrCertLoad:
- * @mngr: the keys manager.
- * @filename: the certificate file.
- * @format: the certificate file format.
- * @type: the flag that indicates is the certificate in @filename
- * trusted or not.
+ * @mngr: the keys manager.
+ * @filename: the certificate file.
+ * @format: the certificate file format.
+ * @type: the flag that indicates is the certificate in @filename
+ * trusted or not.
*
* Reads cert from @filename and adds to the list of trusted or known
* untrusted certs in @store (not implemented yet).
@@ -258,28 +258,28 @@ xmlSecGnuTLSAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
*/
int
xmlSecGnuTLSAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type ATTRIBUTE_UNUSED) {
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type ATTRIBUTE_UNUSED) {
xmlSecAssert2(mngr != NULL, -1);
xmlSecAssert2(filename != NULL, -1);
xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
/* TODO */
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecGnuTLSAppKeysMngrCertLoad",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlSecGnuTLSAppKeysMngrCertLoad",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
/**
* xmlSecGnuTLSAppKeysMngrCertLoadMemory:
- * @mngr: the keys manager.
- * @data: the certificate binary data.
- * @dataSize: the certificate binary data size.
- * @format: the certificate file format.
- * @type: the flag that indicates is the certificate trusted or not.
+ * @mngr: the keys manager.
+ * @data: the certificate binary data.
+ * @dataSize: the certificate binary data size.
+ * @format: the certificate file format.
+ * @type: the flag that indicates is the certificate trusted or not.
*
* Reads cert from binary buffer @data and adds to the list of trusted or known
* untrusted certs in @store (not implemented yet).
@@ -288,18 +288,18 @@ xmlSecGnuTLSAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
*/
int
xmlSecGnuTLSAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* data,
- xmlSecSize dataSize, xmlSecKeyDataFormat format,
- xmlSecKeyDataType type) {
+ xmlSecSize dataSize, xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type) {
xmlSecAssert2(mngr != NULL, -1);
xmlSecAssert2(data != NULL, -1);
xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
/* TODO */
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecGnuTLSAppKeysMngrCertLoadMemory",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlSecGnuTLSAppKeysMngrCertLoadMemory",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -307,7 +307,7 @@ xmlSecGnuTLSAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte*
/**
* xmlSecGnuTLSAppDefaultKeysMngrInit:
- * @mngr: the pointer to keys manager.
+ * @mngr: the pointer to keys manager.
*
* Initializes @mngr with simple keys store #xmlSecSimpleKeysStoreId
* and a default GnuTLS crypto key data stores.
@@ -322,38 +322,38 @@ xmlSecGnuTLSAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
/* create simple keys store if needed */
if(xmlSecKeysMngrGetKeysStore(mngr) == NULL) {
- xmlSecKeyStorePtr keysStore;
-
- keysStore = xmlSecKeyStoreCreate(xmlSecSimpleKeysStoreId);
- if(keysStore == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyStoreCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecSimpleKeysStoreId");
- return(-1);
- }
-
- ret = xmlSecKeysMngrAdoptKeysStore(mngr, keysStore);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrAdoptKeysStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyStoreDestroy(keysStore);
- return(-1);
- }
+ xmlSecKeyStorePtr keysStore;
+
+ keysStore = xmlSecKeyStoreCreate(xmlSecSimpleKeysStoreId);
+ if(keysStore == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyStoreCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecSimpleKeysStoreId");
+ return(-1);
+ }
+
+ ret = xmlSecKeysMngrAdoptKeysStore(mngr, keysStore);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrAdoptKeysStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyStoreDestroy(keysStore);
+ return(-1);
+ }
}
ret = xmlSecGnuTLSKeysMngrInit(mngr);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecGnuTLSKeysMngrInit",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecGnuTLSKeysMngrInit",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* TODO */
@@ -363,8 +363,8 @@ xmlSecGnuTLSAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
/**
* xmlSecGnuTLSAppDefaultKeysMngrAdoptKey:
- * @mngr: the pointer to keys manager.
- * @key: the pointer to key.
+ * @mngr: the pointer to keys manager.
+ * @key: the pointer to key.
*
* Adds @key to the keys manager @mngr created with #xmlSecGnuTLSAppDefaultKeysMngrInit
* function.
@@ -381,22 +381,22 @@ xmlSecGnuTLSAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key)
store = xmlSecKeysMngrGetKeysStore(mngr);
if(store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrGetKeysStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrGetKeysStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecSimpleKeysStoreAdoptKey(store, key);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSimpleKeysStoreAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSimpleKeysStoreAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -404,8 +404,8 @@ xmlSecGnuTLSAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key)
/**
* xmlSecGnuTLSAppDefaultKeysMngrLoad:
- * @mngr: the pointer to keys manager.
- * @uri: the uri.
+ * @mngr: the pointer to keys manager.
+ * @uri: the uri.
*
* Loads XML keys file from @uri to the keys manager @mngr created
* with #xmlSecGnuTLSAppDefaultKeysMngrInit function.
@@ -422,22 +422,22 @@ xmlSecGnuTLSAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
store = xmlSecKeysMngrGetKeysStore(mngr);
if(store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrGetKeysStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrGetKeysStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecSimpleKeysStoreLoad(store, uri, mngr);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSimpleKeysStoreLoad",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "uri=%s", xmlSecErrorsSafeString(uri));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSimpleKeysStoreLoad",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "uri=%s", xmlSecErrorsSafeString(uri));
+ return(-1);
}
return(0);
@@ -445,9 +445,9 @@ xmlSecGnuTLSAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
/**
* xmlSecGnuTLSAppDefaultKeysMngrSave:
- * @mngr: the pointer to keys manager.
- * @filename: the destination filename.
- * @type: the type of keys to save (public/private/symmetric).
+ * @mngr: the pointer to keys manager.
+ * @filename: the destination filename.
+ * @type: the type of keys to save (public/private/symmetric).
*
* Saves keys from @mngr to XML keys file.
*
@@ -463,23 +463,23 @@ xmlSecGnuTLSAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename,
store = xmlSecKeysMngrGetKeysStore(mngr);
if(store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrGetKeysStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrGetKeysStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecSimpleKeysStoreSave(store, filename, type);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSimpleKeysStoreSave",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "filename=%s",
- xmlSecErrorsSafeString(filename));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSimpleKeysStoreSave",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "filename=%s",
+ xmlSecErrorsSafeString(filename));
+ return(-1);
}
return(0);
diff --git a/src/gnutls/ciphers.c b/src/gnutls/ciphers.c
index b942159..4a4eedd 100644
--- a/src/gnutls/ciphers.c
+++ b/src/gnutls/ciphers.c
@@ -25,41 +25,41 @@
* Internal GnuTLS Block cipher CTX
*
*****************************************************************************/
-typedef struct _xmlSecGnuTLSBlockCipherCtx xmlSecGnuTLSBlockCipherCtx,
- *xmlSecGnuTLSBlockCipherCtxPtr;
+typedef struct _xmlSecGnuTLSBlockCipherCtx xmlSecGnuTLSBlockCipherCtx,
+ *xmlSecGnuTLSBlockCipherCtxPtr;
struct _xmlSecGnuTLSBlockCipherCtx {
- int cipher;
- int mode;
- GcryCipherHd cipherCtx;
- xmlSecKeyDataId keyId;
- int keyInitialized;
- int ctxInitialized;
+ int cipher;
+ int mode;
+ GcryCipherHd cipherCtx;
+ xmlSecKeyDataId keyId;
+ int keyInitialized;
+ int ctxInitialized;
};
-static int xmlSecGnuTLSBlockCipherCtxInit (xmlSecGnuTLSBlockCipherCtxPtr ctx,
- xmlSecBufferPtr in,
- xmlSecBufferPtr out,
- int encrypt,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecGnuTLSBlockCipherCtxUpdate (xmlSecGnuTLSBlockCipherCtxPtr ctx,
- xmlSecBufferPtr in,
- xmlSecBufferPtr out,
- int encrypt,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecGnuTLSBlockCipherCtxFinal (xmlSecGnuTLSBlockCipherCtxPtr ctx,
- xmlSecBufferPtr in,
- xmlSecBufferPtr out,
- int encrypt,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecGnuTLSBlockCipherCtxInit (xmlSecGnuTLSBlockCipherCtxPtr ctx,
+ xmlSecBufferPtr in,
+ xmlSecBufferPtr out,
+ int encrypt,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecGnuTLSBlockCipherCtxUpdate (xmlSecGnuTLSBlockCipherCtxPtr ctx,
+ xmlSecBufferPtr in,
+ xmlSecBufferPtr out,
+ int encrypt,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecGnuTLSBlockCipherCtxFinal (xmlSecGnuTLSBlockCipherCtxPtr ctx,
+ xmlSecBufferPtr in,
+ xmlSecBufferPtr out,
+ int encrypt,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx);
static int
xmlSecGnuTLSBlockCipherCtxInit(xmlSecGnuTLSBlockCipherCtxPtr ctx,
- xmlSecBufferPtr in, xmlSecBufferPtr out,
- int encrypt,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecBufferPtr in, xmlSecBufferPtr out,
+ int encrypt,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx) {
int blockLen;
int ret;
@@ -77,62 +77,62 @@ xmlSecGnuTLSBlockCipherCtxInit(xmlSecGnuTLSBlockCipherCtxPtr ctx,
xmlSecAssert2(blockLen > 0, -1);
if(encrypt) {
- xmlSecByte* iv;
- xmlSecSize outSize;
-
- /* allocate space for IV */
- outSize = xmlSecBufferGetSize(out);
- ret = xmlSecBufferSetSize(out, outSize + blockLen);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + blockLen);
- return(-1);
- }
- iv = xmlSecBufferGetData(out) + outSize;
-
- /* generate and use random iv */
- gcry_randomize(iv, blockLen, GCRY_STRONG_RANDOM);
- ret = gcry_cipher_setiv(ctx->cipherCtx, iv, blockLen);
- if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "gcry_cipher_setiv",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "ret=%d", ret);
- return(-1);
- }
+ xmlSecByte* iv;
+ xmlSecSize outSize;
+
+ /* allocate space for IV */
+ outSize = xmlSecBufferGetSize(out);
+ ret = xmlSecBufferSetSize(out, outSize + blockLen);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + blockLen);
+ return(-1);
+ }
+ iv = xmlSecBufferGetData(out) + outSize;
+
+ /* generate and use random iv */
+ gcry_randomize(iv, blockLen, GCRY_STRONG_RANDOM);
+ ret = gcry_cipher_setiv(ctx->cipherCtx, iv, blockLen);
+ if(ret != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "gcry_cipher_setiv",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "ret=%d", ret);
+ return(-1);
+ }
} else {
- /* if we don't have enough data, exit and hope that
- * we'll have iv next time */
- if(xmlSecBufferGetSize(in) < (xmlSecSize)blockLen) {
- return(0);
- }
- xmlSecAssert2(xmlSecBufferGetData(in) != NULL, -1);
-
- /* set iv */
- ret = gcry_cipher_setiv(ctx->cipherCtx, xmlSecBufferGetData(in), blockLen);
- if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "gcry_cipher_setiv",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "ret=%d", ret);
- return(-1);
- }
-
- /* and remove from input */
- ret = xmlSecBufferRemoveHead(in, blockLen);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", blockLen);
- return(-1);
- }
+ /* if we don't have enough data, exit and hope that
+ * we'll have iv next time */
+ if(xmlSecBufferGetSize(in) < (xmlSecSize)blockLen) {
+ return(0);
+ }
+ xmlSecAssert2(xmlSecBufferGetData(in) != NULL, -1);
+
+ /* set iv */
+ ret = gcry_cipher_setiv(ctx->cipherCtx, xmlSecBufferGetData(in), blockLen);
+ if(ret != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "gcry_cipher_setiv",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "ret=%d", ret);
+ return(-1);
+ }
+
+ /* and remove from input */
+ ret = xmlSecBufferRemoveHead(in, blockLen);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", blockLen);
+ return(-1);
+ }
}
ctx->ctxInitialized = 1;
@@ -141,10 +141,10 @@ xmlSecGnuTLSBlockCipherCtxInit(xmlSecGnuTLSBlockCipherCtxPtr ctx,
static int
xmlSecGnuTLSBlockCipherCtxUpdate(xmlSecGnuTLSBlockCipherCtxPtr ctx,
- xmlSecBufferPtr in, xmlSecBufferPtr out,
- int encrypt,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecBufferPtr in, xmlSecBufferPtr out,
+ int encrypt,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecSize inSize, inBlocks, outSize;
int blockLen;
xmlSecByte* outBuf;
@@ -165,14 +165,14 @@ xmlSecGnuTLSBlockCipherCtxUpdate(xmlSecGnuTLSBlockCipherCtxPtr ctx,
outSize = xmlSecBufferGetSize(out);
if(inSize < (xmlSecSize)blockLen) {
- return(0);
+ return(0);
}
if(encrypt) {
inBlocks = inSize / ((xmlSecSize)blockLen);
} else {
- /* we want to have the last block in the input buffer
- * for padding check */
+ /* we want to have the last block in the input buffer
+ * for padding check */
inBlocks = (inSize - 1) / ((xmlSecSize)blockLen);
}
inSize = inBlocks * ((xmlSecSize)blockLen);
@@ -180,70 +180,70 @@ xmlSecGnuTLSBlockCipherCtxUpdate(xmlSecGnuTLSBlockCipherCtxPtr ctx,
/* we write out the input size plus may be one block */
ret = xmlSecBufferSetMaxSize(out, outSize + inSize + blockLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + inSize + blockLen);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + inSize + blockLen);
+ return(-1);
}
outBuf = xmlSecBufferGetData(out) + outSize;
if(encrypt) {
- ret = gcry_cipher_encrypt(ctx->cipherCtx, outBuf, inSize + blockLen,
- xmlSecBufferGetData(in), inSize);
- if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "gcry_cipher_encrypt",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "ret=%d", ret);
- return(-1);
- }
+ ret = gcry_cipher_encrypt(ctx->cipherCtx, outBuf, inSize + blockLen,
+ xmlSecBufferGetData(in), inSize);
+ if(ret != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "gcry_cipher_encrypt",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "ret=%d", ret);
+ return(-1);
+ }
} else {
- ret = gcry_cipher_decrypt(ctx->cipherCtx, outBuf, inSize + blockLen,
- xmlSecBufferGetData(in), inSize);
- if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "gcry_cipher_decrypt",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "ret=%d", ret);
- return(-1);
- }
+ ret = gcry_cipher_decrypt(ctx->cipherCtx, outBuf, inSize + blockLen,
+ xmlSecBufferGetData(in), inSize);
+ if(ret != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "gcry_cipher_decrypt",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "ret=%d", ret);
+ return(-1);
+ }
}
/* set correct output buffer size */
ret = xmlSecBufferSetSize(out, outSize + inSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + inSize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + inSize);
+ return(-1);
}
/* remove the processed block from input */
ret = xmlSecBufferRemoveHead(in, inSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
}
return(0);
}
static int
xmlSecGnuTLSBlockCipherCtxFinal(xmlSecGnuTLSBlockCipherCtxPtr ctx,
- xmlSecBufferPtr in,
- xmlSecBufferPtr out,
- int encrypt,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecBufferPtr in,
+ xmlSecBufferPtr out,
+ int encrypt,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecSize inSize, outSize;
int blockLen, outLen = 0;
xmlSecByte* inBuf;
@@ -267,131 +267,131 @@ xmlSecGnuTLSBlockCipherCtxFinal(xmlSecGnuTLSBlockCipherCtxPtr ctx,
if(encrypt != 0) {
xmlSecAssert2(inSize < (xmlSecSize)blockLen, -1);
- /* create padding */
+ /* create padding */
ret = xmlSecBufferSetMaxSize(in, blockLen);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", blockLen);
- return(-1);
- }
- inBuf = xmlSecBufferGetData(in);
-
- /* create random padding */
- if((xmlSecSize)blockLen > (inSize + 1)) {
- gcry_randomize(inBuf + inSize, blockLen - inSize - 1,
- GCRY_STRONG_RANDOM); /* as usual, we are paranoid */
- }
- inBuf[blockLen - 1] = blockLen - inSize;
- inSize = blockLen;
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", blockLen);
+ return(-1);
+ }
+ inBuf = xmlSecBufferGetData(in);
+
+ /* create random padding */
+ if((xmlSecSize)blockLen > (inSize + 1)) {
+ gcry_randomize(inBuf + inSize, blockLen - inSize - 1,
+ GCRY_STRONG_RANDOM); /* as usual, we are paranoid */
+ }
+ inBuf[blockLen - 1] = blockLen - inSize;
+ inSize = blockLen;
} else {
- if(inSize != (xmlSecSize)blockLen) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "data=%d;block=%d", inSize, blockLen);
- return(-1);
- }
+ if(inSize != (xmlSecSize)blockLen) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "data=%d;block=%d", inSize, blockLen);
+ return(-1);
+ }
}
/* process last block */
ret = xmlSecBufferSetMaxSize(out, outSize + 2 * blockLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + 2 * blockLen);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + 2 * blockLen);
+ return(-1);
}
outBuf = xmlSecBufferGetData(out) + outSize;
if(encrypt) {
- ret = gcry_cipher_encrypt(ctx->cipherCtx, outBuf, inSize + blockLen,
- xmlSecBufferGetData(in), inSize);
- if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "gcry_cipher_encrypt",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "ret=%d", ret);
- return(-1);
- }
+ ret = gcry_cipher_encrypt(ctx->cipherCtx, outBuf, inSize + blockLen,
+ xmlSecBufferGetData(in), inSize);
+ if(ret != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "gcry_cipher_encrypt",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "ret=%d", ret);
+ return(-1);
+ }
} else {
- ret = gcry_cipher_decrypt(ctx->cipherCtx, outBuf, inSize + blockLen,
- xmlSecBufferGetData(in), inSize);
- if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "gcry_cipher_decrypt",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "ret=%d", ret);
- return(-1);
- }
+ ret = gcry_cipher_decrypt(ctx->cipherCtx, outBuf, inSize + blockLen,
+ xmlSecBufferGetData(in), inSize);
+ if(ret != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "gcry_cipher_decrypt",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "ret=%d", ret);
+ return(-1);
+ }
}
if(encrypt == 0) {
- /* check padding */
- if(inSize < outBuf[blockLen - 1]) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "padding=%d;buffer=%d",
- outBuf[blockLen - 1], inSize);
- return(-1);
- }
- outLen = inSize - outBuf[blockLen - 1];
+ /* check padding */
+ if(inSize < outBuf[blockLen - 1]) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "padding=%d;buffer=%d",
+ outBuf[blockLen - 1], inSize);
+ return(-1);
+ }
+ outLen = inSize - outBuf[blockLen - 1];
} else {
- outLen = inSize;
+ outLen = inSize;
}
/* set correct output buffer size */
ret = xmlSecBufferSetSize(out, outSize + outLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + outLen);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + outLen);
+ return(-1);
}
/* remove the processed block from input */
ret = xmlSecBufferRemoveHead(in, inSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
}
/* set correct output buffer size */
ret = xmlSecBufferSetSize(out, outSize + outLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + outLen);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + outLen);
+ return(-1);
}
/* remove the processed block from input */
ret = xmlSecBufferRemoveHead(in, inSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
}
return(0);
@@ -405,29 +405,29 @@ xmlSecGnuTLSBlockCipherCtxFinal(xmlSecGnuTLSBlockCipherCtxPtr ctx,
* xmlSecGnuTLSBlockCipherCtx block is located after xmlSecTransform structure
*
*****************************************************************************/
-#define xmlSecGnuTLSBlockCipherSize \
+#define xmlSecGnuTLSBlockCipherSize \
(sizeof(xmlSecTransform) + sizeof(xmlSecGnuTLSBlockCipherCtx))
#define xmlSecGnuTLSBlockCipherGetCtx(transform) \
((xmlSecGnuTLSBlockCipherCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-static int xmlSecGnuTLSBlockCipherInitialize (xmlSecTransformPtr transform);
-static void xmlSecGnuTLSBlockCipherFinalize (xmlSecTransformPtr transform);
-static int xmlSecGnuTLSBlockCipherSetKeyReq (xmlSecTransformPtr transform,
- xmlSecKeyReqPtr keyReq);
-static int xmlSecGnuTLSBlockCipherSetKey (xmlSecTransformPtr transform,
- xmlSecKeyPtr key);
-static int xmlSecGnuTLSBlockCipherExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecGnuTLSBlockCipherCheckId (xmlSecTransformPtr transform);
-
+static int xmlSecGnuTLSBlockCipherInitialize (xmlSecTransformPtr transform);
+static void xmlSecGnuTLSBlockCipherFinalize (xmlSecTransformPtr transform);
+static int xmlSecGnuTLSBlockCipherSetKeyReq (xmlSecTransformPtr transform,
+ xmlSecKeyReqPtr keyReq);
+static int xmlSecGnuTLSBlockCipherSetKey (xmlSecTransformPtr transform,
+ xmlSecKeyPtr key);
+static int xmlSecGnuTLSBlockCipherExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecGnuTLSBlockCipherCheckId (xmlSecTransformPtr transform);
+
static int
xmlSecGnuTLSBlockCipherCheckId(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_DES
if(xmlSecTransformCheckId(transform, xmlSecGnuTLSTransformDes3CbcId)) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_DES */
@@ -460,35 +460,35 @@ xmlSecGnuTLSBlockCipherInitialize(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_DES
if(transform->id == xmlSecGnuTLSTransformDes3CbcId) {
- ctx->cipher = GCRY_CIPHER_3DES;
- ctx->mode = GCRY_CIPHER_MODE_CBC;
- ctx->keyId = xmlSecGnuTLSKeyDataDesId;
+ ctx->cipher = GCRY_CIPHER_3DES;
+ ctx->mode = GCRY_CIPHER_MODE_CBC;
+ ctx->keyId = xmlSecGnuTLSKeyDataDesId;
} else
#endif /* XMLSEC_NO_DES */
#ifndef XMLSEC_NO_AES
if(transform->id == xmlSecGnuTLSTransformAes128CbcId) {
- ctx->cipher = GCRY_CIPHER_AES128;
- ctx->mode = GCRY_CIPHER_MODE_CBC;
- ctx->keyId = xmlSecGnuTLSKeyDataAesId;
+ ctx->cipher = GCRY_CIPHER_AES128;
+ ctx->mode = GCRY_CIPHER_MODE_CBC;
+ ctx->keyId = xmlSecGnuTLSKeyDataAesId;
} else if(transform->id == xmlSecGnuTLSTransformAes192CbcId) {
- ctx->cipher = GCRY_CIPHER_AES192;
- ctx->mode = GCRY_CIPHER_MODE_CBC;
- ctx->keyId = xmlSecGnuTLSKeyDataAesId;
+ ctx->cipher = GCRY_CIPHER_AES192;
+ ctx->mode = GCRY_CIPHER_MODE_CBC;
+ ctx->keyId = xmlSecGnuTLSKeyDataAesId;
} else if(transform->id == xmlSecGnuTLSTransformAes256CbcId) {
- ctx->cipher = GCRY_CIPHER_AES256;
- ctx->mode = GCRY_CIPHER_MODE_CBC;
- ctx->keyId = xmlSecGnuTLSKeyDataAesId;
+ ctx->cipher = GCRY_CIPHER_AES256;
+ ctx->mode = GCRY_CIPHER_MODE_CBC;
+ ctx->keyId = xmlSecGnuTLSKeyDataAesId;
} else
#endif /* XMLSEC_NO_AES */
if(1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
#ifndef XMLSEC_GNUTLS_OLD
@@ -498,12 +498,12 @@ xmlSecGnuTLSBlockCipherInitialize(xmlSecTransformPtr transform) {
ctx->cipherCtx = gcry_cipher_open(ctx->cipher, ctx->mode, GCRY_CIPHER_SECURE); /* we are paranoid */
if(ctx->cipherCtx == NULL) {
#endif /* XMLSEC_GNUTLS_OLD */
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "gcry_cipher_open",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "gcry_cipher_open",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
@@ -519,7 +519,7 @@ xmlSecGnuTLSBlockCipherFinalize(xmlSecTransformPtr transform) {
xmlSecAssert(ctx != NULL);
if(ctx->cipherCtx != NULL) {
- gcry_cipher_close(ctx->cipherCtx);
+ gcry_cipher_close(ctx->cipherCtx);
}
memset(ctx, 0, sizeof(xmlSecGnuTLSBlockCipherCtx));
@@ -539,12 +539,12 @@ xmlSecGnuTLSBlockCipherSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr
xmlSecAssert2(ctx->cipher != 0, -1);
xmlSecAssert2(ctx->keyId != NULL, -1);
- keyReq->keyId = ctx->keyId;
- keyReq->keyType = xmlSecKeyDataTypeSymmetric;
+ keyReq->keyId = ctx->keyId;
+ keyReq->keyType = xmlSecKeyDataTypeSymmetric;
if(transform->operation == xmlSecTransformOperationEncrypt) {
- keyReq->keyUsage = xmlSecKeyUsageEncrypt;
+ keyReq->keyUsage = xmlSecKeyUsageEncrypt;
} else {
- keyReq->keyUsage = xmlSecKeyUsageDecrypt;
+ keyReq->keyUsage = xmlSecKeyUsageDecrypt;
}
keyReq->keyBitsSize = 8 * gcry_cipher_get_algo_keylen(ctx->cipher);
@@ -578,24 +578,24 @@ xmlSecGnuTLSBlockCipherSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
xmlSecAssert2(buffer != NULL, -1);
if(xmlSecBufferGetSize(buffer) < keySize) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
- "keySize=%d;expected=%d",
- xmlSecBufferGetSize(buffer), keySize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
+ "keySize=%d;expected=%d",
+ xmlSecBufferGetSize(buffer), keySize);
+ return(-1);
}
xmlSecAssert2(xmlSecBufferGetData(buffer) != NULL, -1);
ret = gcry_cipher_setkey(ctx->cipherCtx, xmlSecBufferGetData(buffer), keySize);
if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "gcry_cipher_setkey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "ret=%d", ret);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "gcry_cipher_setkey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "ret=%d", ret);
+ return(-1);
}
ctx->keyInitialized = 1;
@@ -620,72 +620,72 @@ xmlSecGnuTLSBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecTra
xmlSecAssert2(ctx != NULL, -1);
if(transform->status == xmlSecTransformStatusNone) {
- transform->status = xmlSecTransformStatusWorking;
+ transform->status = xmlSecTransformStatusWorking;
}
if(transform->status == xmlSecTransformStatusWorking) {
- if(ctx->ctxInitialized == 0) {
- ret = xmlSecGnuTLSBlockCipherCtxInit(ctx, in, out,
- (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
- xmlSecTransformGetName(transform), transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecGnuTLSBlockCipherCtxInit",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- }
- if((ctx->ctxInitialized == 0) && (last != 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "not enough data to initialize transform");
- return(-1);
- }
- if(ctx->ctxInitialized != 0) {
- ret = xmlSecGnuTLSBlockCipherCtxUpdate(ctx, in, out,
- (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
- xmlSecTransformGetName(transform), transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecGnuTLSBlockCipherCtxUpdate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- }
-
- if(last) {
- ret = xmlSecGnuTLSBlockCipherCtxFinal(ctx, in, out,
- (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
- xmlSecTransformGetName(transform), transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecGnuTLSBlockCipherCtxFinal",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- transform->status = xmlSecTransformStatusFinished;
- }
+ if(ctx->ctxInitialized == 0) {
+ ret = xmlSecGnuTLSBlockCipherCtxInit(ctx, in, out,
+ (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
+ xmlSecTransformGetName(transform), transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecGnuTLSBlockCipherCtxInit",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ }
+ if((ctx->ctxInitialized == 0) && (last != 0)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "not enough data to initialize transform");
+ return(-1);
+ }
+ if(ctx->ctxInitialized != 0) {
+ ret = xmlSecGnuTLSBlockCipherCtxUpdate(ctx, in, out,
+ (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
+ xmlSecTransformGetName(transform), transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecGnuTLSBlockCipherCtxUpdate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ }
+
+ if(last) {
+ ret = xmlSecGnuTLSBlockCipherCtxFinal(ctx, in, out,
+ (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
+ xmlSecTransformGetName(transform), transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecGnuTLSBlockCipherCtxFinal",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ transform->status = xmlSecTransformStatusFinished;
+ }
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
} else if(transform->status == xmlSecTransformStatusNone) {
- /* the only way we can get here is if there is no enough data in the input */
- xmlSecAssert2(last == 0, -1);
+ /* the only way we can get here is if there is no enough data in the input */
+ xmlSecAssert2(last == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
@@ -700,29 +700,29 @@ xmlSecGnuTLSBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecTra
********************************************************************/
static xmlSecTransformKlass xmlSecGnuTLSAes128CbcKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecGnuTLSBlockCipherSize, /* xmlSecSize objSize */
-
- xmlSecNameAes128Cbc, /* const xmlChar* name; */
- xmlSecHrefAes128Cbc, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecGnuTLSBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecGnuTLSBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecGnuTLSBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecGnuTLSBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecGnuTLSBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
-
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecGnuTLSBlockCipherSize, /* xmlSecSize objSize */
+
+ xmlSecNameAes128Cbc, /* const xmlChar* name; */
+ xmlSecHrefAes128Cbc, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecGnuTLSBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecGnuTLSBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecGnuTLSBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecGnuTLSBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecGnuTLSBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
+
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -739,29 +739,29 @@ xmlSecGnuTLSTransformAes128CbcGetKlass(void) {
static xmlSecTransformKlass xmlSecGnuTLSAes192CbcKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecGnuTLSBlockCipherSize, /* xmlSecSize objSize */
-
- xmlSecNameAes192Cbc, /* const xmlChar* name; */
- xmlSecHrefAes192Cbc, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecGnuTLSBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecGnuTLSBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecGnuTLSBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecGnuTLSBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecGnuTLSBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecGnuTLSBlockCipherSize, /* xmlSecSize objSize */
+
+ xmlSecNameAes192Cbc, /* const xmlChar* name; */
+ xmlSecHrefAes192Cbc, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecGnuTLSBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecGnuTLSBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecGnuTLSBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecGnuTLSBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecGnuTLSBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -778,29 +778,29 @@ xmlSecGnuTLSTransformAes192CbcGetKlass(void) {
static xmlSecTransformKlass xmlSecGnuTLSAes256CbcKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecGnuTLSBlockCipherSize, /* xmlSecSize objSize */
-
- xmlSecNameAes256Cbc, /* const xmlChar* name; */
- xmlSecHrefAes256Cbc, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecGnuTLSBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecGnuTLSBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecGnuTLSBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecGnuTLSBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecGnuTLSBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecGnuTLSBlockCipherSize, /* xmlSecSize objSize */
+
+ xmlSecNameAes256Cbc, /* const xmlChar* name; */
+ xmlSecHrefAes256Cbc, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecGnuTLSBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecGnuTLSBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecGnuTLSBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecGnuTLSBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecGnuTLSBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -820,29 +820,29 @@ xmlSecGnuTLSTransformAes256CbcGetKlass(void) {
#ifndef XMLSEC_NO_DES
static xmlSecTransformKlass xmlSecGnuTLSDes3CbcKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecGnuTLSBlockCipherSize, /* xmlSecSize objSize */
-
- xmlSecNameDes3Cbc, /* const xmlChar* name; */
- xmlSecHrefDes3Cbc, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecGnuTLSBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecGnuTLSBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecGnuTLSBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecGnuTLSBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecGnuTLSBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecGnuTLSBlockCipherSize, /* xmlSecSize objSize */
+
+ xmlSecNameDes3Cbc, /* const xmlChar* name; */
+ xmlSecHrefDes3Cbc, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecGnuTLSBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecGnuTLSBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecGnuTLSBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecGnuTLSBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecGnuTLSBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
diff --git a/src/gnutls/crypto.c b/src/gnutls/crypto.c
index dbf69f2..42e696c 100644
--- a/src/gnutls/crypto.c
+++ b/src/gnutls/crypto.c
@@ -37,7 +37,7 @@ xmlSecCryptoGetFunctions_gnutls(void) {
static xmlSecCryptoDLFunctions functions;
if(gXmlSecGnuTLSFunctions != NULL) {
- return(gXmlSecGnuTLSFunctions);
+ return(gXmlSecGnuTLSFunctions);
}
memset(&functions, 0, sizeof(functions));
@@ -46,23 +46,23 @@ xmlSecCryptoGetFunctions_gnutls(void) {
/**
* Crypto Init/shutdown
*/
- gXmlSecGnuTLSFunctions->cryptoInit = xmlSecGnuTLSInit;
- gXmlSecGnuTLSFunctions->cryptoShutdown = xmlSecGnuTLSShutdown;
- gXmlSecGnuTLSFunctions->cryptoKeysMngrInit = xmlSecGnuTLSKeysMngrInit;
+ gXmlSecGnuTLSFunctions->cryptoInit = xmlSecGnuTLSInit;
+ gXmlSecGnuTLSFunctions->cryptoShutdown = xmlSecGnuTLSShutdown;
+ gXmlSecGnuTLSFunctions->cryptoKeysMngrInit = xmlSecGnuTLSKeysMngrInit;
/**
* Key data ids
*/
#ifndef XMLSEC_NO_AES
- gXmlSecGnuTLSFunctions->keyDataAesGetKlass = xmlSecGnuTLSKeyDataAesGetKlass;
+ gXmlSecGnuTLSFunctions->keyDataAesGetKlass = xmlSecGnuTLSKeyDataAesGetKlass;
#endif /* XMLSEC_NO_AES */
#ifndef XMLSEC_NO_DES
- gXmlSecGnuTLSFunctions->keyDataDesGetKlass = xmlSecGnuTLSKeyDataDesGetKlass;
+ gXmlSecGnuTLSFunctions->keyDataDesGetKlass = xmlSecGnuTLSKeyDataDesGetKlass;
#endif /* XMLSEC_NO_DES */
#ifndef XMLSEC_NO_HMAC
- gXmlSecGnuTLSFunctions->keyDataHmacGetKlass = xmlSecGnuTLSKeyDataHmacGetKlass;
+ gXmlSecGnuTLSFunctions->keyDataHmacGetKlass = xmlSecGnuTLSKeyDataHmacGetKlass;
#endif /* XMLSEC_NO_HMAC */
/**
@@ -73,41 +73,41 @@ xmlSecCryptoGetFunctions_gnutls(void) {
* Crypto transforms ids
*/
#ifndef XMLSEC_NO_AES
- gXmlSecGnuTLSFunctions->transformAes128CbcGetKlass = xmlSecGnuTLSTransformAes128CbcGetKlass;
- gXmlSecGnuTLSFunctions->transformAes192CbcGetKlass = xmlSecGnuTLSTransformAes192CbcGetKlass;
- gXmlSecGnuTLSFunctions->transformAes256CbcGetKlass = xmlSecGnuTLSTransformAes256CbcGetKlass;
+ gXmlSecGnuTLSFunctions->transformAes128CbcGetKlass = xmlSecGnuTLSTransformAes128CbcGetKlass;
+ gXmlSecGnuTLSFunctions->transformAes192CbcGetKlass = xmlSecGnuTLSTransformAes192CbcGetKlass;
+ gXmlSecGnuTLSFunctions->transformAes256CbcGetKlass = xmlSecGnuTLSTransformAes256CbcGetKlass;
#endif /* XMLSEC_NO_AES */
#ifndef XMLSEC_NO_DES
- gXmlSecGnuTLSFunctions->transformDes3CbcGetKlass = xmlSecGnuTLSTransformDes3CbcGetKlass;
+ gXmlSecGnuTLSFunctions->transformDes3CbcGetKlass = xmlSecGnuTLSTransformDes3CbcGetKlass;
#endif /* XMLSEC_NO_DES */
#ifndef XMLSEC_NO_HMAC
- gXmlSecGnuTLSFunctions->transformHmacSha1GetKlass = xmlSecGnuTLSTransformHmacSha1GetKlass;
- gXmlSecGnuTLSFunctions->transformHmacRipemd160GetKlass = xmlSecGnuTLSTransformHmacRipemd160GetKlass;
- gXmlSecGnuTLSFunctions->transformHmacMd5GetKlass = xmlSecGnuTLSTransformHmacMd5GetKlass;
+ gXmlSecGnuTLSFunctions->transformHmacSha1GetKlass = xmlSecGnuTLSTransformHmacSha1GetKlass;
+ gXmlSecGnuTLSFunctions->transformHmacRipemd160GetKlass = xmlSecGnuTLSTransformHmacRipemd160GetKlass;
+ gXmlSecGnuTLSFunctions->transformHmacMd5GetKlass = xmlSecGnuTLSTransformHmacMd5GetKlass;
#endif /* XMLSEC_NO_HMAC */
#ifndef XMLSEC_NO_SHA1
- gXmlSecGnuTLSFunctions->transformSha1GetKlass = xmlSecGnuTLSTransformSha1GetKlass;
+ gXmlSecGnuTLSFunctions->transformSha1GetKlass = xmlSecGnuTLSTransformSha1GetKlass;
#endif /* XMLSEC_NO_SHA1 */
/**
* High level routines form xmlsec command line utility
*/
- gXmlSecGnuTLSFunctions->cryptoAppInit = xmlSecGnuTLSAppInit;
- gXmlSecGnuTLSFunctions->cryptoAppShutdown = xmlSecGnuTLSAppShutdown;
- gXmlSecGnuTLSFunctions->cryptoAppDefaultKeysMngrInit = xmlSecGnuTLSAppDefaultKeysMngrInit;
- gXmlSecGnuTLSFunctions->cryptoAppDefaultKeysMngrAdoptKey = xmlSecGnuTLSAppDefaultKeysMngrAdoptKey;
- gXmlSecGnuTLSFunctions->cryptoAppDefaultKeysMngrLoad = xmlSecGnuTLSAppDefaultKeysMngrLoad;
- gXmlSecGnuTLSFunctions->cryptoAppDefaultKeysMngrSave = xmlSecGnuTLSAppDefaultKeysMngrSave;
+ gXmlSecGnuTLSFunctions->cryptoAppInit = xmlSecGnuTLSAppInit;
+ gXmlSecGnuTLSFunctions->cryptoAppShutdown = xmlSecGnuTLSAppShutdown;
+ gXmlSecGnuTLSFunctions->cryptoAppDefaultKeysMngrInit = xmlSecGnuTLSAppDefaultKeysMngrInit;
+ gXmlSecGnuTLSFunctions->cryptoAppDefaultKeysMngrAdoptKey = xmlSecGnuTLSAppDefaultKeysMngrAdoptKey;
+ gXmlSecGnuTLSFunctions->cryptoAppDefaultKeysMngrLoad = xmlSecGnuTLSAppDefaultKeysMngrLoad;
+ gXmlSecGnuTLSFunctions->cryptoAppDefaultKeysMngrSave = xmlSecGnuTLSAppDefaultKeysMngrSave;
#ifndef XMLSEC_NO_X509
- gXmlSecGnuTLSFunctions->cryptoAppKeysMngrCertLoad = xmlSecGnuTLSAppKeysMngrCertLoad;
- gXmlSecGnuTLSFunctions->cryptoAppPkcs12Load = xmlSecGnuTLSAppPkcs12Load;
- gXmlSecGnuTLSFunctions->cryptoAppKeyCertLoad = xmlSecGnuTLSAppKeyCertLoad;
+ gXmlSecGnuTLSFunctions->cryptoAppKeysMngrCertLoad = xmlSecGnuTLSAppKeysMngrCertLoad;
+ gXmlSecGnuTLSFunctions->cryptoAppPkcs12Load = xmlSecGnuTLSAppPkcs12Load;
+ gXmlSecGnuTLSFunctions->cryptoAppKeyCertLoad = xmlSecGnuTLSAppKeyCertLoad;
#endif /* XMLSEC_NO_X509 */
- gXmlSecGnuTLSFunctions->cryptoAppKeyLoad = xmlSecGnuTLSAppKeyLoad;
- gXmlSecGnuTLSFunctions->cryptoAppDefaultPwdCallback = (void*)xmlSecGnuTLSAppGetDefaultPwdCallback();
+ gXmlSecGnuTLSFunctions->cryptoAppKeyLoad = xmlSecGnuTLSAppKeyLoad;
+ gXmlSecGnuTLSFunctions->cryptoAppDefaultPwdCallback = (void*)xmlSecGnuTLSAppGetDefaultPwdCallback();
return(gXmlSecGnuTLSFunctions);
}
@@ -124,22 +124,22 @@ int
xmlSecGnuTLSInit (void) {
/* Check loaded xmlsec library version */
if(xmlSecCheckVersionExact() != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCheckVersionExact",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCheckVersionExact",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* register our klasses */
if(xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(xmlSecCryptoGetFunctions_gnutls()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -159,7 +159,7 @@ xmlSecGnuTLSShutdown(void) {
/**
* xmlSecGnuTLSKeysMngrInit:
- * @mngr: the pointer to keys manager.
+ * @mngr: the pointer to keys manager.
*
* Adds GnuTLS specific key data stores in keys manager.
*
@@ -175,15 +175,15 @@ xmlSecGnuTLSKeysMngrInit(xmlSecKeysMngrPtr mngr) {
/**
* xmlSecGnuTLSGenerateRandom:
- * @buffer: the destination buffer.
- * @size: the numer of bytes to generate.
+ * @buffer: the destination buffer.
+ * @size: the numer of bytes to generate.
*
* Generates @size random bytes and puts result in @buffer.
*
* Returns: 0 on success or a negative value otherwise.
*/
int
-xmlSecGnuTLSGenerateRandom(xmlSecBufferPtr buffer, xmlSecSize size) {
+xmlSecGnuTLSGenerateRandom(xmlSecBufferPtr buffer, xmlSecSize size) {
int ret;
xmlSecAssert2(buffer != NULL, -1);
@@ -191,12 +191,12 @@ xmlSecGnuTLSGenerateRandom(xmlSecBufferPtr buffer, xmlSecSize size) {
ret = xmlSecBufferSetSize(buffer, size);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", size);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", size);
+ return(-1);
}
/* get random data */
diff --git a/src/gnutls/digests.c b/src/gnutls/digests.c
index fb8109d..5b4b4a5 100644
--- a/src/gnutls/digests.c
+++ b/src/gnutls/digests.c
@@ -21,20 +21,20 @@
#include <xmlsec/gnutls/app.h>
#include <xmlsec/gnutls/crypto.h>
-#define XMLSEC_GNUTLS_MAX_DIGEST_SIZE 32
+#define XMLSEC_GNUTLS_MAX_DIGEST_SIZE 32
/**************************************************************************
*
* Internal GNUTLS Digest CTX
*
*****************************************************************************/
-typedef struct _xmlSecGnuTLSDigestCtx xmlSecGnuTLSDigestCtx, *xmlSecGnuTLSDigestCtxPtr;
+typedef struct _xmlSecGnuTLSDigestCtx xmlSecGnuTLSDigestCtx, *xmlSecGnuTLSDigestCtxPtr;
struct _xmlSecGnuTLSDigestCtx {
- int digest;
- GcryMDHd digestCtx;
- xmlSecByte dgst[XMLSEC_GNUTLS_MAX_DIGEST_SIZE];
- xmlSecSize dgstSize; /* dgst size in bytes */
-};
+ int digest;
+ GcryMDHd digestCtx;
+ xmlSecByte dgst[XMLSEC_GNUTLS_MAX_DIGEST_SIZE];
+ xmlSecSize dgstSize; /* dgst size in bytes */
+};
/******************************************************************************
*
@@ -43,28 +43,28 @@ struct _xmlSecGnuTLSDigestCtx {
* xmlSecGnuTLSDigestCtx is located after xmlSecTransform
*
*****************************************************************************/
-#define xmlSecGnuTLSDigestSize \
- (sizeof(xmlSecTransform) + sizeof(xmlSecGnuTLSDigestCtx))
+#define xmlSecGnuTLSDigestSize \
+ (sizeof(xmlSecTransform) + sizeof(xmlSecGnuTLSDigestCtx))
#define xmlSecGnuTLSDigestGetCtx(transform) \
((xmlSecGnuTLSDigestCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-static int xmlSecGnuTLSDigestInitialize (xmlSecTransformPtr transform);
-static void xmlSecGnuTLSDigestFinalize (xmlSecTransformPtr transform);
-static int xmlSecGnuTLSDigestVerify (xmlSecTransformPtr transform,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecGnuTLSDigestExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecGnuTLSDigestCheckId (xmlSecTransformPtr transform);
+static int xmlSecGnuTLSDigestInitialize (xmlSecTransformPtr transform);
+static void xmlSecGnuTLSDigestFinalize (xmlSecTransformPtr transform);
+static int xmlSecGnuTLSDigestVerify (xmlSecTransformPtr transform,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecGnuTLSDigestExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecGnuTLSDigestCheckId (xmlSecTransformPtr transform);
static int
xmlSecGnuTLSDigestCheckId(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_SHA1
if(xmlSecTransformCheckId(transform, xmlSecGnuTLSTransformSha1Id)) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_SHA1 */
@@ -89,17 +89,17 @@ xmlSecGnuTLSDigestInitialize(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_SHA1
if(xmlSecTransformCheckId(transform, xmlSecGnuTLSTransformSha1Id)) {
- ctx->digest = GCRY_MD_SHA1;
+ ctx->digest = GCRY_MD_SHA1;
} else
-#endif /* XMLSEC_NO_SHA1 */
+#endif /* XMLSEC_NO_SHA1 */
if(1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
#ifndef XMLSEC_GNUTLS_OLD
@@ -109,12 +109,12 @@ xmlSecGnuTLSDigestInitialize(xmlSecTransformPtr transform) {
ctx->digestCtx = gcry_md_open(ctx->digest, GCRY_MD_FLAG_SECURE); /* we are paranoid */
if(ctx->digestCtx == NULL) {
#endif /* XMLSEC_GNUTLS_OLD */
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "gcry_md_open",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "gcry_md_open",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
@@ -130,15 +130,15 @@ xmlSecGnuTLSDigestFinalize(xmlSecTransformPtr transform) {
xmlSecAssert(ctx != NULL);
if(ctx->digestCtx != NULL) {
- gcry_md_close(ctx->digestCtx);
+ gcry_md_close(ctx->digestCtx);
}
memset(ctx, 0, sizeof(xmlSecGnuTLSDigestCtx));
}
static int
xmlSecGnuTLSDigestVerify(xmlSecTransformPtr transform,
- const xmlSecByte* data, xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx) {
+ const xmlSecByte* data, xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecGnuTLSDigestCtxPtr ctx;
xmlSecAssert2(xmlSecGnuTLSDigestCheckId(transform), -1);
@@ -153,24 +153,24 @@ xmlSecGnuTLSDigestVerify(xmlSecTransformPtr transform,
xmlSecAssert2(ctx->dgstSize > 0, -1);
if(dataSize != ctx->dgstSize) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "data and digest sizes are different (data=%d, dgst=%d)",
- dataSize, ctx->dgstSize);
- transform->status = xmlSecTransformStatusFail;
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "data and digest sizes are different (data=%d, dgst=%d)",
+ dataSize, ctx->dgstSize);
+ transform->status = xmlSecTransformStatusFail;
+ return(0);
}
if(memcmp(ctx->dgst, data, dataSize) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "data and digest do not match");
- transform->status = xmlSecTransformStatusFail;
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "data and digest do not match");
+ transform->status = xmlSecTransformStatusFail;
+ return(0);
}
transform->status = xmlSecTransformStatusOk;
@@ -197,71 +197,71 @@ xmlSecGnuTLSDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
out = &(transform->outBuf);
if(transform->status == xmlSecTransformStatusNone) {
- transform->status = xmlSecTransformStatusWorking;
+ transform->status = xmlSecTransformStatusWorking;
}
if(transform->status == xmlSecTransformStatusWorking) {
- xmlSecSize inSize;
-
- inSize = xmlSecBufferGetSize(in);
- if(inSize > 0) {
- gcry_md_write(ctx->digestCtx, xmlSecBufferGetData(in), inSize);
-
- ret = xmlSecBufferRemoveHead(in, inSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
- }
- }
- if(last) {
- xmlSecByte* buf;
-
- /* get the final digest */
- gcry_md_final(ctx->digestCtx);
- buf = gcry_md_read(ctx->digestCtx, ctx->digest);
- if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "gcry_md_read",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- /* copy it to our internal buffer */
- ctx->dgstSize = gcry_md_get_algo_dlen(ctx->digest);
- xmlSecAssert2(ctx->dgstSize > 0, -1);
- xmlSecAssert2(ctx->dgstSize <= sizeof(ctx->dgst), -1);
- memcpy(ctx->dgst, buf, ctx->dgstSize);
-
- /* and to the output if needed */
- if(transform->operation == xmlSecTransformOperationSign) {
- ret = xmlSecBufferAppend(out, ctx->dgst, ctx->dgstSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", ctx->dgstSize);
- return(-1);
- }
- }
- transform->status = xmlSecTransformStatusFinished;
- }
+ xmlSecSize inSize;
+
+ inSize = xmlSecBufferGetSize(in);
+ if(inSize > 0) {
+ gcry_md_write(ctx->digestCtx, xmlSecBufferGetData(in), inSize);
+
+ ret = xmlSecBufferRemoveHead(in, inSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
+ }
+ }
+ if(last) {
+ xmlSecByte* buf;
+
+ /* get the final digest */
+ gcry_md_final(ctx->digestCtx);
+ buf = gcry_md_read(ctx->digestCtx, ctx->digest);
+ if(buf == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "gcry_md_read",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ /* copy it to our internal buffer */
+ ctx->dgstSize = gcry_md_get_algo_dlen(ctx->digest);
+ xmlSecAssert2(ctx->dgstSize > 0, -1);
+ xmlSecAssert2(ctx->dgstSize <= sizeof(ctx->dgst), -1);
+ memcpy(ctx->dgst, buf, ctx->dgstSize);
+
+ /* and to the output if needed */
+ if(transform->operation == xmlSecTransformOperationSign) {
+ ret = xmlSecBufferAppend(out, ctx->dgst, ctx->dgstSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", ctx->dgstSize);
+ return(-1);
+ }
+ }
+ transform->status = xmlSecTransformStatusFinished;
+ }
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
@@ -275,31 +275,31 @@ xmlSecGnuTLSDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
*****************************************************************************/
static xmlSecTransformKlass xmlSecGnuTLSSha1Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecGnuTLSDigestSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecGnuTLSDigestSize, /* xmlSecSize objSize */
/* data */
- xmlSecNameSha1, /* const xmlChar* name; */
- xmlSecHrefSha1, /* const xmlChar* href; */
- xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameSha1, /* const xmlChar* name; */
+ xmlSecHrefSha1, /* const xmlChar* href; */
+ xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
/* methods */
- xmlSecGnuTLSDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecGnuTLSDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecGnuTLSDigestVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecGnuTLSDigestExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecGnuTLSDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecGnuTLSDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecGnuTLSDigestVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecGnuTLSDigestExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
diff --git a/src/gnutls/hmac.c b/src/gnutls/hmac.c
index bc10647..4f0e935 100644
--- a/src/gnutls/hmac.c
+++ b/src/gnutls/hmac.c
@@ -24,8 +24,8 @@
#include <xmlsec/gnutls/crypto.h>
/* sizes in bits */
-#define XMLSEC_GNUTLS_MIN_HMAC_SIZE 80
-#define XMLSEC_GNUTLS_MAX_HMAC_SIZE (128 * 8)
+#define XMLSEC_GNUTLS_MIN_HMAC_SIZE 80
+#define XMLSEC_GNUTLS_MAX_HMAC_SIZE (128 * 8)
/**************************************************************************
*
@@ -62,13 +62,13 @@ void xmlSecGnuTLSHmacSetMinOutputLength(int min_length)
* Internal GNUTLS HMAC CTX
*
*****************************************************************************/
-typedef struct _xmlSecGnuTLSHmacCtx xmlSecGnuTLSHmacCtx, *xmlSecGnuTLSHmacCtxPtr;
+typedef struct _xmlSecGnuTLSHmacCtx xmlSecGnuTLSHmacCtx, *xmlSecGnuTLSHmacCtxPtr;
struct _xmlSecGnuTLSHmacCtx {
- int digest;
- GcryMDHd digestCtx;
- xmlSecByte dgst[XMLSEC_GNUTLS_MAX_HMAC_SIZE / 8];
- xmlSecSize dgstSize; /* dgst size in bits */
-};
+ int digest;
+ GcryMDHd digestCtx;
+ xmlSecByte dgst[XMLSEC_GNUTLS_MAX_HMAC_SIZE / 8];
+ xmlSecSize dgstSize; /* dgst size in bits */
+};
/******************************************************************************
*
@@ -79,29 +79,29 @@ struct _xmlSecGnuTLSHmacCtx {
*****************************************************************************/
#define xmlSecGnuTLSHmacGetCtx(transform) \
((xmlSecGnuTLSHmacCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-#define xmlSecGnuTLSHmacSize \
+#define xmlSecGnuTLSHmacSize \
(sizeof(xmlSecTransform) + sizeof(xmlSecGnuTLSHmacCtx))
#define xmlSecGnuTLSHmacCheckId(transform) \
(xmlSecTransformCheckId((transform), xmlSecGnuTLSTransformHmacSha1Id) || \
xmlSecTransformCheckId((transform), xmlSecGnuTLSTransformHmacMd5Id) || \
xmlSecTransformCheckId((transform), xmlSecGnuTLSTransformHmacRipemd160Id))
-static int xmlSecGnuTLSHmacInitialize (xmlSecTransformPtr transform);
-static void xmlSecGnuTLSHmacFinalize (xmlSecTransformPtr transform);
-static int xmlSecGnuTLSHmacNodeRead (xmlSecTransformPtr transform,
- xmlNodePtr node,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecGnuTLSHmacSetKeyReq (xmlSecTransformPtr transform,
- xmlSecKeyReqPtr keyReq);
-static int xmlSecGnuTLSHmacSetKey (xmlSecTransformPtr transform,
- xmlSecKeyPtr key);
-static int xmlSecGnuTLSHmacVerify (xmlSecTransformPtr transform,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecGnuTLSHmacExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecGnuTLSHmacInitialize (xmlSecTransformPtr transform);
+static void xmlSecGnuTLSHmacFinalize (xmlSecTransformPtr transform);
+static int xmlSecGnuTLSHmacNodeRead (xmlSecTransformPtr transform,
+ xmlNodePtr node,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecGnuTLSHmacSetKeyReq (xmlSecTransformPtr transform,
+ xmlSecKeyReqPtr keyReq);
+static int xmlSecGnuTLSHmacSetKey (xmlSecTransformPtr transform,
+ xmlSecKeyPtr key);
+static int xmlSecGnuTLSHmacVerify (xmlSecTransformPtr transform,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecGnuTLSHmacExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
static int
xmlSecGnuTLSHmacInitialize(xmlSecTransformPtr transform) {
@@ -124,12 +124,12 @@ xmlSecGnuTLSHmacInitialize(xmlSecTransformPtr transform) {
} else if(xmlSecTransformCheckId(transform, xmlSecGnuTLSTransformHmacRipemd160Id)) {
ctx->digest = GCRY_MD_RMD160;
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
#ifndef XMLSEC_GNUTLS_OLD
@@ -139,12 +139,12 @@ xmlSecGnuTLSHmacInitialize(xmlSecTransformPtr transform) {
ctx->digestCtx = gcry_md_open(ctx->digest, GCRY_MD_FLAG_HMAC | GCRY_MD_FLAG_SECURE); /* we are paranoid */
if(ctx->digestCtx == NULL) {
#endif /* XMLSEC_GNUTLS_OLD */
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "gcry_md_open",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "gcry_md_open",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -161,7 +161,7 @@ xmlSecGnuTLSHmacFinalize(xmlSecTransformPtr transform) {
xmlSecAssert(ctx != NULL);
if(ctx->digestCtx != NULL) {
- gcry_md_close(ctx->digestCtx);
+ gcry_md_close(ctx->digestCtx);
}
memset(ctx, 0, sizeof(xmlSecGnuTLSHmacCtx));
}
@@ -203,37 +203,37 @@ xmlSecGnuTLSHmacNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTr
cur = xmlSecGetNextElementNode(node->children);
if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeHMACOutputLength, xmlSecDSigNs)) {
- xmlChar *content;
-
- content = xmlNodeGetContent(cur);
- if(content != NULL) {
- ctx->dgstSize = atoi((char*)content);
- xmlFree(content);
- }
-
- /* Ensure that HMAC length is greater than min specified.
- Otherwise, an attacker can set this lenght to 0 or very
- small value
- */
- if((int)ctx->dgstSize < xmlSecGnuTLSHmacGetMinOutputLength()) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
- "HMAC output length is too small");
- return(-1);
- }
-
- cur = xmlSecGetNextElementNode(cur->next);
+ xmlChar *content;
+
+ content = xmlNodeGetContent(cur);
+ if(content != NULL) {
+ ctx->dgstSize = atoi((char*)content);
+ xmlFree(content);
+ }
+
+ /* Ensure that HMAC length is greater than min specified.
+ Otherwise, an attacker can set this lenght to 0 or very
+ small value
+ */
+ if((int)ctx->dgstSize < xmlSecGnuTLSHmacGetMinOutputLength()) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
+ "HMAC output length is too small");
+ return(-1);
+ }
+
+ cur = xmlSecGetNextElementNode(cur->next);
}
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "no nodes expected");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "no nodes expected");
+ return(-1);
}
return(0);
}
@@ -254,9 +254,9 @@ xmlSecGnuTLSHmacSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr keyReq)
keyReq->keyId = xmlSecGnuTLSKeyDataHmacId;
keyReq->keyType= xmlSecKeyDataTypeSymmetric;
if(transform->operation == xmlSecTransformOperationSign) {
- keyReq->keyUsage = xmlSecKeyUsageSign;
+ keyReq->keyUsage = xmlSecKeyUsageSign;
} else {
- keyReq->keyUsage = xmlSecKeyUsageVerify;
+ keyReq->keyUsage = xmlSecKeyUsageVerify;
}
return(0);
@@ -285,33 +285,33 @@ xmlSecGnuTLSHmacSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
xmlSecAssert2(buffer != NULL, -1);
if(xmlSecBufferGetSize(buffer) == 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
- "key is empty");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
+ "key is empty");
+ return(-1);
}
ret = gcry_md_setkey(ctx->digestCtx, xmlSecBufferGetData(buffer),
- xmlSecBufferGetSize(buffer));
+ xmlSecBufferGetSize(buffer));
if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "gcry_md_setkey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "ret=%d", ret);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "gcry_md_setkey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "ret=%d", ret);
+ return(-1);
}
return(0);
}
static int
xmlSecGnuTLSHmacVerify(xmlSecTransformPtr transform,
- const xmlSecByte* data, xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx) {
- static xmlSecByte last_byte_masks[] =
- { 0xFF, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE };
+ const xmlSecByte* data, xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx) {
+ static xmlSecByte last_byte_masks[] =
+ { 0xFF, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE };
xmlSecGnuTLSHmacCtxPtr ctx;
xmlSecByte mask;
@@ -330,38 +330,38 @@ xmlSecGnuTLSHmacVerify(xmlSecTransformPtr transform,
/* compare the digest size in bytes */
if(dataSize != ((ctx->dgstSize + 7) / 8)){
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "data=%d;dgst=%d",
- dataSize, ((ctx->dgstSize + 7) / 8));
- transform->status = xmlSecTransformStatusFail;
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "data=%d;dgst=%d",
+ dataSize, ((ctx->dgstSize + 7) / 8));
+ transform->status = xmlSecTransformStatusFail;
+ return(0);
}
/* we check the last byte separatelly */
xmlSecAssert2(dataSize > 0, -1);
mask = last_byte_masks[ctx->dgstSize % 8];
if((ctx->dgst[dataSize - 1] & mask) != (data[dataSize - 1] & mask)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_DATA_NOT_MATCH,
- "data and digest do not match (last byte)");
- transform->status = xmlSecTransformStatusFail;
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_DATA_NOT_MATCH,
+ "data and digest do not match (last byte)");
+ transform->status = xmlSecTransformStatusFail;
+ return(0);
}
/* now check the rest of the digest */
if((dataSize > 1) && (memcmp(ctx->dgst, data, dataSize - 1) != 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_DATA_NOT_MATCH,
- "data and digest do not match");
- transform->status = xmlSecTransformStatusFail;
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_DATA_NOT_MATCH,
+ "data and digest do not match");
+ transform->status = xmlSecTransformStatusFail;
+ return(0);
}
transform->status = xmlSecTransformStatusOk;
@@ -389,83 +389,83 @@ xmlSecGnuTLSHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransformC
out = &(transform->outBuf);
if(transform->status == xmlSecTransformStatusNone) {
- transform->status = xmlSecTransformStatusWorking;
+ transform->status = xmlSecTransformStatusWorking;
}
if(transform->status == xmlSecTransformStatusWorking) {
- xmlSecSize inSize;
-
- inSize = xmlSecBufferGetSize(in);
- if(inSize > 0) {
- gcry_md_write(ctx->digestCtx, xmlSecBufferGetData(in), inSize);
-
- ret = xmlSecBufferRemoveHead(in, inSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
- }
- }
- if(last) {
- /* get the final digest */
- gcry_md_final(ctx->digestCtx);
- dgst = gcry_md_read(ctx->digestCtx, ctx->digest);
- if(dgst == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "gcry_md_read",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- /* copy it to our internal buffer */
- dgstSize = gcry_md_get_algo_dlen(ctx->digest);
- xmlSecAssert2(dgstSize > 0, -1);
- xmlSecAssert2(dgstSize <= sizeof(ctx->dgst), -1);
- memcpy(ctx->dgst, dgst, dgstSize);
-
- /* check/set the result digest size */
- if(ctx->dgstSize == 0) {
- ctx->dgstSize = dgstSize * 8; /* no dgst size specified, use all we have */
- } else if(ctx->dgstSize <= 8 * dgstSize) {
- dgstSize = ((ctx->dgstSize + 7) / 8); /* we need to truncate result digest */
- } else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "result-bits=%d;required-bits=%d",
- 8 * dgstSize, ctx->dgstSize);
- return(-1);
- }
-
- if(transform->operation == xmlSecTransformOperationSign) {
- ret = xmlSecBufferAppend(out, ctx->dgst, dgstSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", dgstSize);
- return(-1);
- }
- }
- transform->status = xmlSecTransformStatusFinished;
- }
+ xmlSecSize inSize;
+
+ inSize = xmlSecBufferGetSize(in);
+ if(inSize > 0) {
+ gcry_md_write(ctx->digestCtx, xmlSecBufferGetData(in), inSize);
+
+ ret = xmlSecBufferRemoveHead(in, inSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
+ }
+ }
+ if(last) {
+ /* get the final digest */
+ gcry_md_final(ctx->digestCtx);
+ dgst = gcry_md_read(ctx->digestCtx, ctx->digest);
+ if(dgst == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "gcry_md_read",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ /* copy it to our internal buffer */
+ dgstSize = gcry_md_get_algo_dlen(ctx->digest);
+ xmlSecAssert2(dgstSize > 0, -1);
+ xmlSecAssert2(dgstSize <= sizeof(ctx->dgst), -1);
+ memcpy(ctx->dgst, dgst, dgstSize);
+
+ /* check/set the result digest size */
+ if(ctx->dgstSize == 0) {
+ ctx->dgstSize = dgstSize * 8; /* no dgst size specified, use all we have */
+ } else if(ctx->dgstSize <= 8 * dgstSize) {
+ dgstSize = ((ctx->dgstSize + 7) / 8); /* we need to truncate result digest */
+ } else {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "result-bits=%d;required-bits=%d",
+ 8 * dgstSize, ctx->dgstSize);
+ return(-1);
+ }
+
+ if(transform->operation == xmlSecTransformOperationSign) {
+ ret = xmlSecBufferAppend(out, ctx->dgst, dgstSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", dgstSize);
+ return(-1);
+ }
+ }
+ transform->status = xmlSecTransformStatusFinished;
+ }
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "size=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "size=%d", transform->status);
+ return(-1);
}
return(0);
@@ -476,29 +476,29 @@ xmlSecGnuTLSHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransformC
*/
static xmlSecTransformKlass xmlSecGnuTLSHmacSha1Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecGnuTLSHmacSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecGnuTLSHmacSize, /* xmlSecSize objSize */
- xmlSecNameHmacSha1, /* const xmlChar* name; */
- xmlSecHrefHmacSha1, /* const xmlChar *href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameHmacSha1, /* const xmlChar* name; */
+ xmlSecHrefHmacSha1, /* const xmlChar *href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecGnuTLSHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecGnuTLSHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- xmlSecGnuTLSHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecGnuTLSHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecGnuTLSHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecGnuTLSHmacVerify, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecGnuTLSHmacExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecGnuTLSHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecGnuTLSHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ xmlSecGnuTLSHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecGnuTLSHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecGnuTLSHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecGnuTLSHmacVerify, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecGnuTLSHmacExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -518,29 +518,29 @@ xmlSecGnuTLSTransformHmacSha1GetKlass(void) {
*/
static xmlSecTransformKlass xmlSecGnuTLSHmacRipemd160Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecGnuTLSHmacSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecGnuTLSHmacSize, /* xmlSecSize objSize */
- xmlSecNameHmacRipemd160, /* const xmlChar* name; */
- xmlSecHrefHmacRipemd160, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameHmacRipemd160, /* const xmlChar* name; */
+ xmlSecHrefHmacRipemd160, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecGnuTLSHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecGnuTLSHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- xmlSecGnuTLSHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecGnuTLSHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecGnuTLSHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecGnuTLSHmacVerify, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecGnuTLSHmacExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecGnuTLSHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecGnuTLSHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ xmlSecGnuTLSHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecGnuTLSHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecGnuTLSHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecGnuTLSHmacVerify, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecGnuTLSHmacExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -560,29 +560,29 @@ xmlSecGnuTLSTransformHmacRipemd160GetKlass(void) {
*/
static xmlSecTransformKlass xmlSecGnuTLSHmacMd5Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecGnuTLSHmacSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecGnuTLSHmacSize, /* xmlSecSize objSize */
- xmlSecNameHmacMd5, /* const xmlChar* name; */
- xmlSecHrefHmacMd5, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameHmacMd5, /* const xmlChar* name; */
+ xmlSecHrefHmacMd5, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecGnuTLSHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecGnuTLSHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- xmlSecGnuTLSHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecGnuTLSHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecGnuTLSHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecGnuTLSHmacVerify, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecGnuTLSHmacExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecGnuTLSHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecGnuTLSHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ xmlSecGnuTLSHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecGnuTLSHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecGnuTLSHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecGnuTLSHmacVerify, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecGnuTLSHmacExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
diff --git a/src/gnutls/symkeys.c b/src/gnutls/symkeys.c
index 4a11d13..b44744a 100644
--- a/src/gnutls/symkeys.c
+++ b/src/gnutls/symkeys.c
@@ -29,39 +29,39 @@
* Symmetic (binary) keys - just a wrapper for xmlSecKeyDataBinary
*
****************************************************************************/
-static int xmlSecGnuTLSSymKeyDataInitialize (xmlSecKeyDataPtr data);
-static int xmlSecGnuTLSSymKeyDataDuplicate (xmlSecKeyDataPtr dst,
- xmlSecKeyDataPtr src);
-static void xmlSecGnuTLSSymKeyDataFinalize (xmlSecKeyDataPtr data);
-static int xmlSecGnuTLSSymKeyDataXmlRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecGnuTLSSymKeyDataXmlWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecGnuTLSSymKeyDataBinRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- const xmlSecByte* buf,
- xmlSecSize bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecGnuTLSSymKeyDataBinWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlSecByte** buf,
- xmlSecSize* bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecGnuTLSSymKeyDataGenerate (xmlSecKeyDataPtr data,
- xmlSecSize sizeBits,
- xmlSecKeyDataType type);
-
-static xmlSecKeyDataType xmlSecGnuTLSSymKeyDataGetType (xmlSecKeyDataPtr data);
-static xmlSecSize xmlSecGnuTLSSymKeyDataGetSize (xmlSecKeyDataPtr data);
-static void xmlSecGnuTLSSymKeyDataDebugDump (xmlSecKeyDataPtr data,
- FILE* output);
-static void xmlSecGnuTLSSymKeyDataDebugXmlDump (xmlSecKeyDataPtr data,
- FILE* output);
-static int xmlSecGnuTLSSymKeyDataKlassCheck (xmlSecKeyDataKlass* klass);
+static int xmlSecGnuTLSSymKeyDataInitialize (xmlSecKeyDataPtr data);
+static int xmlSecGnuTLSSymKeyDataDuplicate (xmlSecKeyDataPtr dst,
+ xmlSecKeyDataPtr src);
+static void xmlSecGnuTLSSymKeyDataFinalize (xmlSecKeyDataPtr data);
+static int xmlSecGnuTLSSymKeyDataXmlRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecGnuTLSSymKeyDataXmlWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecGnuTLSSymKeyDataBinRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ const xmlSecByte* buf,
+ xmlSecSize bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecGnuTLSSymKeyDataBinWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlSecByte** buf,
+ xmlSecSize* bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecGnuTLSSymKeyDataGenerate (xmlSecKeyDataPtr data,
+ xmlSecSize sizeBits,
+ xmlSecKeyDataType type);
+
+static xmlSecKeyDataType xmlSecGnuTLSSymKeyDataGetType (xmlSecKeyDataPtr data);
+static xmlSecSize xmlSecGnuTLSSymKeyDataGetSize (xmlSecKeyDataPtr data);
+static void xmlSecGnuTLSSymKeyDataDebugDump (xmlSecKeyDataPtr data,
+ FILE* output);
+static void xmlSecGnuTLSSymKeyDataDebugXmlDump (xmlSecKeyDataPtr data,
+ FILE* output);
+static int xmlSecGnuTLSSymKeyDataKlassCheck (xmlSecKeyDataKlass* klass);
#define xmlSecGnuTLSSymKeyDataCheckId(data) \
(xmlSecKeyDataIsValid((data)) && \
@@ -92,7 +92,7 @@ xmlSecGnuTLSSymKeyDataFinalize(xmlSecKeyDataPtr data) {
static int
xmlSecGnuTLSSymKeyDataXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecAssert2(xmlSecGnuTLSSymKeyDataKlassCheck(id), -1);
return(xmlSecKeyDataBinaryValueXmlRead(id, key, node, keyInfoCtx));
@@ -100,7 +100,7 @@ xmlSecGnuTLSSymKeyDataXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
static int
xmlSecGnuTLSSymKeyDataXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecAssert2(xmlSecGnuTLSSymKeyDataKlassCheck(id), -1);
return(xmlSecKeyDataBinaryValueXmlWrite(id, key, node, keyInfoCtx));
@@ -108,8 +108,8 @@ xmlSecGnuTLSSymKeyDataXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
static int
xmlSecGnuTLSSymKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- const xmlSecByte* buf, xmlSecSize bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ const xmlSecByte* buf, xmlSecSize bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecAssert2(xmlSecGnuTLSSymKeyDataKlassCheck(id), -1);
return(xmlSecKeyDataBinaryValueBinRead(id, key, buf, bufSize, keyInfoCtx));
@@ -117,8 +117,8 @@ xmlSecGnuTLSSymKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
static int
xmlSecGnuTLSSymKeyDataBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlSecByte** buf, xmlSecSize* bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlSecByte** buf, xmlSecSize* bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecAssert2(xmlSecGnuTLSSymKeyDataKlassCheck(id), -1);
return(xmlSecKeyDataBinaryValueBinWrite(id, key, buf, bufSize, keyInfoCtx));
@@ -174,19 +174,19 @@ static int
xmlSecGnuTLSSymKeyDataKlassCheck(xmlSecKeyDataKlass* klass) {
#ifndef XMLSEC_NO_DES
if(klass == xmlSecGnuTLSKeyDataDesId) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_DES */
#ifndef XMLSEC_NO_AES
if(klass == xmlSecGnuTLSKeyDataAesId) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_AES */
#ifndef XMLSEC_NO_HMAC
if(klass == xmlSecGnuTLSKeyDataHmacId) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_HMAC */
@@ -206,35 +206,35 @@ static xmlSecKeyDataKlass xmlSecGnuTLSKeyDataAesKlass = {
/* data */
xmlSecNameAESKeyValue,
xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefAESKeyValue, /* const xmlChar* href; */
- xmlSecNodeAESKeyValue, /* const xmlChar* dataNodeName; */
- xmlSecNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefAESKeyValue, /* const xmlChar* href; */
+ xmlSecNodeAESKeyValue, /* const xmlChar* dataNodeName; */
+ xmlSecNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecGnuTLSSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecGnuTLSSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecGnuTLSSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- xmlSecGnuTLSSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecGnuTLSSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecGnuTLSSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecGnuTLSSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ xmlSecGnuTLSSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecGnuTLSSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
- xmlSecGnuTLSSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecGnuTLSSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ xmlSecGnuTLSSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecGnuTLSSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecGnuTLSSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- xmlSecGnuTLSSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
- xmlSecGnuTLSSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecGnuTLSSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecGnuTLSSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ xmlSecGnuTLSSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
+ xmlSecGnuTLSSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecGnuTLSSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- xmlSecGnuTLSSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ xmlSecGnuTLSSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecGnuTLSSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -251,9 +251,9 @@ xmlSecGnuTLSKeyDataAesGetKlass(void) {
/**
* xmlSecGnuTLSKeyDataAesSet:
- * @data: the pointer to AES key data.
- * @buf: the pointer to key value.
- * @bufSize: the key value size (in bytes).
+ * @data: the pointer to AES key data.
+ * @buf: the pointer to key value.
+ * @bufSize: the key value size (in bytes).
*
* Sets the value of AES key data.
*
@@ -287,35 +287,35 @@ static xmlSecKeyDataKlass xmlSecGnuTLSKeyDataDesKlass = {
/* data */
xmlSecNameDESKeyValue,
xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefDESKeyValue, /* const xmlChar* href; */
- xmlSecNodeDESKeyValue, /* const xmlChar* dataNodeName; */
- xmlSecNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefDESKeyValue, /* const xmlChar* href; */
+ xmlSecNodeDESKeyValue, /* const xmlChar* dataNodeName; */
+ xmlSecNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecGnuTLSSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecGnuTLSSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecGnuTLSSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- xmlSecGnuTLSSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecGnuTLSSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecGnuTLSSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecGnuTLSSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ xmlSecGnuTLSSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecGnuTLSSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
- xmlSecGnuTLSSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecGnuTLSSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ xmlSecGnuTLSSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecGnuTLSSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecGnuTLSSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- xmlSecGnuTLSSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
- xmlSecGnuTLSSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecGnuTLSSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecGnuTLSSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ xmlSecGnuTLSSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
+ xmlSecGnuTLSSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecGnuTLSSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- xmlSecGnuTLSSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ xmlSecGnuTLSSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecGnuTLSSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -332,9 +332,9 @@ xmlSecGnuTLSKeyDataDesGetKlass(void) {
/**
* xmlSecGnuTLSKeyDataDesSet:
- * @data: the pointer to DES key data.
- * @buf: the pointer to key value.
- * @bufSize: the key value size (in bytes).
+ * @data: the pointer to DES key data.
+ * @buf: the pointer to key value.
+ * @bufSize: the key value size (in bytes).
*
* Sets the value of DES key data.
*
@@ -369,35 +369,35 @@ static xmlSecKeyDataKlass xmlSecGnuTLSKeyDataHmacKlass = {
/* data */
xmlSecNameHMACKeyValue,
xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefHMACKeyValue, /* const xmlChar* href; */
- xmlSecNodeHMACKeyValue, /* const xmlChar* dataNodeName; */
- xmlSecNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefHMACKeyValue, /* const xmlChar* href; */
+ xmlSecNodeHMACKeyValue, /* const xmlChar* dataNodeName; */
+ xmlSecNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecGnuTLSSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecGnuTLSSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecGnuTLSSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- xmlSecGnuTLSSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecGnuTLSSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecGnuTLSSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecGnuTLSSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ xmlSecGnuTLSSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecGnuTLSSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
- xmlSecGnuTLSSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecGnuTLSSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ xmlSecGnuTLSSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecGnuTLSSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecGnuTLSSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- xmlSecGnuTLSSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
- xmlSecGnuTLSSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecGnuTLSSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecGnuTLSSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ xmlSecGnuTLSSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
+ xmlSecGnuTLSSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecGnuTLSSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- xmlSecGnuTLSSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ xmlSecGnuTLSSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecGnuTLSSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -414,9 +414,9 @@ xmlSecGnuTLSKeyDataHmacGetKlass(void) {
/**
* xmlSecGnuTLSKeyDataHmacSet:
- * @data: the pointer to HMAC key data.
- * @buf: the pointer to key value.
- * @bufSize: the key value size (in bytes).
+ * @data: the pointer to HMAC key data.
+ * @buf: the pointer to key value.
+ * @bufSize: the key value size (in bytes).
*
* Sets the value of HMAC key data.
*
diff --git a/src/io.c b/src/io.c
index a691f68..1b90fcf 100644
--- a/src/io.c
+++ b/src/io.c
@@ -45,15 +45,15 @@ typedef struct _xmlSecIOCallback {
xmlInputCloseCallback closecallback;
} xmlSecIOCallback, *xmlSecIOCallbackPtr;
-static xmlSecIOCallbackPtr xmlSecIOCallbackCreate (xmlInputMatchCallback matchFunc,
- xmlInputOpenCallback openFunc,
- xmlInputReadCallback readFunc,
- xmlInputCloseCallback closeFunc);
-static void xmlSecIOCallbackDestroy (xmlSecIOCallbackPtr callbacks);
+static xmlSecIOCallbackPtr xmlSecIOCallbackCreate (xmlInputMatchCallback matchFunc,
+ xmlInputOpenCallback openFunc,
+ xmlInputReadCallback readFunc,
+ xmlInputCloseCallback closeFunc);
+static void xmlSecIOCallbackDestroy (xmlSecIOCallbackPtr callbacks);
static xmlSecIOCallbackPtr
xmlSecIOCallbackCreate(xmlInputMatchCallback matchFunc, xmlInputOpenCallback openFunc,
- xmlInputReadCallback readFunc, xmlInputCloseCallback closeFunc) {
+ xmlInputReadCallback readFunc, xmlInputCloseCallback closeFunc) {
xmlSecIOCallbackPtr callbacks;
xmlSecAssert2(matchFunc != NULL, NULL);
@@ -61,13 +61,13 @@ xmlSecIOCallbackCreate(xmlInputMatchCallback matchFunc, xmlInputOpenCallback ope
/* Allocate a new xmlSecIOCallback and fill the fields. */
callbacks = (xmlSecIOCallbackPtr)xmlMalloc(sizeof(xmlSecIOCallback));
if(callbacks == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "sizeof(xmlSecIOCallback)=%d",
- sizeof(xmlSecIOCallback));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "sizeof(xmlSecIOCallback)=%d",
+ sizeof(xmlSecIOCallback));
+ return(NULL);
}
memset(callbacks, 0, sizeof(xmlSecIOCallback));
@@ -94,16 +94,16 @@ xmlSecIOCallbackDestroy(xmlSecIOCallbackPtr callbacks) {
******************************************************************/
static xmlSecPtrListKlass xmlSecIOCallbackPtrListKlass = {
BAD_CAST "io-callbacks-list",
- NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
+ NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
(xmlSecPtrDestroyItemMethod)xmlSecIOCallbackDestroy,/* xmlSecPtrDestroyItemMethod destroyItem; */
- NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
- NULL /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
+ NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
+ NULL /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
};
-#define xmlSecIOCallbackPtrListId xmlSecIOCallbackPtrListGetKlass ()
-static xmlSecPtrListId xmlSecIOCallbackPtrListGetKlass (void);
-static xmlSecIOCallbackPtr xmlSecIOCallbackPtrListFind (xmlSecPtrListPtr list,
- const char* uri);
+#define xmlSecIOCallbackPtrListId xmlSecIOCallbackPtrListGetKlass ()
+static xmlSecPtrListId xmlSecIOCallbackPtrListGetKlass (void);
+static xmlSecIOCallbackPtr xmlSecIOCallbackPtrListFind (xmlSecPtrListPtr list,
+ const char* uri);
/**
* xmlSecIOCallbackPtrListGetKlass:
@@ -127,13 +127,13 @@ xmlSecIOCallbackPtrListFind(xmlSecPtrListPtr list, const char* uri) {
size = xmlSecPtrListGetSize(list);
for(i = 0; i < size; ++i) {
- callbacks = (xmlSecIOCallbackPtr)xmlSecPtrListGetItem(list, i);
- xmlSecAssert2(callbacks != NULL, NULL);
- xmlSecAssert2(callbacks->matchcallback != NULL, NULL);
-
- if((callbacks->matchcallback(uri)) != 0) {
- return(callbacks);
- }
+ callbacks = (xmlSecIOCallbackPtr)xmlSecPtrListGetItem(list, i);
+ xmlSecAssert2(callbacks != NULL, NULL);
+ xmlSecAssert2(callbacks->matchcallback != NULL, NULL);
+
+ if((callbacks->matchcallback(uri)) != 0) {
+ return(callbacks);
+ }
}
return(NULL);
}
@@ -154,11 +154,11 @@ xmlSecIOInit(void) {
ret = xmlSecPtrListInitialize(&xmlSecAllIOCallbacks, xmlSecIOCallbackPtrListId);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListPtrInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListPtrInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -206,10 +206,10 @@ xmlSecIOCleanupCallbacks(void) {
/**
* xmlSecIORegisterCallbacks:
- * @matchFunc: the protocol match callback.
- * @openFunc: the open stream callback.
- * @readFunc: the read from stream callback.
- * @closeFunc: the close stream callback.
+ * @matchFunc: the protocol match callback.
+ * @openFunc: the open stream callback.
+ * @readFunc: the read from stream callback.
+ * @closeFunc: the close stream callback.
*
* Register a new set of I/O callback for handling parser input.
*
@@ -217,8 +217,8 @@ xmlSecIOCleanupCallbacks(void) {
*/
int
xmlSecIORegisterCallbacks(xmlInputMatchCallback matchFunc,
- xmlInputOpenCallback openFunc, xmlInputReadCallback readFunc,
- xmlInputCloseCallback closeFunc) {
+ xmlInputOpenCallback openFunc, xmlInputReadCallback readFunc,
+ xmlInputCloseCallback closeFunc) {
xmlSecIOCallbackPtr callbacks;
int ret;
@@ -226,23 +226,23 @@ xmlSecIORegisterCallbacks(xmlInputMatchCallback matchFunc,
callbacks = xmlSecIOCallbackCreate(matchFunc, openFunc, readFunc, closeFunc);
if(callbacks == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecIOCallbackCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecIOCallbackCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecPtrListAdd(&xmlSecAllIOCallbacks, callbacks);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecIOCallbackDestroy(callbacks);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecIOCallbackDestroy(callbacks);
+ return(-1);
}
return(0);
}
@@ -261,39 +261,39 @@ xmlSecIORegisterDefaultCallbacks(void) {
#ifdef LIBXML_HTTP_ENABLED
ret = xmlSecIORegisterCallbacks(xmlIOHTTPMatch, xmlIOHTTPOpen,
- xmlIOHTTPRead, xmlIOHTTPClose);
+ xmlIOHTTPRead, xmlIOHTTPClose);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecIORegisterCallbacks",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "http");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecIORegisterCallbacks",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "http");
+ return(-1);
}
#endif /* LIBXML_HTTP_ENABLED */
#ifdef LIBXML_FTP_ENABLED
ret = xmlSecIORegisterCallbacks(xmlIOFTPMatch, xmlIOFTPOpen,
- xmlIOFTPRead, xmlIOFTPClose);
+ xmlIOFTPRead, xmlIOFTPClose);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecIORegisterCallbacks",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "ftp");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecIORegisterCallbacks",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "ftp");
+ return(-1);
}
#endif /* LIBXML_FTP_ENABLED */
ret = xmlSecIORegisterCallbacks(xmlFileMatch, xmlFileOpen,
- xmlFileRead, xmlFileClose);
+ xmlFileRead, xmlFileClose);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecIORegisterCallbacks",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "file");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecIORegisterCallbacks",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "file");
+ return(-1);
}
return(0);
@@ -301,7 +301,7 @@ xmlSecIORegisterDefaultCallbacks(void) {
-
+
/**************************************************************
*
* Input URI Transform
@@ -309,52 +309,52 @@ xmlSecIORegisterDefaultCallbacks(void) {
* xmlSecInputURICtx is located after xmlSecTransform
*
**************************************************************/
-typedef struct _xmlSecInputURICtx xmlSecInputURICtx,
- *xmlSecInputURICtxPtr;
+typedef struct _xmlSecInputURICtx xmlSecInputURICtx,
+ *xmlSecInputURICtxPtr;
struct _xmlSecInputURICtx {
- xmlSecIOCallbackPtr clbks;
- void* clbksCtx;
+ xmlSecIOCallbackPtr clbks;
+ void* clbksCtx;
};
#define xmlSecTransformInputUriSize \
- (sizeof(xmlSecTransform) + sizeof(xmlSecInputURICtx))
+ (sizeof(xmlSecTransform) + sizeof(xmlSecInputURICtx))
#define xmlSecTransformInputUriGetCtx(transform) \
((xmlSecTransformCheckSize((transform), xmlSecTransformInputUriSize)) ? \
- (xmlSecInputURICtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)) : \
- (xmlSecInputURICtxPtr)NULL)
+ (xmlSecInputURICtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)) : \
+ (xmlSecInputURICtxPtr)NULL)
-static int xmlSecTransformInputURIInitialize (xmlSecTransformPtr transform);
-static void xmlSecTransformInputURIFinalize (xmlSecTransformPtr transform);
-static int xmlSecTransformInputURIPopBin (xmlSecTransformPtr transform,
- xmlSecByte* data,
- xmlSecSize maxDataSize,
- xmlSecSize* dataSize,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecTransformInputURIInitialize (xmlSecTransformPtr transform);
+static void xmlSecTransformInputURIFinalize (xmlSecTransformPtr transform);
+static int xmlSecTransformInputURIPopBin (xmlSecTransformPtr transform,
+ xmlSecByte* data,
+ xmlSecSize maxDataSize,
+ xmlSecSize* dataSize,
+ xmlSecTransformCtxPtr transformCtx);
static xmlSecTransformKlass xmlSecTransformInputURIKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecTransformInputUriSize, /* xmlSecSize objSize */
-
- BAD_CAST "input-uri", /* const xmlChar* name; */
- NULL, /* const xmlChar* href; */
- 0, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecTransformInputURIInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecTransformInputURIFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- NULL, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformInputURIPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- NULL, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecTransformInputUriSize, /* xmlSecSize objSize */
+
+ BAD_CAST "input-uri", /* const xmlChar* name; */
+ NULL, /* const xmlChar* href; */
+ 0, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecTransformInputURIInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecTransformInputURIFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ NULL, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformInputURIPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ NULL, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -371,8 +371,8 @@ xmlSecTransformInputURIGetKlass(void) {
/**
* xmlSecTransformInputURIOpen:
- * @transform: the pointer to IO transform.
- * @uri: the URL to open.
+ * @transform: the pointer to IO transform.
+ * @uri: the URL to open.
*
* Opens the given @uri for reading.
*
@@ -396,16 +396,16 @@ xmlSecTransformInputURIOpen(xmlSecTransformPtr transform, const xmlChar *uri) {
* try with an unescaped version of the uri
*/
if(ctx->clbks == NULL) {
- char *unescaped;
+ char *unescaped;
unescaped = xmlURIUnescapeString((char*)uri, 0, NULL);
- if (unescaped != NULL) {
- ctx->clbks = xmlSecIOCallbackPtrListFind(&xmlSecAllIOCallbacks, unescaped);
- if(ctx->clbks != NULL) {
- ctx->clbksCtx = ctx->clbks->opencallback(unescaped);
- }
- xmlFree(unescaped);
- }
+ if (unescaped != NULL) {
+ ctx->clbks = xmlSecIOCallbackPtrListFind(&xmlSecAllIOCallbacks, unescaped);
+ if(ctx->clbks != NULL) {
+ ctx->clbksCtx = ctx->clbks->opencallback(unescaped);
+ }
+ xmlFree(unescaped);
+ }
}
/*
@@ -413,21 +413,21 @@ xmlSecTransformInputURIOpen(xmlSecTransformPtr transform, const xmlChar *uri) {
* filename
*/
if (ctx->clbks == NULL) {
- ctx->clbks = xmlSecIOCallbackPtrListFind(&xmlSecAllIOCallbacks, (char*)uri);
- if(ctx->clbks != NULL) {
- ctx->clbksCtx = ctx->clbks->opencallback((char*)uri);
- }
+ ctx->clbks = xmlSecIOCallbackPtrListFind(&xmlSecAllIOCallbacks, (char*)uri);
+ if(ctx->clbks != NULL) {
+ ctx->clbksCtx = ctx->clbks->opencallback((char*)uri);
+ }
}
if((ctx->clbks == NULL) || (ctx->clbksCtx == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "opencallback",
- XMLSEC_ERRORS_R_IO_FAILED,
- "uri=%s;errno=%d",
- xmlSecErrorsSafeString(uri),
- errno);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "opencallback",
+ XMLSEC_ERRORS_R_IO_FAILED,
+ "uri=%s;errno=%d",
+ xmlSecErrorsSafeString(uri),
+ errno);
+ return(-1);
}
return(0);
@@ -456,19 +456,19 @@ xmlSecTransformInputURIFinalize(xmlSecTransformPtr transform) {
xmlSecAssert(ctx != NULL);
if((ctx->clbksCtx != NULL) && (ctx->clbks != NULL) && (ctx->clbks->closecallback != NULL)) {
- (ctx->clbks->closecallback)(ctx->clbksCtx);
+ (ctx->clbks->closecallback)(ctx->clbksCtx);
}
memset(ctx, 0, sizeof(xmlSecInputURICtx));
}
static int
xmlSecTransformInputURIPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
- xmlSecSize maxDataSize, xmlSecSize* dataSize,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecSize maxDataSize, xmlSecSize* dataSize,
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecInputURICtxPtr ctx;
int ret;
-
+
xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformInputURIId), -1);
xmlSecAssert2(data != NULL, -1);
xmlSecAssert2(dataSize != NULL, -1);
@@ -479,17 +479,17 @@ xmlSecTransformInputURIPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
if((ctx->clbksCtx != NULL) && (ctx->clbks != NULL) && (ctx->clbks->readcallback != NULL)) {
ret = (ctx->clbks->readcallback)(ctx->clbksCtx, (char*)data, (int)maxDataSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "readcallback",
- XMLSEC_ERRORS_R_IO_FAILED,
- "errno=%d", errno);
- return(-1);
- }
- (*dataSize) = ret;
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "readcallback",
+ XMLSEC_ERRORS_R_IO_FAILED,
+ "errno=%d", errno);
+ return(-1);
+ }
+ (*dataSize) = ret;
} else {
- (*dataSize) = 0;
+ (*dataSize) = 0;
}
return(0);
}
diff --git a/src/keyinfo.c b/src/keyinfo.c
index 6e327b2..3b76ec9 100644
--- a/src/keyinfo.c
+++ b/src/keyinfo.c
@@ -66,9 +66,9 @@
*************************************************************************/
/**
* xmlSecKeyInfoNodeRead:
- * @keyInfoNode: the pointer to <dsig:KeyInfo/> node.
- * @key: the pointer to result key object.
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
+ * @keyInfoNode: the pointer to <dsig:KeyInfo/> node.
+ * @key: the pointer to result key object.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
*
* Parses the <dsig:KeyInfo/> element @keyInfoNode, extracts the key data
* and stores into @key.
@@ -89,46 +89,46 @@ xmlSecKeyInfoNodeRead(xmlNodePtr keyInfoNode, xmlSecKeyPtr key, xmlSecKeyInfoCtx
xmlSecAssert2(keyInfoCtx->mode == xmlSecKeyInfoModeRead, -1);
for(cur = xmlSecGetNextElementNode(keyInfoNode->children);
- (cur != NULL) &&
- (((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND) != 0) ||
- (xmlSecKeyIsValid(key) == 0) ||
- (xmlSecKeyMatch(key, NULL, &(keyInfoCtx->keyReq)) == 0));
- cur = xmlSecGetNextElementNode(cur->next)) {
+ (cur != NULL) &&
+ (((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND) != 0) ||
+ (xmlSecKeyIsValid(key) == 0) ||
+ (xmlSecKeyMatch(key, NULL, &(keyInfoCtx->keyReq)) == 0));
+ cur = xmlSecGetNextElementNode(cur->next)) {
- /* find data id */
- nodeName = cur->name;
- nodeNs = xmlSecGetNodeNsHref(cur);
-
- /* use global list only if we don't have a local one */
- if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) {
- dataId = xmlSecKeyDataIdListFindByNode(&(keyInfoCtx->enabledKeyData),
- nodeName, nodeNs, xmlSecKeyDataUsageKeyInfoNodeRead);
- } else {
- dataId = xmlSecKeyDataIdListFindByNode(xmlSecKeyDataIdsGet(),
- nodeName, nodeNs, xmlSecKeyDataUsageKeyInfoNodeRead);
- }
- if(dataId != xmlSecKeyDataIdUnknown) {
- /* read data node */
- ret = xmlSecKeyDataXmlRead(dataId, key, cur, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
- "xmlSecKeyDataXmlRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
- }
- } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_UNKNOWN_CHILD) != 0) {
- /* there is a laxi schema validation but application may
- * desire to disable unknown nodes*/
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ /* find data id */
+ nodeName = cur->name;
+ nodeNs = xmlSecGetNodeNsHref(cur);
+
+ /* use global list only if we don't have a local one */
+ if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) {
+ dataId = xmlSecKeyDataIdListFindByNode(&(keyInfoCtx->enabledKeyData),
+ nodeName, nodeNs, xmlSecKeyDataUsageKeyInfoNodeRead);
+ } else {
+ dataId = xmlSecKeyDataIdListFindByNode(xmlSecKeyDataIdsGet(),
+ nodeName, nodeNs, xmlSecKeyDataUsageKeyInfoNodeRead);
+ }
+ if(dataId != xmlSecKeyDataIdUnknown) {
+ /* read data node */
+ ret = xmlSecKeyDataXmlRead(dataId, key, cur, keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
+ "xmlSecKeyDataXmlRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
+ }
+ } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_UNKNOWN_CHILD) != 0) {
+ /* there is a laxi schema validation but application may
+ * desire to disable unknown nodes*/
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
return(0);
@@ -136,9 +136,9 @@ xmlSecKeyInfoNodeRead(xmlNodePtr keyInfoNode, xmlSecKeyPtr key, xmlSecKeyInfoCtx
/**
* xmlSecKeyInfoNodeWrite:
- * @keyInfoNode: the pointer to <dsig:KeyInfo/> node.
- * @key: the pointer to key object.
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
+ * @keyInfoNode: the pointer to <dsig:KeyInfo/> node.
+ * @key: the pointer to key object.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
*
* Writes the @key into the <dsig:KeyInfo/> element template @keyInfoNode.
*
@@ -158,43 +158,43 @@ xmlSecKeyInfoNodeWrite(xmlNodePtr keyInfoNode, xmlSecKeyPtr key, xmlSecKeyInfoCt
xmlSecAssert2(keyInfoCtx->mode == xmlSecKeyInfoModeWrite, -1);
for(cur = xmlSecGetNextElementNode(keyInfoNode->children);
- cur != NULL;
- cur = xmlSecGetNextElementNode(cur->next)) {
+ cur != NULL;
+ cur = xmlSecGetNextElementNode(cur->next)) {
- /* find data id */
- nodeName = cur->name;
- nodeNs = xmlSecGetNodeNsHref(cur);
-
- /* use global list only if we don't have a local one */
- if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) {
- dataId = xmlSecKeyDataIdListFindByNode(&(keyInfoCtx->enabledKeyData),
- nodeName, nodeNs,
- xmlSecKeyDataUsageKeyInfoNodeWrite);
- } else {
- dataId = xmlSecKeyDataIdListFindByNode(xmlSecKeyDataIdsGet(),
- nodeName, nodeNs,
- xmlSecKeyDataUsageKeyInfoNodeWrite);
- }
- if(dataId != xmlSecKeyDataIdUnknown) {
- ret = xmlSecKeyDataXmlWrite(dataId, key, cur, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
- "xmlSecKeyDataXmlWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
- }
- } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_UNKNOWN_CHILD) != 0) {
- /* laxi schema validation but application can disable it*/
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ /* find data id */
+ nodeName = cur->name;
+ nodeNs = xmlSecGetNodeNsHref(cur);
+
+ /* use global list only if we don't have a local one */
+ if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) {
+ dataId = xmlSecKeyDataIdListFindByNode(&(keyInfoCtx->enabledKeyData),
+ nodeName, nodeNs,
+ xmlSecKeyDataUsageKeyInfoNodeWrite);
+ } else {
+ dataId = xmlSecKeyDataIdListFindByNode(xmlSecKeyDataIdsGet(),
+ nodeName, nodeNs,
+ xmlSecKeyDataUsageKeyInfoNodeWrite);
+ }
+ if(dataId != xmlSecKeyDataIdUnknown) {
+ ret = xmlSecKeyDataXmlWrite(dataId, key, cur, keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
+ "xmlSecKeyDataXmlWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
+ }
+ } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_UNKNOWN_CHILD) != 0) {
+ /* laxi schema validation but application can disable it*/
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
return(0);
@@ -207,7 +207,7 @@ xmlSecKeyInfoNodeWrite(xmlNodePtr keyInfoNode, xmlSecKeyPtr key, xmlSecKeyInfoCt
*************************************************************************/
/**
* xmlSecKeyInfoCtxCreate:
- * @keysMngr: the pointer to keys manager (may be NULL).
+ * @keysMngr: the pointer to keys manager (may be NULL).
*
* Allocates and initializes <dsig:KeyInfo/> element processing context.
* Caller is responsible for freeing it by calling #xmlSecKeyInfoCtxDestroy
@@ -223,23 +223,23 @@ xmlSecKeyInfoCtxCreate(xmlSecKeysMngrPtr keysMngr) {
/* Allocate a new xmlSecKeyInfoCtx and fill the fields. */
keyInfoCtx = (xmlSecKeyInfoCtxPtr)xmlMalloc(sizeof(xmlSecKeyInfoCtx));
if(keyInfoCtx == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "size=%d", sizeof(xmlSecKeyInfoCtx));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "size=%d", sizeof(xmlSecKeyInfoCtx));
+ return(NULL);
}
ret = xmlSecKeyInfoCtxInitialize(keyInfoCtx, keysMngr);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyInfoCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyInfoCtxDestroy(keyInfoCtx);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyInfoCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyInfoCtxDestroy(keyInfoCtx);
+ return(NULL);
}
return(keyInfoCtx);
@@ -247,7 +247,7 @@ xmlSecKeyInfoCtxCreate(xmlSecKeysMngrPtr keysMngr) {
/**
* xmlSecKeyInfoCtxDestroy:
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
*
* Destroys @keyInfoCtx object created with #xmlSecKeyInfoCtxCreate function.
*/
@@ -261,8 +261,8 @@ xmlSecKeyInfoCtxDestroy(xmlSecKeyInfoCtxPtr keyInfoCtx) {
/**
* xmlSecKeyInfoCtxInitialize:
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
- * @keysMngr: the pointer to keys manager (may be NULL).
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
+ * @keysMngr: the pointer to keys manager (may be NULL).
*
* Initializes <dsig:KeyInfo/> element processing context. Caller is
* responsible for cleaning it up by #xmlSecKeyInfoCtxFinalize function.
@@ -280,23 +280,23 @@ xmlSecKeyInfoCtxInitialize(xmlSecKeyInfoCtxPtr keyInfoCtx, xmlSecKeysMngrPtr key
keyInfoCtx->base64LineSize = xmlSecBase64GetDefaultLineSize();
ret = xmlSecPtrListInitialize(&(keyInfoCtx->enabledKeyData), xmlSecKeyDataIdListId);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
keyInfoCtx->maxRetrievalMethodLevel = 1;
ret = xmlSecTransformCtxInitialize(&(keyInfoCtx->retrievalMethodCtx));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
#ifndef XMLSEC_NO_XMLENC
@@ -309,12 +309,12 @@ xmlSecKeyInfoCtxInitialize(xmlSecKeyInfoCtxPtr keyInfoCtx, xmlSecKeysMngrPtr key
ret = xmlSecKeyReqInitialize(&(keyInfoCtx->keyReq));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyReqInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyReqInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -322,7 +322,7 @@ xmlSecKeyInfoCtxInitialize(xmlSecKeyInfoCtxPtr keyInfoCtx, xmlSecKeysMngrPtr key
/**
* xmlSecKeyInfoCtxFinalize:
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
*
* Cleans up the @keyInfoCtx initialized with #xmlSecKeyInfoCtxInitialize
* function.
@@ -346,7 +346,7 @@ xmlSecKeyInfoCtxFinalize(xmlSecKeyInfoCtxPtr keyInfoCtx) {
/**
* xmlSecKeyInfoCtxReset:
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
*
* Resets the @keyInfoCtx state. User settings are not changed.
*/
@@ -358,7 +358,7 @@ xmlSecKeyInfoCtxReset(xmlSecKeyInfoCtxPtr keyInfoCtx) {
keyInfoCtx->curRetrievalMethodLevel = 0;
#ifndef XMLSEC_NO_XMLENC
- if(keyInfoCtx->encCtx != NULL) {
+ if(keyInfoCtx->encCtx != NULL) {
xmlSecEncCtxReset(keyInfoCtx->encCtx);
}
keyInfoCtx->curEncryptedKeyLevel = 0;
@@ -369,7 +369,7 @@ xmlSecKeyInfoCtxReset(xmlSecKeyInfoCtxPtr keyInfoCtx) {
/**
* xmlSecKeyInfoCtxCreateEncCtx:
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
*
* Creates encryption context form processing <enc:EncryptedKey/> child
* of <dsig:KeyInfo/> element.
@@ -388,59 +388,59 @@ xmlSecKeyInfoCtxCreateEncCtx(xmlSecKeyInfoCtxPtr keyInfoCtx) {
/* we have to use tmp variable to avoid a recursive loop */
tmp = xmlSecEncCtxCreate(keyInfoCtx->keysMngr);
if(tmp == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecEncCtxCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecEncCtxCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
tmp->mode = xmlEncCtxModeEncryptedKey;
/* copy user preferences from our current ctx */
switch(keyInfoCtx->mode) {
- case xmlSecKeyInfoModeRead:
- ret = xmlSecKeyInfoCtxCopyUserPref(&(tmp->keyInfoReadCtx), keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyInfoCtxCopyUserPref",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecEncCtxDestroy(tmp);
- return(-1);
- }
- break;
- case xmlSecKeyInfoModeWrite:
- ret = xmlSecKeyInfoCtxCopyUserPref(&(tmp->keyInfoWriteCtx), keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyInfoCtxCopyUserPref",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecEncCtxDestroy(tmp);
- return(-1);
- }
- break;
+ case xmlSecKeyInfoModeRead:
+ ret = xmlSecKeyInfoCtxCopyUserPref(&(tmp->keyInfoReadCtx), keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyInfoCtxCopyUserPref",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecEncCtxDestroy(tmp);
+ return(-1);
+ }
+ break;
+ case xmlSecKeyInfoModeWrite:
+ ret = xmlSecKeyInfoCtxCopyUserPref(&(tmp->keyInfoWriteCtx), keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyInfoCtxCopyUserPref",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecEncCtxDestroy(tmp);
+ return(-1);
+ }
+ break;
}
keyInfoCtx->encCtx = tmp;
return(0);
#else /* XMLSEC_NO_XMLENC */
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xml encryption",
- XMLSEC_ERRORS_R_DISABLED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xml encryption",
+ XMLSEC_ERRORS_R_DISABLED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
#endif /* XMLSEC_NO_XMLENC */
}
/**
* xmlSecKeyInfoCtxCopyUserPref:
- * @dst: the pointer to destination context object.
- * @src: the pointer to source context object.
+ * @dst: the pointer to destination context object.
+ * @src: the pointer to source context object.
*
* Copies user preferences from @src context to @dst context.
*
@@ -453,68 +453,68 @@ xmlSecKeyInfoCtxCopyUserPref(xmlSecKeyInfoCtxPtr dst, xmlSecKeyInfoCtxPtr src) {
xmlSecAssert2(dst != NULL, -1);
xmlSecAssert2(src != NULL, -1);
- dst->userData = src->userData;
- dst->flags = src->flags;
- dst->flags2 = src->flags2;
- dst->keysMngr = src->keysMngr;
- dst->mode = src->mode;
- dst->base64LineSize = src->base64LineSize;
+ dst->userData = src->userData;
+ dst->flags = src->flags;
+ dst->flags2 = src->flags2;
+ dst->keysMngr = src->keysMngr;
+ dst->mode = src->mode;
+ dst->base64LineSize = src->base64LineSize;
ret = xmlSecPtrListCopy(&(dst->enabledKeyData), &(src->enabledKeyData));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListCopy",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "enabledKeyData");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListCopy",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "enabledKeyData");
+ return(-1);
}
/* <dsig:RetrievalMethod/> */
dst->maxRetrievalMethodLevel= src->maxRetrievalMethodLevel;
ret = xmlSecTransformCtxCopyUserPref(&(dst->retrievalMethodCtx),
- &(src->retrievalMethodCtx));
+ &(src->retrievalMethodCtx));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxCopyUserPref",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "enabledKeyData");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxCopyUserPref",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "enabledKeyData");
+ return(-1);
}
/* <enc:EncryptedContext /> */
#ifndef XMLSEC_NO_XMLENC
xmlSecAssert2(dst->encCtx == NULL, -1);
- if(src->encCtx != NULL) {
- dst->encCtx = xmlSecEncCtxCreate(dst->keysMngr);
- if(dst->encCtx == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecEncCtxCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- dst->encCtx->mode = xmlEncCtxModeEncryptedKey;
+ if(src->encCtx != NULL) {
+ dst->encCtx = xmlSecEncCtxCreate(dst->keysMngr);
+ if(dst->encCtx == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecEncCtxCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ dst->encCtx->mode = xmlEncCtxModeEncryptedKey;
ret = xmlSecEncCtxCopyUserPref(dst->encCtx, src->encCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecEncCtxCopyUserPref",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecEncCtxCopyUserPref",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
- dst->maxEncryptedKeyLevel = src->maxEncryptedKeyLevel;
+ dst->maxEncryptedKeyLevel = src->maxEncryptedKeyLevel;
#endif /* XMLSEC_NO_XMLENC */
/* <dsig:X509Data /> */
#ifndef XMLSEC_NO_X509
- dst->certsVerificationTime = src->certsVerificationTime;
- dst->certsVerificationDepth = src->certsVerificationDepth;
+ dst->certsVerificationTime = src->certsVerificationTime;
+ dst->certsVerificationDepth = src->certsVerificationDepth;
#endif /* XMLSEC_NO_X509 */
return(0);
@@ -522,8 +522,8 @@ xmlSecKeyInfoCtxCopyUserPref(xmlSecKeyInfoCtxPtr dst, xmlSecKeyInfoCtxPtr src) {
/**
* xmlSecKeyInfoCtxDebugDump:
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
- * @output: the output file pointer.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
+ * @output: the output file pointer.
*
* Prints user settings and current context state to @output.
*/
@@ -533,33 +533,33 @@ xmlSecKeyInfoCtxDebugDump(xmlSecKeyInfoCtxPtr keyInfoCtx, FILE* output) {
xmlSecAssert(output != NULL);
switch(keyInfoCtx->mode) {
- case xmlSecKeyInfoModeRead:
- fprintf(output, "= KEY INFO READ CONTEXT\n");
- break;
- case xmlSecKeyInfoModeWrite:
- fprintf(output, "= KEY INFO WRITE CONTEXT\n");
- break;
+ case xmlSecKeyInfoModeRead:
+ fprintf(output, "= KEY INFO READ CONTEXT\n");
+ break;
+ case xmlSecKeyInfoModeWrite:
+ fprintf(output, "= KEY INFO WRITE CONTEXT\n");
+ break;
}
fprintf(output, "== flags: 0x%08x\n", keyInfoCtx->flags);
fprintf(output, "== flags2: 0x%08x\n", keyInfoCtx->flags2);
if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) {
- fprintf(output, "== enabled key data: ");
- xmlSecKeyDataIdListDebugDump(&(keyInfoCtx->enabledKeyData), output);
+ fprintf(output, "== enabled key data: ");
+ xmlSecKeyDataIdListDebugDump(&(keyInfoCtx->enabledKeyData), output);
} else {
- fprintf(output, "== enabled key data: all\n");
+ fprintf(output, "== enabled key data: all\n");
}
fprintf(output, "== RetrievalMethod level (cur/max): %d/%d\n",
- keyInfoCtx->curRetrievalMethodLevel,
- keyInfoCtx->maxRetrievalMethodLevel);
+ keyInfoCtx->curRetrievalMethodLevel,
+ keyInfoCtx->maxRetrievalMethodLevel);
xmlSecTransformCtxDebugDump(&(keyInfoCtx->retrievalMethodCtx), output);
#ifndef XMLSEC_NO_XMLENC
fprintf(output, "== EncryptedKey level (cur/max): %d/%d\n",
- keyInfoCtx->curEncryptedKeyLevel,
- keyInfoCtx->maxEncryptedKeyLevel);
+ keyInfoCtx->curEncryptedKeyLevel,
+ keyInfoCtx->maxEncryptedKeyLevel);
if(keyInfoCtx->encCtx != NULL) {
- xmlSecEncCtxDebugDump(keyInfoCtx->encCtx, output);
+ xmlSecEncCtxDebugDump(keyInfoCtx->encCtx, output);
}
#endif /* XMLSEC_NO_XMLENC */
@@ -568,8 +568,8 @@ xmlSecKeyInfoCtxDebugDump(xmlSecKeyInfoCtxPtr keyInfoCtx, FILE* output) {
/**
* xmlSecKeyInfoCtxDebugXmlDump:
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
- * @output: the output file pointer.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
+ * @output: the output file pointer.
*
* Prints user settings and current context state in XML format to @output.
*/
@@ -579,46 +579,46 @@ xmlSecKeyInfoCtxDebugXmlDump(xmlSecKeyInfoCtxPtr keyInfoCtx, FILE* output) {
xmlSecAssert(output != NULL);
switch(keyInfoCtx->mode) {
- case xmlSecKeyInfoModeRead:
- fprintf(output, "<KeyInfoReadContext>\n");
- break;
- case xmlSecKeyInfoModeWrite:
- fprintf(output, "<KeyInfoWriteContext>\n");
- break;
+ case xmlSecKeyInfoModeRead:
+ fprintf(output, "<KeyInfoReadContext>\n");
+ break;
+ case xmlSecKeyInfoModeWrite:
+ fprintf(output, "<KeyInfoWriteContext>\n");
+ break;
}
-
+
fprintf(output, "<Flags>%08x</Flags>\n", keyInfoCtx->flags);
fprintf(output, "<Flags2>%08x</Flags2>\n", keyInfoCtx->flags2);
if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) {
- fprintf(output, "<EnabledKeyData>\n");
- xmlSecKeyDataIdListDebugXmlDump(&(keyInfoCtx->enabledKeyData), output);
- fprintf(output, "</EnabledKeyData>\n");
+ fprintf(output, "<EnabledKeyData>\n");
+ xmlSecKeyDataIdListDebugXmlDump(&(keyInfoCtx->enabledKeyData), output);
+ fprintf(output, "</EnabledKeyData>\n");
} else {
- fprintf(output, "<EnabledKeyData>all</EnabledKeyData>\n");
+ fprintf(output, "<EnabledKeyData>all</EnabledKeyData>\n");
}
fprintf(output, "<RetrievalMethodLevel cur=\"%d\" max=\"%d\" />\n",
- keyInfoCtx->curRetrievalMethodLevel,
- keyInfoCtx->maxRetrievalMethodLevel);
+ keyInfoCtx->curRetrievalMethodLevel,
+ keyInfoCtx->maxRetrievalMethodLevel);
xmlSecTransformCtxDebugXmlDump(&(keyInfoCtx->retrievalMethodCtx), output);
#ifndef XMLSEC_NO_XMLENC
fprintf(output, "<EncryptedKeyLevel cur=\"%d\" max=\"%d\" />\n",
- keyInfoCtx->curEncryptedKeyLevel,
- keyInfoCtx->maxEncryptedKeyLevel);
+ keyInfoCtx->curEncryptedKeyLevel,
+ keyInfoCtx->maxEncryptedKeyLevel);
if(keyInfoCtx->encCtx != NULL) {
- xmlSecEncCtxDebugXmlDump(keyInfoCtx->encCtx, output);
+ xmlSecEncCtxDebugXmlDump(keyInfoCtx->encCtx, output);
}
#endif /* XMLSEC_NO_XMLENC */
xmlSecKeyReqDebugXmlDump(&(keyInfoCtx->keyReq), output);
switch(keyInfoCtx->mode) {
- case xmlSecKeyInfoModeRead:
- fprintf(output, "</KeyInfoReadContext>\n");
- break;
- case xmlSecKeyInfoModeWrite:
- fprintf(output, "</KeyInfoWriteContext>\n");
- break;
+ case xmlSecKeyInfoModeRead:
+ fprintf(output, "</KeyInfoReadContext>\n");
+ break;
+ case xmlSecKeyInfoModeWrite:
+ fprintf(output, "</KeyInfoWriteContext>\n");
+ break;
}
}
@@ -627,14 +627,14 @@ xmlSecKeyInfoCtxDebugXmlDump(xmlSecKeyInfoCtxPtr keyInfoCtx, FILE* output) {
* <dsig:KeyName/> processing
*
*************************************************************************/
-static int xmlSecKeyDataNameXmlRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecKeyDataNameXmlWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecKeyDataNameXmlRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecKeyDataNameXmlWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
static xmlSecKeyDataKlass xmlSecKeyDataNameKlass = {
sizeof(xmlSecKeyDataKlass),
@@ -642,35 +642,35 @@ static xmlSecKeyDataKlass xmlSecKeyDataNameKlass = {
/* data */
xmlSecNameKeyName,
- xmlSecKeyDataUsageKeyInfoNode, /* xmlSecKeyDataUsage usage; */
- NULL, /* const xmlChar* href; */
- xmlSecNodeKeyName, /* const xmlChar* dataNodeName; */
- xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
+ xmlSecKeyDataUsageKeyInfoNode, /* xmlSecKeyDataUsage usage; */
+ NULL, /* const xmlChar* href; */
+ xmlSecNodeKeyName, /* const xmlChar* dataNodeName; */
+ xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- NULL, /* xmlSecKeyDataInitializeMethod initialize; */
- NULL, /* xmlSecKeyDataDuplicateMethod duplicate; */
- NULL, /* xmlSecKeyDataFinalizeMethod finalize; */
- NULL, /* xmlSecKeyDataGenerateMethod generate; */
+ NULL, /* xmlSecKeyDataInitializeMethod initialize; */
+ NULL, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ NULL, /* xmlSecKeyDataFinalizeMethod finalize; */
+ NULL, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- NULL, /* xmlSecKeyDataGetTypeMethod getType; */
- NULL, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ NULL, /* xmlSecKeyDataGetTypeMethod getType; */
+ NULL, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecKeyDataNameXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecKeyDataNameXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- NULL, /* xmlSecKeyDataBinReadMethod binRead; */
- NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecKeyDataNameXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecKeyDataNameXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ NULL, /* xmlSecKeyDataBinReadMethod binRead; */
+ NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- NULL, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- NULL, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ NULL, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ NULL, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -709,59 +709,59 @@ xmlSecKeyDataNameXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node,
oldName = xmlSecKeyGetName(key);
newName = xmlNodeGetContent(node);
if(newName == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* TODO: do we need to decode the name? */
/* compare name values */
if((oldName != NULL) && !xmlStrEqual(oldName, newName)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "key name is already specified",
- XMLSEC_ERRORS_R_INVALID_KEY_DATA,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(newName);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "key name is already specified",
+ XMLSEC_ERRORS_R_INVALID_KEY_DATA,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(newName);
+ return(-1);
}
/* try to find key in the manager */
if((xmlSecKeyGetValue(key) == NULL) && (keyInfoCtx->keysMngr != NULL)) {
- xmlSecKeyPtr tmpKey;
-
- tmpKey = xmlSecKeysMngrFindKey(keyInfoCtx->keysMngr, newName, keyInfoCtx);
- if(tmpKey != NULL) {
- /* erase any current information in the key */
- xmlSecKeyEmpty(key);
-
- /* TODO: since we will destroy tmpKey anyway, we can easily
- * just re-assign key data values. It'll save use some memory
- * malloc/free
- */
-
- /* and copy what we've found */
- ret = xmlSecKeyCopy(key, tmpKey);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyCopy",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(tmpKey);
- xmlFree(newName);
- return(-1);
- }
- xmlSecKeyDestroy(tmpKey);
- }
- }
+ xmlSecKeyPtr tmpKey;
+
+ tmpKey = xmlSecKeysMngrFindKey(keyInfoCtx->keysMngr, newName, keyInfoCtx);
+ if(tmpKey != NULL) {
+ /* erase any current information in the key */
+ xmlSecKeyEmpty(key);
+
+ /* TODO: since we will destroy tmpKey anyway, we can easily
+ * just re-assign key data values. It'll save use some memory
+ * malloc/free
+ */
+
+ /* and copy what we've found */
+ ret = xmlSecKeyCopy(key, tmpKey);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyCopy",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(tmpKey);
+ xmlFree(newName);
+ return(-1);
+ }
+ xmlSecKeyDestroy(tmpKey);
+ }
+ }
/* finally set key name if it is not there */
if(xmlSecKeyGetName(key) == NULL) {
- xmlSecKeySetName(key, newName);
+ xmlSecKeySetName(key, newName);
}
xmlFree(newName);
return(0);
@@ -779,7 +779,7 @@ xmlSecKeyDataNameXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node,
name = xmlSecKeyGetName(key);
if(name != NULL) {
- xmlSecNodeEncodeAndSetContent(node, name);
+ xmlSecNodeEncodeAndSetContent(node, name);
}
return(0);
}
@@ -789,14 +789,14 @@ xmlSecKeyDataNameXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node,
* <dsig:KeyValue/> processing
*
*************************************************************************/
-static int xmlSecKeyDataValueXmlRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecKeyDataValueXmlWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecKeyDataValueXmlRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecKeyDataValueXmlWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
static xmlSecKeyDataKlass xmlSecKeyDataValueKlass = {
sizeof(xmlSecKeyDataKlass),
@@ -804,35 +804,35 @@ static xmlSecKeyDataKlass xmlSecKeyDataValueKlass = {
/* data */
xmlSecNameKeyValue,
- xmlSecKeyDataUsageKeyInfoNode, /* xmlSecKeyDataUsage usage; */
- NULL, /* const xmlChar* href; */
- xmlSecNodeKeyValue, /* const xmlChar* dataNodeName; */
- xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
+ xmlSecKeyDataUsageKeyInfoNode, /* xmlSecKeyDataUsage usage; */
+ NULL, /* const xmlChar* href; */
+ xmlSecNodeKeyValue, /* const xmlChar* dataNodeName; */
+ xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- NULL, /* xmlSecKeyDataInitializeMethod initialize; */
- NULL, /* xmlSecKeyDataDuplicateMethod duplicate; */
- NULL, /* xmlSecKeyDataFinalizeMethod finalize; */
- NULL, /* xmlSecKeyDataGenerateMethod generate; */
+ NULL, /* xmlSecKeyDataInitializeMethod initialize; */
+ NULL, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ NULL, /* xmlSecKeyDataFinalizeMethod finalize; */
+ NULL, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- NULL, /* xmlSecKeyDataGetTypeMethod getType; */
- NULL, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ NULL, /* xmlSecKeyDataGetTypeMethod getType; */
+ NULL, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecKeyDataValueXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecKeyDataValueXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- NULL, /* xmlSecKeyDataBinReadMethod binRead; */
- NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecKeyDataValueXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecKeyDataValueXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ NULL, /* xmlSecKeyDataBinReadMethod binRead; */
+ NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- NULL, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- NULL, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ NULL, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ NULL, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -867,8 +867,8 @@ xmlSecKeyDataValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node,
cur = xmlSecGetNextElementNode(node->children);
if(cur == NULL) {
- /* just an empty node */
- return(0);
+ /* just an empty node */
+ return(0);
}
/* find data id */
@@ -877,43 +877,43 @@ xmlSecKeyDataValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node,
/* use global list only if we don't have a local one */
if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) {
- dataId = xmlSecKeyDataIdListFindByNode(&(keyInfoCtx->enabledKeyData),
- nodeName, nodeNs, xmlSecKeyDataUsageKeyValueNodeRead);
- } else {
- dataId = xmlSecKeyDataIdListFindByNode(xmlSecKeyDataIdsGet(),
- nodeName, nodeNs, xmlSecKeyDataUsageKeyValueNodeRead);
+ dataId = xmlSecKeyDataIdListFindByNode(&(keyInfoCtx->enabledKeyData),
+ nodeName, nodeNs, xmlSecKeyDataUsageKeyValueNodeRead);
+ } else {
+ dataId = xmlSecKeyDataIdListFindByNode(xmlSecKeyDataIdsGet(),
+ nodeName, nodeNs, xmlSecKeyDataUsageKeyValueNodeRead);
}
if(dataId != xmlSecKeyDataIdUnknown) {
- /* read data node */
- ret = xmlSecKeyDataXmlRead(dataId, key, cur, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyDataXmlRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
- }
+ /* read data node */
+ ret = xmlSecKeyDataXmlRead(dataId, key, cur, keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyDataXmlRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
+ }
} else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_KEYVALUE_STOP_ON_UNKNOWN_CHILD) != 0) {
- /* laxi schema validation but application can disable it */
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ /* laxi schema validation but application can disable it */
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* <dsig:KeyValue/> might have only one node */
cur = xmlSecGetNextElementNode(cur->next);
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -934,18 +934,18 @@ xmlSecKeyDataValueXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node
if(!xmlSecKeyDataIsValid(key->value) ||
!xmlSecKeyDataCheckUsage(key->value, xmlSecKeyDataUsageKeyValueNodeWrite)){
- /* nothing to write */
- return(0);
+ /* nothing to write */
+ return(0);
}
if((xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) &&
(xmlSecKeyDataIdListFind(&(keyInfoCtx->enabledKeyData), id) != 1)) {
- /* we are not enabled to write out key data with this id */
- return(0);
+ /* we are not enabled to write out key data with this id */
+ return(0);
}
if(xmlSecKeyReqMatchKey(&(keyInfoCtx->keyReq), key) != 1) {
- /* we are not allowed to write out this key */
- return(0);
+ /* we are not allowed to write out this key */
+ return(0);
}
nodeName = key->value->id->dataNodeName;
@@ -958,24 +958,24 @@ xmlSecKeyDataValueXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node
/* create key node */
cur = xmlSecAddChild(node, nodeName, nodeNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
+ return(-1);
}
ret = xmlSecKeyDataXmlWrite(key->value->id, key, cur, keyInfoCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyDataXmlWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyDataXmlWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
}
return(0);
@@ -986,14 +986,14 @@ xmlSecKeyDataValueXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node
* <dsig:RetrievalMethod/> processing
*
*************************************************************************/
-static int xmlSecKeyDataRetrievalMethodXmlRead(xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecKeyDataRetrievalMethodXmlWrite(xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecKeyDataRetrievalMethodXmlRead(xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecKeyDataRetrievalMethodXmlWrite(xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
@@ -1003,42 +1003,42 @@ static xmlSecKeyDataKlass xmlSecKeyDataRetrievalMethodKlass = {
/* data */
xmlSecNameRetrievalMethod,
- xmlSecKeyDataUsageKeyInfoNode, /* xmlSecKeyDataUsage usage; */
- NULL, /* const xmlChar* href; */
- xmlSecNodeRetrievalMethod, /* const xmlChar* dataNodeName; */
- xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
+ xmlSecKeyDataUsageKeyInfoNode, /* xmlSecKeyDataUsage usage; */
+ NULL, /* const xmlChar* href; */
+ xmlSecNodeRetrievalMethod, /* const xmlChar* dataNodeName; */
+ xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- NULL, /* xmlSecKeyDataInitializeMethod initialize; */
- NULL, /* xmlSecKeyDataDuplicateMethod duplicate; */
- NULL, /* xmlSecKeyDataFinalizeMethod finalize; */
- NULL, /* xmlSecKeyDataGenerateMethod generate; */
+ NULL, /* xmlSecKeyDataInitializeMethod initialize; */
+ NULL, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ NULL, /* xmlSecKeyDataFinalizeMethod finalize; */
+ NULL, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- NULL, /* xmlSecKeyDataGetTypeMethod getType; */
- NULL, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ NULL, /* xmlSecKeyDataGetTypeMethod getType; */
+ NULL, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecKeyDataRetrievalMethodXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecKeyDataRetrievalMethodXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- NULL, /* xmlSecKeyDataBinReadMethod binRead; */
- NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecKeyDataRetrievalMethodXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecKeyDataRetrievalMethodXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ NULL, /* xmlSecKeyDataBinReadMethod binRead; */
+ NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- NULL, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- NULL, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ NULL, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ NULL, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
-static int xmlSecKeyDataRetrievalMethodReadXmlResult(xmlSecKeyDataId typeId,
- xmlSecKeyPtr key,
- const xmlChar* buffer,
- xmlSecSize bufferSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecKeyDataRetrievalMethodReadXmlResult(xmlSecKeyDataId typeId,
+ xmlSecKeyPtr key,
+ const xmlChar* buffer,
+ xmlSecSize bufferSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
/**
* xmlSecKeyDataRetrievalMethodGetKlass:
@@ -1081,41 +1081,41 @@ xmlSecKeyDataRetrievalMethodXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNod
/* check retrieval level */
if(keyInfoCtx->curRetrievalMethodLevel >= keyInfoCtx->maxRetrievalMethodLevel) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- NULL,
- XMLSEC_ERRORS_R_MAX_RETRIEVALS_LEVEL,
- "cur=%d;max=%d",
- keyInfoCtx->curRetrievalMethodLevel,
- keyInfoCtx->maxRetrievalMethodLevel);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ NULL,
+ XMLSEC_ERRORS_R_MAX_RETRIEVALS_LEVEL,
+ "cur=%d;max=%d",
+ keyInfoCtx->curRetrievalMethodLevel,
+ keyInfoCtx->maxRetrievalMethodLevel);
+ goto done;
}
++keyInfoCtx->curRetrievalMethodLevel;
retrType = xmlGetProp(node, xmlSecAttrType);
if(retrType != NULL) {
- /* use global list only if we don't have a local one */
- if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) {
- dataId = xmlSecKeyDataIdListFindByHref(&(keyInfoCtx->enabledKeyData),
- retrType, xmlSecKeyDataUsageRetrievalMethodNode);
- } else {
- dataId = xmlSecKeyDataIdListFindByHref(xmlSecKeyDataIdsGet(),
- retrType, xmlSecKeyDataUsageRetrievalMethodNode);
- }
+ /* use global list only if we don't have a local one */
+ if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) {
+ dataId = xmlSecKeyDataIdListFindByHref(&(keyInfoCtx->enabledKeyData),
+ retrType, xmlSecKeyDataUsageRetrievalMethodNode);
+ } else {
+ dataId = xmlSecKeyDataIdListFindByHref(xmlSecKeyDataIdsGet(),
+ retrType, xmlSecKeyDataUsageRetrievalMethodNode);
+ }
}
/* laxi schema validation but aplication can disable it */
if(dataId == xmlSecKeyDataIdUnknown) {
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_UNKNOWN_HREF) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecAttrType),
- XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
- "value=%s", xmlSecErrorsSafeString(retrType));
- } else {
- res = 0;
- }
- goto done;
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_UNKNOWN_HREF) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecAttrType),
+ XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
+ "value=%s", xmlSecErrorsSafeString(retrType));
+ } else {
+ res = 0;
+ }
+ goto done;
}
/* destroy prev retrieval method context */
@@ -1125,39 +1125,39 @@ xmlSecKeyDataRetrievalMethodXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNod
uri = xmlGetProp(node, xmlSecAttrURI);
ret = xmlSecTransformCtxSetUri(&(keyInfoCtx->retrievalMethodCtx), uri, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecTransformCtxSetUri",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "uri=%s",
- xmlSecErrorsSafeString(uri));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecTransformCtxSetUri",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "uri=%s",
+ xmlSecErrorsSafeString(uri));
+ goto done;
}
/* the only one node is optional Transforms node */
cur = xmlSecGetNextElementNode(node->children);
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeTransforms, xmlSecDSigNs))) {
- ret = xmlSecTransformCtxNodesListRead(&(keyInfoCtx->retrievalMethodCtx),
- cur, xmlSecTransformUsageDSigTransform);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecTransformCtxNodesListRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- goto done;
- }
+ ret = xmlSecTransformCtxNodesListRead(&(keyInfoCtx->retrievalMethodCtx),
+ cur, xmlSecTransformUsageDSigTransform);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecTransformCtxNodesListRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ goto done;
+ }
cur = xmlSecGetNextElementNode(cur->next);
}
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
/* finally get transforms results */
@@ -1166,12 +1166,12 @@ xmlSecKeyDataRetrievalMethodXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNod
(keyInfoCtx->retrievalMethodCtx.result == NULL) ||
(xmlSecBufferGetData(keyInfoCtx->retrievalMethodCtx.result) == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecTransformCtxExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecTransformCtxExecute",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
@@ -1179,41 +1179,41 @@ xmlSecKeyDataRetrievalMethodXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNod
if((dataId == xmlSecKeyDataIdUnknown) ||
((dataId->usage & xmlSecKeyDataUsageRetrievalMethodNodeXml) != 0)) {
- ret = xmlSecKeyDataRetrievalMethodReadXmlResult(dataId, key,
- xmlSecBufferGetData(keyInfoCtx->retrievalMethodCtx.result),
+ ret = xmlSecKeyDataRetrievalMethodReadXmlResult(dataId, key,
+ xmlSecBufferGetData(keyInfoCtx->retrievalMethodCtx.result),
xmlSecBufferGetSize(keyInfoCtx->retrievalMethodCtx.result),
- keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyDataRetrievalMethodReadXmlResult",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
+ keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyDataRetrievalMethodReadXmlResult",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
} else {
- ret = xmlSecKeyDataBinRead(dataId, key,
- xmlSecBufferGetData(keyInfoCtx->retrievalMethodCtx.result),
+ ret = xmlSecKeyDataBinRead(dataId, key,
+ xmlSecBufferGetData(keyInfoCtx->retrievalMethodCtx.result),
xmlSecBufferGetSize(keyInfoCtx->retrievalMethodCtx.result),
- keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyDataBinRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
+ keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyDataBinRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
}
--keyInfoCtx->curRetrievalMethodLevel;
res = 0;
done:
if(uri != NULL) {
- xmlFree(uri);
+ xmlFree(uri);
}
if(retrType != NULL) {
- xmlFree(retrType);
+ xmlFree(retrType);
}
return(res);
}
@@ -1232,8 +1232,8 @@ xmlSecKeyDataRetrievalMethodXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNo
static int
xmlSecKeyDataRetrievalMethodReadXmlResult(xmlSecKeyDataId typeId, xmlSecKeyPtr key,
- const xmlChar* buffer, xmlSecSize bufferSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ const xmlChar* buffer, xmlSecSize bufferSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlDocPtr doc;
xmlNodePtr cur;
const xmlChar* nodeName;
@@ -1249,23 +1249,23 @@ xmlSecKeyDataRetrievalMethodReadXmlResult(xmlSecKeyDataId typeId, xmlSecKeyPtr k
doc = xmlRecoverMemory((const char*)buffer, bufferSize);
if(doc == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(typeId)),
- "xmlRecoverMemory",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(typeId)),
+ "xmlRecoverMemory",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
-
+
cur = xmlDocGetRootElement(doc);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(typeId)),
- "xmlDocGetRootElement",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFreeDoc(doc);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(typeId)),
+ "xmlDocGetRootElement",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFreeDoc(doc);
+ return(-1);
}
nodeName = cur->name;
@@ -1273,48 +1273,48 @@ xmlSecKeyDataRetrievalMethodReadXmlResult(xmlSecKeyDataId typeId, xmlSecKeyPtr k
/* use global list only if we don't have a local one */
if(xmlSecPtrListGetSize(&(keyInfoCtx->enabledKeyData)) > 0) {
- dataId = xmlSecKeyDataIdListFindByNode(&(keyInfoCtx->enabledKeyData),
- nodeName, nodeNs, xmlSecKeyDataUsageRetrievalMethodNodeXml);
- } else {
- dataId = xmlSecKeyDataIdListFindByNode(xmlSecKeyDataIdsGet(),
- nodeName, nodeNs, xmlSecKeyDataUsageRetrievalMethodNodeXml);
+ dataId = xmlSecKeyDataIdListFindByNode(&(keyInfoCtx->enabledKeyData),
+ nodeName, nodeNs, xmlSecKeyDataUsageRetrievalMethodNodeXml);
+ } else {
+ dataId = xmlSecKeyDataIdListFindByNode(xmlSecKeyDataIdsGet(),
+ nodeName, nodeNs, xmlSecKeyDataUsageRetrievalMethodNodeXml);
}
if(dataId == xmlSecKeyDataIdUnknown) {
- xmlFreeDoc(doc);
-
- /* laxi schema validation but application can disable it */
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_KEYVALUE_STOP_ON_UNKNOWN_CHILD) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(typeId)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- return(0);
+ xmlFreeDoc(doc);
+
+ /* laxi schema validation but application can disable it */
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_KEYVALUE_STOP_ON_UNKNOWN_CHILD) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(typeId)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ return(0);
} else if((typeId != xmlSecKeyDataIdUnknown) && (typeId != dataId) &&
- ((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_MISMATCH_HREF) != 0)) {
-
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(typeId)),
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
- XMLSEC_ERRORS_R_MAX_RETRIEVAL_TYPE_MISMATCH,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFreeDoc(doc);
- return(-1);
+ ((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_RETRMETHOD_STOP_ON_MISMATCH_HREF) != 0)) {
+
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(typeId)),
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
+ XMLSEC_ERRORS_R_MAX_RETRIEVAL_TYPE_MISMATCH,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFreeDoc(doc);
+ return(-1);
}
/* read data node */
ret = xmlSecKeyDataXmlRead(dataId, key, cur, keyInfoCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(typeId)),
- "xmlSecKeyDataXmlRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- xmlFreeDoc(doc);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(typeId)),
+ "xmlSecKeyDataXmlRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ xmlFreeDoc(doc);
+ return(-1);
}
xmlFreeDoc(doc);
@@ -1328,14 +1328,14 @@ xmlSecKeyDataRetrievalMethodReadXmlResult(xmlSecKeyDataId typeId, xmlSecKeyPtr k
* <enc:EncryptedKey/> processing
*
*************************************************************************/
-static int xmlSecKeyDataEncryptedKeyXmlRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecKeyDataEncryptedKeyXmlWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecKeyDataEncryptedKeyXmlRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecKeyDataEncryptedKeyXmlWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
@@ -1345,36 +1345,36 @@ static xmlSecKeyDataKlass xmlSecKeyDataEncryptedKeyKlass = {
/* data */
xmlSecNameEncryptedKey,
- xmlSecKeyDataUsageKeyInfoNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefEncryptedKey, /* const xmlChar* href; */
- xmlSecNodeEncryptedKey, /* const xmlChar* dataNodeName; */
- xmlSecEncNs, /* const xmlChar* dataNodeNs; */
+ xmlSecKeyDataUsageKeyInfoNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefEncryptedKey, /* const xmlChar* href; */
+ xmlSecNodeEncryptedKey, /* const xmlChar* dataNodeName; */
+ xmlSecEncNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- NULL, /* xmlSecKeyDataInitializeMethod initialize; */
- NULL, /* xmlSecKeyDataDuplicateMethod duplicate; */
- NULL, /* xmlSecKeyDataFinalizeMethod finalize; */
- NULL, /* xmlSecKeyDataGenerateMethod generate; */
+ NULL, /* xmlSecKeyDataInitializeMethod initialize; */
+ NULL, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ NULL, /* xmlSecKeyDataFinalizeMethod finalize; */
+ NULL, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- NULL, /* xmlSecKeyDataGetTypeMethod getType; */
- NULL, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ NULL, /* xmlSecKeyDataGetTypeMethod getType; */
+ NULL, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecKeyDataEncryptedKeyXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecKeyDataEncryptedKeyXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- NULL, /* xmlSecKeyDataBinReadMethod binRead; */
- NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecKeyDataEncryptedKeyXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecKeyDataEncryptedKeyXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ NULL, /* xmlSecKeyDataBinReadMethod binRead; */
+ NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- NULL, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- NULL, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ NULL, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ NULL, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -1412,61 +1412,61 @@ xmlSecKeyDataEncryptedKeyXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePt
/* check the enc level */
if(keyInfoCtx->curEncryptedKeyLevel >= keyInfoCtx->maxEncryptedKeyLevel) {
xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- NULL,
- XMLSEC_ERRORS_R_MAX_ENCKEY_LEVEL,
- "cur=%d;max=%d",
- keyInfoCtx->curEncryptedKeyLevel,
- keyInfoCtx->maxEncryptedKeyLevel);
- return(-1);
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ NULL,
+ XMLSEC_ERRORS_R_MAX_ENCKEY_LEVEL,
+ "cur=%d;max=%d",
+ keyInfoCtx->curEncryptedKeyLevel,
+ keyInfoCtx->maxEncryptedKeyLevel);
+ return(-1);
}
++keyInfoCtx->curEncryptedKeyLevel;
/* init Enc context */
if(keyInfoCtx->encCtx != NULL) {
- xmlSecEncCtxReset(keyInfoCtx->encCtx);
+ xmlSecEncCtxReset(keyInfoCtx->encCtx);
} else {
- ret = xmlSecKeyInfoCtxCreateEncCtx(keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyInfoCtxCreateEncCtx",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ ret = xmlSecKeyInfoCtxCreateEncCtx(keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyInfoCtxCreateEncCtx",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
}
xmlSecAssert2(keyInfoCtx->encCtx != NULL, -1);
result = xmlSecEncCtxDecryptToBuffer(keyInfoCtx->encCtx, node);
if((result == NULL) || (xmlSecBufferGetData(result) == NULL)) {
- /* We might have multiple EncryptedKey elements, encrypted
- * for different receipints but application can enforce
- * correct enc key.
- */
+ /* We might have multiple EncryptedKey elements, encrypted
+ * for different receipints but application can enforce
+ * correct enc key.
+ */
if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_ENCKEY_DONT_STOP_ON_FAILED_DECRYPTION) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecEncCtxDecryptToBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecEncCtxDecryptToBuffer",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ return(0);
}
-
+
ret = xmlSecKeyDataBinRead(keyInfoCtx->keyReq.keyId, key,
- xmlSecBufferGetData(result),
- xmlSecBufferGetSize(result),
- keyInfoCtx);
+ xmlSecBufferGetData(result),
+ xmlSecBufferGetSize(result),
+ keyInfoCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyDataBinRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyDataBinRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
--keyInfoCtx->curEncryptedKeyLevel;
return(0);
@@ -1490,69 +1490,69 @@ xmlSecKeyDataEncryptedKeyXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodeP
/* dump key to a binary buffer */
ret = xmlSecKeyInfoCtxInitialize(&keyInfoCtx2, NULL);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyInfoCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyInfoCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
ret = xmlSecKeyInfoCtxCopyUserPref(&keyInfoCtx2, keyInfoCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyInfoCtxCopyUserPref",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyInfoCtxFinalize(&keyInfoCtx2);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyInfoCtxCopyUserPref",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyInfoCtxFinalize(&keyInfoCtx2);
+ goto done;
}
keyInfoCtx2.keyReq.keyType = xmlSecKeyDataTypeAny;
ret = xmlSecKeyDataBinWrite(key->value->id, key, &keyBuf, &keySize, &keyInfoCtx2);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyDataBinWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyInfoCtxFinalize(&keyInfoCtx2);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyDataBinWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyInfoCtxFinalize(&keyInfoCtx2);
+ goto done;
}
xmlSecKeyInfoCtxFinalize(&keyInfoCtx2);
/* init Enc context */
if(keyInfoCtx->encCtx != NULL) {
- xmlSecEncCtxReset(keyInfoCtx->encCtx);
+ xmlSecEncCtxReset(keyInfoCtx->encCtx);
} else {
- ret = xmlSecKeyInfoCtxCreateEncCtx(keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyInfoCtxCreateEncCtx",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
+ ret = xmlSecKeyInfoCtxCreateEncCtx(keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyInfoCtxCreateEncCtx",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
}
xmlSecAssert2(keyInfoCtx->encCtx != NULL, -1);
ret = xmlSecEncCtxBinaryEncrypt(keyInfoCtx->encCtx, node, keyBuf, keySize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecEncCtxBinaryEncrypt",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecEncCtxBinaryEncrypt",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
res = 0;
done:
if(keyBuf != NULL) {
- memset(keyBuf, 0, keySize);
- xmlFree(keyBuf); keyBuf = NULL;
+ memset(keyBuf, 0, keySize);
+ xmlFree(keyBuf); keyBuf = NULL;
}
return(res);
}
diff --git a/src/keys.c b/src/keys.c
index 44522aa..4acd5d9 100644
--- a/src/keys.c
+++ b/src/keys.c
@@ -107,34 +107,34 @@ xmlSecKeyUseWithCreate(const xmlChar* application, const xmlChar* identifier) {
/* Allocate a new xmlSecKeyUseWith and fill the fields. */
keyUseWith = (xmlSecKeyUseWithPtr)xmlMalloc(sizeof(xmlSecKeyUseWith));
if(keyUseWith == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "sizeof(xmlSecKeyUseWith)=%d",
- sizeof(xmlSecKeyUseWith));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "sizeof(xmlSecKeyUseWith)=%d",
+ sizeof(xmlSecKeyUseWith));
+ return(NULL);
}
memset(keyUseWith, 0, sizeof(xmlSecKeyUseWith));
ret = xmlSecKeyUseWithInitialize(keyUseWith);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyUseWithInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyUseWithInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
xmlSecKeyUseWithDestroy(keyUseWith);
return(NULL);
}
ret = xmlSecKeyUseWithSet(keyUseWith, application, identifier);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyUseWithSet",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyUseWithSet",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
xmlSecKeyUseWithDestroy(keyUseWith);
return(NULL);
}
@@ -161,21 +161,21 @@ xmlSecKeyUseWithDuplicate(xmlSecKeyUseWithPtr keyUseWith) {
newKeyUseWith = xmlSecKeyUseWithCreate(NULL, NULL);
if(newKeyUseWith == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyUseWithCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyUseWithCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(NULL);
}
ret = xmlSecKeyUseWithCopy(newKeyUseWith, keyUseWith);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyUseWithCopy",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyUseWithCopy",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
xmlSecKeyUseWithDestroy(keyUseWith);
return(NULL);
}
@@ -213,37 +213,37 @@ xmlSecKeyUseWithSet(xmlSecKeyUseWithPtr keyUseWith, const xmlChar* application,
xmlSecAssert2(keyUseWith != NULL, -1);
if(keyUseWith->application != NULL) {
- xmlFree(keyUseWith->application);
- keyUseWith->application = NULL;
+ xmlFree(keyUseWith->application);
+ keyUseWith->application = NULL;
}
if(keyUseWith->identifier != NULL) {
- xmlFree(keyUseWith->identifier);
- keyUseWith->identifier = NULL;
+ xmlFree(keyUseWith->identifier);
+ keyUseWith->identifier = NULL;
}
if(application != NULL) {
- keyUseWith->application = xmlStrdup(application);
- if(keyUseWith->application == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "xmlStrlen(application)=%d",
- xmlStrlen(application));
- return(-1);
- }
+ keyUseWith->application = xmlStrdup(application);
+ if(keyUseWith->application == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "xmlStrlen(application)=%d",
+ xmlStrlen(application));
+ return(-1);
+ }
}
if(identifier != NULL) {
- keyUseWith->identifier = xmlStrdup(identifier);
- if(keyUseWith->identifier == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "xmlStrlen(identifier)=%d",
- xmlStrlen(identifier));
- return(-1);
- }
+ keyUseWith->identifier = xmlStrdup(identifier);
+ if(keyUseWith->identifier == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "xmlStrlen(identifier)=%d",
+ xmlStrlen(identifier));
+ return(-1);
+ }
}
return(0);
@@ -298,10 +298,10 @@ xmlSecKeyUseWithDebugXmlDump(xmlSecKeyUseWithPtr keyUseWith, FILE* output) {
**********************************************************************/
static xmlSecPtrListKlass xmlSecKeyUseWithPtrListKlass = {
BAD_CAST "key-use-with-list",
- (xmlSecPtrDuplicateItemMethod)xmlSecKeyUseWithDuplicate, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
- (xmlSecPtrDestroyItemMethod)xmlSecKeyUseWithDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */
- (xmlSecPtrDebugDumpItemMethod)xmlSecKeyUseWithDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
- (xmlSecPtrDebugDumpItemMethod)xmlSecKeyUseWithDebugXmlDump, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
+ (xmlSecPtrDuplicateItemMethod)xmlSecKeyUseWithDuplicate, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
+ (xmlSecPtrDestroyItemMethod)xmlSecKeyUseWithDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */
+ (xmlSecPtrDebugDumpItemMethod)xmlSecKeyUseWithDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
+ (xmlSecPtrDebugDumpItemMethod)xmlSecKeyUseWithDebugXmlDump, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
};
/**
@@ -323,7 +323,7 @@ xmlSecKeyUseWithPtrListGetKlass(void) {
*************************************************************************/
/**
* xmlSecKeyReqInitialize:
- * @keyReq: the pointer to key requirements object.
+ * @keyReq: the pointer to key requirements object.
*
* Initialize key requirements object. Caller is responsible for
* cleaning it with #xmlSecKeyReqFinalize function.
@@ -338,15 +338,15 @@ xmlSecKeyReqInitialize(xmlSecKeyReqPtr keyReq) {
memset(keyReq, 0, sizeof(xmlSecKeyReq));
- keyReq->keyUsage = xmlSecKeyUsageAny; /* by default you can do whatever you want with the key */
+ keyReq->keyUsage = xmlSecKeyUsageAny; /* by default you can do whatever you want with the key */
ret = xmlSecPtrListInitialize(&keyReq->keyUseWithList, xmlSecKeyUseWithPtrListId);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
@@ -355,7 +355,7 @@ xmlSecKeyReqInitialize(xmlSecKeyReqPtr keyReq) {
/**
* xmlSecKeyReqFinalize:
- * @keyReq: the pointer to key requirements object.
+ * @keyReq: the pointer to key requirements object.
*
* Cleans the key requirements object initialized with #xmlSecKeyReqInitialize
* function.
@@ -370,7 +370,7 @@ xmlSecKeyReqFinalize(xmlSecKeyReqPtr keyReq) {
/**
* xmlSecKeyReqReset:
- * @keyReq: the pointer to key requirements object.
+ * @keyReq: the pointer to key requirements object.
*
* Resets key requirements object for new key search.
*/
@@ -379,16 +379,16 @@ xmlSecKeyReqReset(xmlSecKeyReqPtr keyReq) {
xmlSecAssert(keyReq != NULL);
xmlSecPtrListEmpty(&keyReq->keyUseWithList);
- keyReq->keyId = NULL;
- keyReq->keyType = 0;
- keyReq->keyUsage = xmlSecKeyUsageAny;
- keyReq->keyBitsSize = 0;
+ keyReq->keyId = NULL;
+ keyReq->keyType = 0;
+ keyReq->keyUsage = xmlSecKeyUsageAny;
+ keyReq->keyBitsSize = 0;
}
/**
* xmlSecKeyReqCopy:
- * @dst: the pointer to destination object.
- * @src: the pointer to source object.
+ * @dst: the pointer to destination object.
+ * @src: the pointer to source object.
*
* Copies key requirements from @src object to @dst object.
*
@@ -401,19 +401,19 @@ xmlSecKeyReqCopy(xmlSecKeyReqPtr dst, xmlSecKeyReqPtr src) {
xmlSecAssert2(dst != NULL, -1);
xmlSecAssert2(src != NULL, -1);
- dst->keyId = src->keyId;
- dst->keyType = src->keyType;
- dst->keyUsage = src->keyUsage;
- dst->keyBitsSize = src->keyBitsSize;
+ dst->keyId = src->keyId;
+ dst->keyType = src->keyType;
+ dst->keyUsage = src->keyUsage;
+ dst->keyBitsSize = src->keyBitsSize;
ret = xmlSecPtrListCopy(&dst->keyUseWithList, &src->keyUseWithList);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListCopy",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListCopy",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -421,8 +421,8 @@ xmlSecKeyReqCopy(xmlSecKeyReqPtr dst, xmlSecKeyReqPtr src) {
/**
* xmlSecKeyReqMatchKey:
- * @keyReq: the pointer to key requirements object.
- * @key: the pointer to key.
+ * @keyReq: the pointer to key requirements object.
+ * @key: the pointer to key.
*
* Checks whether @key matches key requirements @keyReq.
*
@@ -435,10 +435,10 @@ xmlSecKeyReqMatchKey(xmlSecKeyReqPtr keyReq, xmlSecKeyPtr key) {
xmlSecAssert2(xmlSecKeyIsValid(key), -1);
if((keyReq->keyType != xmlSecKeyDataTypeUnknown) && ((xmlSecKeyGetType(key) & keyReq->keyType) == 0)) {
- return(0);
+ return(0);
}
if((keyReq->keyUsage != xmlSecKeyDataUsageUnknown) && ((keyReq->keyUsage & key->usage) == 0)) {
- return(0);
+ return(0);
}
return(xmlSecKeyReqMatchKeyValue(keyReq, xmlSecKeyGetValue(key)));
@@ -446,8 +446,8 @@ xmlSecKeyReqMatchKey(xmlSecKeyReqPtr keyReq, xmlSecKeyPtr key) {
/**
* xmlSecKeyReqMatchKeyValue:
- * @keyReq: the pointer to key requirements.
- * @value: the pointer to key value.
+ * @keyReq: the pointer to key requirements.
+ * @value: the pointer to key value.
*
* Checks whether @keyValue matches key requirements @keyReq.
*
@@ -462,21 +462,21 @@ xmlSecKeyReqMatchKeyValue(xmlSecKeyReqPtr keyReq, xmlSecKeyDataPtr value) {
if((keyReq->keyId != xmlSecKeyDataIdUnknown) &&
(!xmlSecKeyDataCheckId(value, keyReq->keyId))) {
- return(0);
+ return(0);
}
if((keyReq->keyBitsSize > 0) &&
(xmlSecKeyDataGetSize(value) > 0) &&
(xmlSecKeyDataGetSize(value) < keyReq->keyBitsSize)) {
-
- return(0);
+
+ return(0);
}
return(1);
}
/**
* xmlSecKeyReqDebugDump:
- * @keyReq: the pointer to key requirements object.
- * @output: the pointer to output FILE.
+ * @keyReq: the pointer to key requirements object.
+ * @output: the pointer to output FILE.
*
* Prints debug information about @keyReq into @output.
*/
@@ -487,9 +487,9 @@ xmlSecKeyReqDebugDump(xmlSecKeyReqPtr keyReq, FILE* output) {
fprintf(output, "=== KeyReq:\n");
fprintf(output, "==== keyId: %s\n",
- (xmlSecKeyDataKlassGetName(keyReq->keyId)) ?
- xmlSecKeyDataKlassGetName(keyReq->keyId) :
- BAD_CAST "NULL");
+ (xmlSecKeyDataKlassGetName(keyReq->keyId)) ?
+ xmlSecKeyDataKlassGetName(keyReq->keyId) :
+ BAD_CAST "NULL");
fprintf(output, "==== keyType: 0x%08x\n", keyReq->keyType);
fprintf(output, "==== keyUsage: 0x%08x\n", keyReq->keyUsage);
fprintf(output, "==== keyBitsSize: %d\n", keyReq->keyBitsSize);
@@ -498,8 +498,8 @@ xmlSecKeyReqDebugDump(xmlSecKeyReqPtr keyReq, FILE* output) {
/**
* xmlSecKeyReqDebugXmlDump:
- * @keyReq: the pointer to key requirements object.
- * @output: the pointer to output FILE.
+ * @keyReq: the pointer to key requirements object.
+ * @output: the pointer to output FILE.
*
* Prints debug information about @keyReq into @output in XML format.
*/
@@ -536,29 +536,29 @@ xmlSecKeyReqDebugXmlDump(xmlSecKeyReqPtr keyReq, FILE* output) {
* Returns: the pointer to newly allocated @xmlSecKey structure
* or NULL if an error occurs.
*/
-xmlSecKeyPtr
+xmlSecKeyPtr
xmlSecKeyCreate(void) {
xmlSecKeyPtr key;
/* Allocate a new xmlSecKey and fill the fields. */
key = (xmlSecKeyPtr)xmlMalloc(sizeof(xmlSecKey));
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "sizeof(xmlSecKey)=%d",
- sizeof(xmlSecKey));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "sizeof(xmlSecKey)=%d",
+ sizeof(xmlSecKey));
+ return(NULL);
}
memset(key, 0, sizeof(xmlSecKey));
- key->usage = xmlSecKeyUsageAny;
+ key->usage = xmlSecKeyUsageAny;
return(key);
}
/**
* xmlSecKeyEmpty:
- * @key: the pointer to key.
+ * @key: the pointer to key.
*
* Clears the @key data.
*/
@@ -567,13 +567,13 @@ xmlSecKeyEmpty(xmlSecKeyPtr key) {
xmlSecAssert(key != NULL);
if(key->value != NULL) {
- xmlSecKeyDataDestroy(key->value);
+ xmlSecKeyDataDestroy(key->value);
}
if(key->name != NULL) {
- xmlFree(key->name);
+ xmlFree(key->name);
}
if(key->dataList != NULL) {
- xmlSecPtrListDestroy(key->dataList);
+ xmlSecPtrListDestroy(key->dataList);
}
memset(key, 0, sizeof(xmlSecKey));
@@ -581,7 +581,7 @@ xmlSecKeyEmpty(xmlSecKeyPtr key) {
/**
* xmlSecKeyDestroy:
- * @key: the pointer to key.
+ * @key: the pointer to key.
*
* Destroys the key created using #xmlSecKeyCreate function.
*/
@@ -595,8 +595,8 @@ xmlSecKeyDestroy(xmlSecKeyPtr key) {
/**
* xmlSecKeyCopy:
- * @keyDst: the destination key.
- * @keySrc: the source key.
+ * @keyDst: the destination key.
+ * @keySrc: the source key.
*
* Copies key data from @keySrc to @keyDst.
*
@@ -612,42 +612,42 @@ xmlSecKeyCopy(xmlSecKeyPtr keyDst, xmlSecKeyPtr keySrc) {
/* copy everything */
if(keySrc->name != NULL) {
- keyDst->name = xmlStrdup(keySrc->name);
- if(keyDst->name == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_STRDUP_FAILED,
- "len=%d", xmlStrlen(keySrc->name));
- return(-1);
+ keyDst->name = xmlStrdup(keySrc->name);
+ if(keyDst->name == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_STRDUP_FAILED,
+ "len=%d", xmlStrlen(keySrc->name));
+ return(-1);
}
}
if(keySrc->value != NULL) {
- keyDst->value = xmlSecKeyDataDuplicate(keySrc->value);
- if(keyDst->value == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataDuplicate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ keyDst->value = xmlSecKeyDataDuplicate(keySrc->value);
+ if(keyDst->value == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataDuplicate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
}
if(keySrc->dataList != NULL) {
- keyDst->dataList = xmlSecPtrListDuplicate(keySrc->dataList);
- if(keyDst->dataList == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListDuplicate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ keyDst->dataList = xmlSecPtrListDuplicate(keySrc->dataList);
+ if(keyDst->dataList == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListDuplicate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
}
- keyDst->usage = keySrc->usage;
+ keyDst->usage = keySrc->usage;
keyDst->notValidBefore = keySrc->notValidBefore;
keyDst->notValidAfter = keySrc->notValidAfter;
return(0);
@@ -655,14 +655,14 @@ xmlSecKeyCopy(xmlSecKeyPtr keyDst, xmlSecKeyPtr keySrc) {
/**
* xmlSecKeyDuplicate:
- * @key: the pointer to the #xmlSecKey structure.
+ * @key: the pointer to the #xmlSecKey structure.
*
* Creates a duplicate of the given @key.
*
* Returns: the pointer to newly allocated #xmlSecKey structure
* or NULL if an error occurs.
*/
-xmlSecKeyPtr
+xmlSecKeyPtr
xmlSecKeyDuplicate(xmlSecKeyPtr key) {
xmlSecKeyPtr newKey;
int ret;
@@ -671,23 +671,23 @@ xmlSecKeyDuplicate(xmlSecKeyPtr key) {
newKey = xmlSecKeyCreate();
if(newKey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
ret = xmlSecKeyCopy(newKey, key);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyCopy",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(newKey);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyCopy",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(newKey);
+ return(NULL);
}
return(newKey);
@@ -695,9 +695,9 @@ xmlSecKeyDuplicate(xmlSecKeyPtr key) {
/**
* xmlSecKeyMatch:
- * @key: the pointer to key.
- * @name: the pointer to key name (may be NULL).
- * @keyReq: the pointer to key requirements.
+ * @key: the pointer to key.
+ * @name: the pointer to key name (may be NULL).
+ * @keyReq: the pointer to key requirements.
*
* Checks whether the @key matches the given criteria.
*
@@ -709,14 +709,14 @@ xmlSecKeyMatch(xmlSecKeyPtr key, const xmlChar *name, xmlSecKeyReqPtr keyReq) {
xmlSecAssert2(keyReq != NULL, -1);
if((name != NULL) && (!xmlStrEqual(xmlSecKeyGetName(key), name))) {
- return(0);
+ return(0);
}
return(xmlSecKeyReqMatchKey(keyReq, key));
}
/**
* xmlSecKeyGetType:
- * @key: the pointer to key.
+ * @key: the pointer to key.
*
* Gets @key type.
*
@@ -730,20 +730,20 @@ xmlSecKeyGetType(xmlSecKeyPtr key) {
data = xmlSecKeyGetValue(key);
if(data == NULL) {
- return(xmlSecKeyDataTypeUnknown);
+ return(xmlSecKeyDataTypeUnknown);
}
return(xmlSecKeyDataGetType(data));
}
/**
* xmlSecKeyGetName:
- * @key: the pointer to key.
+ * @key: the pointer to key.
*
* Gets key name (see also #xmlSecKeySetName function).
*
* Returns: key name.
*/
-const xmlChar*
+const xmlChar*
xmlSecKeyGetName(xmlSecKeyPtr key) {
xmlSecAssert2(key != NULL, NULL);
@@ -752,8 +752,8 @@ xmlSecKeyGetName(xmlSecKeyPtr key) {
/**
* xmlSecKeySetName:
- * @key: the pointer to key.
- * @name: the new key name.
+ * @key: the pointer to key.
+ * @name: the new key name.
*
* Sets key name (see also #xmlSecKeyGetName function).
*
@@ -764,20 +764,20 @@ xmlSecKeySetName(xmlSecKeyPtr key, const xmlChar* name) {
xmlSecAssert2(key != NULL, -1);
if(key->name != NULL) {
- xmlFree(key->name);
- key->name = NULL;
+ xmlFree(key->name);
+ key->name = NULL;
}
if(name != NULL) {
- key->name = xmlStrdup(name);
- if(key->name == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_STRDUP_FAILED,
- "len=%d", xmlStrlen(name));
- return(-1);
- }
+ key->name = xmlStrdup(name);
+ if(key->name == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_STRDUP_FAILED,
+ "len=%d", xmlStrlen(name));
+ return(-1);
+ }
}
return(0);
@@ -785,7 +785,7 @@ xmlSecKeySetName(xmlSecKeyPtr key, const xmlChar* name) {
/**
* xmlSecKeyGetValue:
- * @key: the pointer to key.
+ * @key: the pointer to key.
*
* Gets key value (see also #xmlSecKeySetValue function).
*
@@ -800,8 +800,8 @@ xmlSecKeyGetValue(xmlSecKeyPtr key) {
/**
* xmlSecKeySetValue:
- * @key: the pointer to key.
- * @value: the new value.
+ * @key: the pointer to key.
+ * @value: the new value.
*
* Sets key value (see also #xmlSecKeyGetValue function).
*
@@ -812,8 +812,8 @@ xmlSecKeySetValue(xmlSecKeyPtr key, xmlSecKeyDataPtr value) {
xmlSecAssert2(key != NULL, -1);
if(key->value != NULL) {
- xmlSecKeyDataDestroy(key->value);
- key->value = NULL;
+ xmlSecKeyDataDestroy(key->value);
+ key->value = NULL;
}
key->value = value;
@@ -822,8 +822,8 @@ xmlSecKeySetValue(xmlSecKeyPtr key, xmlSecKeyDataPtr value) {
/**
* xmlSecKeyGetData:
- * @key: the pointer to key.
- * @dataId: the requested data klass.
+ * @key: the pointer to key.
+ * @dataId: the requested data klass.
*
* Gets key's data.
*
@@ -838,26 +838,26 @@ xmlSecKeyGetData(xmlSecKeyPtr key, xmlSecKeyDataId dataId) {
/* special cases */
if(dataId == xmlSecKeyDataValueId) {
- return(key->value);
+ return(key->value);
} else if(key->dataList != NULL) {
- xmlSecKeyDataPtr tmp;
- xmlSecSize pos, size;
-
- size = xmlSecPtrListGetSize(key->dataList);
- for(pos = 0; pos < size; ++pos) {
- tmp = (xmlSecKeyDataPtr)xmlSecPtrListGetItem(key->dataList, pos);
- if((tmp != NULL) && (tmp->id == dataId)) {
- return(tmp);
- }
- }
+ xmlSecKeyDataPtr tmp;
+ xmlSecSize pos, size;
+
+ size = xmlSecPtrListGetSize(key->dataList);
+ for(pos = 0; pos < size; ++pos) {
+ tmp = (xmlSecKeyDataPtr)xmlSecPtrListGetItem(key->dataList, pos);
+ if((tmp != NULL) && (tmp->id == dataId)) {
+ return(tmp);
+ }
+ }
}
return(NULL);
}
/**
* xmlSecKeyEnsureData:
- * @key: the pointer to key.
- * @dataId: the requested data klass.
+ * @key: the pointer to key.
+ * @dataId: the requested data klass.
*
* If necessary, creates key data of @dataId klass and adds to @key.
*
@@ -873,30 +873,30 @@ xmlSecKeyEnsureData(xmlSecKeyPtr key, xmlSecKeyDataId dataId) {
data = xmlSecKeyGetData(key, dataId);
if(data != NULL) {
- return(data);
+ return(data);
}
data = xmlSecKeyDataCreate(dataId);
if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "dataId=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "dataId=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)));
+ return(NULL);
}
-
+
ret = xmlSecKeyAdoptData(key, data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyAdoptData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "dataId=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)));
- xmlSecKeyDataDestroy(data);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyAdoptData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "dataId=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)));
+ xmlSecKeyDataDestroy(data);
+ return(NULL);
}
return(data);
@@ -904,8 +904,8 @@ xmlSecKeyEnsureData(xmlSecKeyPtr key, xmlSecKeyDataId dataId) {
/**
* xmlSecKeyAdoptData:
- * @key: the pointer to key.
- * @data: the pointer to key data.
+ * @key: the pointer to key.
+ * @data: the pointer to key data.
*
* Adds @data to the @key. The @data object will be destroyed
* by @key.
@@ -922,32 +922,32 @@ xmlSecKeyAdoptData(xmlSecKeyPtr key, xmlSecKeyDataPtr data) {
/* special cases */
if(data->id == xmlSecKeyDataValueId) {
- if(key->value != NULL) {
- xmlSecKeyDataDestroy(key->value);
- }
- key->value = data;
- return(0);
+ if(key->value != NULL) {
+ xmlSecKeyDataDestroy(key->value);
+ }
+ key->value = data;
+ return(0);
}
if(key->dataList == NULL) {
- key->dataList = xmlSecPtrListCreate(xmlSecKeyDataListId);
- if(key->dataList == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ key->dataList = xmlSecPtrListCreate(xmlSecKeyDataListId);
+ if(key->dataList == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
-
+
size = xmlSecPtrListGetSize(key->dataList);
for(pos = 0; pos < size; ++pos) {
- tmp = (xmlSecKeyDataPtr)xmlSecPtrListGetItem(key->dataList, pos);
- if((tmp != NULL) && (tmp->id == data->id)) {
- return(xmlSecPtrListSet(key->dataList, data, pos));
- }
+ tmp = (xmlSecKeyDataPtr)xmlSecPtrListGetItem(key->dataList, pos);
+ if((tmp != NULL) && (tmp->id == data->id)) {
+ return(xmlSecPtrListSet(key->dataList, data, pos));
+ }
}
return(xmlSecPtrListAdd(key->dataList, data));
@@ -955,8 +955,8 @@ xmlSecKeyAdoptData(xmlSecKeyPtr key, xmlSecKeyDataPtr data) {
/**
* xmlSecKeyDebugDump:
- * @key: the pointer to key.
- * @output: the pointer to output FILE.
+ * @key: the pointer to key.
+ * @output: the pointer to output FILE.
*
* Prints the information about the @key to the @output.
*/
@@ -967,40 +967,40 @@ xmlSecKeyDebugDump(xmlSecKeyPtr key, FILE *output) {
fprintf(output, "== KEY\n");
fprintf(output, "=== method: %s\n",
- (key->value->id->dataNodeName != NULL) ?
- (char*)(key->value->id->dataNodeName) : "NULL");
+ (key->value->id->dataNodeName != NULL) ?
+ (char*)(key->value->id->dataNodeName) : "NULL");
fprintf(output, "=== key type: ");
if((xmlSecKeyGetType(key) & xmlSecKeyDataTypeSymmetric) != 0) {
- fprintf(output, "Symmetric\n");
+ fprintf(output, "Symmetric\n");
} else if((xmlSecKeyGetType(key) & xmlSecKeyDataTypePrivate) != 0) {
- fprintf(output, "Private\n");
+ fprintf(output, "Private\n");
} else if((xmlSecKeyGetType(key) & xmlSecKeyDataTypePublic) != 0) {
- fprintf(output, "Public\n");
+ fprintf(output, "Public\n");
} else {
- fprintf(output, "Unknown\n");
+ fprintf(output, "Unknown\n");
}
if(key->name != NULL) {
- fprintf(output, "=== key name: %s\n", key->name);
+ fprintf(output, "=== key name: %s\n", key->name);
}
fprintf(output, "=== key usage: %d\n", key->usage);
if(key->notValidBefore < key->notValidAfter) {
fprintf(output, "=== key not valid before: %ld\n", (unsigned long)key->notValidBefore);
- fprintf(output, "=== key not valid after: %ld\n", (unsigned long)key->notValidAfter);
+ fprintf(output, "=== key not valid after: %ld\n", (unsigned long)key->notValidAfter);
}
if(key->value != NULL) {
- xmlSecKeyDataDebugDump(key->value, output);
+ xmlSecKeyDataDebugDump(key->value, output);
}
if(key->dataList != NULL) {
- xmlSecPtrListDebugDump(key->dataList, output);
+ xmlSecPtrListDebugDump(key->dataList, output);
}
}
/**
* xmlSecKeyDebugXmlDump:
- * @key: the pointer to key.
- * @output: the pointer to output FILE.
+ * @key: the pointer to key.
+ * @output: the pointer to output FILE.
*
* Prints the information about the @key to the @output in XML format.
*/
@@ -1017,13 +1017,13 @@ xmlSecKeyDebugXmlDump(xmlSecKeyPtr key, FILE *output) {
fprintf(output, "<KeyType>");
if((xmlSecKeyGetType(key) & xmlSecKeyDataTypeSymmetric) != 0) {
- fprintf(output, "Symmetric\n");
+ fprintf(output, "Symmetric\n");
} else if((xmlSecKeyGetType(key) & xmlSecKeyDataTypePrivate) != 0) {
- fprintf(output, "Private\n");
+ fprintf(output, "Private\n");
} else if((xmlSecKeyGetType(key) & xmlSecKeyDataTypePublic) != 0) {
- fprintf(output, "Public\n");
+ fprintf(output, "Public\n");
} else {
- fprintf(output, "Unknown\n");
+ fprintf(output, "Unknown\n");
}
fprintf(output, "</KeyType>\n");
@@ -1033,15 +1033,15 @@ xmlSecKeyDebugXmlDump(xmlSecKeyPtr key, FILE *output) {
if(key->notValidBefore < key->notValidAfter) {
fprintf(output, "<KeyValidity notValidBefore=\"%ld\" notValidAfter=\"%ld\"/>\n",
- (unsigned long)key->notValidBefore,
- (unsigned long)key->notValidAfter);
+ (unsigned long)key->notValidBefore,
+ (unsigned long)key->notValidAfter);
}
if(key->value != NULL) {
- xmlSecKeyDataDebugXmlDump(key->value, output);
+ xmlSecKeyDataDebugXmlDump(key->value, output);
}
if(key->dataList != NULL) {
- xmlSecPtrListDebugXmlDump(key->dataList, output);
+ xmlSecPtrListDebugXmlDump(key->dataList, output);
}
fprintf(output, "</KeyInfo>\n");
@@ -1049,9 +1049,9 @@ xmlSecKeyDebugXmlDump(xmlSecKeyPtr key, FILE *output) {
/**
* xmlSecKeyGenerate:
- * @dataId: the requested key klass (rsa, dsa, aes, ...).
- * @sizeBits: the new key size (in bits!).
- * @type: the new key type (session, permanent, ...).
+ * @dataId: the requested key klass (rsa, dsa, aes, ...).
+ * @sizeBits: the new key size (in bits!).
+ * @type: the new key type (session, permanent, ...).
*
* Generates new key of requested klass @dataId and @type.
*
@@ -1067,46 +1067,46 @@ xmlSecKeyGenerate(xmlSecKeyDataId dataId, xmlSecSize sizeBits, xmlSecKeyDataType
data = xmlSecKeyDataCreate(dataId);
if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
ret = xmlSecKeyDataGenerate(data, sizeBits, type);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
- "xmlSecKeyDataGenerate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d;type=%d", sizeBits, type);
- xmlSecKeyDataDestroy(data);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
+ "xmlSecKeyDataGenerate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d;type=%d", sizeBits, type);
+ xmlSecKeyDataDestroy(data);
+ return(NULL);
}
key = xmlSecKeyCreate();
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
- "xmlSecKeyCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(data);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
+ "xmlSecKeyCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(data);
+ return(NULL);
}
ret = xmlSecKeySetValue(key, data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(data);
- xmlSecKeyDestroy(key);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(data);
+ xmlSecKeyDestroy(key);
+ return(NULL);
}
return(key);
@@ -1114,9 +1114,9 @@ xmlSecKeyGenerate(xmlSecKeyDataId dataId, xmlSecSize sizeBits, xmlSecKeyDataType
/**
* xmlSecKeyGenerateByName:
- * @name: the requested key klass name (rsa, dsa, aes, ...).
- * @sizeBits: the new key size (in bits!).
- * @type: the new key type (session, permanent, ...).
+ * @name: the requested key klass name (rsa, dsa, aes, ...).
+ * @sizeBits: the new key size (in bits!).
+ * @type: the new key type (session, permanent, ...).
*
* Generates new key of requested @klass and @type.
*
@@ -1130,12 +1130,12 @@ xmlSecKeyGenerateByName(const xmlChar* name, xmlSecSize sizeBits, xmlSecKeyDataT
dataId = xmlSecKeyDataIdListFindByName(xmlSecKeyDataIdsGet(), name, xmlSecKeyDataUsageAny);
if(dataId == xmlSecKeyDataIdUnknown) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(name),
- XMLSEC_ERRORS_R_KEY_DATA_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(name),
+ XMLSEC_ERRORS_R_KEY_DATA_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(xmlSecKeyGenerate(dataId, sizeBits, type));
@@ -1143,8 +1143,8 @@ xmlSecKeyGenerateByName(const xmlChar* name, xmlSecSize sizeBits, xmlSecKeyDataT
/**
* xmlSecKeyReadBuffer:
- * @dataId: the key value data klass.
- * @buffer: the buffer that contains the binary data.
+ * @dataId: the key value data klass.
+ * @buffer: the buffer that contains the binary data.
*
* Reads the key value of klass @dataId from a buffer.
*
@@ -1162,39 +1162,39 @@ xmlSecKeyReadBuffer(xmlSecKeyDataId dataId, xmlSecBuffer* buffer) {
/* create key data */
key = xmlSecKeyCreate();
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
- "xmlSecKeyCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
+ "xmlSecKeyCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
ret = xmlSecKeyInfoCtxInitialize(&keyInfoCtx, NULL);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
- "xmlSecKeyInfoCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(key);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
+ "xmlSecKeyInfoCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(key);
+ return(NULL);
}
keyInfoCtx.keyReq.keyType = xmlSecKeyDataTypeAny;
ret = xmlSecKeyDataBinRead(dataId, key,
- xmlSecBufferGetData(buffer),
- xmlSecBufferGetSize(buffer),
- &keyInfoCtx);
+ xmlSecBufferGetData(buffer),
+ xmlSecBufferGetSize(buffer),
+ &keyInfoCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
- "xmlSecKeyDataBinRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
- xmlSecKeyDestroy(key);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
+ "xmlSecKeyDataBinRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
+ xmlSecKeyDestroy(key);
+ return(NULL);
}
xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
@@ -1203,8 +1203,8 @@ xmlSecKeyReadBuffer(xmlSecKeyDataId dataId, xmlSecBuffer* buffer) {
/**
* xmlSecKeyReadBinaryFile:
- * @dataId: the key value data klass.
- * @filename: the key binary filename.
+ * @dataId: the key value data klass.
+ * @filename: the key binary filename.
*
* Reads the key value of klass @dataId from a binary file @filename.
*
@@ -1222,36 +1222,36 @@ xmlSecKeyReadBinaryFile(xmlSecKeyDataId dataId, const char* filename) {
/* read file to buffer */
ret = xmlSecBufferInitialize(&buffer, 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
ret = xmlSecBufferReadFile(&buffer, filename);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
- "xmlSecBufferReadFile",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "filename=%s",
- xmlSecErrorsSafeString(filename));
- xmlSecBufferFinalize(&buffer);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
+ "xmlSecBufferReadFile",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "filename=%s",
+ xmlSecErrorsSafeString(filename));
+ xmlSecBufferFinalize(&buffer);
+ return(NULL);
}
key = xmlSecKeyReadBuffer(dataId, &buffer);
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
- "xmlSecKeyReadBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "filename=%s",
- xmlSecErrorsSafeString(filename));
- xmlSecBufferFinalize(&buffer);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
+ "xmlSecKeyReadBuffer",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "filename=%s",
+ xmlSecErrorsSafeString(filename));
+ xmlSecBufferFinalize(&buffer);
+ return(NULL);
}
xmlSecBufferFinalize(&buffer);
@@ -1260,9 +1260,9 @@ xmlSecKeyReadBinaryFile(xmlSecKeyDataId dataId, const char* filename) {
/**
* xmlSecKeyReadMemory:
- * @dataId: the key value data klass.
- * @data: the memory containing the key
- * @dataSize: the size of the memory block
+ * @dataId: the key value data klass.
+ * @data: the memory containing the key
+ * @dataSize: the size of the memory block
*
* Reads the key value of klass @dataId from a memory block @data.
*
@@ -1281,33 +1281,33 @@ xmlSecKeyReadMemory(xmlSecKeyDataId dataId, const xmlSecByte* data, xmlSecSize d
/* read file to buffer */
ret = xmlSecBufferInitialize(&buffer, 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
if (xmlSecBufferAppend(&buffer, data, dataSize) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
- "xmlSecBufferAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBufferFinalize(&buffer);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
+ "xmlSecBufferAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBufferFinalize(&buffer);
+ return(NULL);
}
key = xmlSecKeyReadBuffer(dataId, &buffer);
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
- "xmlSecKeyReadBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBufferFinalize(&buffer);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(dataId)),
+ "xmlSecKeyReadBuffer",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBufferFinalize(&buffer);
+ return(NULL);
}
xmlSecBufferFinalize(&buffer);
@@ -1316,15 +1316,15 @@ xmlSecKeyReadMemory(xmlSecKeyDataId dataId, const xmlSecByte* data, xmlSecSize d
/**
* xmlSecKeysMngrGetKey:
- * @keyInfoNode: the pointer to <dsig:KeyInfo/> node.
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> node processing context.
+ * @keyInfoNode: the pointer to <dsig:KeyInfo/> node.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> node processing context.
*
* Reads the <dsig:KeyInfo/> node @keyInfoNode and extracts the key.
*
* Returns: the pointer to key or NULL if the key is not found or
* an error occurs.
*/
-xmlSecKeyPtr
+xmlSecKeyPtr
xmlSecKeysMngrGetKey(xmlNodePtr keyInfoNode, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyPtr key;
int ret;
@@ -1335,56 +1335,56 @@ xmlSecKeysMngrGetKey(xmlNodePtr keyInfoNode, xmlSecKeyInfoCtxPtr keyInfoCtx) {
/* first try to read data from <dsig:KeyInfo/> node */
key = xmlSecKeyCreate();
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
if(keyInfoNode != NULL) {
- ret = xmlSecKeyInfoNodeRead(keyInfoNode, key, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyInfoNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(keyInfoNode)));
- xmlSecKeyDestroy(key);
- return(NULL);
- }
-
- if((xmlSecKeyGetValue(key) != NULL) &&
+ ret = xmlSecKeyInfoNodeRead(keyInfoNode, key, keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyInfoNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(keyInfoNode)));
+ xmlSecKeyDestroy(key);
+ return(NULL);
+ }
+
+ if((xmlSecKeyGetValue(key) != NULL) &&
(xmlSecKeyMatch(key, NULL, &(keyInfoCtx->keyReq)) != 0)) {
return(key);
}
- }
+ }
xmlSecKeyDestroy(key);
/* if we have keys manager, try it */
if(keyInfoCtx->keysMngr != NULL) {
- key = xmlSecKeysMngrFindKey(keyInfoCtx->keysMngr, NULL, keyInfoCtx);
- if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrFindKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
- if(xmlSecKeyGetValue(key) != NULL) {
- return(key);
- }
- xmlSecKeyDestroy(key);
+ key = xmlSecKeysMngrFindKey(keyInfoCtx->keysMngr, NULL, keyInfoCtx);
+ if(key == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrFindKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+ if(xmlSecKeyGetValue(key) != NULL) {
+ return(key);
+ }
+ xmlSecKeyDestroy(key);
}
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_KEY_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_KEY_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(NULL);
}
@@ -1395,9 +1395,9 @@ xmlSecKeysMngrGetKey(xmlNodePtr keyInfoNode, xmlSecKeyInfoCtxPtr keyInfoCtx) {
**********************************************************************/
static xmlSecPtrListKlass xmlSecKeyPtrListKlass = {
BAD_CAST "keys-list",
- (xmlSecPtrDuplicateItemMethod)xmlSecKeyDuplicate, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
- (xmlSecPtrDestroyItemMethod)xmlSecKeyDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */
- (xmlSecPtrDebugDumpItemMethod)xmlSecKeyDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
+ (xmlSecPtrDuplicateItemMethod)xmlSecKeyDuplicate, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
+ (xmlSecPtrDestroyItemMethod)xmlSecKeyDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */
+ (xmlSecPtrDebugDumpItemMethod)xmlSecKeyDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
(xmlSecPtrDebugDumpItemMethod)xmlSecKeyDebugXmlDump,/* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
};
diff --git a/src/keysdata.c b/src/keysdata.c
index 1101f7f..608c3ff 100644
--- a/src/keysdata.c
+++ b/src/keysdata.c
@@ -59,21 +59,21 @@ xmlSecKeyDataIdsInit(void) {
ret = xmlSecPtrListInitialize(xmlSecKeyDataIdsGet(), xmlSecKeyDataIdListId);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListPtrInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecKeyDataIdListId");
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListPtrInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecKeyDataIdListId");
return(-1);
}
ret = xmlSecKeyDataIdsRegisterDefault();
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataIdsRegisterDefault",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataIdsRegisterDefault",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -93,7 +93,7 @@ xmlSecKeyDataIdsShutdown(void) {
/**
* xmlSecKeyDataIdsRegister:
- * @id: the key data klass.
+ * @id: the key data klass.
*
* Registers @id in the global list of key data klasses.
*
@@ -107,12 +107,12 @@ xmlSecKeyDataIdsRegister(xmlSecKeyDataId id) {
ret = xmlSecPtrListAdd(xmlSecKeyDataIdsGet(), (xmlSecPtr)id);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "dataId=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "dataId=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)));
return(-1);
}
@@ -131,40 +131,40 @@ xmlSecKeyDataIdsRegister(xmlSecKeyDataId id) {
int
xmlSecKeyDataIdsRegisterDefault(void) {
if(xmlSecKeyDataIdsRegister(xmlSecKeyDataNameId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecKeyDataNameId");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecKeyDataNameId");
+ return(-1);
}
if(xmlSecKeyDataIdsRegister(xmlSecKeyDataValueId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecKeyDataValueId");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecKeyDataValueId");
+ return(-1);
}
if(xmlSecKeyDataIdsRegister(xmlSecKeyDataRetrievalMethodId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecKeyDataRetrievalMethodId");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecKeyDataRetrievalMethodId");
+ return(-1);
}
#ifndef XMLSEC_NO_XMLENC
if(xmlSecKeyDataIdsRegister(xmlSecKeyDataEncryptedKeyId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecKeyDataEncryptedKeyId");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecKeyDataEncryptedKeyId");
+ return(-1);
}
#endif /* XMLSEC_NO_XMLENC */
@@ -178,7 +178,7 @@ xmlSecKeyDataIdsRegisterDefault(void) {
*************************************************************************/
/**
* xmlSecKeyDataCreate:
- * @id: the data id.
+ * @id: the data id.
*
* Allocates and initializes new key data of the specified type @id.
* Caller is responsible for destroing returend object with
@@ -187,7 +187,7 @@ xmlSecKeyDataIdsRegisterDefault(void) {
* Returns: the pointer to newly allocated key data structure
* or NULL if an error occurs.
*/
-xmlSecKeyDataPtr
+xmlSecKeyDataPtr
xmlSecKeyDataCreate(xmlSecKeyDataId id) {
xmlSecKeyDataPtr data;
int ret;
@@ -200,27 +200,27 @@ xmlSecKeyDataCreate(xmlSecKeyDataId id) {
/* Allocate a new xmlSecKeyData and fill the fields. */
data = (xmlSecKeyDataPtr)xmlMalloc(id->objSize);
if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "size=%d", id->objSize);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "size=%d", id->objSize);
+ return(NULL);
}
memset(data, 0, id->objSize);
data->id = id;
if(id->initialize != NULL) {
- ret = (id->initialize)(data);
+ ret = (id->initialize)(data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "id->initialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(data);
- return(NULL);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "id->initialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(data);
+ return(NULL);
+ }
}
return(data);
@@ -228,7 +228,7 @@ xmlSecKeyDataCreate(xmlSecKeyDataId id) {
/**
* xmlSecKeyDataDuplicate:
- * @data: the pointer to the key data.
+ * @data: the pointer to the key data.
*
* Creates a duplicate of the given @data. Caller is responsible for
* destroing returend object with #xmlSecKeyDataDestroy function.
@@ -236,7 +236,7 @@ xmlSecKeyDataCreate(xmlSecKeyDataId id) {
* Returns: the pointer to newly allocated key data structure
* or NULL if an error occurs.
*/
-xmlSecKeyDataPtr
+xmlSecKeyDataPtr
xmlSecKeyDataDuplicate(xmlSecKeyDataPtr data) {
xmlSecKeyDataPtr newData;
int ret;
@@ -246,23 +246,23 @@ xmlSecKeyDataDuplicate(xmlSecKeyDataPtr data) {
newData = xmlSecKeyDataCreate(data->id);
if(newData == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
ret = (data->id->duplicate)(newData, data);
if(newData == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "id->duplicate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(newData);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "id->duplicate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(newData);
+ return(NULL);
}
return(newData);
@@ -270,7 +270,7 @@ xmlSecKeyDataDuplicate(xmlSecKeyDataPtr data) {
/**
* xmlSecKeyDataDestroy:
- * @data: the pointer to the key data.
+ * @data: the pointer to the key data.
*
* Destroys the data and frees all allocated memory.
*/
@@ -280,7 +280,7 @@ xmlSecKeyDataDestroy(xmlSecKeyDataPtr data) {
xmlSecAssert(data->id->objSize > 0);
if(data->id->finalize != NULL) {
- (data->id->finalize)(data);
+ (data->id->finalize)(data);
}
memset(data, 0, data->id->objSize);
xmlFree(data);
@@ -289,10 +289,10 @@ xmlSecKeyDataDestroy(xmlSecKeyDataPtr data) {
/**
* xmlSecKeyDataXmlRead:
- * @id: the data klass.
- * @key: the destination key.
- * @node: the pointer to an XML node.
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
+ * @id: the data klass.
+ * @key: the destination key.
+ * @node: the pointer to an XML node.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
*
* Reads the key data of klass @id from XML @node and adds them to @key.
*
@@ -310,10 +310,10 @@ xmlSecKeyDataXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xmlS
/**
* xmlSecKeyDataXmlWrite:
- * @id: the data klass.
- * @key: the source key.
- * @node: the pointer to an XML node.
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
+ * @id: the data klass.
+ * @key: the source key.
+ * @node: the pointer to an XML node.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
*
* Writes the key data of klass @id from @key to an XML @node.
*
@@ -331,11 +331,11 @@ xmlSecKeyDataXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xml
/**
* xmlSecKeyDataBinRead:
- * @id: the data klass.
- * @key: the destination key.
- * @buf: the input binary buffer.
- * @bufSize: the input buffer size.
- * @keyInfoCtx: the <dsig:KeyInfo/> node processing context.
+ * @id: the data klass.
+ * @key: the destination key.
+ * @buf: the input binary buffer.
+ * @bufSize: the input buffer size.
+ * @keyInfoCtx: the <dsig:KeyInfo/> node processing context.
*
* Reads the key data of klass @id from binary buffer @buf to @key.
*
@@ -343,8 +343,8 @@ xmlSecKeyDataXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key, xmlNodePtr node, xml
*/
int
xmlSecKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- const xmlSecByte* buf, xmlSecSize bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ const xmlSecByte* buf, xmlSecSize bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecAssert2(id != NULL, -1);
xmlSecAssert2(id->binRead != NULL, -1);
xmlSecAssert2(key != NULL, -1);
@@ -355,11 +355,11 @@ xmlSecKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
/**
* xmlSecKeyDataBinWrite:
- * @id: the data klass.
- * @key: the source key.
- * @buf: the output binary buffer.
- * @bufSize: the output buffer size.
- * @keyInfoCtx: the <dsig:KeyInfo/> node processing context.
+ * @id: the data klass.
+ * @key: the source key.
+ * @buf: the output binary buffer.
+ * @bufSize: the output buffer size.
+ * @keyInfoCtx: the <dsig:KeyInfo/> node processing context.
*
* Writes the key data of klass @id from the @key to a binary buffer @buf.
*
@@ -367,8 +367,8 @@ xmlSecKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
*/
int
xmlSecKeyDataBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlSecByte** buf, xmlSecSize* bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlSecByte** buf, xmlSecSize* bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecAssert2(id != NULL, -1);
xmlSecAssert2(id->binWrite != NULL, -1);
xmlSecAssert2(key != NULL, -1);
@@ -379,9 +379,9 @@ xmlSecKeyDataBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
/**
* xmlSecKeyDataGenerate:
- * @data: the pointer to key data.
- * @sizeBits: the desired key data size (in bits).
- * @type: the desired key data type.
+ * @data: the pointer to key data.
+ * @sizeBits: the desired key data size (in bits).
+ * @type: the desired key data type.
*
* Generates new key data of given size and type.
*
@@ -389,7 +389,7 @@ xmlSecKeyDataBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
*/
int
xmlSecKeyDataGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits,
- xmlSecKeyDataType type) {
+ xmlSecKeyDataType type) {
int ret;
xmlSecAssert2(xmlSecKeyDataIsValid(data), -1);
@@ -398,25 +398,25 @@ xmlSecKeyDataGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits,
/* write data */
ret = data->id->generate(data, sizeBits, type);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "id->generate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", sizeBits);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "id->generate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", sizeBits);
+ return(-1);
}
return(0);
}
/**
* xmlSecKeyDataGetType:
- * @data: the pointer to key data.
+ * @data: the pointer to key data.
*
* Gets key data type.
*
* Returns: key data type.
*/
-xmlSecKeyDataType
+xmlSecKeyDataType
xmlSecKeyDataGetType(xmlSecKeyDataPtr data) {
xmlSecAssert2(xmlSecKeyDataIsValid(data), xmlSecKeyDataTypeUnknown);
xmlSecAssert2(data->id->getType != NULL, xmlSecKeyDataTypeUnknown);
@@ -426,7 +426,7 @@ xmlSecKeyDataGetType(xmlSecKeyDataPtr data) {
/**
* xmlSecKeyDataGetSize:
- * @data: the pointer to key data.
+ * @data: the pointer to key data.
*
* Gets key data size.
*
@@ -442,7 +442,7 @@ xmlSecKeyDataGetSize(xmlSecKeyDataPtr data) {
/**
* xmlSecKeyDataGetIdentifier:
- * @data: the pointer to key data.
+ * @data: the pointer to key data.
*
* Gets key data identifier string.
*
@@ -458,8 +458,8 @@ xmlSecKeyDataGetIdentifier(xmlSecKeyDataPtr data) {
/**
* xmlSecKeyDataDebugDump:
- * @data: the pointer to key data.
- * @output: the pointer to output FILE.
+ * @data: the pointer to key data.
+ * @output: the pointer to output FILE.
*
* Prints key data debug info.
*/
@@ -474,8 +474,8 @@ xmlSecKeyDataDebugDump(xmlSecKeyDataPtr data, FILE *output) {
/**
* xmlSecKeyDataDebugXmlDump:
- * @data: the pointer to key data.
- * @output: the pointer to output FILE.
+ * @data: the pointer to key data.
+ * @output: the pointer to output FILE.
*
* Prints key data debug info in XML format.
*/
@@ -497,7 +497,7 @@ xmlSecKeyDataDebugXmlDump(xmlSecKeyDataPtr data, FILE *output) {
*************************************************************************/
/**
* xmlSecKeyDataBinaryValueInitialize:
- * @data: the pointer to binary key data.
+ * @data: the pointer to binary key data.
*
* Initializes key data.
*
@@ -517,12 +517,12 @@ xmlSecKeyDataBinaryValueInitialize(xmlSecKeyDataPtr data) {
ret = xmlSecBufferInitialize(buffer, 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -530,8 +530,8 @@ xmlSecKeyDataBinaryValueInitialize(xmlSecKeyDataPtr data) {
/**
* xmlSecKeyDataBinaryValueDuplicate:
- * @dst: the pointer to destination binary key data.
- * @src: the pointer to source binary key data.
+ * @dst: the pointer to destination binary key data.
+ * @src: the pointer to source binary key data.
*
* Copies binary key data from @src to @dst.
*
@@ -552,15 +552,15 @@ xmlSecKeyDataBinaryValueDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
/* copy data */
ret = xmlSecKeyDataBinaryValueSetBuffer(dst,
- xmlSecBufferGetData(buffer),
- xmlSecBufferGetSize(buffer));
+ xmlSecBufferGetData(buffer),
+ xmlSecBufferGetSize(buffer));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "xmlSecKeyDataBinaryValueSetBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "xmlSecKeyDataBinaryValueSetBuffer",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -568,7 +568,7 @@ xmlSecKeyDataBinaryValueDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
/**
* xmlSecKeyDataBinaryValueFinalize:
- * @data: the pointer to binary key data.
+ * @data: the pointer to binary key data.
*
* Cleans up binary key data.
*/
@@ -588,10 +588,10 @@ xmlSecKeyDataBinaryValueFinalize(xmlSecKeyDataPtr data) {
/**
* xmlSecKeyDataBinaryValueXmlRead:
- * @id: the data klass.
- * @key: the pointer to destination key.
- * @node: the pointer to an XML node.
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
+ * @id: the data klass.
+ * @key: the pointer to destination key.
+ * @node: the pointer to an XML node.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
*
* Reads binary key data from @node to the key by base64 decoding the @node content.
*
@@ -599,7 +599,7 @@ xmlSecKeyDataBinaryValueFinalize(xmlSecKeyDataPtr data) {
*/
int
xmlSecKeyDataBinaryValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlChar* str;
xmlSecSize len;
xmlSecKeyDataPtr data;
@@ -612,115 +612,115 @@ xmlSecKeyDataBinaryValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
str = xmlNodeGetContent(node);
if(str == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* usual trick: decode into the same buffer */
ret = xmlSecBase64Decode(str, (xmlSecByte*)str, xmlStrlen(str));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBase64Decode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(str);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBase64Decode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(str);
+ return(-1);
}
len = ret;
/* check do we have a key already */
data = xmlSecKeyGetValue(key);
if(data != NULL) {
- xmlSecBufferPtr buffer;
-
- if(!xmlSecKeyDataCheckId(data, id)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(str);
- return(-1);
- }
-
- buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
- if((buffer != NULL) && ((xmlSecSize)xmlSecBufferGetSize(buffer) != len)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST,
- "cur-data-size=%d;new-data-size=%d",
- xmlSecBufferGetSize(buffer), len);
- xmlFree(str);
- return(-1);
- }
- if((buffer != NULL) && (len > 0) && (memcmp(xmlSecBufferGetData(buffer), str, len) != 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST,
- "key already has a different value");
- xmlFree(str);
- return(-1);
- }
- if(buffer != NULL) {
- /* we already have exactly the same key */
- xmlFree(str);
- return(0);
- }
-
- /* we have binary key value with empty buffer */
+ xmlSecBufferPtr buffer;
+
+ if(!xmlSecKeyDataCheckId(data, id)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(str);
+ return(-1);
+ }
+
+ buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
+ if((buffer != NULL) && ((xmlSecSize)xmlSecBufferGetSize(buffer) != len)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST,
+ "cur-data-size=%d;new-data-size=%d",
+ xmlSecBufferGetSize(buffer), len);
+ xmlFree(str);
+ return(-1);
+ }
+ if((buffer != NULL) && (len > 0) && (memcmp(xmlSecBufferGetData(buffer), str, len) != 0)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST,
+ "key already has a different value");
+ xmlFree(str);
+ return(-1);
+ }
+ if(buffer != NULL) {
+ /* we already have exactly the same key */
+ xmlFree(str);
+ return(0);
+ }
+
+ /* we have binary key value with empty buffer */
}
data = xmlSecKeyDataCreate(id);
if(data == NULL ) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(str);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(str);
+ return(-1);
}
ret = xmlSecKeyDataBinaryValueSetBuffer(data, (xmlSecByte*)str, len);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyDataBinaryValueSetBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", len);
- xmlSecKeyDataDestroy(data);
- xmlFree(str);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyDataBinaryValueSetBuffer",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", len);
+ xmlSecKeyDataDestroy(data);
+ xmlFree(str);
+ return(-1);
}
xmlFree(str);
if(xmlSecKeyReqMatchKeyValue(&(keyInfoCtx->keyReq), data) != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyReqMatchKeyValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(data);
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyReqMatchKeyValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(data);
+ return(0);
}
ret = xmlSecKeySetValue(key, data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(data);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(data);
+ return(-1);
}
return(0);
@@ -728,10 +728,10 @@ xmlSecKeyDataBinaryValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
/**
* xmlSecKeyDataBinaryValueXmlWrite:
- * @id: the data klass.
- * @key: the pointer to source key.
- * @node: the pointer to an XML node.
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
+ * @id: the data klass.
+ * @key: the pointer to source key.
+ * @node: the pointer to an XML node.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
*
* Base64 encodes binary key data of klass @id from the @key and
* sets to the @node content.
@@ -740,7 +740,7 @@ xmlSecKeyDataBinaryValueXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
*/
int
xmlSecKeyDataBinaryValueXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecBufferPtr buffer;
xmlSecKeyDataPtr value;
xmlChar* str;
@@ -751,8 +751,8 @@ xmlSecKeyDataBinaryValueXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
xmlSecAssert2(keyInfoCtx != NULL, -1);
if((xmlSecKeyDataTypeSymmetric & keyInfoCtx->keyReq.keyType) == 0) {
- /* we can have only symmetric key */
- return(0);
+ /* we can have only symmetric key */
+ return(0);
}
value = xmlSecKeyGetValue(key);
@@ -762,15 +762,15 @@ xmlSecKeyDataBinaryValueXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
xmlSecAssert2(buffer != NULL, -1);
str = xmlSecBase64Encode(xmlSecBufferGetData(buffer),
- xmlSecBufferGetSize(buffer),
- keyInfoCtx->base64LineSize);
+ xmlSecBufferGetSize(buffer),
+ keyInfoCtx->base64LineSize);
if(str == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBase64Encode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBase64Encode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
xmlNodeSetContent(node, str);
xmlFree(str);
@@ -779,11 +779,11 @@ xmlSecKeyDataBinaryValueXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
/**
* xmlSecKeyDataBinaryValueBinRead:
- * @id: the data klass.
- * @key: the pointer to destination key.
- * @buf: the source binary buffer.
- * @bufSize: the source binary buffer size.
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
+ * @id: the data klass.
+ * @key: the pointer to destination key.
+ * @buf: the source binary buffer.
+ * @bufSize: the source binary buffer size.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
*
* Reads binary key data of the klass @id from @buf to the @key.
*
@@ -791,8 +791,8 @@ xmlSecKeyDataBinaryValueXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
*/
int
xmlSecKeyDataBinaryValueBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- const xmlSecByte* buf, xmlSecSize bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ const xmlSecByte* buf, xmlSecSize bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyDataPtr data;
int ret;
@@ -805,83 +805,83 @@ xmlSecKeyDataBinaryValueBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
/* check do we have a key already */
data = xmlSecKeyGetValue(key);
if(data != NULL) {
- xmlSecBufferPtr buffer;
-
- if(!xmlSecKeyDataCheckId(data, id)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
- if((buffer != NULL) && ((xmlSecSize)xmlSecBufferGetSize(buffer) != bufSize)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST,
- "cur-data-size=%d;new-data-size=%d",
- xmlSecBufferGetSize(buffer), bufSize);
- return(-1);
- }
- if((buffer != NULL) && (bufSize > 0) && (memcmp(xmlSecBufferGetData(buffer), buf, bufSize) != 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST,
- "key already has a different value");
- return(-1);
- }
- if(buffer != NULL) {
- /* we already have exactly the same key */
- return(0);
- }
-
- /* we have binary key value with empty buffer */
+ xmlSecBufferPtr buffer;
+
+ if(!xmlSecKeyDataCheckId(data, id)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ buffer = xmlSecKeyDataBinaryValueGetBuffer(data);
+ if((buffer != NULL) && ((xmlSecSize)xmlSecBufferGetSize(buffer) != bufSize)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST,
+ "cur-data-size=%d;new-data-size=%d",
+ xmlSecBufferGetSize(buffer), bufSize);
+ return(-1);
+ }
+ if((buffer != NULL) && (bufSize > 0) && (memcmp(xmlSecBufferGetData(buffer), buf, bufSize) != 0)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ XMLSEC_ERRORS_R_KEY_DATA_ALREADY_EXIST,
+ "key already has a different value");
+ return(-1);
+ }
+ if(buffer != NULL) {
+ /* we already have exactly the same key */
+ return(0);
+ }
+
+ /* we have binary key value with empty buffer */
}
data = xmlSecKeyDataCreate(id);
if(data == NULL ) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecKeyDataBinaryValueSetBuffer(data, buf, bufSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyDataBinaryValueSetBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", bufSize);
- xmlSecKeyDataDestroy(data);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyDataBinaryValueSetBuffer",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", bufSize);
+ xmlSecKeyDataDestroy(data);
+ return(-1);
}
if(xmlSecKeyReqMatchKeyValue(&(keyInfoCtx->keyReq), data) != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyReqMatchKeyValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(data);
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyReqMatchKeyValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(data);
+ return(0);
}
ret = xmlSecKeySetValue(key, data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(data);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(data);
+ return(-1);
}
return(0);
@@ -889,11 +889,11 @@ xmlSecKeyDataBinaryValueBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
/**
* xmlSecKeyDataBinaryValueBinWrite:
- * @id: the data klass.
- * @key: the pointer to source key.
- * @buf: the destination binary buffer.
- * @bufSize: the destination binary buffer size.
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
+ * @id: the data klass.
+ * @key: the pointer to source key.
+ * @buf: the destination binary buffer.
+ * @bufSize: the destination binary buffer size.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
*
* Writes binary key data of klass @id from the @key to @buf.
*
@@ -901,8 +901,8 @@ xmlSecKeyDataBinaryValueBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
*/
int
xmlSecKeyDataBinaryValueBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlSecByte** buf, xmlSecSize* bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlSecByte** buf, xmlSecSize* bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyDataPtr value;
xmlSecBufferPtr buffer;
@@ -913,8 +913,8 @@ xmlSecKeyDataBinaryValueBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
xmlSecAssert2(keyInfoCtx != NULL, -1);
if((xmlSecKeyDataTypeSymmetric & keyInfoCtx->keyReq.keyType) == 0) {
- /* we can have only symmetric key */
- return(0);
+ /* we can have only symmetric key */
+ return(0);
}
value = xmlSecKeyGetValue(key);
@@ -926,12 +926,12 @@ xmlSecKeyDataBinaryValueBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
(*bufSize) = xmlSecBufferGetSize(buffer);
(*buf) = (xmlSecByte*) xmlMalloc((*bufSize));
if((*buf) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
memcpy((*buf), xmlSecBufferGetData(buffer), (*bufSize));
return(0);
@@ -939,8 +939,8 @@ xmlSecKeyDataBinaryValueBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
/**
* xmlSecKeyDataBinaryValueDebugDump:
- * @data: the pointer to binary key data.
- * @output: the pointer to output FILE.
+ * @data: the pointer to binary key data.
+ * @output: the pointer to output FILE.
*
* Prints binary key data debug information to @output.
*/
@@ -958,13 +958,13 @@ xmlSecKeyDataBinaryValueDebugDump(xmlSecKeyDataPtr data, FILE* output) {
/* print only size, everything else is sensitive */
fprintf(output, "=== %s: size=%d\n", data->id->dataNodeName,
- xmlSecKeyDataGetSize(data));
+ xmlSecKeyDataGetSize(data));
}
/**
* xmlSecKeyDataBinaryValueDebugXmlDump:
- * @data: the pointer to binary key data.
- * @output: the pointer to output FILE.
+ * @data: the pointer to binary key data.
+ * @output: the pointer to output FILE.
*
* Prints binary key data debug information to @output in XML format.
*/
@@ -982,12 +982,12 @@ xmlSecKeyDataBinaryValueDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
/* print only size, everything else is sensitive */
fprintf(output, "<%s size=\"%d\" />\n", data->id->dataNodeName,
- xmlSecKeyDataGetSize(data));
+ xmlSecKeyDataGetSize(data));
}
/**
* xmlSecKeyDataBinaryValueGetSize:
- * @data: the pointer to binary key data.
+ * @data: the pointer to binary key data.
*
* Gets the binary key data size.
*
@@ -1009,7 +1009,7 @@ xmlSecKeyDataBinaryValueGetSize(xmlSecKeyDataPtr data) {
/**
* xmlSecKeyDataBinaryValueGetBuffer:
- * @data: the pointer to binary key data.
+ * @data: the pointer to binary key data.
*
* Gets the binary key data buffer.
*
@@ -1026,9 +1026,9 @@ xmlSecKeyDataBinaryValueGetBuffer(xmlSecKeyDataPtr data) {
/**
* xmlSecKeyDataBinaryValueSetBuffer:
- * @data: the pointer to binary key data.
- * @buf: the pointer to binary buffer.
- * @bufSize: the binary buffer size.
+ * @data: the pointer to binary key data.
+ * @buf: the pointer to binary buffer.
+ * @bufSize: the binary buffer size.
*
* Sets the value of @data to @buf.
*
@@ -1036,7 +1036,7 @@ xmlSecKeyDataBinaryValueGetBuffer(xmlSecKeyDataPtr data) {
*/
int
xmlSecKeyDataBinaryValueSetBuffer(xmlSecKeyDataPtr data,
- const xmlSecByte* buf, xmlSecSize bufSize) {
+ const xmlSecByte* buf, xmlSecSize bufSize) {
xmlSecBufferPtr buffer;
xmlSecAssert2(xmlSecKeyDataIsValid(data), -1);
@@ -1057,10 +1057,10 @@ xmlSecKeyDataBinaryValueSetBuffer(xmlSecKeyDataPtr data,
**********************************************************************/
static xmlSecPtrListKlass xmlSecKeyDataListKlass = {
BAD_CAST "key-data-list",
- (xmlSecPtrDuplicateItemMethod)xmlSecKeyDataDuplicate, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
- (xmlSecPtrDestroyItemMethod)xmlSecKeyDataDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */
- (xmlSecPtrDebugDumpItemMethod)xmlSecKeyDataDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
- (xmlSecPtrDebugDumpItemMethod)xmlSecKeyDataDebugXmlDump, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
+ (xmlSecPtrDuplicateItemMethod)xmlSecKeyDataDuplicate, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
+ (xmlSecPtrDestroyItemMethod)xmlSecKeyDataDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */
+ (xmlSecPtrDebugDumpItemMethod)xmlSecKeyDataDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
+ (xmlSecPtrDebugDumpItemMethod)xmlSecKeyDataDebugXmlDump, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
};
/**
@@ -1083,10 +1083,10 @@ xmlSecKeyDataListGetKlass(void) {
**********************************************************************/
static xmlSecPtrListKlass xmlSecKeyDataIdListKlass = {
BAD_CAST "key-data-ids-list",
- NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
- NULL, /* xmlSecPtrDestroyItemMethod destroyItem; */
- NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
- NULL, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
+ NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
+ NULL, /* xmlSecPtrDestroyItemMethod destroyItem; */
+ NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
+ NULL, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
};
/**
@@ -1103,8 +1103,8 @@ xmlSecKeyDataIdListGetKlass(void) {
/**
* xmlSecKeyDataIdListFind:
- * @list: the pointer to key data ids list.
- * @dataId: the key data klass.
+ * @list: the pointer to key data ids list.
+ * @dataId: the key data klass.
*
* Lookups @dataId in @list.
*
@@ -1120,28 +1120,28 @@ xmlSecKeyDataIdListFind(xmlSecPtrListPtr list, xmlSecKeyDataId dataId) {
size = xmlSecPtrListGetSize(list);
for(i = 0; i < size; ++i) {
- if((xmlSecKeyDataId)xmlSecPtrListGetItem(list, i) == dataId) {
- return(1);
- }
+ if((xmlSecKeyDataId)xmlSecPtrListGetItem(list, i) == dataId) {
+ return(1);
+ }
}
return(0);
}
/**
* xmlSecKeyDataIdListFindByNode:
- * @list: the pointer to key data ids list.
- * @nodeName: the desired key data klass XML node name.
- * @nodeNs: the desired key data klass XML node namespace.
- * @usage: the desired key data usage.
+ * @list: the pointer to key data ids list.
+ * @nodeName: the desired key data klass XML node name.
+ * @nodeNs: the desired key data klass XML node namespace.
+ * @usage: the desired key data usage.
*
* Lookups data klass in the list with given @nodeName, @nodeNs and
* @usage in the @list.
*
* Returns: key data klass is found and NULL otherwise.
*/
-xmlSecKeyDataId
+xmlSecKeyDataId
xmlSecKeyDataIdListFindByNode(xmlSecPtrListPtr list, const xmlChar* nodeName,
- const xmlChar* nodeNs, xmlSecKeyDataUsage usage) {
+ const xmlChar* nodeNs, xmlSecKeyDataUsage usage) {
xmlSecKeyDataId dataId;
xmlSecSize i, size;
@@ -1150,32 +1150,32 @@ xmlSecKeyDataIdListFindByNode(xmlSecPtrListPtr list, const xmlChar* nodeName,
size = xmlSecPtrListGetSize(list);
for(i = 0; i < size; ++i) {
- dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(list, i);
- xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, xmlSecKeyDataIdUnknown);
-
- if(((usage & dataId->usage) != 0) &&
- xmlStrEqual(nodeName, dataId->dataNodeName) &&
- xmlStrEqual(nodeNs, dataId->dataNodeNs)) {
-
- return(dataId);
- }
+ dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(list, i);
+ xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, xmlSecKeyDataIdUnknown);
+
+ if(((usage & dataId->usage) != 0) &&
+ xmlStrEqual(nodeName, dataId->dataNodeName) &&
+ xmlStrEqual(nodeNs, dataId->dataNodeNs)) {
+
+ return(dataId);
+ }
}
return(xmlSecKeyDataIdUnknown);
}
/**
* xmlSecKeyDataIdListFindByHref:
- * @list: the pointer to key data ids list.
- * @href: the desired key data klass href.
- * @usage: the desired key data usage.
+ * @list: the pointer to key data ids list.
+ * @href: the desired key data klass href.
+ * @usage: the desired key data usage.
*
* Lookups data klass in the list with given @href and @usage in @list.
*
* Returns: key data klass is found and NULL otherwise.
*/
-xmlSecKeyDataId
+xmlSecKeyDataId
xmlSecKeyDataIdListFindByHref(xmlSecPtrListPtr list, const xmlChar* href,
- xmlSecKeyDataUsage usage) {
+ xmlSecKeyDataUsage usage) {
xmlSecKeyDataId dataId;
xmlSecSize i, size;
@@ -1184,31 +1184,31 @@ xmlSecKeyDataIdListFindByHref(xmlSecPtrListPtr list, const xmlChar* href,
size = xmlSecPtrListGetSize(list);
for(i = 0; i < size; ++i) {
- dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(list, i);
- xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, xmlSecKeyDataIdUnknown);
-
- if(((usage & dataId->usage) != 0) && (dataId->href != NULL) &&
- xmlStrEqual(href, dataId->href)) {
-
- return(dataId);
- }
+ dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(list, i);
+ xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, xmlSecKeyDataIdUnknown);
+
+ if(((usage & dataId->usage) != 0) && (dataId->href != NULL) &&
+ xmlStrEqual(href, dataId->href)) {
+
+ return(dataId);
+ }
}
return(xmlSecKeyDataIdUnknown);
}
/**
* xmlSecKeyDataIdListFindByName:
- * @list: the pointer to key data ids list.
- * @name: the desired key data klass name.
- * @usage: the desired key data usage.
+ * @list: the pointer to key data ids list.
+ * @name: the desired key data klass name.
+ * @usage: the desired key data usage.
*
* Lookups data klass in the list with given @name and @usage in @list.
*
* Returns: key data klass is found and NULL otherwise.
*/
-xmlSecKeyDataId
+xmlSecKeyDataId
xmlSecKeyDataIdListFindByName(xmlSecPtrListPtr list, const xmlChar* name,
- xmlSecKeyDataUsage usage) {
+ xmlSecKeyDataUsage usage) {
xmlSecKeyDataId dataId;
xmlSecSize i, size;
@@ -1217,22 +1217,22 @@ xmlSecKeyDataIdListFindByName(xmlSecPtrListPtr list, const xmlChar* name,
size = xmlSecPtrListGetSize(list);
for(i = 0; i < size; ++i) {
- dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(list, i);
- xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, xmlSecKeyDataIdUnknown);
-
- if(((usage & dataId->usage) != 0) && (dataId->name != NULL) &&
- xmlStrEqual(name, BAD_CAST dataId->name)) {
-
- return(dataId);
- }
+ dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(list, i);
+ xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, xmlSecKeyDataIdUnknown);
+
+ if(((usage & dataId->usage) != 0) && (dataId->name != NULL) &&
+ xmlStrEqual(name, BAD_CAST dataId->name)) {
+
+ return(dataId);
+ }
}
return(xmlSecKeyDataIdUnknown);
}
/**
* xmlSecKeyDataIdListDebugDump:
- * @list: the pointer to key data ids list.
- * @output: the pointer to output FILE.
+ * @list: the pointer to key data ids list.
+ * @output: the pointer to output FILE.
*
* Prints binary key data debug information to @output.
*/
@@ -1246,23 +1246,23 @@ xmlSecKeyDataIdListDebugDump(xmlSecPtrListPtr list, FILE* output) {
size = xmlSecPtrListGetSize(list);
for(i = 0; i < size; ++i) {
- dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(list, i);
- xmlSecAssert(dataId != NULL);
- xmlSecAssert(dataId->name != NULL);
-
- if(i > 0) {
- fprintf(output, ",\"%s\"", dataId->name);
- } else {
- fprintf(output, "\"%s\"", dataId->name);
- }
+ dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(list, i);
+ xmlSecAssert(dataId != NULL);
+ xmlSecAssert(dataId->name != NULL);
+
+ if(i > 0) {
+ fprintf(output, ",\"%s\"", dataId->name);
+ } else {
+ fprintf(output, "\"%s\"", dataId->name);
+ }
}
fprintf(output, "\n");
}
/**
* xmlSecKeyDataIdListDebugXmlDump:
- * @list: the pointer to key data ids list.
- * @output: the pointer to output FILE.
+ * @list: the pointer to key data ids list.
+ * @output: the pointer to output FILE.
*
* Prints binary key data debug information to @output in XML format.
*/
@@ -1277,11 +1277,11 @@ xmlSecKeyDataIdListDebugXmlDump(xmlSecPtrListPtr list, FILE* output) {
fprintf(output, "<KeyDataIdsList>\n");
size = xmlSecPtrListGetSize(list);
for(i = 0; i < size; ++i) {
- dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(list, i);
- xmlSecAssert(dataId != NULL);
- xmlSecAssert(dataId->name != NULL);
-
- fprintf(output, "<DataId name=\"");
+ dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(list, i);
+ xmlSecAssert(dataId != NULL);
+ xmlSecAssert(dataId->name != NULL);
+
+ fprintf(output, "<DataId name=\"");
xmlSecPrintXmlString(output, dataId->name);
fprintf(output, "\"/>");
}
@@ -1295,7 +1295,7 @@ xmlSecKeyDataIdListDebugXmlDump(xmlSecPtrListPtr list, FILE* output) {
*************************************************************************/
/**
* xmlSecKeyDataStoreCreate:
- * @id: the store id.
+ * @id: the store id.
*
* Creates new key data store of the specified klass @id. Caller is responsible
* for freeng returned object with #xmlSecKeyDataStoreDestroy function.
@@ -1303,7 +1303,7 @@ xmlSecKeyDataIdListDebugXmlDump(xmlSecPtrListPtr list, FILE* output) {
* Returns: the pointer to newly allocated key data store structure
* or NULL if an error occurs.
*/
-xmlSecKeyDataStorePtr
+xmlSecKeyDataStorePtr
xmlSecKeyDataStoreCreate(xmlSecKeyDataStoreId id) {
xmlSecKeyDataStorePtr store;
int ret;
@@ -1314,27 +1314,27 @@ xmlSecKeyDataStoreCreate(xmlSecKeyDataStoreId id) {
/* Allocate a new xmlSecKeyDataStore and fill the fields. */
store = (xmlSecKeyDataStorePtr)xmlMalloc(id->objSize);
if(store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreKlassGetName(id)),
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "size=%d", id->objSize);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreKlassGetName(id)),
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "size=%d", id->objSize);
+ return(NULL);
}
memset(store, 0, id->objSize);
store->id = id;
if(id->initialize != NULL) {
- ret = (id->initialize)(store);
+ ret = (id->initialize)(store);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreKlassGetName(id)),
- "id->initialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataStoreDestroy(store);
- return(NULL);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreKlassGetName(id)),
+ "id->initialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataStoreDestroy(store);
+ return(NULL);
+ }
}
return(store);
@@ -1342,7 +1342,7 @@ xmlSecKeyDataStoreCreate(xmlSecKeyDataStoreId id) {
/**
* xmlSecKeyDataStoreDestroy:
- * @store: the pointer to the key data store..
+ * @store: the pointer to the key data store..
*
* Destroys the key data store created with #xmlSecKeyDataStoreCreate
* function.
@@ -1366,10 +1366,10 @@ xmlSecKeyDataStoreDestroy(xmlSecKeyDataStorePtr store) {
**********************************************************************/
static xmlSecPtrListKlass xmlSecKeyDataStorePtrListKlass = {
BAD_CAST "keys-data-store-list",
- NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
- (xmlSecPtrDestroyItemMethod)xmlSecKeyDataStoreDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */
- NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
- NULL, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
+ NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
+ (xmlSecPtrDestroyItemMethod)xmlSecKeyDataStoreDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */
+ NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
+ NULL, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
};
/**
diff --git a/src/keysmngr.c b/src/keysmngr.c
index e93cbb4..6d79b71 100644
--- a/src/keysmngr.c
+++ b/src/keysmngr.c
@@ -48,24 +48,24 @@ xmlSecKeysMngrCreate(void) {
/* Allocate a new xmlSecKeysMngr and fill the fields. */
mngr = (xmlSecKeysMngrPtr)xmlMalloc(sizeof(xmlSecKeysMngr));
if(mngr == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "sizeof(xmlSecKeysMngr)=%d",
- sizeof(xmlSecKeysMngr));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "sizeof(xmlSecKeysMngr)=%d",
+ sizeof(xmlSecKeysMngr));
+ return(NULL);
}
memset(mngr, 0, sizeof(xmlSecKeysMngr));
ret = xmlSecPtrListInitialize(&(mngr->storesList), xmlSecKeyDataStorePtrListId);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecKeyDataStorePtrListId");
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecKeyDataStorePtrListId");
+ return(NULL);
}
return(mngr);
@@ -73,7 +73,7 @@ xmlSecKeysMngrCreate(void) {
/**
* xmlSecKeysMngrDestroy:
- * @mngr: the pointer to keys manager.
+ * @mngr: the pointer to keys manager.
*
* Destroys keys manager created with #xmlSecKeysMngrCreate function.
*/
@@ -83,7 +83,7 @@ xmlSecKeysMngrDestroy(xmlSecKeysMngrPtr mngr) {
/* destroy keys store */
if(mngr->keysStore != NULL) {
- xmlSecKeyStoreDestroy(mngr->keysStore);
+ xmlSecKeyStoreDestroy(mngr->keysStore);
}
/* destroy other data stores */
@@ -95,9 +95,9 @@ xmlSecKeysMngrDestroy(xmlSecKeysMngrPtr mngr) {
/**
* xmlSecKeysMngrFindKey:
- * @mngr: the pointer to keys manager.
- * @name: the desired key name.
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> node processing context.
+ * @mngr: the pointer to keys manager.
+ * @name: the desired key name.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> node processing context.
*
* Lookups key in the keys manager keys store. The caller is responsible
* for destroying the returned key using #xmlSecKeyDestroy method.
@@ -113,8 +113,8 @@ xmlSecKeysMngrFindKey(xmlSecKeysMngrPtr mngr, const xmlChar* name, xmlSecKeyInfo
store = xmlSecKeysMngrGetKeysStore(mngr);
if(store == NULL) {
- /* no store. is it an error? */
- return(NULL);
+ /* no store. is it an error? */
+ return(NULL);
}
return(xmlSecKeyStoreFindKey(store, name, keyInfoCtx));
@@ -122,8 +122,8 @@ xmlSecKeysMngrFindKey(xmlSecKeysMngrPtr mngr, const xmlChar* name, xmlSecKeyInfo
/**
* xmlSecKeysMngrAdoptKeysStore:
- * @mngr: the pointer to keys manager.
- * @store: the pointer to keys store.
+ * @mngr: the pointer to keys manager.
+ * @store: the pointer to keys store.
*
* Adopts keys store in the keys manager @mngr.
*
@@ -135,7 +135,7 @@ xmlSecKeysMngrAdoptKeysStore(xmlSecKeysMngrPtr mngr, xmlSecKeyStorePtr store) {
xmlSecAssert2(xmlSecKeyStoreIsValid(store), -1);
if(mngr->keysStore != NULL) {
- xmlSecKeyStoreDestroy(mngr->keysStore);
+ xmlSecKeyStoreDestroy(mngr->keysStore);
}
mngr->keysStore = store;
@@ -144,7 +144,7 @@ xmlSecKeysMngrAdoptKeysStore(xmlSecKeysMngrPtr mngr, xmlSecKeyStorePtr store) {
/**
* xmlSecKeysMngrGetKeysStore:
- * @mngr: the pointer to keys manager.
+ * @mngr: the pointer to keys manager.
*
* Gets the keys store.
*
@@ -160,8 +160,8 @@ xmlSecKeysMngrGetKeysStore(xmlSecKeysMngrPtr mngr) {
/**
* xmlSecKeysMngrAdoptDataStore:
- * @mngr: the pointer to keys manager.
- * @store: the pointer to data store.
+ * @mngr: the pointer to keys manager.
+ * @store: the pointer to data store.
*
* Adopts data store in the keys manager.
*
@@ -177,10 +177,10 @@ xmlSecKeysMngrAdoptDataStore(xmlSecKeysMngrPtr mngr, xmlSecKeyDataStorePtr store
size = xmlSecPtrListGetSize(&(mngr->storesList));
for(pos = 0; pos < size; ++pos) {
- tmp = (xmlSecKeyDataStorePtr)xmlSecPtrListGetItem(&(mngr->storesList), pos);
- if((tmp != NULL) && (tmp->id == store->id)) {
- return(xmlSecPtrListSet(&(mngr->storesList), store, pos));
- }
+ tmp = (xmlSecKeyDataStorePtr)xmlSecPtrListGetItem(&(mngr->storesList), pos);
+ if((tmp != NULL) && (tmp->id == store->id)) {
+ return(xmlSecPtrListSet(&(mngr->storesList), store, pos));
+ }
}
return(xmlSecPtrListAdd(&(mngr->storesList), store));
@@ -189,8 +189,8 @@ xmlSecKeysMngrAdoptDataStore(xmlSecKeysMngrPtr mngr, xmlSecKeyDataStorePtr store
/**
* xmlSecKeysMngrGetDataStore:
- * @mngr: the pointer to keys manager.
- * @id: the desired data store klass.
+ * @mngr: the pointer to keys manager.
+ * @id: the desired data store klass.
*
* Lookups the data store of given klass @id in the keys manager.
*
@@ -207,10 +207,10 @@ xmlSecKeysMngrGetDataStore(xmlSecKeysMngrPtr mngr, xmlSecKeyDataStoreId id) {
size = xmlSecPtrListGetSize(&(mngr->storesList));
for(pos = 0; pos < size; ++pos) {
- tmp = (xmlSecKeyDataStorePtr)xmlSecPtrListGetItem(&(mngr->storesList), pos);
- if((tmp != NULL) && (tmp->id == id)) {
- return(tmp);
- }
+ tmp = (xmlSecKeyDataStorePtr)xmlSecPtrListGetItem(&(mngr->storesList), pos);
+ if((tmp != NULL) && (tmp->id == id)) {
+ return(tmp);
+ }
}
return(NULL);
@@ -223,14 +223,14 @@ xmlSecKeysMngrGetDataStore(xmlSecKeysMngrPtr mngr, xmlSecKeyDataStoreId id) {
*************************************************************************/
/**
* xmlSecKeyStoreCreate:
- * @id: the key store klass.
+ * @id: the key store klass.
*
* Creates new store of the specified klass @klass. Caller is responsible
* for freeing the returned store by calling #xmlSecKeyStoreDestroy function.
*
* Returns: the pointer to newly allocated keys store or NULL if an error occurs.
*/
-xmlSecKeyStorePtr
+xmlSecKeyStorePtr
xmlSecKeyStoreCreate(xmlSecKeyStoreId id) {
xmlSecKeyStorePtr store;
int ret;
@@ -241,27 +241,27 @@ xmlSecKeyStoreCreate(xmlSecKeyStoreId id) {
/* Allocate a new xmlSecKeyStore and fill the fields. */
store = (xmlSecKeyStorePtr)xmlMalloc(id->objSize);
if(store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreKlassGetName(id)),
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "size=%d", id->objSize);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreKlassGetName(id)),
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "size=%d", id->objSize);
+ return(NULL);
}
memset(store, 0, id->objSize);
store->id = id;
if(id->initialize != NULL) {
- ret = (id->initialize)(store);
+ ret = (id->initialize)(store);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreKlassGetName(id)),
- "id->initialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyStoreDestroy(store);
- return(NULL);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreKlassGetName(id)),
+ "id->initialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyStoreDestroy(store);
+ return(NULL);
+ }
}
return(store);
@@ -269,7 +269,7 @@ xmlSecKeyStoreCreate(xmlSecKeyStoreId id) {
/**
* xmlSecKeyStoreDestroy:
- * @store: the pointer to keys store.
+ * @store: the pointer to keys store.
*
* Destroys the store created with #xmlSecKeyStoreCreate function.
*/
@@ -287,9 +287,9 @@ xmlSecKeyStoreDestroy(xmlSecKeyStorePtr store) {
/**
* xmlSecKeyStoreFindKey:
- * @store: the pointer to keys store.
- * @name: the desired key name.
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> node processing context.
+ * @store: the pointer to keys store.
+ * @name: the desired key name.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> node processing context.
*
* Lookups key in the store. The caller is responsible for destroying
* the returned key using #xmlSecKeyDestroy method.
@@ -313,33 +313,33 @@ xmlSecKeyStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name, xmlSecKeyInf
*
***************************************************************************/
#define xmlSecSimpleKeysStoreSize \
- (sizeof(xmlSecKeyStore) + sizeof(xmlSecPtrList))
+ (sizeof(xmlSecKeyStore) + sizeof(xmlSecPtrList))
#define xmlSecSimpleKeysStoreGetList(store) \
((xmlSecKeyStoreCheckSize((store), xmlSecSimpleKeysStoreSize)) ? \
- (xmlSecPtrListPtr)(((xmlSecByte*)(store)) + sizeof(xmlSecKeyStore)) : \
- (xmlSecPtrListPtr)NULL)
+ (xmlSecPtrListPtr)(((xmlSecByte*)(store)) + sizeof(xmlSecKeyStore)) : \
+ (xmlSecPtrListPtr)NULL)
-static int xmlSecSimpleKeysStoreInitialize (xmlSecKeyStorePtr store);
-static void xmlSecSimpleKeysStoreFinalize (xmlSecKeyStorePtr store);
-static xmlSecKeyPtr xmlSecSimpleKeysStoreFindKey (xmlSecKeyStorePtr store,
- const xmlChar* name,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecSimpleKeysStoreInitialize (xmlSecKeyStorePtr store);
+static void xmlSecSimpleKeysStoreFinalize (xmlSecKeyStorePtr store);
+static xmlSecKeyPtr xmlSecSimpleKeysStoreFindKey (xmlSecKeyStorePtr store,
+ const xmlChar* name,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
static xmlSecKeyStoreKlass xmlSecSimpleKeysStoreKlass = {
sizeof(xmlSecKeyStoreKlass),
xmlSecSimpleKeysStoreSize,
/* data */
- BAD_CAST "simple-keys-store", /* const xmlChar* name; */
+ BAD_CAST "simple-keys-store", /* const xmlChar* name; */
/* constructors/destructor */
- xmlSecSimpleKeysStoreInitialize, /* xmlSecKeyStoreInitializeMethod initialize; */
- xmlSecSimpleKeysStoreFinalize, /* xmlSecKeyStoreFinalizeMethod finalize; */
- xmlSecSimpleKeysStoreFindKey, /* xmlSecKeyStoreFindKeyMethod findKey; */
+ xmlSecSimpleKeysStoreInitialize, /* xmlSecKeyStoreInitializeMethod initialize; */
+ xmlSecSimpleKeysStoreFinalize, /* xmlSecKeyStoreFinalizeMethod finalize; */
+ xmlSecSimpleKeysStoreFindKey, /* xmlSecKeyStoreFindKeyMethod findKey; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -356,8 +356,8 @@ xmlSecSimpleKeysStoreGetKlass(void) {
/**
* xmlSecSimpleKeysStoreAdoptKey:
- * @store: the pointer to simple keys store.
- * @key: the pointer to key.
+ * @store: the pointer to simple keys store.
+ * @key: the pointer to key.
*
* Adds @key to the @store.
*
@@ -376,12 +376,12 @@ xmlSecSimpleKeysStoreAdoptKey(xmlSecKeyStorePtr store, xmlSecKeyPtr key) {
ret = xmlSecPtrListAdd(list, key);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -389,9 +389,9 @@ xmlSecSimpleKeysStoreAdoptKey(xmlSecKeyStorePtr store, xmlSecKeyPtr key) {
/**
* xmlSecSimpleKeysStoreLoad:
- * @store: the pointer to simple keys store.
- * @uri: the filename.
- * @keysMngr: the pointer to associated keys manager.
+ * @store: the pointer to simple keys store.
+ * @uri: the filename.
+ * @keysMngr: the pointer to associated keys manager.
*
* Reads keys from an XML file.
*
@@ -399,7 +399,7 @@ xmlSecSimpleKeysStoreAdoptKey(xmlSecKeyStorePtr store, xmlSecKeyPtr key) {
*/
int
xmlSecSimpleKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
- xmlSecKeysMngrPtr keysMngr) {
+ xmlSecKeysMngrPtr keysMngr) {
xmlDocPtr doc;
xmlNodePtr root;
xmlNodePtr cur;
@@ -412,101 +412,101 @@ xmlSecSimpleKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
doc = xmlParseFile(uri);
if(doc == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlParseFile",
- XMLSEC_ERRORS_R_XML_FAILED,
- "uri=%s",
- xmlSecErrorsSafeString(uri));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlParseFile",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "uri=%s",
+ xmlSecErrorsSafeString(uri));
+ return(-1);
}
root = xmlDocGetRootElement(doc);
if(!xmlSecCheckNodeName(root, BAD_CAST "Keys", xmlSecNs)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(root)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "expected-node=<xmlsec:Keys>");
- xmlFreeDoc(doc);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(root)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "expected-node=<xmlsec:Keys>");
+ xmlFreeDoc(doc);
+ return(-1);
}
cur = xmlSecGetNextElementNode(root->children);
while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeKeyInfo, xmlSecDSigNs)) {
- key = xmlSecKeyCreate();
- if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "expected-node=%s",
- xmlSecErrorsSafeString(xmlSecNodeKeyInfo));
- xmlFreeDoc(doc);
- return(-1);
- }
-
- ret = xmlSecKeyInfoCtxInitialize(&keyInfoCtx, NULL);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecKeyInfoCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(key);
- xmlFreeDoc(doc);
- return(-1);
- }
-
- keyInfoCtx.mode = xmlSecKeyInfoModeRead;
- keyInfoCtx.keysMngr = keysMngr;
- keyInfoCtx.flags = XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND |
- XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS;
- keyInfoCtx.keyReq.keyId = xmlSecKeyDataIdUnknown;
- keyInfoCtx.keyReq.keyType = xmlSecKeyDataTypeAny;
- keyInfoCtx.keyReq.keyUsage= xmlSecKeyDataUsageAny;
-
- ret = xmlSecKeyInfoNodeRead(cur, key, &keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecKeyInfoNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
- xmlSecKeyDestroy(key);
- xmlFreeDoc(doc);
- return(-1);
- }
- xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
-
- if(xmlSecKeyIsValid(key)) {
- ret = xmlSecSimpleKeysStoreAdoptKey(store, key);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecSimpleKeysStoreAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(key);
- xmlFreeDoc(doc);
- return(-1);
- }
- } else {
- /* we have an unknown key in our file, just ignore it */
- xmlSecKeyDestroy(key);
- }
+ key = xmlSecKeyCreate();
+ if(key == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "expected-node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeKeyInfo));
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+
+ ret = xmlSecKeyInfoCtxInitialize(&keyInfoCtx, NULL);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecKeyInfoCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(key);
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+
+ keyInfoCtx.mode = xmlSecKeyInfoModeRead;
+ keyInfoCtx.keysMngr = keysMngr;
+ keyInfoCtx.flags = XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND |
+ XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS;
+ keyInfoCtx.keyReq.keyId = xmlSecKeyDataIdUnknown;
+ keyInfoCtx.keyReq.keyType = xmlSecKeyDataTypeAny;
+ keyInfoCtx.keyReq.keyUsage= xmlSecKeyDataUsageAny;
+
+ ret = xmlSecKeyInfoNodeRead(cur, key, &keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecKeyInfoNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
+ xmlSecKeyDestroy(key);
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+ xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
+
+ if(xmlSecKeyIsValid(key)) {
+ ret = xmlSecSimpleKeysStoreAdoptKey(store, key);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecSimpleKeysStoreAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(key);
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+ } else {
+ /* we have an unknown key in our file, just ignore it */
+ xmlSecKeyDestroy(key);
+ }
cur = xmlSecGetNextElementNode(cur->next);
}
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFreeDoc(doc);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFreeDoc(doc);
+ return(-1);
}
xmlFreeDoc(doc);
@@ -516,9 +516,9 @@ xmlSecSimpleKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
/**
* xmlSecSimpleKeysStoreSave:
- * @store: the pointer to simple keys store.
- * @filename: the filename.
- * @type: the saved keys type (public, private, ...).
+ * @store: the pointer to simple keys store.
+ * @filename: the filename.
+ * @type: the saved keys type (public, private, ...).
*
* Writes keys from @store to an XML file.
*
@@ -547,118 +547,118 @@ xmlSecSimpleKeysStoreSave(xmlSecKeyStorePtr store, const char *filename, xmlSecK
/* create doc */
doc = xmlSecCreateTree(BAD_CAST "Keys", xmlSecNs);
if(doc == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecCreateTree",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecCreateTree",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
- idsList = xmlSecKeyDataIdsGet();
+ idsList = xmlSecKeyDataIdsGet();
xmlSecAssert2(idsList != NULL, -1);
-
+
keysSize = xmlSecPtrListGetSize(list);
idsSize = xmlSecPtrListGetSize(idsList);
for(i = 0; i < keysSize; ++i) {
- key = (xmlSecKeyPtr)xmlSecPtrListGetItem(list, i);
- xmlSecAssert2(key != NULL, -1);
-
- cur = xmlSecAddChild(xmlDocGetRootElement(doc), xmlSecNodeKeyInfo, xmlSecDSigNs);
- if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeKeyInfo));
- xmlFreeDoc(doc);
- return(-1);
- }
-
- /* special data key name */
- if(xmlSecKeyGetName(key) != NULL) {
- if(xmlSecAddChild(cur, xmlSecNodeKeyName, xmlSecDSigNs) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeKeyName));
- xmlFreeDoc(doc);
- return(-1);
- }
- }
+ key = (xmlSecKeyPtr)xmlSecPtrListGetItem(list, i);
+ xmlSecAssert2(key != NULL, -1);
+
+ cur = xmlSecAddChild(xmlDocGetRootElement(doc), xmlSecNodeKeyInfo, xmlSecDSigNs);
+ if(cur == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeKeyInfo));
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+
+ /* special data key name */
+ if(xmlSecKeyGetName(key) != NULL) {
+ if(xmlSecAddChild(cur, xmlSecNodeKeyName, xmlSecDSigNs) == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeKeyName));
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+ }
- /* create nodes for other keys data */
- for(j = 0; j < idsSize; ++j) {
- dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(idsList, j);
- xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, -1);
-
- if(dataId->dataNodeName == NULL) {
- continue;
- }
-
- data = xmlSecKeyGetData(key, dataId);
- if(data == NULL) {
- continue;
- }
-
- if(xmlSecAddChild(cur, dataId->dataNodeName, dataId->dataNodeNs) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(dataId->dataNodeName));
- xmlFreeDoc(doc);
- return(-1);
- }
- }
-
- ret = xmlSecKeyInfoCtxInitialize(&keyInfoCtx, NULL);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecKeyInfoCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFreeDoc(doc);
- return(-1);
- }
-
- keyInfoCtx.mode = xmlSecKeyInfoModeWrite;
- keyInfoCtx.keyReq.keyId = xmlSecKeyDataIdUnknown;
- keyInfoCtx.keyReq.keyType = type;
- keyInfoCtx.keyReq.keyUsage = xmlSecKeyDataUsageAny;
-
- /* finally write key in the node */
- ret = xmlSecKeyInfoNodeWrite(cur, key, &keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecKeyInfoNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
- xmlFreeDoc(doc);
- return(-1);
- }
- xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
+ /* create nodes for other keys data */
+ for(j = 0; j < idsSize; ++j) {
+ dataId = (xmlSecKeyDataId)xmlSecPtrListGetItem(idsList, j);
+ xmlSecAssert2(dataId != xmlSecKeyDataIdUnknown, -1);
+
+ if(dataId->dataNodeName == NULL) {
+ continue;
+ }
+
+ data = xmlSecKeyGetData(key, dataId);
+ if(data == NULL) {
+ continue;
+ }
+
+ if(xmlSecAddChild(cur, dataId->dataNodeName, dataId->dataNodeNs) == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(dataId->dataNodeName));
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+ }
+
+ ret = xmlSecKeyInfoCtxInitialize(&keyInfoCtx, NULL);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecKeyInfoCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+
+ keyInfoCtx.mode = xmlSecKeyInfoModeWrite;
+ keyInfoCtx.keyReq.keyId = xmlSecKeyDataIdUnknown;
+ keyInfoCtx.keyReq.keyType = type;
+ keyInfoCtx.keyReq.keyUsage = xmlSecKeyDataUsageAny;
+
+ /* finally write key in the node */
+ ret = xmlSecKeyInfoNodeWrite(cur, key, &keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecKeyInfoNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+ xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
}
/* now write result */
ret = xmlSaveFormatFile(filename, doc, 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSaveFormatFile",
- XMLSEC_ERRORS_R_XML_FAILED,
- "filename=%s",
- xmlSecErrorsSafeString(filename));
- xmlFreeDoc(doc);
- return(-1);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSaveFormatFile",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "filename=%s",
+ xmlSecErrorsSafeString(filename));
+ xmlFreeDoc(doc);
+ return(-1);
+ }
xmlFreeDoc(doc);
return(0);
@@ -666,7 +666,7 @@ xmlSecSimpleKeysStoreSave(xmlSecKeyStorePtr store, const char *filename, xmlSecK
/**
* xmlSecSimpleKeysStoreGetKeys:
- * @store: the pointer to simple keys store.
+ * @store: the pointer to simple keys store.
*
* Gets list of keys from simple keys store.
*
@@ -697,12 +697,12 @@ xmlSecSimpleKeysStoreInitialize(xmlSecKeyStorePtr store) {
ret = xmlSecPtrListInitialize(list, xmlSecKeyPtrListId);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecPtrListInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecKeyPtrListId");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecPtrListInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecKeyPtrListId");
+ return(-1);
}
return(0);
@@ -722,7 +722,7 @@ xmlSecSimpleKeysStoreFinalize(xmlSecKeyStorePtr store) {
static xmlSecKeyPtr
xmlSecSimpleKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecPtrListPtr list;
xmlSecKeyPtr key;
xmlSecSize pos, size;
@@ -735,10 +735,10 @@ xmlSecSimpleKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name,
size = xmlSecPtrListGetSize(list);
for(pos = 0; pos < size; ++pos) {
- key = (xmlSecKeyPtr)xmlSecPtrListGetItem(list, pos);
- if((key != NULL) && (xmlSecKeyMatch(key, name, &(keyInfoCtx->keyReq)) == 1)) {
- return(xmlSecKeyDuplicate(key));
- }
+ key = (xmlSecKeyPtr)xmlSecPtrListGetItem(list, pos);
+ if((key != NULL) && (xmlSecKeyMatch(key, name, &(keyInfoCtx->keyReq)) == 1)) {
+ return(xmlSecKeyDuplicate(key));
+ }
}
return(NULL);
}
diff --git a/src/list.c b/src/list.c
index a4b6ad5..10e2e2d 100644
--- a/src/list.c
+++ b/src/list.c
@@ -20,16 +20,16 @@
#include <xmlsec/errors.h>
-static int xmlSecPtrListEnsureSize (xmlSecPtrListPtr list,
- xmlSecSize size);
-
+static int xmlSecPtrListEnsureSize (xmlSecPtrListPtr list,
+ xmlSecSize size);
+
static xmlSecAllocMode gAllocMode = xmlSecAllocModeDouble;
static xmlSecSize gInitialSize = 64;
/**
* xmlSecPtrListSetDefaultAllocMode:
- * @defAllocMode: the new default memory allocation mode.
- * @defInitialSize: the new default minimal initial size.
+ * @defAllocMode: the new default memory allocation mode.
+ * @defInitialSize: the new default minimal initial size.
*
* Sets new default allocation mode and minimal initial list size.
*/
@@ -43,7 +43,7 @@ xmlSecPtrListSetDefaultAllocMode(xmlSecAllocMode defAllocMode, xmlSecSize defIni
/**
* xmlSecPtrListCreate:
- * @id: the list klass.
+ * @id: the list klass.
*
* Creates new list object. Caller is responsible for freeing returned list
* by calling #xmlSecPtrListDestroy function.
@@ -60,24 +60,24 @@ xmlSecPtrListCreate(xmlSecPtrListId id) {
/* Allocate a new xmlSecPtrList and fill the fields. */
list = (xmlSecPtrListPtr)xmlMalloc(sizeof(xmlSecPtrList));
if(list == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecPtrListKlassGetName(id)),
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "sizeof(xmlSecPtrList)=%d",
- sizeof(xmlSecPtrList));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecPtrListKlassGetName(id)),
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "sizeof(xmlSecPtrList)=%d",
+ sizeof(xmlSecPtrList));
+ return(NULL);
}
ret = xmlSecPtrListInitialize(list, id);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecPtrListKlassGetName(id)),
- "xmlSecPtrListInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(list);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecPtrListKlassGetName(id)),
+ "xmlSecPtrListInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(list);
+ return(NULL);
}
return(list);
@@ -85,7 +85,7 @@ xmlSecPtrListCreate(xmlSecPtrListId id) {
/**
* xmlSecPtrListDestroy:
- * @list: the pointer to list.
+ * @list: the pointer to list.
*
* Destroys @list created with #xmlSecPtrListCreate function.
*/
@@ -98,8 +98,8 @@ xmlSecPtrListDestroy(xmlSecPtrListPtr list) {
/**
* xmlSecPtrListInitialize:
- * @list: the pointer to list.
- * @id: the list klass.
+ * @list: the pointer to list.
+ * @id: the list klass.
*
* Initializes the list of given klass. Caller is responsible
* for cleaning up by calling #xmlSecPtrListFinalize function.
@@ -120,7 +120,7 @@ xmlSecPtrListInitialize(xmlSecPtrListPtr list, xmlSecPtrListId id) {
/**
* xmlSecPtrListFinalize:
- * @list: the pointer to list.
+ * @list: the pointer to list.
*
* Cleans up the list initialized with #xmlSecPtrListInitialize
* function.
@@ -135,7 +135,7 @@ xmlSecPtrListFinalize(xmlSecPtrListPtr list) {
/**
* xmlSecPtrListEmpty:
- * @list: the pointer to list.
+ * @list: the pointer to list.
*
* Remove all items from @list (if any).
*/
@@ -144,20 +144,20 @@ xmlSecPtrListEmpty(xmlSecPtrListPtr list) {
xmlSecAssert(xmlSecPtrListIsValid(list));
if(list->id->destroyItem != NULL) {
- xmlSecSize pos;
-
- for(pos = 0; pos < list->use; ++pos) {
- xmlSecAssert(list->data != NULL);
- if(list->data[pos] != NULL) {
- list->id->destroyItem(list->data[pos]);
- }
- }
+ xmlSecSize pos;
+
+ for(pos = 0; pos < list->use; ++pos) {
+ xmlSecAssert(list->data != NULL);
+ if(list->data[pos] != NULL) {
+ list->id->destroyItem(list->data[pos]);
+ }
+ }
}
if(list->max > 0) {
- xmlSecAssert(list->data != NULL);
+ xmlSecAssert(list->data != NULL);
- memset(list->data, 0, sizeof(xmlSecPtr) * list->use);
- xmlFree(list->data);
+ memset(list->data, 0, sizeof(xmlSecPtr) * list->use);
+ xmlFree(list->data);
}
list->max = list->use = 0;
list->data = NULL;
@@ -165,8 +165,8 @@ xmlSecPtrListEmpty(xmlSecPtrListPtr list) {
/**
* xmlSecPtrListCopy:
- * @dst: the pointer to destination list.
- * @src: the pointer to source list.
+ * @dst: the pointer to destination list.
+ * @src: the pointer to source list.
*
* Copies @src list items to @dst list using #duplicateItem method
* of the list klass. If #duplicateItem method is NULL then
@@ -186,32 +186,32 @@ xmlSecPtrListCopy(xmlSecPtrListPtr dst, xmlSecPtrListPtr src) {
/* allocate memory */
ret = xmlSecPtrListEnsureSize(dst, dst->use + src->use);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecPtrListGetName(src)),
- "xmlSecPtrListEnsureSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", src->use);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecPtrListGetName(src)),
+ "xmlSecPtrListEnsureSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", src->use);
+ return(-1);
}
/* copy one item after another */
for(i = 0; i < src->use; ++i, ++dst->use) {
- xmlSecAssert2(src->data != NULL, -1);
- xmlSecAssert2(dst->data != NULL, -1);
-
- if((dst->id->duplicateItem != NULL) && (src->data[i] != NULL)) {
- dst->data[dst->use] = dst->id->duplicateItem(src->data[i]);
- if(dst->data[dst->use] == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecPtrListGetName(src)),
- "duplicateItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- } else {
- dst->data[dst->use] = src->data[i];
- }
+ xmlSecAssert2(src->data != NULL, -1);
+ xmlSecAssert2(dst->data != NULL, -1);
+
+ if((dst->id->duplicateItem != NULL) && (src->data[i] != NULL)) {
+ dst->data[dst->use] = dst->id->duplicateItem(src->data[i]);
+ if(dst->data[dst->use] == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecPtrListGetName(src)),
+ "duplicateItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ } else {
+ dst->data[dst->use] = src->data[i];
+ }
}
return(0);
@@ -219,7 +219,7 @@ xmlSecPtrListCopy(xmlSecPtrListPtr dst, xmlSecPtrListPtr src) {
/**
* xmlSecPtrListDuplicate:
- * @list: the pointer to list.
+ * @list: the pointer to list.
*
* Creates a new copy of @list and all its items.
*
@@ -234,36 +234,36 @@ xmlSecPtrListDuplicate(xmlSecPtrListPtr list) {
newList = xmlSecPtrListCreate(list->id);
if(newList == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecPtrListGetName(list)),
- "xmlSecPtrListCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecPtrListGetName(list)),
+ "xmlSecPtrListCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
ret = xmlSecPtrListCopy(newList, list);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecPtrListGetName(list)),
- "xmlSecPtrListCopy",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecPtrListDestroy(newList);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecPtrListGetName(list)),
+ "xmlSecPtrListCopy",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecPtrListDestroy(newList);
+ return(NULL);
}
return(newList);
}
/**
* xmlSecPtrListGetSize:
- * @list: the pointer to list.
+ * @list: the pointer to list.
*
* Gets list size.
*
* Returns: the number of itmes in @list.
*/
-xmlSecSize
+xmlSecSize
xmlSecPtrListGetSize(xmlSecPtrListPtr list) {
xmlSecAssert2(xmlSecPtrListIsValid(list), 0);
@@ -272,8 +272,8 @@ xmlSecPtrListGetSize(xmlSecPtrListPtr list) {
/**
* xmlSecPtrListGetItem:
- * @list: the pointer to list.
- * @pos: the item position.
+ * @list: the pointer to list.
+ * @pos: the item position.
*
* Gets item from the list.
*
@@ -291,8 +291,8 @@ xmlSecPtrListGetItem(xmlSecPtrListPtr list, xmlSecSize pos) {
/**
* xmlSecPtrListAdd:
- * @list: the pointer to list.
- * @item: the item.
+ * @list: the pointer to list.
+ * @item: the item.
*
* Adds @item to the end of the @list.
*
@@ -306,12 +306,12 @@ xmlSecPtrListAdd(xmlSecPtrListPtr list, xmlSecPtr item) {
ret = xmlSecPtrListEnsureSize(list, list->use + 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecPtrListGetName(list)),
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", list->use + 1);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecPtrListGetName(list)),
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", list->use + 1);
+ return(-1);
}
list->data[list->use++] = item;
@@ -320,9 +320,9 @@ xmlSecPtrListAdd(xmlSecPtrListPtr list, xmlSecPtr item) {
/**
* xmlSecPtrListSet:
- * @list: the pointer to list.
- * @item: the item.
- * @pos: the pos.
+ * @list: the pointer to list.
+ * @item: the item.
+ * @pos: the pos.
*
* Sets the value of list item at position @pos. The old value
* is destroyed.
@@ -336,7 +336,7 @@ xmlSecPtrListSet(xmlSecPtrListPtr list, xmlSecPtr item, xmlSecSize pos) {
xmlSecAssert2(pos < list->use, -1);
if((list->id->destroyItem != NULL) && (list->data[pos] != NULL)) {
- list->id->destroyItem(list->data[pos]);
+ list->id->destroyItem(list->data[pos]);
}
list->data[pos] = item;
return(0);
@@ -344,8 +344,8 @@ xmlSecPtrListSet(xmlSecPtrListPtr list, xmlSecPtr item, xmlSecSize pos) {
/**
* xmlSecPtrListRemove:
- * @list: the pointer to list.
- * @pos: the position.
+ * @list: the pointer to list.
+ * @pos: the position.
*
* Destroys list item at the position @pos and sets it value to NULL.
*
@@ -358,19 +358,19 @@ xmlSecPtrListRemove(xmlSecPtrListPtr list, xmlSecSize pos) {
xmlSecAssert2(pos < list->use, -1);
if((list->id->destroyItem != NULL) && (list->data[pos] != NULL)) {
- list->id->destroyItem(list->data[pos]);
+ list->id->destroyItem(list->data[pos]);
}
list->data[pos] = NULL;
if(pos == list->use - 1) {
- --list->use;
+ --list->use;
}
return(0);
}
/**
* xmlSecPtrListDebugDump:
- * @list: the pointer to list.
- * @output: the pointer to output FILE.
+ * @list: the pointer to list.
+ * @output: the pointer to output FILE.
*
* Prints debug information about @list to the @output.
*/
@@ -381,21 +381,21 @@ xmlSecPtrListDebugDump(xmlSecPtrListPtr list, FILE* output) {
fprintf(output, "=== list size: %d\n", list->use);
if(list->id->debugDumpItem != NULL) {
- xmlSecSize pos;
-
- for(pos = 0; pos < list->use; ++pos) {
- xmlSecAssert(list->data != NULL);
- if(list->data[pos] != NULL) {
- list->id->debugDumpItem(list->data[pos], output);
- }
- }
+ xmlSecSize pos;
+
+ for(pos = 0; pos < list->use; ++pos) {
+ xmlSecAssert(list->data != NULL);
+ if(list->data[pos] != NULL) {
+ list->id->debugDumpItem(list->data[pos], output);
+ }
+ }
}
}
/**
* xmlSecPtrListDebugXmlDump:
- * @list: the pointer to list.
- * @output: the pointer to output FILE.
+ * @list: the pointer to list.
+ * @output: the pointer to output FILE.
*
* Prints debug information about @list to the @output in XML format.
*/
@@ -406,14 +406,14 @@ xmlSecPtrListDebugXmlDump(xmlSecPtrListPtr list, FILE* output) {
fprintf(output, "<List size=\"%d\">\n", list->use);
if(list->id->debugXmlDumpItem != NULL) {
- xmlSecSize pos;
-
- for(pos = 0; pos < list->use; ++pos) {
- xmlSecAssert(list->data != NULL);
- if(list->data[pos] != NULL) {
- list->id->debugXmlDumpItem(list->data[pos], output);
- }
- }
+ xmlSecSize pos;
+
+ for(pos = 0; pos < list->use; ++pos) {
+ xmlSecAssert(list->data != NULL);
+ if(list->data[pos] != NULL) {
+ list->id->debugXmlDumpItem(list->data[pos], output);
+ }
+ }
}
fprintf(output, "</List>\n");
}
@@ -426,35 +426,35 @@ xmlSecPtrListEnsureSize(xmlSecPtrListPtr list, xmlSecSize size) {
xmlSecAssert2(xmlSecPtrListIsValid(list), -1);
if(size < list->max) {
- return(0);
+ return(0);
}
switch(list->allocMode) {
- case xmlSecAllocModeExact:
- newSize = size + 8;
- break;
- case xmlSecAllocModeDouble:
- newSize = 2 * size + 32;
- break;
+ case xmlSecAllocModeExact:
+ newSize = size + 8;
+ break;
+ case xmlSecAllocModeDouble:
+ newSize = 2 * size + 32;
+ break;
}
if(newSize < gInitialSize) {
- newSize = gInitialSize;
+ newSize = gInitialSize;
}
if(list->data != NULL) {
- newData = (xmlSecPtr*)xmlRealloc(list->data, sizeof(xmlSecPtr) * newSize);
+ newData = (xmlSecPtr*)xmlRealloc(list->data, sizeof(xmlSecPtr) * newSize);
} else {
- newData = (xmlSecPtr*)xmlMalloc(sizeof(xmlSecPtr) * newSize);
+ newData = (xmlSecPtr*)xmlMalloc(sizeof(xmlSecPtr) * newSize);
}
if(newData == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecPtrListGetName(list)),
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "sizeof(xmlSecPtr)*%d=%d",
- newSize, sizeof(xmlSecPtr) * newSize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecPtrListGetName(list)),
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "sizeof(xmlSecPtr)*%d=%d",
+ newSize, sizeof(xmlSecPtr) * newSize);
+ return(-1);
}
list->data = newData;
@@ -468,15 +468,15 @@ xmlSecPtrListEnsureSize(xmlSecPtrListPtr list, xmlSecSize size) {
* strings list
*
**********************************************************************/
-static xmlSecPtr xmlSecStringListDuplicateItem (xmlSecPtr ptr);
-static void xmlSecStringListDestroyItem (xmlSecPtr ptr);
+static xmlSecPtr xmlSecStringListDuplicateItem (xmlSecPtr ptr);
+static void xmlSecStringListDestroyItem (xmlSecPtr ptr);
static xmlSecPtrListKlass xmlSecStringListKlass = {
BAD_CAST "strings-list",
- xmlSecStringListDuplicateItem, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
- xmlSecStringListDestroyItem, /* xmlSecPtrDestroyItemMethod destroyItem; */
- NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
- NULL, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
+ xmlSecStringListDuplicateItem, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
+ xmlSecStringListDestroyItem, /* xmlSecPtrDestroyItemMethod destroyItem; */
+ NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
+ NULL, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
};
/**
diff --git a/src/membuf.c b/src/membuf.c
index 5505325..56391a0 100644
--- a/src/membuf.c
+++ b/src/membuf.c
@@ -33,42 +33,42 @@
*
****************************************************************************/
#define xmlSecTransformMemBufSize \
- (sizeof(xmlSecTransform) + sizeof(xmlSecBuffer))
+ (sizeof(xmlSecTransform) + sizeof(xmlSecBuffer))
#define xmlSecTransformMemBufGetBuf(transform) \
((xmlSecTransformCheckSize((transform), xmlSecTransformMemBufSize)) ? \
- (xmlSecBufferPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)) : \
- (xmlSecBufferPtr)NULL)
-
-static int xmlSecTransformMemBufInitialize (xmlSecTransformPtr transform);
-static void xmlSecTransformMemBufFinalize (xmlSecTransformPtr transform);
-static int xmlSecTransformMemBufExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
+ (xmlSecBufferPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)) : \
+ (xmlSecBufferPtr)NULL)
+
+static int xmlSecTransformMemBufInitialize (xmlSecTransformPtr transform);
+static void xmlSecTransformMemBufFinalize (xmlSecTransformPtr transform);
+static int xmlSecTransformMemBufExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
static xmlSecTransformKlass xmlSecTransformMemBufKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecTransformMemBufSize, /* xmlSecSize objSize */
-
- xmlSecNameMemBuf, /* const xmlChar* name; */
- NULL, /* const xmlChar* href; */
- 0, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecTransformMemBufInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecTransformMemBufFinalize, /* xmlSecTransformFianlizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecTransformMemBufExecute, /* xmlSecTransformExecuteMethod execute; */
-
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecTransformMemBufSize, /* xmlSecSize objSize */
+
+ xmlSecNameMemBuf, /* const xmlChar* name; */
+ NULL, /* const xmlChar* href; */
+ 0, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecTransformMemBufInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecTransformMemBufFinalize, /* xmlSecTransformFianlizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecTransformMemBufExecute, /* xmlSecTransformExecuteMethod execute; */
+
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -85,7 +85,7 @@ xmlSecTransformMemBufGetKlass(void) {
/**
* xmlSecTransformMemBufGetBuffer:
- * @transform: the pointer to memory buffer transform.
+ * @transform: the pointer to memory buffer transform.
*
* Gets the pointer to memory buffer transform buffer.
*
@@ -115,12 +115,12 @@ xmlSecTransformMemBufInitialize(xmlSecTransformPtr transform) {
ret = xmlSecBufferInitialize(buffer, 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
@@ -155,54 +155,54 @@ xmlSecTransformMemBufExecute(xmlSecTransformPtr transform, int last, xmlSecTrans
inSize = xmlSecBufferGetSize(in);
if(transform->status == xmlSecTransformStatusNone) {
- transform->status = xmlSecTransformStatusWorking;
+ transform->status = xmlSecTransformStatusWorking;
}
- if(transform->status == xmlSecTransformStatusWorking) {
- /* just copy everything from in to our buffer and out */
- ret = xmlSecBufferAppend(buffer, xmlSecBufferGetData(in), inSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
- }
-
- ret = xmlSecBufferAppend(out, xmlSecBufferGetData(in), inSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
- }
-
- ret = xmlSecBufferRemoveHead(in, inSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
- }
-
- if(last != 0) {
- transform->status = xmlSecTransformStatusFinished;
- }
+ if(transform->status == xmlSecTransformStatusWorking) {
+ /* just copy everything from in to our buffer and out */
+ ret = xmlSecBufferAppend(buffer, xmlSecBufferGetData(in), inSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
+ }
+
+ ret = xmlSecBufferAppend(out, xmlSecBufferGetData(in), inSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
+ }
+
+ ret = xmlSecBufferRemoveHead(in, inSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
+ }
+
+ if(last != 0) {
+ transform->status = xmlSecTransformStatusFinished;
+ }
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(inSize == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(inSize == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
}
diff --git a/src/mscrypto/app.c b/src/mscrypto/app.c
index dc3227c..2e36dbb 100644
--- a/src/mscrypto/app.c
+++ b/src/mscrypto/app.c
@@ -32,39 +32,39 @@
static LPWSTR
xmlSecMSCryptoConvertLocaleToUnicode(const char* str) {
- LPWSTR res = NULL;
- int len;
- int ret;
+ LPWSTR res = NULL;
+ int len;
+ int ret;
xmlSecAssert2(str != NULL, NULL);
- /* call MultiByteToWideChar first to get the buffer size */
- ret = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
- if(ret <= 0) {
- return(NULL);
- }
- len = ret;
-
- /* allocate buffer */
- res = (LPWSTR)xmlMalloc(sizeof(WCHAR) * len);
- if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
-
- /* convert */
- ret = MultiByteToWideChar(CP_ACP, 0, str, -1, res, len);
- if(ret <= 0) {
- xmlFree(res);
- return(NULL);
- }
-
- /* done */
- return(res);
+ /* call MultiByteToWideChar first to get the buffer size */
+ ret = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
+ if(ret <= 0) {
+ return(NULL);
+ }
+ len = ret;
+
+ /* allocate buffer */
+ res = (LPWSTR)xmlMalloc(sizeof(WCHAR) * len);
+ if(res == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+
+ /* convert */
+ ret = MultiByteToWideChar(CP_ACP, 0, str, -1, res, len);
+ if(ret <= 0) {
+ xmlFree(res);
+ return(NULL);
+ }
+
+ /* done */
+ return(res);
}
@@ -75,7 +75,7 @@ static char *gXmlSecMSCryptoAppCertStoreName = NULL;
/**
* xmlSecMSCryptoAppInit:
- * @config: the name of another then the default ms certificate store.
+ * @config: the name of another then the default ms certificate store.
*
* General crypto engine initialization. This function is used
* by XMLSec command line utility and called before
@@ -91,17 +91,17 @@ xmlSecMSCryptoAppInit(const char* config) {
* then the default (MY)
*/
if (NULL != config && strlen(config) > 0) {
- if (gXmlSecMSCryptoAppCertStoreName) {
- /* This should not happen, initialize twice */
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "config=%s, config already set",
- xmlSecErrorsSafeString(config));
- return (-1);
- }
- gXmlSecMSCryptoAppCertStoreName = xmlStrdup(config);
+ if (gXmlSecMSCryptoAppCertStoreName) {
+ /* This should not happen, initialize twice */
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "config=%s, config already set",
+ xmlSecErrorsSafeString(config));
+ return (-1);
+ }
+ gXmlSecMSCryptoAppCertStoreName = xmlStrdup(config);
}
return(0);
@@ -120,8 +120,8 @@ int
xmlSecMSCryptoAppShutdown(void) {
/* shutdown MSCrypto crypto engine */
if (NULL != gXmlSecMSCryptoAppCertStoreName) {
- xmlFree(gXmlSecMSCryptoAppCertStoreName);
- gXmlSecMSCryptoAppCertStoreName = NULL;
+ xmlFree(gXmlSecMSCryptoAppCertStoreName);
+ gXmlSecMSCryptoAppCertStoreName = NULL;
}
return(0);
}
@@ -144,11 +144,11 @@ xmlSecMSCryptoAppGetCertStoreName(void) {
/**
* xmlSecMSCryptoAppKeyLoad:
- * @filename: the key filename.
- * @format: the key file format.
- * @pwd: the key file password.
- * @pwdCallback: the key password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @filename: the key filename.
+ * @format: the key file format.
+ * @pwd: the key file password.
+ * @pwdCallback: the key password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key from the a file.
*
@@ -156,7 +156,7 @@ xmlSecMSCryptoAppGetCertStoreName(void) {
*/
xmlSecKeyPtr
xmlSecMSCryptoAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
- const char *pwd, void* pwdCallback, void* pwdCallbackCtx) {
+ const char *pwd, void* pwdCallback, void* pwdCallbackCtx) {
xmlSecBuffer buffer;
xmlSecKeyPtr key = NULL;
int ret;
@@ -166,14 +166,14 @@ xmlSecMSCryptoAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
switch (format) {
case xmlSecKeyDataFormatPkcs12:
- key = xmlSecMSCryptoAppPkcs12Load(filename, pwd, pwdCallback, pwdCallbackCtx);
+ key = xmlSecMSCryptoAppPkcs12Load(filename, pwd, pwdCallback, pwdCallbackCtx);
if(key == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
"xmlSecMSCryptoAppPkcs12Load",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ return(NULL);
}
break;
case xmlSecKeyDataFormatCertDer:
@@ -184,7 +184,7 @@ xmlSecMSCryptoAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
"xmlSecBufferInitialize",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ return(NULL);
}
ret = xmlSecBufferReadFile(&buffer, filename);
@@ -195,24 +195,24 @@ xmlSecMSCryptoAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
XMLSEC_ERRORS_R_XMLSEC_FAILED,
"filename=%s",
xmlSecErrorsSafeString(filename));
- xmlSecBufferFinalize(&buffer);
+ xmlSecBufferFinalize(&buffer);
return (NULL);
}
-
- key = xmlSecMSCryptoAppKeyLoadMemory(xmlSecBufferGetData(&buffer),
- xmlSecBufferGetSize(&buffer), format,
- pwd, pwdCallback, pwdCallbackCtx);
+
+ key = xmlSecMSCryptoAppKeyLoadMemory(xmlSecBufferGetData(&buffer),
+ xmlSecBufferGetSize(&buffer), format,
+ pwd, pwdCallback, pwdCallbackCtx);
if(key == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
"xmlSecMSCryptoAppKeyLoadMemory",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBufferFinalize(&buffer);
- return(NULL);
+ xmlSecBufferFinalize(&buffer);
+ return(NULL);
}
- xmlSecBufferFinalize(&buffer);
- break;
+ xmlSecBufferFinalize(&buffer);
+ break;
default:
/* Any other format like PEM keys is currently not supported */
xmlSecError(XMLSEC_ERRORS_HERE,
@@ -220,7 +220,7 @@ xmlSecMSCryptoAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
NULL,
XMLSEC_ERRORS_R_INVALID_FORMAT,
"format=%d", format);
- return(NULL);
+ return(NULL);
}
return(key);
@@ -228,20 +228,20 @@ xmlSecMSCryptoAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
/**
* xmlSecMSCryptoAppKeyLoadMemory:
- * @data: the key binary data.
- * @dataSize: the key data size.
- * @format: the key format.
- * @pwd: the key password.
- * @pwdCallback: the key password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @data: the key binary data.
+ * @dataSize: the key data size.
+ * @format: the key format.
+ * @pwd: the key password.
+ * @pwdCallback: the key password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key from the a file.
*
* Returns: pointer to the key or NULL if an error occurs.
*/
-xmlSecKeyPtr
+xmlSecKeyPtr
xmlSecMSCryptoAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlSecKeyDataFormat format,
- const char *pwd, void* pwdCallback, void* pwdCallbackCtx) {
+ const char *pwd, void* pwdCallback, void* pwdCallbackCtx) {
PCCERT_CONTEXT pCert = NULL;
PCCERT_CONTEXT tmpcert = NULL;
xmlSecKeyDataPtr x509Data = NULL;
@@ -256,91 +256,91 @@ xmlSecMSCryptoAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlS
pCert = CertCreateCertificateContext(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, data, dataSize);
if (NULL == pCert) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CertCreateCertificateContext",
- XMLSEC_ERRORS_R_IO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CertCreateCertificateContext",
+ XMLSEC_ERRORS_R_IO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
x509Data = xmlSecKeyDataCreate(xmlSecMSCryptoKeyDataX509Id);
if(x509Data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecMSCryptoKeyDataX509Id)));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecMSCryptoKeyDataX509Id)));
+ goto done;
}
tmpcert = CertDuplicateCertificateContext(pCert);
if(tmpcert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CertDuplicateCertificateContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CertDuplicateCertificateContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
}
ret = xmlSecMSCryptoKeyDataX509AdoptKeyCert(x509Data, tmpcert);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoKeyDataX509AdoptKeyCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- CertFreeCertificateContext(tmpcert);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoKeyDataX509AdoptKeyCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ CertFreeCertificateContext(tmpcert);
+ goto done;
}
tmpcert = NULL;
keyData = xmlSecMSCryptoCertAdopt(pCert, xmlSecKeyDataTypePublic);
if(keyData == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoCertAdopt",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoCertAdopt",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
pCert = NULL;
key = xmlSecKeyCreate();
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
ret = xmlSecKeySetValue(key, keyData);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
}
keyData = NULL;
ret = xmlSecKeyAdoptData(key, x509Data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyAdoptData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyAdoptData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
}
x509Data = NULL;
@@ -349,19 +349,19 @@ xmlSecMSCryptoAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlS
key = NULL;
done:
if(pCert != NULL) {
- CertFreeCertificateContext(pCert);
+ CertFreeCertificateContext(pCert);
}
if(tmpcert != NULL) {
- CertFreeCertificateContext(tmpcert);
+ CertFreeCertificateContext(tmpcert);
}
if(x509Data != NULL) {
- xmlSecKeyDataDestroy(x509Data);
+ xmlSecKeyDataDestroy(x509Data);
}
if(keyData != NULL) {
xmlSecKeyDataDestroy(keyData);
}
if(key != NULL) {
- xmlSecKeyDestroy(key);
+ xmlSecKeyDestroy(key);
}
return(res);
}
@@ -375,57 +375,57 @@ done:
/**
* xmlSecMSCryptoAppKeyCertLoad:
- * @key: the pointer to key.
- * @filename: the certificate filename.
- * @format: the certificate file format.
+ * @key: the pointer to key.
+ * @filename: the certificate filename.
+ * @format: the certificate file format.
*
* Reads the certificate from $ filename and adds it to key.
*
* Returns: 0 on success or a negative value otherwise.
*/
-int
+int
xmlSecMSCryptoAppKeyCertLoad(xmlSecKeyPtr key, const char* filename,
- xmlSecKeyDataFormat format) {
+ xmlSecKeyDataFormat format) {
xmlSecBuffer buffer;
int ret;
xmlSecAssert2(key != NULL, -1);
xmlSecAssert2(filename != NULL, -1);
xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
-
+
ret = xmlSecBufferInitialize(&buffer, 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecBufferReadFile(&buffer, filename);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferReadFile",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "filename=%s",
- xmlSecErrorsSafeString(filename));
- xmlSecBufferFinalize(&buffer);
- return (-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferReadFile",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "filename=%s",
+ xmlSecErrorsSafeString(filename));
+ xmlSecBufferFinalize(&buffer);
+ return (-1);
}
ret = xmlSecMSCryptoAppKeyCertLoadMemory(key, xmlSecBufferGetData(&buffer),
- xmlSecBufferGetSize(&buffer), format);
+ xmlSecBufferGetSize(&buffer), format);
if (ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoAppKeyCertLoadMemory",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBufferFinalize(&buffer);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoAppKeyCertLoadMemory",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBufferFinalize(&buffer);
+ return(-1);
}
xmlSecBufferFinalize(&buffer);
@@ -434,18 +434,18 @@ xmlSecMSCryptoAppKeyCertLoad(xmlSecKeyPtr key, const char* filename,
/**
* xmlSecMSCryptoAppKeyCertLoadMemory:
- * @key: the pointer to key.
- * @data: the binary certificate.
+ * @key: the pointer to key.
+ * @data: the binary certificate.
* @dataSize: size of certificate binary (data)
- * @format: the certificate file format.
+ * @format: the certificate file format.
*
* Reads the certificate from $ data and adds it to key.
*
* Returns: 0 on success or a negative value otherwise.
*/
-int
+int
xmlSecMSCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSize dataSize,
- xmlSecKeyDataFormat format) {
+ xmlSecKeyDataFormat format) {
PCCERT_CONTEXT pCert;
xmlSecKeyDataPtr kdata;
int ret;
@@ -456,13 +456,13 @@ xmlSecMSCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xml
kdata = xmlSecKeyEnsureData(key, xmlSecMSCryptoKeyDataX509Id);
if(kdata == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyEnsureData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecMSCryptoKeyDataX509Id)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyEnsureData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecMSCryptoKeyDataX509Id)));
+ return(-1);
}
/* For now only DER certificates are supported */
@@ -478,7 +478,7 @@ xmlSecMSCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xml
XMLSEC_ERRORS_R_XMLSEC_FAILED,
"format=%d", format);
return(-1);
- }
+ }
ret = xmlSecMSCryptoKeyDataX509AdoptCert(kdata, pCert);
if(ret < 0) {
@@ -491,14 +491,14 @@ xmlSecMSCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xml
CertFreeCertificateContext(pCert);
return(-1);
}
- break;
+ break;
default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_FORMAT,
- "format=%d", (int)format);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_FORMAT,
+ "format=%d", (int)format);
+ return(-1);
}
return(0);
@@ -506,20 +506,20 @@ xmlSecMSCryptoAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xml
/**
* xmlSecMSCryptoAppPkcs12Load:
- * @filename: the PKCS12 key filename.
- * @pwd: the PKCS12 file password.
- * @pwdCallback: the password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @filename: the PKCS12 key filename.
+ * @pwd: the PKCS12 file password.
+ * @pwdCallback: the password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key and all associated certificates from the PKCS12 file
*
* Returns: pointer to the key or NULL if an error occurs.
*/
-xmlSecKeyPtr
+xmlSecKeyPtr
xmlSecMSCryptoAppPkcs12Load(const char *filename,
- const char *pwd,
- void* pwdCallback ATTRIBUTE_UNUSED,
- void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
+ const char *pwd,
+ void* pwdCallback ATTRIBUTE_UNUSED,
+ void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
xmlSecBuffer buffer;
xmlSecKeyPtr key;
int ret;
@@ -529,46 +529,46 @@ xmlSecMSCryptoAppPkcs12Load(const char *filename,
ret = xmlSecBufferInitialize(&buffer, 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
ret = xmlSecBufferReadFile(&buffer, filename);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferReadFile",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "filename=%s",
- xmlSecErrorsSafeString(filename));
- xmlSecBufferFinalize(&buffer);
- return (NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferReadFile",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "filename=%s",
+ xmlSecErrorsSafeString(filename));
+ xmlSecBufferFinalize(&buffer);
+ return (NULL);
}
if(xmlSecBufferGetData(&buffer) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBufferFinalize(&buffer);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBufferFinalize(&buffer);
+ return(NULL);
}
key = xmlSecMSCryptoAppPkcs12LoadMemory(xmlSecBufferGetData(&buffer),
- xmlSecBufferGetSize(&buffer), pwd,
- pwdCallback, pwdCallbackCtx);
+ xmlSecBufferGetSize(&buffer), pwd,
+ pwdCallback, pwdCallbackCtx);
if (key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoAppPkcs12LoadMemory",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBufferFinalize(&buffer);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoAppPkcs12LoadMemory",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBufferFinalize(&buffer);
+ return(NULL);
}
xmlSecBufferFinalize(&buffer);
@@ -577,22 +577,22 @@ xmlSecMSCryptoAppPkcs12Load(const char *filename,
/**
* xmlSecMSCryptoAppPkcs12LoadMemory:
- * @data: the binary PKCS12 key in data.
+ * @data: the binary PKCS12 key in data.
* @dataSize: size of binary pkcs12 data
- * @pwd: the PKCS12 file password.
- * @pwdCallback: the password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @pwd: the PKCS12 file password.
+ * @pwdCallback: the password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key and all associated certificates from the PKCS12 binary
*
* Returns: pointer to the key or NULL if an error occurs.
*/
-xmlSecKeyPtr
+xmlSecKeyPtr
xmlSecMSCryptoAppPkcs12LoadMemory(const xmlSecByte* data,
- xmlSecSize dataSize,
- const char *pwd,
- void* pwdCallback ATTRIBUTE_UNUSED,
- void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
+ xmlSecSize dataSize,
+ const char *pwd,
+ void* pwdCallback ATTRIBUTE_UNUSED,
+ void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
CRYPT_DATA_BLOB pfx;
HCERTSTORE hCertStore = NULL;
PCCERT_CONTEXT tmpcert = NULL;
@@ -601,7 +601,7 @@ xmlSecMSCryptoAppPkcs12LoadMemory(const xmlSecByte* data,
xmlSecKeyDataPtr x509Data = NULL;
xmlSecKeyDataPtr keyData = NULL;
xmlSecKeyPtr key = NULL;
- int ret;
+ int ret;
xmlSecAssert2(data != NULL, NULL);
xmlSecAssert2(dataSize > 1, NULL);
@@ -612,176 +612,176 @@ xmlSecMSCryptoAppPkcs12LoadMemory(const xmlSecByte* data,
pfx.cbData = dataSize;
if(FALSE == PFXIsPFXBlob(&pfx)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PFXIsPFXBlob",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "size=%ld",
- pfx.cbData);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PFXIsPFXBlob",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "size=%ld",
+ pfx.cbData);
+ goto done;
}
- wcPwd = xmlSecMSCryptoConvertLocaleToUnicode(pwd);
+ wcPwd = xmlSecMSCryptoConvertLocaleToUnicode(pwd);
if (wcPwd == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoConvertLocaleToUnicode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "wcPwd");
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoConvertLocaleToUnicode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "wcPwd");
+ goto done;
}
if (FALSE == PFXVerifyPassword(&pfx, wcPwd, 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PFXVerifyPassword",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PFXVerifyPassword",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
hCertStore = PFXImportCertStore(&pfx, wcPwd, CRYPT_EXPORTABLE);
if (NULL == hCertStore) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PFXImportCertStore",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PFXImportCertStore",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
x509Data = xmlSecKeyDataCreate(xmlSecMSCryptoKeyDataX509Id);
if(x509Data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecMSCryptoKeyDataX509Id)));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecMSCryptoKeyDataX509Id)));
+ goto done;
}
while (pCert = CertEnumCertificatesInStore(hCertStore, pCert)) {
- DWORD dwData = 0;
+ DWORD dwData = 0;
DWORD dwDataLen = sizeof(DWORD);
- /* Find the certificate that has the private key */
- if((TRUE == CertGetCertificateContextProperty(pCert, CERT_KEY_SPEC_PROP_ID, &dwData, &dwDataLen)) && (dwData > 0)) {
- tmpcert = CertDuplicateCertificateContext(pCert);
- if(tmpcert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CertDuplicateCertificateContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
- }
-
- keyData = xmlSecMSCryptoCertAdopt(tmpcert, xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic);
- if(keyData == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoCertAdopt",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
+ /* Find the certificate that has the private key */
+ if((TRUE == CertGetCertificateContextProperty(pCert, CERT_KEY_SPEC_PROP_ID, &dwData, &dwDataLen)) && (dwData > 0)) {
+ tmpcert = CertDuplicateCertificateContext(pCert);
+ if(tmpcert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CertDuplicateCertificateContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
+ }
+
+ keyData = xmlSecMSCryptoCertAdopt(tmpcert, xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic);
+ if(keyData == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoCertAdopt",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
tmpcert = NULL;
-
- tmpcert = CertDuplicateCertificateContext(pCert);
- if(tmpcert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CertDuplicateCertificateContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
- }
-
- ret = xmlSecMSCryptoKeyDataX509AdoptKeyCert(x509Data, tmpcert);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoKeyDataX509AdoptKeyCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
- }
- tmpcert = NULL;
- }
-
- /* load certificate in the x509 key data */
- tmpcert = CertDuplicateCertificateContext(pCert);
+
+ tmpcert = CertDuplicateCertificateContext(pCert);
+ if(tmpcert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CertDuplicateCertificateContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
+ }
+
+ ret = xmlSecMSCryptoKeyDataX509AdoptKeyCert(x509Data, tmpcert);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoKeyDataX509AdoptKeyCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
+ }
+ tmpcert = NULL;
+ }
+
+ /* load certificate in the x509 key data */
+ tmpcert = CertDuplicateCertificateContext(pCert);
if(tmpcert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CertDuplicateCertificateContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
- }
-
- ret = xmlSecMSCryptoKeyDataX509AdoptCert(x509Data, tmpcert);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
- }
- tmpcert = NULL;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CertDuplicateCertificateContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
+ }
+
+ ret = xmlSecMSCryptoKeyDataX509AdoptCert(x509Data, tmpcert);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
+ }
+ tmpcert = NULL;
}
if (keyData == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoAppPkcs12Load",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "private key not found in PKCS12 file");
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoAppPkcs12Load",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "private key not found in PKCS12 file");
+ goto done;
}
key = xmlSecKeyCreate();
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
ret = xmlSecKeySetValue(key, keyData);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- xmlSecKeyDestroy(key);
- key = NULL;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ xmlSecKeyDestroy(key);
+ key = NULL;
+ goto done;
}
keyData = NULL;
ret = xmlSecKeyAdoptData(key, x509Data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyAdoptData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- xmlSecKeyDestroy(key);
- key = NULL;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyAdoptData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ xmlSecKeyDestroy(key);
+ key = NULL;
+ goto done;
}
x509Data = NULL;
@@ -793,24 +793,24 @@ done:
xmlFree(wcPwd);
}
if(x509Data != NULL) {
- xmlSecKeyDataDestroy(x509Data);
+ xmlSecKeyDataDestroy(x509Data);
}
if(keyData != NULL) {
xmlSecKeyDataDestroy(keyData);
}
if(tmpcert != NULL) {
- CertFreeCertificateContext(tmpcert);
+ CertFreeCertificateContext(tmpcert);
}
return(key);
}
/**
* xmlSecMSCryptoAppKeysMngrCertLoad:
- * @mngr: the keys manager.
- * @filename: the certificate file.
- * @format: the certificate file format.
- * @type: the flag that indicates is the certificate in @filename
- * trusted or not.
+ * @mngr: the keys manager.
+ * @filename: the certificate file.
+ * @format: the certificate file format.
+ * @type: the flag that indicates is the certificate in @filename
+ * trusted or not.
*
* Reads cert from @filename and adds to the list of trusted or known
* untrusted certs in @store (not implemented yet).
@@ -819,8 +819,8 @@ done:
*/
int
xmlSecMSCryptoAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type ATTRIBUTE_UNUSED) {
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type ATTRIBUTE_UNUSED) {
xmlSecBuffer buffer;
int ret;
@@ -830,37 +830,37 @@ xmlSecMSCryptoAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
ret = xmlSecBufferInitialize(&buffer, 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecBufferReadFile(&buffer, filename);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferReadFile",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "filename=%s",
- xmlSecErrorsSafeString(filename));
- xmlSecBufferFinalize(&buffer);
- return (-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferReadFile",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "filename=%s",
+ xmlSecErrorsSafeString(filename));
+ xmlSecBufferFinalize(&buffer);
+ return (-1);
}
ret = xmlSecMSCryptoAppKeysMngrCertLoadMemory(mngr, xmlSecBufferGetData(&buffer),
xmlSecBufferGetSize(&buffer), format, type);
if (ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoAppKeysMngrCertLoadMemory",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "filename=%s",
- xmlSecErrorsSafeString(filename));
- xmlSecBufferFinalize(&buffer);
- return(-1);
+ NULL,
+ "xmlSecMSCryptoAppKeysMngrCertLoadMemory",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "filename=%s",
+ xmlSecErrorsSafeString(filename));
+ xmlSecBufferFinalize(&buffer);
+ return(-1);
}
xmlSecBufferFinalize(&buffer);
@@ -869,12 +869,12 @@ xmlSecMSCryptoAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
/**
* xmlSecMSCryptoAppKeysMngrCertLoadMemory:
- * @mngr: the keys manager.
- * @data: the binary certificate.
+ * @mngr: the keys manager.
+ * @data: the binary certificate.
* @dataSize: size of binary certificate (data)
- * @format: the certificate file format.
- * @type: the flag that indicates is the certificate in @filename
- * trusted or not.
+ * @format: the certificate file format.
+ * @type: the flag that indicates is the certificate in @filename
+ * trusted or not.
*
* Reads cert from @data and adds to the list of trusted or known
* untrusted certs in @store.
@@ -896,35 +896,35 @@ xmlSecMSCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte
x509Store = xmlSecKeysMngrGetDataStore(mngr, xmlSecMSCryptoX509StoreId);
if(x509Store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrGetDataStore",
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrGetDataStore",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
"xmlSecMSCryptoX509StoreId");
return(-1);
}
switch (format) {
- case xmlSecKeyDataFormatDer:
- case xmlSecKeyDataFormatCertDer:
- pCert = CertCreateCertificateContext(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
- data, dataSize);
- if (NULL == pCert) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CertCreateCertificateContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return (-1);
- }
- break;
- default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_FORMAT,
- "format=%d", format);
- return(-1);
+ case xmlSecKeyDataFormatDer:
+ case xmlSecKeyDataFormatCertDer:
+ pCert = CertCreateCertificateContext(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
+ data, dataSize);
+ if (NULL == pCert) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CertCreateCertificateContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return (-1);
+ }
+ break;
+ default:
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_FORMAT,
+ "format=%d", format);
+ return(-1);
}
xmlSecAssert2(pCert != NULL, -1);
@@ -934,8 +934,8 @@ xmlSecMSCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte
NULL,
"xmlSecMSCryptoX509StoreAdoptCert",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CertFreeCertificateContext(pCert);
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CertFreeCertificateContext(pCert);
return(-1);
}
@@ -944,7 +944,7 @@ xmlSecMSCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte
/**
* xmlSecMSCryptoAppDefaultKeysMngrAdoptKeyStore:
- * @mngr: the keys manager.
+ * @mngr: the keys manager.
* @keyStore: the pointer to keys store.
*
* Adds @keyStore to the list of key stores in the keys manager @mngr.
@@ -954,36 +954,36 @@ xmlSecMSCryptoAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte
int
xmlSecMSCryptoAppDefaultKeysMngrAdoptKeyStore(xmlSecKeysMngrPtr mngr, HCERTSTORE keyStore)
{
- xmlSecKeyDataStorePtr x509Store ;
+ xmlSecKeyDataStorePtr x509Store ;
- xmlSecAssert2( mngr != NULL, -1 ) ;
- xmlSecAssert2( keyStore != NULL, -1 ) ;
+ xmlSecAssert2( mngr != NULL, -1 ) ;
+ xmlSecAssert2( keyStore != NULL, -1 ) ;
x509Store = xmlSecKeysMngrGetDataStore( mngr, xmlSecMSCryptoX509StoreId) ;
- if( x509Store == NULL ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "xmlSecKeysMngrGetDataStore" ,
- XMLSEC_ERRORS_R_XMLSEC_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1) ;
- }
-
- if( xmlSecMSCryptoX509StoreAdoptKeyStore( x509Store, keyStore ) < 0 ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- xmlSecErrorsSafeString( xmlSecKeyDataStoreGetName( x509Store ) ) ,
- "xmlSecMSCryptoX509StoreAdoptKeyStore" ,
- XMLSEC_ERRORS_R_XMLSEC_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1) ;
- }
-
- return (0) ;
+ if( x509Store == NULL ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "xmlSecKeysMngrGetDataStore" ,
+ XMLSEC_ERRORS_R_XMLSEC_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1) ;
+ }
+
+ if( xmlSecMSCryptoX509StoreAdoptKeyStore( x509Store, keyStore ) < 0 ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ xmlSecErrorsSafeString( xmlSecKeyDataStoreGetName( x509Store ) ) ,
+ "xmlSecMSCryptoX509StoreAdoptKeyStore" ,
+ XMLSEC_ERRORS_R_XMLSEC_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1) ;
+ }
+
+ return (0) ;
}
/**
* xmlSecMSCryptoAppDefaultKeysMngrAdoptTrustedStore:
- * @mngr: the keys manager.
+ * @mngr: the keys manager.
* @trustedStore: the pointer to certs store.
*
* Adds @trustedStore to the list of trusted cert stores in the keys manager @mngr.
@@ -993,36 +993,36 @@ xmlSecMSCryptoAppDefaultKeysMngrAdoptKeyStore(xmlSecKeysMngrPtr mngr, HCERTSTORE
int
xmlSecMSCryptoAppDefaultKeysMngrAdoptTrustedStore(xmlSecKeysMngrPtr mngr, HCERTSTORE trustedStore)
{
- xmlSecKeyDataStorePtr x509Store ;
+ xmlSecKeyDataStorePtr x509Store ;
- xmlSecAssert2( mngr != NULL, -1 ) ;
- xmlSecAssert2( trustedStore != NULL, -1 ) ;
+ xmlSecAssert2( mngr != NULL, -1 ) ;
+ xmlSecAssert2( trustedStore != NULL, -1 ) ;
x509Store = xmlSecKeysMngrGetDataStore( mngr, xmlSecMSCryptoX509StoreId ) ;
- if( x509Store == NULL ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "xmlSecKeysMngrGetDataStore" ,
- XMLSEC_ERRORS_R_XMLSEC_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1) ;
- }
-
- if( xmlSecMSCryptoX509StoreAdoptTrustedStore( x509Store, trustedStore ) < 0 ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- xmlSecErrorsSafeString( xmlSecKeyDataStoreGetName( x509Store ) ) ,
- "xmlSecMSCryptoX509StoreAdoptKeyStore" ,
- XMLSEC_ERRORS_R_XMLSEC_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1) ;
- }
-
- return(0);
+ if( x509Store == NULL ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "xmlSecKeysMngrGetDataStore" ,
+ XMLSEC_ERRORS_R_XMLSEC_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1) ;
+ }
+
+ if( xmlSecMSCryptoX509StoreAdoptTrustedStore( x509Store, trustedStore ) < 0 ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ xmlSecErrorsSafeString( xmlSecKeyDataStoreGetName( x509Store ) ) ,
+ "xmlSecMSCryptoX509StoreAdoptKeyStore" ,
+ XMLSEC_ERRORS_R_XMLSEC_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1) ;
+ }
+
+ return(0);
}
/**
* xmlSecMSCryptoAppDefaultKeysMngrAdoptUntrustedStore:
- * @mngr: the keys manager.
+ * @mngr: the keys manager.
* @untrustedStore: the pointer to certs store.
*
* Adds @trustedStore to the list of un-trusted cert stores in the keys manager @mngr.
@@ -1032,38 +1032,38 @@ xmlSecMSCryptoAppDefaultKeysMngrAdoptTrustedStore(xmlSecKeysMngrPtr mngr, HCERTS
int
xmlSecMSCryptoAppDefaultKeysMngrAdoptUntrustedStore(xmlSecKeysMngrPtr mngr, HCERTSTORE untrustedStore)
{
- xmlSecKeyDataStorePtr x509Store ;
+ xmlSecKeyDataStorePtr x509Store ;
- xmlSecAssert2( mngr != NULL, -1 ) ;
- xmlSecAssert2( untrustedStore != NULL, -1 ) ;
+ xmlSecAssert2( mngr != NULL, -1 ) ;
+ xmlSecAssert2( untrustedStore != NULL, -1 ) ;
x509Store = xmlSecKeysMngrGetDataStore( mngr, xmlSecMSCryptoX509StoreId);
- if( x509Store == NULL ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "xmlSecKeysMngrGetDataStore" ,
- XMLSEC_ERRORS_R_XMLSEC_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1);
- }
-
- if( xmlSecMSCryptoX509StoreAdoptUntrustedStore( x509Store, untrustedStore ) < 0) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- xmlSecErrorsSafeString( xmlSecKeyDataStoreGetName( x509Store ) ) ,
- "xmlSecMSCryptoX509StoreAdoptKeyStore" ,
- XMLSEC_ERRORS_R_XMLSEC_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1);
- }
-
- return(0) ;
+ if( x509Store == NULL ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "xmlSecKeysMngrGetDataStore" ,
+ XMLSEC_ERRORS_R_XMLSEC_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1);
+ }
+
+ if( xmlSecMSCryptoX509StoreAdoptUntrustedStore( x509Store, untrustedStore ) < 0) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ xmlSecErrorsSafeString( xmlSecKeyDataStoreGetName( x509Store ) ) ,
+ "xmlSecMSCryptoX509StoreAdoptKeyStore" ,
+ XMLSEC_ERRORS_R_XMLSEC_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1);
+ }
+
+ return(0) ;
}
#endif /* XMLSEC_NO_X509 */
/**
* xmlSecMSCryptoAppDefaultKeysMngrInit:
- * @mngr: the pointer to keys manager.
+ * @mngr: the pointer to keys manager.
*
* Initializes @mngr with simple keys store #xmlSecSimpleKeysStoreId
* and a default MSCrypto crypto key data stores.
@@ -1078,37 +1078,37 @@ xmlSecMSCryptoAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
/* create MSCrypto keys store if needed */
if(xmlSecKeysMngrGetKeysStore(mngr) == NULL) {
- xmlSecKeyStorePtr keysStore;
-
- keysStore = xmlSecKeyStoreCreate(xmlSecMSCryptoKeysStoreId);
- if(keysStore == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyStoreCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecMSCryptoKeysStoreId");
- return(-1);
- }
-
- ret = xmlSecKeysMngrAdoptKeysStore(mngr, keysStore);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrAdoptKeysStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyStoreDestroy(keysStore);
- return(-1);
- }
+ xmlSecKeyStorePtr keysStore;
+
+ keysStore = xmlSecKeyStoreCreate(xmlSecMSCryptoKeysStoreId);
+ if(keysStore == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyStoreCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecMSCryptoKeysStoreId");
+ return(-1);
+ }
+
+ ret = xmlSecKeysMngrAdoptKeysStore(mngr, keysStore);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrAdoptKeysStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyStoreDestroy(keysStore);
+ return(-1);
+ }
}
ret = xmlSecMSCryptoKeysMngrInit(mngr);
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoKeysMngrInit",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlSecMSCryptoKeysMngrInit",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -1118,8 +1118,8 @@ xmlSecMSCryptoAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
/**
* xmlSecMSCryptoAppDefaultKeysMngrAdoptKey:
- * @mngr: the pointer to keys manager.
- * @key: the pointer to key.
+ * @mngr: the pointer to keys manager.
+ * @key: the pointer to key.
*
* Adds @key to the keys manager @mngr created with #xmlSecMSCryptoAppDefaultKeysMngrInit
* function.
@@ -1136,22 +1136,22 @@ xmlSecMSCryptoAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr ke
store = xmlSecKeysMngrGetKeysStore(mngr);
if(store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrGetKeysStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrGetKeysStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecMSCryptoKeysStoreAdoptKey(store, key);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoKeysStoreAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoKeysStoreAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -1159,8 +1159,8 @@ xmlSecMSCryptoAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr ke
/**
* xmlSecMSCryptoAppDefaultKeysMngrLoad:
- * @mngr: the pointer to keys manager.
- * @uri: the uri.
+ * @mngr: the pointer to keys manager.
+ * @uri: the uri.
*
* Loads XML keys file from @uri to the keys manager @mngr created
* with #xmlSecMSCryptoAppDefaultKeysMngrInit function.
@@ -1177,22 +1177,22 @@ xmlSecMSCryptoAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
store = xmlSecKeysMngrGetKeysStore(mngr);
if(store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrGetKeysStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrGetKeysStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecMSCryptoKeysStoreLoad(store, uri, mngr);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoKeysStoreLoad",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "uri=%s", xmlSecErrorsSafeString(uri));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoKeysStoreLoad",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "uri=%s", xmlSecErrorsSafeString(uri));
+ return(-1);
}
return(0);
@@ -1200,9 +1200,9 @@ xmlSecMSCryptoAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
/**
* xmlSecMSCryptoAppDefaultKeysMngrSave:
- * @mngr: the pointer to keys manager.
+ * @mngr: the pointer to keys manager.
* @filename: the destination filename.
- * @type: the type of keys to save (public/private/symmetric).
+ * @type: the type of keys to save (public/private/symmetric).
*
* Saves keys from @mngr to XML keys file.
*
@@ -1219,20 +1219,20 @@ xmlSecMSCryptoAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filenam
store = xmlSecKeysMngrGetKeysStore(mngr);
if(store == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrGetKeysStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlSecKeysMngrGetKeysStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
ret = xmlSecMSCryptoKeysStoreSave(store, filename, type);
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoKeysStoreSave",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "filename%s", xmlSecErrorsSafeString(filename));
+ NULL,
+ "xmlSecMSCryptoKeysStoreSave",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "filename%s", xmlSecErrorsSafeString(filename));
return(-1);
}
@@ -1241,7 +1241,7 @@ xmlSecMSCryptoAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filenam
/**
* xmlSecMSCryptoAppDefaultKeysMngrPrivateKeyLoad:
- * @mngr: the pointer to keys manager.
+ * @mngr: the pointer to keys manager.
* @hKey: the key handle.
*
* Adds private key @hKey to the keys manager @mngr.
@@ -1259,7 +1259,7 @@ xmlSecMSCryptoAppDefaultKeysMngrPrivateKeyLoad(xmlSecKeysMngrPtr mngr, HCRYPTKEY
/**
* xmlSecMSCryptoAppDefaultKeysMngrPublicKeyLoad:
- * @mngr: the pointer to keys manager.
+ * @mngr: the pointer to keys manager.
* @hKey: the key handle.
*
* Adds public key @hKey to the keys manager @mngr.
@@ -1277,7 +1277,7 @@ xmlSecMSCryptoAppDefaultKeysMngrPublicKeyLoad(xmlSecKeysMngrPtr mngr, HCRYPTKEY
/**
* xmlSecMSCryptoAppDefaultKeysMngrSymKeyLoad:
- * @mngr: the pointer to keys manager.
+ * @mngr: the pointer to keys manager.
* @hKey: the key handle.
*
* Adds symmetric key @hKey to the keys manager @mngr.
diff --git a/src/mscrypto/certkeys.c b/src/mscrypto/certkeys.c
index 6ddb2f6..02545e3 100644
--- a/src/mscrypto/certkeys.c
+++ b/src/mscrypto/certkeys.c
@@ -50,7 +50,7 @@
*
*************************************************************************/
typedef struct _xmlSecMSCryptoKeyDataCtx xmlSecMSCryptoKeyDataCtx,
- *xmlSecMSCryptoKeyDataCtxPtr;
+ *xmlSecMSCryptoKeyDataCtxPtr;
#ifdef XMLSEC_MSCRYPTO_NT4
/*-
@@ -59,8 +59,8 @@ typedef struct _xmlSecMSCryptoKeyDataCtx xmlSecMSCryptoKeyDataCtx,
* by WINNT 4.0, the wrapper will enable the library work on WINNT 4.0
*/
struct _mscrypt_key {
- HCRYPTKEY hKey ;
- volatile LONG refcnt ;
+ HCRYPTKEY hKey ;
+ volatile LONG refcnt ;
} ;
/*-
@@ -69,9 +69,9 @@ struct _mscrypt_key {
* by WINNT 4.0, the wrapper will enable the library work on WINNT 4.0
*/
struct _mscrypt_prov {
- HCRYPTPROV hProv ;
+ HCRYPTPROV hProv ;
BOOL fCallerFreeProv ;
- volatile LONG refcnt ;
+ volatile LONG refcnt ;
} ;
#endif /* XMLSEC_MSCRYPTO_NT4 */
@@ -84,19 +84,19 @@ struct _mscrypt_prov {
*/
struct _xmlSecMSCryptoKeyDataCtx {
#ifndef XMLSEC_MSCRYPTO_NT4
- HCRYPTPROV hProv;
- BOOL fCallerFreeProv;
- HCRYPTKEY hKey;
+ HCRYPTPROV hProv;
+ BOOL fCallerFreeProv;
+ HCRYPTKEY hKey;
#else /* XMLSEC_MSCRYPTO_NT4 */
- struct _mscrypt_prov* p_prov ;
+ struct _mscrypt_prov* p_prov ;
struct _mscrypt_key* p_key ;
#endif /* XMLSEC_MSCRYPTO_NT4 */
- PCCERT_CONTEXT pCert;
- LPCTSTR providerName;
- DWORD providerType;
- DWORD dwKeySpec;
- xmlSecKeyDataType type;
-};
+ PCCERT_CONTEXT pCert;
+ LPCTSTR providerName;
+ DWORD providerType;
+ DWORD dwKeySpec;
+ xmlSecKeyDataType type;
+};
#ifndef XMLSEC_MSCRYPTO_NT4
@@ -107,8 +107,8 @@ static void
xmlSecMSCryptoKeyDataCtxCreateProvider(xmlSecMSCryptoKeyDataCtxPtr ctx) {
xmlSecAssert(ctx != NULL);
- ctx->hProv = 0;
- ctx->fCallerFreeProv = FALSE;
+ ctx->hProv = 0;
+ ctx->fCallerFreeProv = FALSE;
}
static void
@@ -116,10 +116,10 @@ xmlSecMSCryptoKeyDataCtxDestroyProvider(xmlSecMSCryptoKeyDataCtxPtr ctx) {
xmlSecAssert(ctx != NULL);
if ((ctx->hProv != 0) && (ctx->fCallerFreeProv)) {
- CryptReleaseContext(ctx->hProv, 0);
+ CryptReleaseContext(ctx->hProv, 0);
}
- ctx->hProv = 0;
- ctx->fCallerFreeProv = FALSE;
+ ctx->hProv = 0;
+ ctx->fCallerFreeProv = FALSE;
}
static void
@@ -128,7 +128,7 @@ xmlSecMSCryptoKeyDataCtxSetProvider(xmlSecMSCryptoKeyDataCtxPtr ctx, HCRYPTPROV
xmlSecAssert(ctx != NULL);
xmlSecMSCryptoKeyDataCtxDestroyProvider(ctx);
- ctx->hProv = hProv;
+ ctx->hProv = hProv;
ctx->fCallerFreeProv = fCallerFreeProv;
}
@@ -141,16 +141,16 @@ xmlSecMSCryptoKeyDataCtxDuplicateProvider(xmlSecMSCryptoKeyDataCtxPtr ctxDst, xm
if(ctxSrc->hProv != 0) {
if(!CryptContextAddRef(ctxSrc->hProv, NULL, 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptContextAddRef",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptContextAddRef",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
- ctxDst->hProv = ctxSrc->hProv;
- ctxDst->fCallerFreeProv = TRUE;
+ ctxDst->hProv = ctxSrc->hProv;
+ ctxDst->fCallerFreeProv = TRUE;
}
return(0);
}
@@ -170,7 +170,7 @@ xmlSecMSCryptoKeyDataCtxDestroyKey(xmlSecMSCryptoKeyDataCtxPtr ctx) {
xmlSecAssert(ctx != NULL);
if (ctx->hKey != 0) {
- CryptDestroyKey(ctx->hKey);
+ CryptDestroyKey(ctx->hKey);
}
ctx->hKey = 0;
}
@@ -190,14 +190,14 @@ xmlSecMSCryptoKeyDataCtxDuplicateKey(xmlSecMSCryptoKeyDataCtxPtr ctxDst, xmlSecM
xmlSecMSCryptoKeyDataCtxDestroyKey(ctxDst);
if (ctxSrc->hKey != 0) {
- if (!CryptDuplicateKey(ctxSrc->hKey, NULL, 0, &(ctxDst->hKey))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptDuplicateKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ if (!CryptDuplicateKey(ctxSrc->hKey, NULL, 0, &(ctxDst->hKey))) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptDuplicateKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
return(0);
@@ -212,15 +212,15 @@ static void
xmlSecMSCryptoKeyDataCtxCreateProvider(xmlSecMSCryptoKeyDataCtxPtr ctx) {
xmlSecAssert(ctx != NULL);
- ctx->p_prov = (struct _mscrypt_prov*)xmlMalloc(sizeof(struct _mscrypt_prov));
- if(ctx->p_prov == NULL ) {
- xmlSecError( XMLSEC_ERRORS_HERE,
- "mscrypt_create_prov" ,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE
- );
- }
+ ctx->p_prov = (struct _mscrypt_prov*)xmlMalloc(sizeof(struct _mscrypt_prov));
+ if(ctx->p_prov == NULL ) {
+ xmlSecError( XMLSEC_ERRORS_HERE,
+ "mscrypt_create_prov" ,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE
+ );
+ }
memset(ctx->p_prov, 0, sizeof(struct _mscrypt_prov));
}
@@ -228,16 +228,16 @@ static void
xmlSecMSCryptoKeyDataCtxDestroyProvider(xmlSecMSCryptoKeyDataCtxPtr ctx) {
xmlSecAssert(ctx != NULL);
- if(ctx->p_prov != NULL) {
- if(InterlockedDecrement(&(ctx->p_prov->refcnt)) <= 0) {
- if((ctx->p_prov->hProv != 0) && (ctx->p_prov->fCallerFreeProv)) {
- CryptReleaseContext(ctx->p_prov->hProv, 0) ;
- }
+ if(ctx->p_prov != NULL) {
+ if(InterlockedDecrement(&(ctx->p_prov->refcnt)) <= 0) {
+ if((ctx->p_prov->hProv != 0) && (ctx->p_prov->fCallerFreeProv)) {
+ CryptReleaseContext(ctx->p_prov->hProv, 0) ;
+ }
memset(ctx->p_prov, 0, sizeof(struct _mscrypt_prov));
- xmlFree(ctx->p_prov) ;
- }
+ xmlFree(ctx->p_prov) ;
+ }
ctx->p_prov = NULL;
- }
+ }
}
static void
@@ -248,9 +248,9 @@ xmlSecMSCryptoKeyDataCtxSetProvider(xmlSecMSCryptoKeyDataCtxPtr ctx, HCRYPTPROV
xmlSecMSCryptoKeyDataCtxDestroyProvider(ctx);
if((ctx->p_prov != NULL) && (ctx->p_prov->refcnt == 1)) {
- if((ctx->p_prov->hProv != 0) && (ctx->p_prov->fCallerFreeProv)) {
- CryptReleaseContext(ctx->p_prov->hProv, 0) ;
- }
+ if((ctx->p_prov->hProv != 0) && (ctx->p_prov->fCallerFreeProv)) {
+ CryptReleaseContext(ctx->p_prov->hProv, 0) ;
+ }
memset(ctx->p_prov, 0, sizeof(struct _mscrypt_prov));
} else {
xmlSecMSCryptoKeyDataCtxDestroyProvider(ctx);
@@ -284,15 +284,15 @@ static void
xmlSecMSCryptoKeyDataCtxCreateKey(xmlSecMSCryptoKeyDataCtxPtr ctx) {
xmlSecAssert(ctx != NULL);
- ctx->p_key = (struct _mscrypt_key*)xmlMalloc(sizeof(struct _mscrypt_key));
- if(ctx->p_key == NULL ) {
- xmlSecError( XMLSEC_ERRORS_HERE,
- "mscrypt_create_key" ,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE
- );
- }
+ ctx->p_key = (struct _mscrypt_key*)xmlMalloc(sizeof(struct _mscrypt_key));
+ if(ctx->p_key == NULL ) {
+ xmlSecError( XMLSEC_ERRORS_HERE,
+ "mscrypt_create_key" ,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE
+ );
+ }
memset(ctx->p_key, 0, sizeof(struct _mscrypt_key));
}
@@ -300,16 +300,16 @@ static void
xmlSecMSCryptoKeyDataCtxDestroyKey(xmlSecMSCryptoKeyDataCtxPtr ctx) {
xmlSecAssert(ctx != NULL);
- if(ctx->p_key != NULL) {
- if(InterlockedDecrement(&(ctx->p_key->refcnt)) <= 0) {
- if(ctx->p_key->hKey != 0) {
- CryptDestroyKey(ctx->p_key->hKey) ;
- }
+ if(ctx->p_key != NULL) {
+ if(InterlockedDecrement(&(ctx->p_key->refcnt)) <= 0) {
+ if(ctx->p_key->hKey != 0) {
+ CryptDestroyKey(ctx->p_key->hKey) ;
+ }
memset(ctx->p_key, 0, sizeof(struct _mscrypt_key));
- xmlFree(ctx->p_key) ;
- }
+ xmlFree(ctx->p_key) ;
+ }
ctx->p_key = NULL;
- }
+ }
}
static void
@@ -317,9 +317,9 @@ xmlSecMSCryptoKeyDataCtxSetKey(xmlSecMSCryptoKeyDataCtxPtr ctx, HCRYPTKEY hKey)
xmlSecAssert(ctx != NULL);
if((ctx->p_key != NULL) && (ctx->p_key->refcnt == 1)) {
- if(ctx->p_key->hKey != 0) {
- CryptDestroyKey(ctx->p_key->hKey) ;
- }
+ if(ctx->p_key->hKey != 0) {
+ CryptDestroyKey(ctx->p_key->hKey) ;
+ }
memset(ctx->p_key, 0, sizeof(struct _mscrypt_key));
} else {
xmlSecMSCryptoKeyDataCtxDestroyKey(ctx);
@@ -360,7 +360,7 @@ xmlSecMSCryptoKeyDataCtxDestroyCert(xmlSecMSCryptoKeyDataCtxPtr ctx) {
xmlSecAssert(ctx != NULL);
if(ctx->pCert != NULL) {
- CertFreeCertificateContext(ctx->pCert);
+ CertFreeCertificateContext(ctx->pCert);
}
ctx->pCert = NULL;
}
@@ -380,15 +380,15 @@ xmlSecMSCryptoKeyDataCtxDuplicateCert(xmlSecMSCryptoKeyDataCtxPtr ctxDst, xmlSec
xmlSecMSCryptoKeyDataCtxDestroyCert(ctxDst);
if(ctxSrc->pCert != NULL) {
- ctxDst->pCert = xmlSecMSCryptoCertDup(ctxSrc->pCert);
- if(ctxDst->pCert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoPCCDup",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ctxDst->pCert = xmlSecMSCryptoCertDup(ctxSrc->pCert);
+ if(ctxDst->pCert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoPCCDup",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
return(0);
}
@@ -398,19 +398,19 @@ xmlSecMSCryptoKeyDataCtxDuplicateCert(xmlSecMSCryptoKeyDataCtxPtr ctxDst, xmlSec
* xmlSecMSCryptoKeyDataCtx is located after xmlSecTransform
*
*****************************************************************************/
-#define xmlSecMSCryptoKeyDataSize \
- (sizeof(xmlSecKeyData) + sizeof(xmlSecMSCryptoKeyDataCtx))
+#define xmlSecMSCryptoKeyDataSize \
+ (sizeof(xmlSecKeyData) + sizeof(xmlSecMSCryptoKeyDataCtx))
#define xmlSecMSCryptoKeyDataGetCtx(data) \
((xmlSecMSCryptoKeyDataCtxPtr)(((xmlSecByte*)(data)) + sizeof(xmlSecKeyData)))
-static int xmlSecMSCryptoKeyDataDuplicate (xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src);
-static void xmlSecMSCryptoKeyDataFinalize (xmlSecKeyDataPtr data);
-static int xmlSecMSCryptoKeyDataGetSize (xmlSecKeyDataPtr data);
+static int xmlSecMSCryptoKeyDataDuplicate (xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src);
+static void xmlSecMSCryptoKeyDataFinalize (xmlSecKeyDataPtr data);
+static int xmlSecMSCryptoKeyDataGetSize (xmlSecKeyDataPtr data);
/**
* xmlSecMSCryptoKeyDataAdoptCert:
- * @data: the pointer to MSCrypto pccert data.
- * @pCert: the pointer to PCCERT key.
+ * @data: the pointer to MSCrypto pccert data.
+ * @pCert: the pointer to PCCERT key.
*
* Sets the value of key data.
*
@@ -444,42 +444,42 @@ xmlSecMSCryptoKeyDataAdoptCert(xmlSecKeyDataPtr data, PCCERT_CONTEXT pCert, xmlS
BOOL fCallerFreeProv = FALSE;
if (!CryptAcquireCertificatePrivateKey(pCert,
- CRYPT_ACQUIRE_COMPARE_KEY_FLAG,
- NULL,
- &hProv,
- &(ctx->dwKeySpec),
- &fCallerFreeProv)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptAcquireCertificatePrivateKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ CRYPT_ACQUIRE_COMPARE_KEY_FLAG,
+ NULL,
+ &hProv,
+ &(ctx->dwKeySpec),
+ &fCallerFreeProv)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptAcquireCertificatePrivateKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
xmlSecMSCryptoKeyDataCtxSetProvider(ctx, hProv, fCallerFreeProv);
} else if((type & xmlSecKeyDataTypePublic) != 0){
HCRYPTPROV hProv = 0;
if (!CryptAcquireContext(&hProv,
- NULL,
- NULL, /* ctx->providerName, */
- ctx->providerType,
- CRYPT_VERIFYCONTEXT)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptAcquireContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ NULL,
+ NULL, /* ctx->providerName, */
+ ctx->providerType,
+ CRYPT_VERIFYCONTEXT)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptAcquireContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
xmlSecMSCryptoKeyDataCtxSetProvider(ctx, hProv, TRUE);
- ctx->dwKeySpec = 0;
+ ctx->dwKeySpec = 0;
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "Unsupported keytype");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "Unsupported keytype");
+ return(-1);
}
/* CryptImportPublicKeyInfo is only needed when a real key handle
@@ -490,15 +490,15 @@ xmlSecMSCryptoKeyDataAdoptCert(xmlSecKeyDataPtr data, PCCERT_CONTEXT pCert, xmlS
* made. WK
*/
if(!CryptImportPublicKeyInfo(xmlSecMSCryptoKeyDataCtxGetProvider(ctx),
- X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
- &(pCert->pCertInfo->SubjectPublicKeyInfo),
- &hKey)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptImportPublicKeyInfo",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
+ &(pCert->pCertInfo->SubjectPublicKeyInfo),
+ &hKey)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptImportPublicKeyInfo",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
xmlSecMSCryptoKeyDataCtxSetKey(ctx, hKey);
@@ -508,11 +508,11 @@ xmlSecMSCryptoKeyDataAdoptCert(xmlSecKeyDataPtr data, PCCERT_CONTEXT pCert, xmlS
static int
xmlSecMSCryptoKeyDataAdoptKey(xmlSecKeyDataPtr data,
- HCRYPTPROV hProv,
- BOOL fCallerFreeProv,
- HCRYPTKEY hKey,
- DWORD dwKeySpec,
- xmlSecKeyDataType type) {
+ HCRYPTPROV hProv,
+ BOOL fCallerFreeProv,
+ HCRYPTKEY hKey,
+ DWORD dwKeySpec,
+ xmlSecKeyDataType type) {
xmlSecMSCryptoKeyDataCtxPtr ctx;
xmlSecAssert2(xmlSecKeyDataIsValid(data), -1);
@@ -527,15 +527,15 @@ xmlSecMSCryptoKeyDataAdoptKey(xmlSecKeyDataPtr data,
xmlSecMSCryptoKeyDataCtxSetKey(ctx, hKey);
xmlSecMSCryptoKeyDataCtxSetCert(ctx, NULL);
- ctx->dwKeySpec = dwKeySpec;
- ctx->type = type;
+ ctx->dwKeySpec = dwKeySpec;
+ ctx->type = type;
return(0);
}
/**
* xmlSecMSCryptoKeyDataGetKey:
- * @data: the key data to retrieve certificate from.
+ * @data: the key data to retrieve certificate from.
* @type: type of key requested (public/private)
*
* Native MSCrypto key retrieval from xmlsec keydata. The
@@ -558,7 +558,7 @@ xmlSecMSCryptoKeyDataGetKey(xmlSecKeyDataPtr data, xmlSecKeyDataType type) {
/**
* xmlSecMSCryptoKeyDataGetDecryptKey:
- * @data: the key data pointer
+ * @data: the key data pointer
*
* Native MSCrypto decrypt key retrieval from xmlsec keydata. The
* returned HKEY must not be destroyed by the caller.
@@ -567,29 +567,29 @@ xmlSecMSCryptoKeyDataGetKey(xmlSecKeyDataPtr data, xmlSecKeyDataType type) {
*/
HCRYPTKEY
xmlSecMSCryptoKeyDataGetDecryptKey(xmlSecKeyDataPtr data) {
- xmlSecMSCryptoKeyDataCtxPtr ctx;
- HCRYPTKEY hKey;
-
- xmlSecAssert2(xmlSecKeyDataIsValid(data), 0);
- xmlSecAssert2(xmlSecKeyDataCheckSize(data, xmlSecMSCryptoKeyDataSize), 0);
-
- ctx = xmlSecMSCryptoKeyDataGetCtx(data);
- xmlSecAssert2(ctx != NULL, 0);
-
- if( !CryptGetUserKey(xmlSecMSCryptoKeyDataCtxGetProvider(ctx), AT_KEYEXCHANGE, &(hKey))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptGetUserKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(0);
- }
- return (hKey);
+ xmlSecMSCryptoKeyDataCtxPtr ctx;
+ HCRYPTKEY hKey;
+
+ xmlSecAssert2(xmlSecKeyDataIsValid(data), 0);
+ xmlSecAssert2(xmlSecKeyDataCheckSize(data, xmlSecMSCryptoKeyDataSize), 0);
+
+ ctx = xmlSecMSCryptoKeyDataGetCtx(data);
+ xmlSecAssert2(ctx != NULL, 0);
+
+ if( !CryptGetUserKey(xmlSecMSCryptoKeyDataCtxGetProvider(ctx), AT_KEYEXCHANGE, &(hKey))) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptGetUserKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(0);
+ }
+ return (hKey);
}
/**
* xmlSecMSCryptoKeyDataGetCert:
- * @data: the key data to retrieve certificate from.
+ * @data: the key data to retrieve certificate from.
*
* Native MSCrypto certificate retrieval from xmlsec keydata. The
* returned PCCERT_CONTEXT must not be released by the caller.
@@ -652,36 +652,36 @@ xmlSecMSCryptoKeyDataDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
xmlSecAssert2(ctxSrc != NULL, -1);
if(xmlSecMSCryptoKeyDataCtxDuplicateProvider(ctxDst, ctxSrc) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "xmlSecMSCryptoKeyDataCtxDuplicateProvider",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "xmlSecMSCryptoKeyDataCtxDuplicateProvider",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if(xmlSecMSCryptoKeyDataCtxDuplicateKey(ctxDst, ctxSrc) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "xmlSecMSCryptoKeyDataCtxDuplicateKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "xmlSecMSCryptoKeyDataCtxDuplicateKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if(xmlSecMSCryptoKeyDataCtxDuplicateCert(ctxDst, ctxSrc) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "xmlSecMSCryptoKeyDataCtxDuplicateCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "xmlSecMSCryptoKeyDataCtxDuplicateCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
- ctxDst->dwKeySpec = ctxSrc->dwKeySpec;
+ ctxDst->dwKeySpec = ctxSrc->dwKeySpec;
ctxDst->providerName = ctxSrc->providerName;
ctxDst->providerType = ctxSrc->providerType;
- ctxDst->type = ctxSrc->type;
+ ctxDst->type = ctxSrc->type;
return(0);
}
@@ -732,21 +732,21 @@ xmlSecMSCryptoKeyDataGetSize(xmlSecKeyDataPtr data) {
if(xmlSecMSCryptoKeyDataCtxGetCert(ctx) != NULL) {
xmlSecAssert2(xmlSecMSCryptoKeyDataCtxGetCert(ctx)->pCertInfo != NULL, 0);
- return (CertGetPublicKeyLength(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
- &(xmlSecMSCryptoKeyDataCtxGetCert(ctx)->pCertInfo->SubjectPublicKeyInfo)));
+ return (CertGetPublicKeyLength(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
+ &(xmlSecMSCryptoKeyDataCtxGetCert(ctx)->pCertInfo->SubjectPublicKeyInfo)));
} else if (xmlSecMSCryptoKeyDataCtxGetKey(ctx) != 0) {
DWORD length = 0;
- DWORD lenlen = sizeof(DWORD);
-
- if (!CryptGetKeyParam(xmlSecMSCryptoKeyDataCtxGetKey(ctx), KP_KEYLEN, (BYTE *)&length, &lenlen, 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CertDuplicateCertificateContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(0);
- }
- return(length);
+ DWORD lenlen = sizeof(DWORD);
+
+ if (!CryptGetKeyParam(xmlSecMSCryptoKeyDataCtxGetKey(ctx), KP_KEYLEN, (BYTE *)&length, &lenlen, 0)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CertDuplicateCertificateContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(0);
+ }
+ return(length);
}
return (0);
@@ -772,7 +772,7 @@ xmlSecMSCryptoKeyDataGetType(xmlSecKeyDataPtr data) {
/**
* xmlSecMSCryptoCertDup:
- * @pCert: the pointer to cert.
+ * @pCert: the pointer to cert.
*
* Duplicates the @pCert.
*
@@ -786,12 +786,12 @@ PCCERT_CONTEXT xmlSecMSCryptoCertDup(PCCERT_CONTEXT pCert) {
ret = CertDuplicateCertificateContext(pCert);
if(ret == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CertDuplicateCertificateContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CertDuplicateCertificateContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(ret);
@@ -800,8 +800,8 @@ PCCERT_CONTEXT xmlSecMSCryptoCertDup(PCCERT_CONTEXT pCert) {
/**
* xmlSecMSCryptoCertAdopt:
- * @pCert: the pointer to cert.
- * @type: the expected key type.
+ * @pCert: the pointer to cert.
+ * @type: the expected key type.
*
* Creates key data value from the cert.
*
@@ -818,68 +818,68 @@ xmlSecMSCryptoCertAdopt(PCCERT_CONTEXT pCert, xmlSecKeyDataType type) {
#ifndef XMLSEC_NO_RSA
if (!strcmp(pCert->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId, szOID_RSA_RSA)) {
- data = xmlSecKeyDataCreate(xmlSecMSCryptoKeyDataRsaId);
- if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecMSCryptoDataRsaId");
- return(NULL);
- }
- }
-#endif /* XMLSEC_NO_RSA */
+ data = xmlSecKeyDataCreate(xmlSecMSCryptoKeyDataRsaId);
+ if(data == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecMSCryptoDataRsaId");
+ return(NULL);
+ }
+ }
+#endif /* XMLSEC_NO_RSA */
#ifndef XMLSEC_NO_DSA
if (!strcmp(pCert->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId, szOID_X957_DSA /*szOID_DSALG_SIGN*/)) {
- data = xmlSecKeyDataCreate(xmlSecMSCryptoKeyDataDsaId);
- if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecMSCryptoKeyDataDsaId");
- return(NULL);
- }
- }
-#endif /* XMLSEC_NO_DSA */
+ data = xmlSecKeyDataCreate(xmlSecMSCryptoKeyDataDsaId);
+ if(data == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecMSCryptoKeyDataDsaId");
+ return(NULL);
+ }
+ }
+#endif /* XMLSEC_NO_DSA */
#ifndef XMLSEC_NO_GOST
if (!strcmp(pCert->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId, szOID_MAGPRO_PUBKEY_SIGN_R3410_2001_CP) ||
!strcmp(pCert->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId, szOID_MAGPRO_PUBKEY_SIGN_R3410_2001) ||
- !strcmp(pCert->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId, szOID_MAGPRO_PUBKEY_SIGN_R3410_94_CP)) {
- data = xmlSecKeyDataCreate(xmlSecMSCryptoKeyDataGost2001Id);
- if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecMSCryptoKeyDataGost2001Id");
- return(NULL);
- }
- }
-#endif /* XMLSEC_NO_GOST*/
+ !strcmp(pCert->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId, szOID_MAGPRO_PUBKEY_SIGN_R3410_94_CP)) {
+ data = xmlSecKeyDataCreate(xmlSecMSCryptoKeyDataGost2001Id);
+ if(data == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecMSCryptoKeyDataGost2001Id");
+ return(NULL);
+ }
+ }
+#endif /* XMLSEC_NO_GOST*/
if (NULL == data) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_TYPE,
- "PCCERT_CONTEXT key type %s not supported", pCert->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TYPE,
+ "PCCERT_CONTEXT key type %s not supported", pCert->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId);
+ return(NULL);
}
xmlSecAssert2(data != NULL, NULL);
ret = xmlSecMSCryptoKeyDataAdoptCert(data, pCert, type);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoPCCDataAdoptPCC",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(data);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoPCCDataAdoptPCC",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(data);
+ return(NULL);
}
return(data);
}
@@ -898,7 +898,7 @@ xmlSecMSCryptoCertAdopt(PCCERT_CONTEXT pCert, xmlSecKeyDataType type) {
* <RSAKeyValue>
* <Modulus>xA7SEU+e0yQH5rm9kbCDN9o3aPIo7HbP7tX6WOocLZAtNfyxSZDU16ksL6W
* jubafOqNEpcwR3RdFsT7bCqnXPBe5ELh5u4VEy19MzxkXRgrMvavzyBpVRgBUwUlV
- * 5foK5hhmbktQhyNdy/6LpQRhDUDsTvK+g9Ucj47es9AQJ3U=
+ * 5foK5hhmbktQhyNdy/6LpQRhDUDsTvK+g9Ucj47es9AQJ3U=
* </Modulus>
* <Exponent>AQAB</Exponent>
* </RSAKeyValue>
@@ -929,23 +929,23 @@ xmlSecMSCryptoCertAdopt(PCCERT_CONTEXT pCert, xmlSecKeyDataType type) {
static int xmlSecMSCryptoKeyDataRsaInitialize(xmlSecKeyDataPtr data);
static int xmlSecMSCryptoKeyDataRsaDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src);
-static void xmlSecMSCryptoKeyDataRsaFinalize(xmlSecKeyDataPtr data);
+static void xmlSecMSCryptoKeyDataRsaFinalize(xmlSecKeyDataPtr data);
static int xmlSecMSCryptoKeyDataRsaXmlRead(xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
static int xmlSecMSCryptoKeyDataRsaXmlWrite(xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
xmlSecKeyInfoCtxPtr keyInfoCtx);
static int xmlSecMSCryptoKeyDataRsaGenerate(xmlSecKeyDataPtr data,
- xmlSecSize sizeBits,
- xmlSecKeyDataType type);
+ xmlSecSize sizeBits,
+ xmlSecKeyDataType type);
static xmlSecKeyDataType xmlSecMSCryptoKeyDataRsaGetType(xmlSecKeyDataPtr data);
static xmlSecSize xmlSecMSCryptoKeyDataRsaGetSize(xmlSecKeyDataPtr data);
-static void xmlSecMSCryptoKeyDataRsaDebugDump(xmlSecKeyDataPtr data, FILE* output);
-static void xmlSecMSCryptoKeyDataRsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output);
+static void xmlSecMSCryptoKeyDataRsaDebugDump(xmlSecKeyDataPtr data, FILE* output);
+static void xmlSecMSCryptoKeyDataRsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output);
static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataRsaKlass = {
sizeof(xmlSecKeyDataKlass),
@@ -954,35 +954,35 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataRsaKlass = {
/* data */
xmlSecNameRSAKeyValue,
xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefRSAKeyValue, /* const xmlChar* href; */
- xmlSecNodeRSAKeyValue, /* const xmlChar* dataNodeName; */
- xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefRSAKeyValue, /* const xmlChar* href; */
+ xmlSecNodeRSAKeyValue, /* const xmlChar* dataNodeName; */
+ xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecMSCryptoKeyDataRsaInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecMSCryptoKeyDataRsaDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecMSCryptoKeyDataRsaFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- xmlSecMSCryptoKeyDataRsaGenerate, /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecMSCryptoKeyDataRsaInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecMSCryptoKeyDataRsaDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecMSCryptoKeyDataRsaFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ xmlSecMSCryptoKeyDataRsaGenerate, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecMSCryptoKeyDataRsaGetType, /* xmlSecKeyDataGetTypeMethod getType; */
- xmlSecMSCryptoKeyDataRsaGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecMSCryptoKeyDataRsaGetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ xmlSecMSCryptoKeyDataRsaGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecMSCryptoKeyDataRsaXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecMSCryptoKeyDataRsaXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- NULL, /* xmlSecKeyDataBinReadMethod binRead; */
- NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecMSCryptoKeyDataRsaXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecMSCryptoKeyDataRsaXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ NULL, /* xmlSecKeyDataBinReadMethod binRead; */
+ NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecMSCryptoKeyDataRsaDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- xmlSecMSCryptoKeyDataRsaDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ xmlSecMSCryptoKeyDataRsaDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecMSCryptoKeyDataRsaDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -1031,7 +1031,7 @@ xmlSecMSCryptoKeyDataRsaFinalize(xmlSecKeyDataPtr data) {
static int
xmlSecMSCryptoKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecBn modulus, exponent;
xmlSecBuffer blob;
unsigned int blobBufferLen;
@@ -1051,46 +1051,46 @@ xmlSecMSCryptoKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
xmlSecAssert2(keyInfoCtx != NULL, -1);
if(xmlSecKeyGetValue(key) != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_KEY_DATA,
- "key already has a value");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_KEY_DATA,
+ "key already has a value");
+ return(-1);
}
/* initialize buffers */
ret = xmlSecBnInitialize(&modulus, 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBnInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "modulus");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBnInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "modulus");
+ return(-1);
}
ret = xmlSecBnInitialize(&exponent, 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBnInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "exponent");
- xmlSecBnFinalize(&modulus);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBnInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "exponent");
+ xmlSecBnFinalize(&modulus);
+ return(-1);
}
ret = xmlSecBufferInitialize(&blob, 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "blob");
- xmlSecBnFinalize(&modulus);
- xmlSecBnFinalize(&exponent);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "blob");
+ xmlSecBnFinalize(&modulus);
+ xmlSecBnFinalize(&exponent);
+ return(-1);
}
/* read xml */
@@ -1098,96 +1098,96 @@ xmlSecMSCryptoKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
/* first is Modulus node. It is REQUIRED because we do not support Seed and PgenCounter*/
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeRSAModulus, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
+ goto done;
}
ret = xmlSecBnGetNodeValue(&modulus, cur, xmlSecBnBase64, 1);
if((ret < 0) || (xmlSecBnGetSize(&modulus) == 0)){
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBnGetNodeValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBnGetNodeValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
+ goto done;
}
cur = xmlSecGetNextElementNode(cur->next);
/* next is Exponent node. It is REQUIRED because we do not support Seed and PgenCounter*/
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeRSAExponent, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
+ goto done;
}
ret = xmlSecBnGetNodeValue(&exponent, cur, xmlSecBnBase64, 1);
if((ret < 0) || (xmlSecBnGetSize(&exponent) == 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBnGetNodeValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBnGetNodeValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
+ goto done;
}
cur = xmlSecGetNextElementNode(cur->next);
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeRSAPrivateExponent, xmlSecNs))) {
/* next is X node. It is REQUIRED for private key but
- * MSCrypto does not support it. We just ignore it */
- cur = xmlSecGetNextElementNode(cur->next);
+ * MSCrypto does not support it. We just ignore it */
+ cur = xmlSecGetNextElementNode(cur->next);
}
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "no nodes expected");
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "no nodes expected");
+ goto done;
}
/* Now try to create the key */
blobBufferLen = sizeof(PUBLICKEYSTRUC) + sizeof(RSAPUBKEY) + xmlSecBnGetSize(&modulus);
ret = xmlSecBufferSetSize(&blob, blobBufferLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", blobBufferLen);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", blobBufferLen);
+ goto done;
}
/* Set the PUBLICKEYSTRUC */
pubKeyStruc = (PUBLICKEYSTRUC *)xmlSecBufferGetData(&blob);
- pubKeyStruc->bType = PUBLICKEYBLOB;
+ pubKeyStruc->bType = PUBLICKEYBLOB;
pubKeyStruc->bVersion = 0x02;
pubKeyStruc->reserved = 0;
pubKeyStruc->aiKeyAlg = CALG_RSA_KEYX | CALG_RSA_SIGN;
/* Set the public key header */
pubKey = (RSAPUBKEY*) (xmlSecBufferGetData(&blob) + sizeof(PUBLICKEYSTRUC));
- pubKey->magic = 0x31415352; /* == RSA1 public */
- pubKey->bitlen = xmlSecBnGetSize(&modulus) * 8; /* Number of bits in prime modulus */
- pubKey->pubexp = 0;
+ pubKey->magic = 0x31415352; /* == RSA1 public */
+ pubKey->bitlen = xmlSecBnGetSize(&modulus) * 8; /* Number of bits in prime modulus */
+ pubKey->pubexp = 0;
if(sizeof(pubKey->pubexp) < xmlSecBnGetSize(&exponent)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "exponent size=%d",
- xmlSecBnGetSize(&exponent));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "exponent size=%d",
+ xmlSecBnGetSize(&exponent));
+ goto done;
}
xmlSecAssert2(xmlSecBnGetData(&exponent) != NULL, -1);
memcpy(&(pubKey->pubexp), xmlSecBnGetData(&exponent), xmlSecBnGetSize(&exponent));
@@ -1198,65 +1198,65 @@ xmlSecMSCryptoKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
/* Now that we have the blob, import */
if (!CryptAcquireContext(&hProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, 0)) {
- if(NTE_BAD_KEYSET == GetLastError()) {
- if(!CryptAcquireContext(&hProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_NEWKEYSET)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "CryptAcquireContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
- } else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "CryptAcquireContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
+ if(NTE_BAD_KEYSET == GetLastError()) {
+ if(!CryptAcquireContext(&hProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_NEWKEYSET)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "CryptAcquireContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
+ } else {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "CryptAcquireContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
}
if (!CryptImportKey(hProv, xmlSecBufferGetData(&blob), xmlSecBufferGetSize(&blob), 0, 0, &hKey)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "CryptImportKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "CryptImportKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
data = xmlSecKeyDataCreate(id);
if(data == NULL ) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
ret = xmlSecMSCryptoKeyDataAdoptKey(data, hProv, TRUE, hKey, 0, xmlSecKeyDataTypePublic);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecMSCryptoKeyDataAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecMSCryptoKeyDataAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
hProv = 0;
hKey = 0;
ret = xmlSecKeySetValue(key, data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(data);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(data);
+ goto done;
}
data = NULL;
@@ -1265,7 +1265,7 @@ xmlSecMSCryptoKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
done:
if (hProv == 0) {
- CryptReleaseContext(hProv, 0);
+ CryptReleaseContext(hProv, 0);
}
if (hKey != 0) {
CryptDestroyKey(hKey);
@@ -1282,7 +1282,7 @@ done:
static int
xmlSecMSCryptoKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecMSCryptoKeyDataCtxPtr ctx;
xmlSecBuffer buf;
DWORD dwBlobLen;
@@ -1304,144 +1304,144 @@ xmlSecMSCryptoKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
xmlSecAssert2(xmlSecMSCryptoKeyDataCtxGetKey(ctx) != 0, -1);
if (!CryptExportKey(xmlSecMSCryptoKeyDataCtxGetKey(ctx), 0, PUBLICKEYBLOB, 0, NULL, &dwBlobLen)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "CryptExportKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "CryptExportKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecBufferInitialize(&buf, dwBlobLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%ld", dwBlobLen);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%ld", dwBlobLen);
+ return(-1);
}
blob = xmlSecBufferGetData(&buf);
if (!CryptExportKey(xmlSecMSCryptoKeyDataCtxGetKey(ctx), 0, PUBLICKEYBLOB, 0, blob, &dwBlobLen)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "CryptExportKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "CryptExportKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
if (dwBlobLen < sizeof(PUBLICKEYSTRUC)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "blobLen=%ld", dwBlobLen);
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "blobLen=%ld", dwBlobLen);
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
/* check PUBLICKEYSTRUC */
pubKeyStruc = (PUBLICKEYSTRUC*)blob;
if(pubKeyStruc->bVersion != 0x02) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptExportKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "pubKeyStruc->bVersion=%d", pubKeyStruc->bVersion);
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptExportKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "pubKeyStruc->bVersion=%d", pubKeyStruc->bVersion);
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
if(pubKeyStruc->bType != PUBLICKEYBLOB) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptExportKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "pubKeyStruc->bType=%d", (int)pubKeyStruc->bType);
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptExportKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "pubKeyStruc->bType=%d", (int)pubKeyStruc->bType);
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
/* check RSAPUBKEY */
- pubKey = (RSAPUBKEY *)(blob + sizeof(PUBLICKEYSTRUC));
+ pubKey = (RSAPUBKEY *)(blob + sizeof(PUBLICKEYSTRUC));
if(pubKey->magic != 0x31415352) { /* RSA public key magic */
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptExportKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "pubKey->magic=0x%08lx", pubKey->magic);
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptExportKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "pubKey->magic=0x%08lx", pubKey->magic);
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
- modulusLen = pubKey->bitlen / 8;
+ modulusLen = pubKey->bitlen / 8;
if (dwBlobLen < sizeof(PUBLICKEYSTRUC) + sizeof(RSAPUBKEY) + modulusLen) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "blobLen=%ld; modulusLen=%d", dwBlobLen, modulusLen);
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "blobLen=%ld; modulusLen=%d", dwBlobLen, modulusLen);
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
- blob += sizeof(PUBLICKEYSTRUC) + sizeof(RSAPUBKEY);
+ blob += sizeof(PUBLICKEYSTRUC) + sizeof(RSAPUBKEY);
/* first is Modulus node */
cur = xmlSecAddChild(node, xmlSecNodeRSAModulus, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
ret = xmlSecBnBlobSetNodeValue(blob, modulusLen, cur, xmlSecBnBase64, 1, 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBnBlobSetNodeValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBnBlobSetNodeValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
/* next is Exponent node. */
cur = xmlSecAddChild(node, xmlSecNodeRSAExponent, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
/* Remove leading zero's (from least significant end) */
- blob = (xmlSecByte*)(&(pubKey->pubexp));
+ blob = (xmlSecByte*)(&(pubKey->pubexp));
exponentLen = sizeof(pubKey->pubexp);
while (exponentLen > 0 && blob[exponentLen - 1] == 0) {
- exponentLen--;
+ exponentLen--;
}
ret = xmlSecBnBlobSetNodeValue(blob, exponentLen, cur, xmlSecBnBase64, 1, 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBnBlobSetNodeValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBnBlobSetNodeValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
/* next is PrivateExponent node: not supported in MSCrypto */
@@ -1452,7 +1452,7 @@ xmlSecMSCryptoKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
static int
xmlSecMSCryptoKeyDataRsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits,
- xmlSecKeyDataType type ATTRIBUTE_UNUSED) {
+ xmlSecKeyDataType type ATTRIBUTE_UNUSED) {
xmlSecMSCryptoKeyDataCtxPtr ctx;
HCRYPTPROV hProv = 0;
HCRYPTKEY hKey = 0;
@@ -1470,47 +1470,47 @@ xmlSecMSCryptoKeyDataRsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits,
xmlSecAssert2(ctx != NULL, -1);
if (!CryptAcquireContext(&hProv, XMLSEC_CONTAINER_NAME, MS_STRONG_PROV, PROV_RSA_FULL, 0)) {
- if (NTE_BAD_KEYSET == GetLastError()) {
- if(!CryptAcquireContext(&hProv, XMLSEC_CONTAINER_NAME, MS_STRONG_PROV, PROV_RSA_FULL, CRYPT_NEWKEYSET)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "CryptAcquireContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ if (NTE_BAD_KEYSET == GetLastError()) {
+ if(!CryptAcquireContext(&hProv, XMLSEC_CONTAINER_NAME, MS_STRONG_PROV, PROV_RSA_FULL, CRYPT_NEWKEYSET)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "CryptAcquireContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- } else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "CryptAcquireContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ } else {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "CryptAcquireContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ return(-1);
+ }
}
dwKeySpec = AT_KEYEXCHANGE | AT_SIGNATURE;
dwSize = ((sizeBits << 16) | CRYPT_EXPORTABLE);
if (!CryptGenKey(hProv, CALG_RSA_SIGN, dwSize, &hKey)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "CryptGenKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "CryptGenKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
ret = xmlSecMSCryptoKeyDataAdoptKey(data, hProv, TRUE, hKey, dwKeySpec,
- xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate);
+ xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecMSCryptoKeyDataAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecMSCryptoKeyDataAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
hProv = 0;
hKey = 0;
@@ -1520,11 +1520,11 @@ xmlSecMSCryptoKeyDataRsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits,
done:
if (hProv != 0) {
- CryptReleaseContext(hProv, 0);
+ CryptReleaseContext(hProv, 0);
}
if (hKey != 0) {
- CryptDestroyKey(hKey);
+ CryptDestroyKey(hKey);
}
return(res);
@@ -1548,7 +1548,7 @@ xmlSecMSCryptoKeyDataRsaDebugDump(xmlSecKeyDataPtr data, FILE* output) {
xmlSecAssert(output != NULL);
fprintf(output, "=== rsa key: size = %d\n",
- xmlSecMSCryptoKeyDataRsaGetSize(data));
+ xmlSecMSCryptoKeyDataRsaGetSize(data));
}
static void xmlSecMSCryptoKeyDataRsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
@@ -1556,7 +1556,7 @@ static void xmlSecMSCryptoKeyDataRsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* ou
xmlSecAssert(output != NULL);
fprintf(output, "<RSAKeyValue size=\"%d\" />\n",
- xmlSecMSCryptoKeyDataRsaGetSize(data));
+ xmlSecMSCryptoKeyDataRsaGetSize(data));
}
#endif /* XMLSEC_NO_RSA */
@@ -1577,7 +1577,7 @@ static void xmlSecMSCryptoKeyDataRsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* ou
* divisor of P-1
* * G - an integer with certain properties with respect to P and Q
* * Y - G**X mod P (where X is part of the private key and not made
- * public)
+ * public)
* * J - (P - 1) / Q
* * seed - a DSA prime generation seed
* * pgenCounter - a DSA prime generation counter
@@ -1635,28 +1635,28 @@ static void xmlSecMSCryptoKeyDataRsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* ou
* by this the P, Q and G are *required*!
*
*************************************************************************/
-static int xmlSecMSCryptoKeyDataDsaInitialize(xmlSecKeyDataPtr data);
-static int xmlSecMSCryptoKeyDataDsaDuplicate(xmlSecKeyDataPtr dst,
- xmlSecKeyDataPtr src);
-static void xmlSecMSCryptoKeyDataDsaFinalize(xmlSecKeyDataPtr data);
-static int xmlSecMSCryptoKeyDataDsaXmlRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecMSCryptoKeyDataDsaGenerate(xmlSecKeyDataPtr data,
- xmlSecSize sizeBits,
- xmlSecKeyDataType type);
+static int xmlSecMSCryptoKeyDataDsaInitialize(xmlSecKeyDataPtr data);
+static int xmlSecMSCryptoKeyDataDsaDuplicate(xmlSecKeyDataPtr dst,
+ xmlSecKeyDataPtr src);
+static void xmlSecMSCryptoKeyDataDsaFinalize(xmlSecKeyDataPtr data);
+static int xmlSecMSCryptoKeyDataDsaXmlRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoKeyDataDsaGenerate(xmlSecKeyDataPtr data,
+ xmlSecSize sizeBits,
+ xmlSecKeyDataType type);
static xmlSecKeyDataType xmlSecMSCryptoKeyDataDsaGetType(xmlSecKeyDataPtr data);
-static xmlSecSize xmlSecMSCryptoKeyDataDsaGetSize(xmlSecKeyDataPtr data);
-static void xmlSecMSCryptoKeyDataDsaDebugDump(xmlSecKeyDataPtr data,
- FILE* output);
-static void xmlSecMSCryptoKeyDataDsaDebugXmlDump(xmlSecKeyDataPtr data,
- FILE* output);
+static xmlSecSize xmlSecMSCryptoKeyDataDsaGetSize(xmlSecKeyDataPtr data);
+static void xmlSecMSCryptoKeyDataDsaDebugDump(xmlSecKeyDataPtr data,
+ FILE* output);
+static void xmlSecMSCryptoKeyDataDsaDebugXmlDump(xmlSecKeyDataPtr data,
+ FILE* output);
static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataDsaKlass = {
sizeof(xmlSecKeyDataKlass),
@@ -1665,35 +1665,35 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataDsaKlass = {
/* data */
xmlSecNameDSAKeyValue,
xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefDSAKeyValue, /* const xmlChar* href; */
- xmlSecNodeDSAKeyValue, /* const xmlChar* dataNodeName; */
- xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefDSAKeyValue, /* const xmlChar* href; */
+ xmlSecNodeDSAKeyValue, /* const xmlChar* dataNodeName; */
+ xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecMSCryptoKeyDataDsaInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecMSCryptoKeyDataDsaDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecMSCryptoKeyDataDsaFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- xmlSecMSCryptoKeyDataDsaGenerate, /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecMSCryptoKeyDataDsaInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecMSCryptoKeyDataDsaDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecMSCryptoKeyDataDsaFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ xmlSecMSCryptoKeyDataDsaGenerate, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecMSCryptoKeyDataDsaGetType, /* xmlSecKeyDataGetTypeMethod getType; */
- xmlSecMSCryptoKeyDataDsaGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecMSCryptoKeyDataDsaGetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ xmlSecMSCryptoKeyDataDsaGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecMSCryptoKeyDataDsaXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecMSCryptoKeyDataDsaXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- NULL, /* xmlSecKeyDataBinReadMethod binRead; */
- NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecMSCryptoKeyDataDsaXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecMSCryptoKeyDataDsaXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ NULL, /* xmlSecKeyDataBinReadMethod binRead; */
+ NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecMSCryptoKeyDataDsaDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecMSCryptoKeyDataDsaDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
xmlSecMSCryptoKeyDataDsaDebugXmlDump,/* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -1743,7 +1743,7 @@ xmlSecMSCryptoKeyDataDsaFinalize(xmlSecKeyDataPtr data) {
static int
xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyDataPtr data = NULL;
xmlNodePtr cur;
xmlSecBn p, q, g, y;
@@ -1765,73 +1765,73 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
xmlSecAssert2(keyInfoCtx != NULL, -1);
if(xmlSecKeyGetValue(key) != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_KEY_DATA,
- "key already has a value");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_KEY_DATA,
+ "key already has a value");
+ return(-1);
}
/* initialize buffers */
ret = xmlSecBnInitialize(&p, 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBnInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "p");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBnInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "p");
+ return(-1);
}
ret = xmlSecBnInitialize(&q, 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBnInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "q");
- xmlSecBnFinalize(&p);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBnInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "q");
+ xmlSecBnFinalize(&p);
+ return(-1);
}
ret = xmlSecBnInitialize(&g, 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBnInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "g");
- xmlSecBnFinalize(&p);
- xmlSecBnFinalize(&q);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBnInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "g");
+ xmlSecBnFinalize(&p);
+ xmlSecBnFinalize(&q);
+ return(-1);
}
ret = xmlSecBnInitialize(&y, 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBnInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "y");
- xmlSecBnFinalize(&p);
- xmlSecBnFinalize(&q);
- xmlSecBnFinalize(&g);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBnInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "y");
+ xmlSecBnFinalize(&p);
+ xmlSecBnFinalize(&q);
+ xmlSecBnFinalize(&g);
+ return(-1);
}
ret = xmlSecBufferInitialize(&blob, 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "blob");
- xmlSecBnFinalize(&p);
- xmlSecBnFinalize(&q);
- xmlSecBnFinalize(&g);
- xmlSecBnFinalize(&y);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "blob");
+ xmlSecBnFinalize(&p);
+ xmlSecBnFinalize(&q);
+ xmlSecBnFinalize(&g);
+ xmlSecBnFinalize(&y);
+ return(-1);
}
/* read xml */
@@ -1839,149 +1839,149 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
/* first is P node. It is REQUIRED because we do not support Seed and PgenCounter*/
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeDSAP, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAP));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAP));
+ goto done;
}
ret = xmlSecBnGetNodeValue(&p, cur, xmlSecBnBase64, 1);
if((ret < 0) || (xmlSecBnGetSize(&p) == 0)){
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBnGetNodeValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAP));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBnGetNodeValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAP));
+ goto done;
}
cur = xmlSecGetNextElementNode(cur->next);
/* next is Q node. It is REQUIRED because we do not support Seed and PgenCounter*/
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeDSAQ, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAQ));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAQ));
+ goto done;
}
ret = xmlSecBnGetNodeValue(&q, cur, xmlSecBnBase64, 1);
if((ret < 0) || (xmlSecBnGetSize(&q) == 0)){
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBnGetNodeValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAQ));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBnGetNodeValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAQ));
+ goto done;
}
cur = xmlSecGetNextElementNode(cur->next);
/* next is G node. It is REQUIRED because we do not support Seed and PgenCounter*/
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeDSAG, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAG));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAG));
+ goto done;
}
ret = xmlSecBnGetNodeValue(&g, cur, xmlSecBnBase64, 1);
if((ret < 0) || (xmlSecBnGetSize(&q) == 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBnGetNodeValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAG));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBnGetNodeValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAG));
+ goto done;
}
cur = xmlSecGetNextElementNode(cur->next);
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSAX, xmlSecNs))) {
/* next is X node. It is REQUIRED for private key but
- * MSCrypto does not support it, we just ignore it */
+ * MSCrypto does not support it, we just ignore it */
- cur = xmlSecGetNextElementNode(cur->next);
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* next is Y node. */
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeDSAY, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAY));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAY));
+ goto done;
}
ret = xmlSecBnGetNodeValue(&y, cur, xmlSecBnBase64, 1);
if((ret < 0) || (xmlSecBnGetSize(&y) == 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBnGetNodeValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s", xmlSecErrorsSafeString(xmlSecNodeDSAY));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBnGetNodeValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s", xmlSecErrorsSafeString(xmlSecNodeDSAY));
+ goto done;
}
cur = xmlSecGetNextElementNode(cur->next);
/* todo: add support for J */
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSAJ, xmlSecDSigNs))) {
- cur = xmlSecGetNextElementNode(cur->next);
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* todo: add support for seed */
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSASeed, xmlSecDSigNs))) {
- cur = xmlSecGetNextElementNode(cur->next);
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* todo: add support for pgencounter */
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSAPgenCounter, xmlSecDSigNs))) {
- cur = xmlSecGetNextElementNode(cur->next);
+ cur = xmlSecGetNextElementNode(cur->next);
}
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
/* we assume that sizeof(q) < 0x14, sizeof(g) <= sizeof(p) and sizeof(y) <= sizeof(p) */
blobBufferLen = sizeof(PUBLICKEYSTRUC) + sizeof(DSSPUBKEY) + 3 * xmlSecBnGetSize(&p) + 0x14 + sizeof(DSSSEED);
ret = xmlSecBufferSetSize(&blob, blobBufferLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", blobBufferLen);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", blobBufferLen);
+ goto done;
}
/* Set PUBLICKEYSTRUC */
- pubKeyStruc = (PUBLICKEYSTRUC *)xmlSecBufferGetData(&blob);
- pubKeyStruc->bType = PUBLICKEYBLOB;
+ pubKeyStruc = (PUBLICKEYSTRUC *)xmlSecBufferGetData(&blob);
+ pubKeyStruc->bType = PUBLICKEYBLOB;
pubKeyStruc->bVersion = 0x02;
pubKeyStruc->reserved = 0;
pubKeyStruc->aiKeyAlg = CALG_DSS_SIGN;
/* Set the public key header */
- pubKey = (DSSPUBKEY *) (xmlSecBufferGetData(&blob) + sizeof(PUBLICKEYSTRUC));
- pubKey->magic = 0x31535344; /* == DSS1 pub key */
- pubKey->bitlen = xmlSecBnGetSize(&p) * 8; /* Number of bits in prime modulus */
+ pubKey = (DSSPUBKEY *) (xmlSecBufferGetData(&blob) + sizeof(PUBLICKEYSTRUC));
+ pubKey->magic = 0x31535344; /* == DSS1 pub key */
+ pubKey->bitlen = xmlSecBnGetSize(&p) * 8; /* Number of bits in prime modulus */
/* copy the key data */
- buf = (BYTE*) (xmlSecBufferGetData(&blob) + sizeof(PUBLICKEYSTRUC) + sizeof(DSSPUBKEY));
+ buf = (BYTE*) (xmlSecBufferGetData(&blob) + sizeof(PUBLICKEYSTRUC) + sizeof(DSSPUBKEY));
/* set p */
xmlSecAssert2(xmlSecBnGetData(&p) != NULL, -1);
@@ -1990,12 +1990,12 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
/* set q */
if(xmlSecBnGetSize(&q) > 0x14) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "q",
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "size=%d > 0x14", xmlSecBnGetSize(&q));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "q",
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "size=%d > 0x14", xmlSecBnGetSize(&q));
+ goto done;
}
xmlSecAssert2(xmlSecBnGetData(&q) != NULL, -1);
memcpy(buf, xmlSecBnGetData(&q), xmlSecBnGetSize(&q));
@@ -2003,45 +2003,45 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
/* Pad with zeros */
for(i = xmlSecBnGetSize(&q); i < 0x14; ++i) {
- *(buf++) = 0;
+ *(buf++) = 0;
}
/* set generator */
if(xmlSecBnGetSize(&g) > xmlSecBnGetSize(&p)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "g",
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "size=%d > %d",
- xmlSecBnGetSize(&g),
- xmlSecBnGetSize(&p));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "g",
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "size=%d > %d",
+ xmlSecBnGetSize(&g),
+ xmlSecBnGetSize(&p));
+ goto done;
}
xmlSecAssert2(xmlSecBnGetData(&g) != NULL, -1);
memcpy(buf, xmlSecBnGetData(&g), xmlSecBnGetSize(&g));
buf += xmlSecBnGetSize(&g);
/* Pad with zeros */
for(i = xmlSecBnGetSize(&g); i < xmlSecBnGetSize(&p); ++i) {
- *(buf++) = 0;
+ *(buf++) = 0;
}
/* Public key */
if(xmlSecBnGetSize(&y) > xmlSecBnGetSize(&p)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "y",
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "size=%d > %d",
- xmlSecBnGetSize(&y),
- xmlSecBnGetSize(&p));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "y",
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "size=%d > %d",
+ xmlSecBnGetSize(&y),
+ xmlSecBnGetSize(&p));
+ goto done;
}
xmlSecAssert2(xmlSecBnGetData(&y) != NULL, -1);
memcpy(buf, xmlSecBnGetData(&y), xmlSecBnGetSize(&y));
buf += xmlSecBnGetSize(&y);
/* Pad with zeros */
for(i = xmlSecBnGetSize(&y); i < xmlSecBnGetSize(&p); ++i) {
- *(buf++) = 0;
+ *(buf++) = 0;
}
/* Set seed to 0xFFFFFFFFF */
@@ -2050,65 +2050,65 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
seed->counter = 0xFFFFFFFF; /* SEED Counter set to 0xFFFFFFFF will cause seed to be ignored */
if (!CryptAcquireContext(&hProv, NULL, MS_DEF_DSS_PROV, PROV_DSS, 0)) {
- if (NTE_BAD_KEYSET == GetLastError()) {
- if (!CryptAcquireContext(&hProv, NULL, MS_DEF_DSS_PROV, PROV_DSS, CRYPT_NEWKEYSET)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "CryptAcquireContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
- } else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "CryptAcquireContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
+ if (NTE_BAD_KEYSET == GetLastError()) {
+ if (!CryptAcquireContext(&hProv, NULL, MS_DEF_DSS_PROV, PROV_DSS, CRYPT_NEWKEYSET)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "CryptAcquireContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
+ } else {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "CryptAcquireContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
}
/* import the key blob */
if (!CryptImportKey(hProv, xmlSecBufferGetData(&blob), xmlSecBufferGetSize(&blob), 0, 0, &hKey)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "CryptImportKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "CryptImportKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
data = xmlSecKeyDataCreate(id);
if(data == NULL ) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
ret = xmlSecMSCryptoKeyDataAdoptKey(data, hProv, TRUE, hKey, 0, xmlSecKeyDataTypePublic);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecMSCryptoKeyDataAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecMSCryptoKeyDataAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
hProv = 0;
hKey = 0;
ret = xmlSecKeySetValue(key, data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
data = NULL;
@@ -2117,13 +2117,13 @@ xmlSecMSCryptoKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
done:
if (hKey != 0) {
- CryptDestroyKey(hKey);
+ CryptDestroyKey(hKey);
}
if (hProv != 0) {
- CryptReleaseContext(hProv, 0);
+ CryptReleaseContext(hProv, 0);
}
if (data != NULL) {
- xmlSecKeyDataDestroy(data);
+ xmlSecKeyDataDestroy(data);
}
xmlSecBufferFinalize(&blob);
@@ -2137,7 +2137,7 @@ done:
static int
xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecMSCryptoKeyDataCtxPtr ctx;
xmlSecBuffer buf;
DWORD dwBlobLen;
@@ -2160,127 +2160,127 @@ xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
xmlSecAssert2(xmlSecMSCryptoKeyDataCtxGetKey(ctx) != 0, -1);
if (!CryptExportKey(xmlSecMSCryptoKeyDataCtxGetKey(ctx), 0, PUBLICKEYBLOB, 0, NULL, &dwBlobLen)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "CryptExportKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "CryptExportKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecBufferInitialize(&buf, dwBlobLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%ld", dwBlobLen);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%ld", dwBlobLen);
+ return(-1);
}
blob = xmlSecBufferGetData(&buf);
if (!CryptExportKey(xmlSecMSCryptoKeyDataCtxGetKey(ctx), 0, PUBLICKEYBLOB, 0, blob, &dwBlobLen)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "CryptExportKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "CryptExportKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
if (dwBlobLen < sizeof(PUBLICKEYSTRUC)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "blobLen=%ld", dwBlobLen);
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "blobLen=%ld", dwBlobLen);
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
/* check PUBLICKEYSTRUC */
- pubKeyStruc = (PUBLICKEYSTRUC*)blob;
+ pubKeyStruc = (PUBLICKEYSTRUC*)blob;
if(pubKeyStruc->bVersion != 0x02) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptExportKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "pubKeyStruc->bVersion=%d", pubKeyStruc->bVersion);
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptExportKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "pubKeyStruc->bVersion=%d", pubKeyStruc->bVersion);
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
if(pubKeyStruc->bType != PUBLICKEYBLOB) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptExportKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "pubKeyStruc->bType=%d", (int)pubKeyStruc->bType);
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptExportKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "pubKeyStruc->bType=%d", (int)pubKeyStruc->bType);
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
/* check DSSPUBKEY */
- pubKey = (DSSPUBKEY*)(blob + sizeof(PUBLICKEYSTRUC));
+ pubKey = (DSSPUBKEY*)(blob + sizeof(PUBLICKEYSTRUC));
if(pubKey->magic != 0x31535344) { /* DSS key magic */
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptExportKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "pubKey->magic=0x%08lx", pubKey->magic);
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptExportKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "pubKey->magic=0x%08lx", pubKey->magic);
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
- keyLen = pubKey->bitlen / 8;
+ keyLen = pubKey->bitlen / 8;
/* we assume that sizeof(q) < 0x14, sizeof(g) <= sizeof(p) and sizeof(y) <= sizeof(p) */
if (dwBlobLen < sizeof(PUBLICKEYSTRUC) + sizeof(DSSPUBKEY) + 3 * keyLen + 0x14 + sizeof(DSSSEED)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "blobLen=%ld; keyLen=%d", dwBlobLen, keyLen);
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "blobLen=%ld; keyLen=%d", dwBlobLen, keyLen);
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
- blob += sizeof(PUBLICKEYSTRUC) + sizeof(DSSPUBKEY);
+ blob += sizeof(PUBLICKEYSTRUC) + sizeof(DSSPUBKEY);
/* first is P node */
cur = xmlSecAddChild(node, xmlSecNodeDSAP, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAP));
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAP));
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
ret = xmlSecBnBlobSetNodeValue(blob, keyLen, cur, xmlSecBnBase64, 1, 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBnBlobSetNodeValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAP));
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBnBlobSetNodeValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAP));
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
blob += keyLen;
/* next is Q node. */
cur = xmlSecAddChild(node, xmlSecNodeDSAQ, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAQ));
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAQ));
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
/* we think that the size of q is 0x14, skip trailing zeros */
@@ -2288,28 +2288,28 @@ xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
ret = xmlSecBnBlobSetNodeValue(blob, len, cur, xmlSecBnBase64, 1, 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBnBlobSetNodeValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAQ));
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBnBlobSetNodeValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAQ));
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
blob += 0x14;
/* next is G node. */
cur = xmlSecAddChild(node, xmlSecNodeDSAG, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAG));
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAG));
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
/* skip trailing zeros */
@@ -2317,13 +2317,13 @@ xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
ret = xmlSecBnBlobSetNodeValue(blob, len, cur, xmlSecBnBase64, 1, 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBnBlobSetNodeValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAG));
- xmlSecBufferFinalize(&buf);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBnBlobSetNodeValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAG));
+ xmlSecBufferFinalize(&buf);
return(-1);
}
blob += keyLen;
@@ -2333,14 +2333,14 @@ xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
/* next is Y node. */
cur = xmlSecAddChild(node, xmlSecNodeDSAY, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAY));
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAY));
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
/* skip trailing zeros */
@@ -2348,14 +2348,14 @@ xmlSecMSCryptoKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
ret = xmlSecBnBlobSetNodeValue(blob, len, cur, xmlSecBnBase64, 1, 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecBnBlobSetNodeValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAY));
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecBnBlobSetNodeValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAY));
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
blob += keyLen;
@@ -2381,45 +2381,45 @@ xmlSecMSCryptoKeyDataDsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, xml
ctx = xmlSecMSCryptoKeyDataGetCtx(data);
if(!CryptAcquireContext(&hProv, XMLSEC_CONTAINER_NAME, ctx->providerName, ctx->providerType, 0)) {
- if (NTE_BAD_KEYSET == GetLastError()) {
- if(!CryptAcquireContext(&hProv, XMLSEC_CONTAINER_NAME, ctx->providerName, ctx->providerType, CRYPT_NEWKEYSET)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "CryptAcquireContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- } else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "CryptAcquireContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ if (NTE_BAD_KEYSET == GetLastError()) {
+ if(!CryptAcquireContext(&hProv, XMLSEC_CONTAINER_NAME, ctx->providerName, ctx->providerType, CRYPT_NEWKEYSET)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "CryptAcquireContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ } else {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "CryptAcquireContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
dwKeySpec = AT_SIGNATURE;
dwSize = ((sizeBits << 16) | CRYPT_EXPORTABLE);
if (!CryptGenKey(hProv, CALG_DSS_SIGN, dwSize, &hKey)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "CryptGenKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "CryptGenKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
ret = xmlSecMSCryptoKeyDataAdoptKey(data, hProv, TRUE, hKey, dwKeySpec,
- xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate);
+ xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecMSCryptoKeyDataAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecMSCryptoKeyDataAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
hProv = 0;
hKey = 0;
@@ -2429,11 +2429,11 @@ xmlSecMSCryptoKeyDataDsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, xml
done:
if (hProv != 0) {
- CryptReleaseContext(hProv, 0);
+ CryptReleaseContext(hProv, 0);
}
if (hKey != 0) {
- CryptDestroyKey(hKey);
+ CryptDestroyKey(hKey);
}
return(res);
@@ -2457,7 +2457,7 @@ xmlSecMSCryptoKeyDataDsaDebugDump(xmlSecKeyDataPtr data, FILE* output) {
xmlSecAssert(output != NULL);
fprintf(output, "=== dsa key: size = %d\n",
- xmlSecMSCryptoKeyDataDsaGetSize(data));
+ xmlSecMSCryptoKeyDataDsaGetSize(data));
}
static void
@@ -2466,7 +2466,7 @@ xmlSecMSCryptoKeyDataDsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
xmlSecAssert(output != NULL);
fprintf(output, "<DSAKeyValue size=\"%d\" />\n",
- xmlSecMSCryptoKeyDataDsaGetSize(data));
+ xmlSecMSCryptoKeyDataDsaGetSize(data));
}
#endif /* XMLSEC_NO_DSA */
@@ -2478,28 +2478,28 @@ xmlSecMSCryptoKeyDataDsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
* GOST2001 xml key representation processing. Contain errors.
*
*************************************************************************/
-static int xmlSecMSCryptoKeyDataGost2001Initialize(xmlSecKeyDataPtr data);
-static int xmlSecMSCryptoKeyDataGost2001Duplicate(xmlSecKeyDataPtr dst,
- xmlSecKeyDataPtr src);
-static void xmlSecMSCryptoKeyDataGost2001Finalize(xmlSecKeyDataPtr data);
-static int xmlSecMSCryptoKeyDataGost2001XmlRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecMSCryptoKeyDataGost2001XmlWrite(xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecMSCryptoKeyDataGost2001Generate(xmlSecKeyDataPtr data,
- xmlSecSize sizeBits,
- xmlSecKeyDataType type);
+static int xmlSecMSCryptoKeyDataGost2001Initialize(xmlSecKeyDataPtr data);
+static int xmlSecMSCryptoKeyDataGost2001Duplicate(xmlSecKeyDataPtr dst,
+ xmlSecKeyDataPtr src);
+static void xmlSecMSCryptoKeyDataGost2001Finalize(xmlSecKeyDataPtr data);
+static int xmlSecMSCryptoKeyDataGost2001XmlRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoKeyDataGost2001XmlWrite(xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoKeyDataGost2001Generate(xmlSecKeyDataPtr data,
+ xmlSecSize sizeBits,
+ xmlSecKeyDataType type);
static xmlSecKeyDataType xmlSecMSCryptoKeyDataGost2001GetType(xmlSecKeyDataPtr data);
-static xmlSecSize xmlSecMSCryptoKeyDataGost2001GetSize(xmlSecKeyDataPtr data);
-static void xmlSecMSCryptoKeyDataGost2001DebugDump(xmlSecKeyDataPtr data,
- FILE* output);
-static void xmlSecMSCryptoKeyDataGost2001DebugXmlDump(xmlSecKeyDataPtr data,
- FILE* output);
+static xmlSecSize xmlSecMSCryptoKeyDataGost2001GetSize(xmlSecKeyDataPtr data);
+static void xmlSecMSCryptoKeyDataGost2001DebugDump(xmlSecKeyDataPtr data,
+ FILE* output);
+static void xmlSecMSCryptoKeyDataGost2001DebugXmlDump(xmlSecKeyDataPtr data,
+ FILE* output);
static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataGost2001Klass = {
sizeof(xmlSecKeyDataKlass),
@@ -2508,35 +2508,35 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataGost2001Klass = {
/* data */
xmlSecNameGOST2001KeyValue,
xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefGOST2001KeyValue, /* const xmlChar* href; */
- xmlSecNodeGOST2001KeyValue, /* const xmlChar* dataNodeName; */
- xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefGOST2001KeyValue, /* const xmlChar* href; */
+ xmlSecNodeGOST2001KeyValue, /* const xmlChar* dataNodeName; */
+ xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecMSCryptoKeyDataGost2001Initialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecMSCryptoKeyDataGost2001Duplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecMSCryptoKeyDataGost2001Finalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- NULL, /* xmlSecMSCryptoKeyDataGost2001Generate,*/ /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecMSCryptoKeyDataGost2001Initialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecMSCryptoKeyDataGost2001Duplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecMSCryptoKeyDataGost2001Finalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ NULL, /* xmlSecMSCryptoKeyDataGost2001Generate,*/ /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecMSCryptoKeyDataGost2001GetType, /* xmlSecKeyDataGetTypeMethod getType; */
- xmlSecMSCryptoKeyDataGost2001GetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecMSCryptoKeyDataGost2001GetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ xmlSecMSCryptoKeyDataGost2001GetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- NULL, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- NULL, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- NULL, /* xmlSecKeyDataBinReadMethod binRead; */
- NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ NULL, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ NULL, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ NULL, /* xmlSecKeyDataBinReadMethod binRead; */
+ NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecMSCryptoKeyDataGost2001DebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecMSCryptoKeyDataGost2001DebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
xmlSecMSCryptoKeyDataGost2001DebugXmlDump,/* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -2573,12 +2573,12 @@ xmlSecMSCryptoKeyDataGost2001Initialize(xmlSecKeyDataPtr data) {
ctx->providerName = "CryptoPro CSP";
ctx->providerType = PROV_CRYPTOPRO_GOST;
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecMSCryptoKeyDataGost2001Initialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return -1;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecMSCryptoKeyDataGost2001Initialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return -1;
}
}
CryptReleaseContext(tmp_ctx, 0);
@@ -2618,7 +2618,7 @@ xmlSecMSCryptoKeyDataGost2001DebugDump(xmlSecKeyDataPtr data, FILE* output) {
xmlSecAssert(output != NULL);
fprintf(output, "=== dsa key: size = %d\n",
- xmlSecMSCryptoKeyDataGost2001GetSize(data));
+ xmlSecMSCryptoKeyDataGost2001GetSize(data));
}
static void
@@ -2627,7 +2627,7 @@ xmlSecMSCryptoKeyDataGost2001DebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
xmlSecAssert(output != NULL);
fprintf(output, "<GOST2001KeyValue size=\"%d\" />\n",
- xmlSecMSCryptoKeyDataGost2001GetSize(data));
+ xmlSecMSCryptoKeyDataGost2001GetSize(data));
}
#endif /* XMLSEC_NO_GOST*/
diff --git a/src/mscrypto/ciphers.c b/src/mscrypto/ciphers.c
index 45d8296..8185f85 100644
--- a/src/mscrypto/ciphers.c
+++ b/src/mscrypto/ciphers.c
@@ -29,51 +29,51 @@
#define MS_ENH_RSA_AES_PROV_PROTO "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"
#endif /* MS_ENH_RSA_AES_PROV_PROTO */
-static BOOL xmlSecMSCryptoCreatePrivateExponentOneKey (HCRYPTPROV hProv,
- HCRYPTKEY *hPrivateKey);
-static BOOL xmlSecMSCryptoImportPlainSessionBlob (HCRYPTPROV hProv,
- HCRYPTKEY hPrivateKey,
- ALG_ID dwAlgId,
- LPBYTE pbKeyMaterial,
- DWORD dwKeyMaterial,
- HCRYPTKEY *hSessionKey);
+static BOOL xmlSecMSCryptoCreatePrivateExponentOneKey (HCRYPTPROV hProv,
+ HCRYPTKEY *hPrivateKey);
+static BOOL xmlSecMSCryptoImportPlainSessionBlob (HCRYPTPROV hProv,
+ HCRYPTKEY hPrivateKey,
+ ALG_ID dwAlgId,
+ LPBYTE pbKeyMaterial,
+ DWORD dwKeyMaterial,
+ HCRYPTKEY *hSessionKey);
/**************************************************************************
*
* Internal MSCrypto Block cipher CTX
*
*****************************************************************************/
-typedef struct _xmlSecMSCryptoBlockCipherCtx xmlSecMSCryptoBlockCipherCtx,
- *xmlSecMSCryptoBlockCipherCtxPtr;
+typedef struct _xmlSecMSCryptoBlockCipherCtx xmlSecMSCryptoBlockCipherCtx,
+ *xmlSecMSCryptoBlockCipherCtxPtr;
struct _xmlSecMSCryptoBlockCipherCtx {
- ALG_ID algorithmIdentifier;
- int mode;
- HCRYPTPROV cryptProvider;
- HCRYPTKEY cryptKey;
- HCRYPTKEY pubPrivKey;
- xmlSecKeyDataId keyId;
- LPCTSTR providerName;
- int providerType;
- int keyInitialized;
- int ctxInitialized;
- xmlSecSize keySize;
+ ALG_ID algorithmIdentifier;
+ int mode;
+ HCRYPTPROV cryptProvider;
+ HCRYPTKEY cryptKey;
+ HCRYPTKEY pubPrivKey;
+ xmlSecKeyDataId keyId;
+ LPCTSTR providerName;
+ int providerType;
+ int keyInitialized;
+ int ctxInitialized;
+ xmlSecSize keySize;
};
/* function declarations */
-static int xmlSecMSCryptoBlockCipherCtxUpdate (xmlSecMSCryptoBlockCipherCtxPtr ctx,
- xmlSecBufferPtr in,
- xmlSecBufferPtr out,
- int encrypt,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecMSCryptoBlockCipherCtxUpdate (xmlSecMSCryptoBlockCipherCtxPtr ctx,
+ xmlSecBufferPtr in,
+ xmlSecBufferPtr out,
+ int encrypt,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx);
static int
xmlSecMSCryptoBlockCipherCtxInit(xmlSecMSCryptoBlockCipherCtxPtr ctx,
- xmlSecBufferPtr in,
- xmlSecBufferPtr out,
- int encrypt,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecBufferPtr in,
+ xmlSecBufferPtr out,
+ int encrypt,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx) {
int blockLen;
int ret;
DWORD dwBlockLen, dwBlockLenLen;
@@ -88,92 +88,92 @@ xmlSecMSCryptoBlockCipherCtxInit(xmlSecMSCryptoBlockCipherCtxPtr ctx,
/* iv len == block len */
dwBlockLenLen = sizeof(DWORD);
if (!CryptGetKeyParam(ctx->cryptKey, KP_BLOCKLEN, (BYTE *)&dwBlockLen, &dwBlockLenLen, 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "CryptGetKeyParam",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "CryptGetKeyParam",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
blockLen = dwBlockLen / 8;
xmlSecAssert2(blockLen > 0, -1);
if(encrypt) {
- unsigned char* iv;
- size_t outSize;
-
- /* allocate space for IV */
- outSize = xmlSecBufferGetSize(out);
- ret = xmlSecBufferSetSize(out, outSize + blockLen);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + blockLen);
- return(-1);
- }
- iv = xmlSecBufferGetData(out) + outSize;
-
- /* generate and use random iv */
- if(!CryptGenRandom(ctx->cryptProvider, blockLen, iv)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "CryptGenRandom",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "len=%d", blockLen);
- return(-1);
- }
-
- if(!CryptSetKeyParam(ctx->cryptKey, KP_IV, iv, 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "CryptSetKeyParam",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ unsigned char* iv;
+ size_t outSize;
+
+ /* allocate space for IV */
+ outSize = xmlSecBufferGetSize(out);
+ ret = xmlSecBufferSetSize(out, outSize + blockLen);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + blockLen);
+ return(-1);
+ }
+ iv = xmlSecBufferGetData(out) + outSize;
+
+ /* generate and use random iv */
+ if(!CryptGenRandom(ctx->cryptProvider, blockLen, iv)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "CryptGenRandom",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "len=%d", blockLen);
+ return(-1);
+ }
+
+ if(!CryptSetKeyParam(ctx->cryptKey, KP_IV, iv, 0)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "CryptSetKeyParam",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
} else {
- /* if we don't have enough data, exit and hope that
- * we'll have iv next time */
- if(xmlSecBufferGetSize(in) < (size_t)blockLen) {
- return(0);
- }
- xmlSecAssert2(xmlSecBufferGetData(in) != NULL, -1);
-
- /* set iv */
- if (!CryptSetKeyParam(ctx->cryptKey, KP_IV, xmlSecBufferGetData(in), 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "CryptSetKeyParam",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- /* and remove from input */
- ret = xmlSecBufferRemoveHead(in, blockLen);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", blockLen);
- return(-1);
-
- }
+ /* if we don't have enough data, exit and hope that
+ * we'll have iv next time */
+ if(xmlSecBufferGetSize(in) < (size_t)blockLen) {
+ return(0);
+ }
+ xmlSecAssert2(xmlSecBufferGetData(in) != NULL, -1);
+
+ /* set iv */
+ if (!CryptSetKeyParam(ctx->cryptKey, KP_IV, xmlSecBufferGetData(in), 0)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "CryptSetKeyParam",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ /* and remove from input */
+ ret = xmlSecBufferRemoveHead(in, blockLen);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", blockLen);
+ return(-1);
+
+ }
}
ctx->ctxInitialized = 1;
- return(0);
+ return(0);
}
static int
xmlSecMSCryptoBlockCipherCtxUpdate(xmlSecMSCryptoBlockCipherCtxPtr ctx,
- xmlSecBufferPtr in, xmlSecBufferPtr out,
- int encrypt,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecBufferPtr in, xmlSecBufferPtr out,
+ int encrypt,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx) {
size_t inSize, inBlocks, outSize;
int blockLen;
unsigned char* outBuf;
@@ -186,15 +186,15 @@ xmlSecMSCryptoBlockCipherCtxUpdate(xmlSecMSCryptoBlockCipherCtxPtr ctx,
xmlSecAssert2(in != NULL, -1);
xmlSecAssert2(out != NULL, -1);
xmlSecAssert2(transformCtx != NULL, -1);
-
+
dwBlockLenLen = sizeof(DWORD);
if (!CryptGetKeyParam(ctx->cryptKey, KP_BLOCKLEN, (BYTE *)&dwBlockLen, &dwBlockLenLen, 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "CryptSetKeyParam",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "CryptSetKeyParam",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
blockLen = dwBlockLen / 8;
xmlSecAssert2(blockLen > 0, -1);
@@ -203,27 +203,27 @@ xmlSecMSCryptoBlockCipherCtxUpdate(xmlSecMSCryptoBlockCipherCtxPtr ctx,
outSize = xmlSecBufferGetSize(out);
if(inSize < (size_t)blockLen) {
- return(0);
+ return(0);
}
if(encrypt) {
- inBlocks = inSize / ((size_t)blockLen);
+ inBlocks = inSize / ((size_t)blockLen);
} else {
- /* we want to have the last block in the input buffer
- * for padding check */
- inBlocks = (inSize - 1) / ((size_t)blockLen);
+ /* we want to have the last block in the input buffer
+ * for padding check */
+ inBlocks = (inSize - 1) / ((size_t)blockLen);
}
inSize = inBlocks * ((size_t)blockLen);
/* we write out the input size plus may be one block */
ret = xmlSecBufferSetMaxSize(out, outSize + inSize + blockLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + inSize + blockLen);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + inSize + blockLen);
+ return(-1);
}
outBuf = xmlSecBufferGetData(out) + outSize;
inBuf = xmlSecBufferGetData(in);
@@ -232,65 +232,65 @@ xmlSecMSCryptoBlockCipherCtxUpdate(xmlSecMSCryptoBlockCipherCtxPtr ctx,
memcpy(outBuf, inBuf, inSize);
dwCLen = inSize;
if(encrypt) {
- if(!CryptEncrypt(ctx->cryptKey, 0, FALSE, 0, outBuf, &dwCLen, inSize + blockLen)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "CryptEncrypt",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ if(!CryptEncrypt(ctx->cryptKey, 0, FALSE, 0, outBuf, &dwCLen, inSize + blockLen)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "CryptEncrypt",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
} else {
- if (!CryptDecrypt(ctx->cryptKey, 0, FALSE, 0, outBuf, &dwCLen)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "CryptSetKeyDecrypt",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ if (!CryptDecrypt(ctx->cryptKey, 0, FALSE, 0, outBuf, &dwCLen)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "CryptSetKeyDecrypt",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
/* Check if we really have de/encrypted the numbers of bytes that we requested */
if (dwCLen != inSize) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "CryptEn/Decrypt",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%ld", dwCLen);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "CryptEn/Decrypt",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%ld", dwCLen);
+ return(-1);
}
/* set correct output buffer size */
ret = xmlSecBufferSetSize(out, outSize + inSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + inSize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + inSize);
+ return(-1);
}
/* remove the processed block from input */
ret = xmlSecBufferRemoveHead(in, inSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
}
return(0);
}
static int
xmlSecMSCryptoBlockCipherCtxFinal(xmlSecMSCryptoBlockCipherCtxPtr ctx,
- xmlSecBufferPtr in,
- xmlSecBufferPtr out,
- int encrypt,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecBufferPtr in,
+ xmlSecBufferPtr out,
+ int encrypt,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx) {
size_t inSize, outSize;
int blockLen, outLen = 0;
unsigned char* inBuf;
@@ -306,12 +306,12 @@ xmlSecMSCryptoBlockCipherCtxFinal(xmlSecMSCryptoBlockCipherCtxPtr ctx,
dwBlockLenLen = sizeof(DWORD);
if (!CryptGetKeyParam(ctx->cryptKey, KP_BLOCKLEN, (BYTE *)&dwBlockLen, &dwBlockLenLen, 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "CryptGetKeyParam",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "CryptGetKeyParam",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
blockLen = dwBlockLen / 8;
xmlSecAssert2(blockLen > 0, -1);
@@ -320,127 +320,127 @@ xmlSecMSCryptoBlockCipherCtxFinal(xmlSecMSCryptoBlockCipherCtxPtr ctx,
outSize = xmlSecBufferGetSize(out);
if(encrypt != 0) {
- xmlSecAssert2(inSize < (size_t)blockLen, -1);
-
- /* create padding */
- ret = xmlSecBufferSetMaxSize(in, blockLen);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", blockLen);
- return(-1);
- }
- inBuf = xmlSecBufferGetData(in);
-
- /* create random padding */
- if((size_t)blockLen > (inSize + 1)) {
- if (!CryptGenRandom(ctx->cryptProvider, blockLen - inSize - 1, inBuf + inSize)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "CryptGenRandom",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- }
- inBuf[blockLen - 1] = blockLen - inSize;
- inSize = blockLen;
+ xmlSecAssert2(inSize < (size_t)blockLen, -1);
+
+ /* create padding */
+ ret = xmlSecBufferSetMaxSize(in, blockLen);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", blockLen);
+ return(-1);
+ }
+ inBuf = xmlSecBufferGetData(in);
+
+ /* create random padding */
+ if((size_t)blockLen > (inSize + 1)) {
+ if (!CryptGenRandom(ctx->cryptProvider, blockLen - inSize - 1, inBuf + inSize)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "CryptGenRandom",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ }
+ inBuf[blockLen - 1] = blockLen - inSize;
+ inSize = blockLen;
} else {
- if(inSize != (size_t)blockLen) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "data=%d;block=%d", inSize, blockLen);
- return(-1);
- }
- inBuf = xmlSecBufferGetData(in);
+ if(inSize != (size_t)blockLen) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "data=%d;block=%d", inSize, blockLen);
+ return(-1);
+ }
+ inBuf = xmlSecBufferGetData(in);
}
/* process last block */
ret = xmlSecBufferSetMaxSize(out, outSize + 2 * blockLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + 2 * blockLen);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + 2 * blockLen);
+ return(-1);
}
outBuf = xmlSecBufferGetData(out) + outSize;
memcpy(outBuf, inBuf, inSize);
dwCLen = inSize;
if(encrypt) {
- /* Set process last block to false, since we handle padding ourselves, and MSCrypto padding
- * can be skipped. I hope this will work .... */
- if(!CryptEncrypt(ctx->cryptKey, 0, FALSE, 0, outBuf, &dwCLen, inSize + blockLen)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "CryptEncrypt",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ /* Set process last block to false, since we handle padding ourselves, and MSCrypto padding
+ * can be skipped. I hope this will work .... */
+ if(!CryptEncrypt(ctx->cryptKey, 0, FALSE, 0, outBuf, &dwCLen, inSize + blockLen)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "CryptEncrypt",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
} else {
- if (!CryptDecrypt(ctx->cryptKey, 0, FALSE, 0, outBuf, &dwCLen)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "CryptDecrypt",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ if (!CryptDecrypt(ctx->cryptKey, 0, FALSE, 0, outBuf, &dwCLen)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "CryptDecrypt",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
/* Check if we really have de/encrypted the numbers of bytes that we requested */
if (dwCLen != inSize) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "CryptEn/Decrypt",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%ld", dwCLen);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "CryptEn/Decrypt",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%ld", dwCLen);
+ return(-1);
}
if(encrypt == 0) {
- /* check padding */
- if(inSize < outBuf[blockLen - 1]) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "padding=%d;buffer=%d",
- outBuf[blockLen - 1], inSize);
- return(-1);
- }
- outLen = inSize - outBuf[blockLen - 1];
+ /* check padding */
+ if(inSize < outBuf[blockLen - 1]) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "padding=%d;buffer=%d",
+ outBuf[blockLen - 1], inSize);
+ return(-1);
+ }
+ outLen = inSize - outBuf[blockLen - 1];
} else {
- outLen = inSize;
+ outLen = inSize;
}
/* set correct output buffer size */
ret = xmlSecBufferSetSize(out, outSize + outLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + outLen);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + outLen);
+ return(-1);
}
/* remove the processed block from input */
ret = xmlSecBufferRemoveHead(in, inSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
}
return(0);
@@ -453,27 +453,27 @@ xmlSecMSCryptoBlockCipherCtxFinal(xmlSecMSCryptoBlockCipherCtxPtr ctx,
* xmlSecMSCryptoBlockCipherCtx block is located after xmlSecTransform structure
*
*****************************************************************************/
-#define xmlSecMSCryptoBlockCipherSize \
+#define xmlSecMSCryptoBlockCipherSize \
(sizeof(xmlSecTransform) + sizeof(xmlSecMSCryptoBlockCipherCtx))
#define xmlSecMSCryptoBlockCipherGetCtx(transform) \
((xmlSecMSCryptoBlockCipherCtxPtr)(((unsigned char*)(transform)) + sizeof(xmlSecTransform)))
-static int xmlSecMSCryptoBlockCipherInitialize (xmlSecTransformPtr transform);
-static void xmlSecMSCryptoBlockCipherFinalize (xmlSecTransformPtr transform);
-static int xmlSecMSCryptoBlockCipherSetKeyReq (xmlSecTransformPtr transform,
- xmlSecKeyReqPtr keyReq);
-static int xmlSecMSCryptoBlockCipherSetKey (xmlSecTransformPtr transform,
- xmlSecKeyPtr key);
-static int xmlSecMSCryptoBlockCipherExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecMSCryptoBlockCipherCheckId (xmlSecTransformPtr transform);
-
+static int xmlSecMSCryptoBlockCipherInitialize (xmlSecTransformPtr transform);
+static void xmlSecMSCryptoBlockCipherFinalize (xmlSecTransformPtr transform);
+static int xmlSecMSCryptoBlockCipherSetKeyReq (xmlSecTransformPtr transform,
+ xmlSecKeyReqPtr keyReq);
+static int xmlSecMSCryptoBlockCipherSetKey (xmlSecTransformPtr transform,
+ xmlSecKeyPtr key);
+static int xmlSecMSCryptoBlockCipherExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecMSCryptoBlockCipherCheckId (xmlSecTransformPtr transform);
+
static int
xmlSecMSCryptoBlockCipherCheckId(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_DES
if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformDes3CbcId)) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_DES */
@@ -503,94 +503,94 @@ xmlSecMSCryptoBlockCipherInitialize(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_DES
if(transform->id == xmlSecMSCryptoTransformDes3CbcId) {
- ctx->algorithmIdentifier = CALG_3DES;
- ctx->keyId = xmlSecMSCryptoKeyDataDesId;
- ctx->providerName = MS_ENHANCED_PROV;
- ctx->providerType = PROV_RSA_FULL;
- ctx->keySize = 24;
+ ctx->algorithmIdentifier = CALG_3DES;
+ ctx->keyId = xmlSecMSCryptoKeyDataDesId;
+ ctx->providerName = MS_ENHANCED_PROV;
+ ctx->providerType = PROV_RSA_FULL;
+ ctx->keySize = 24;
} else
#endif /* XMLSEC_NO_DES */
#ifndef XMLSEC_NO_AES
if(transform->id == xmlSecMSCryptoTransformAes128CbcId) {
- ctx->algorithmIdentifier = CALG_AES_128;
- ctx->keyId = xmlSecMSCryptoKeyDataAesId;
- ctx->providerName = MS_ENH_RSA_AES_PROV_PROTO;
- ctx->providerType = PROV_RSA_AES;
- ctx->keySize = 16;
+ ctx->algorithmIdentifier = CALG_AES_128;
+ ctx->keyId = xmlSecMSCryptoKeyDataAesId;
+ ctx->providerName = MS_ENH_RSA_AES_PROV_PROTO;
+ ctx->providerType = PROV_RSA_AES;
+ ctx->keySize = 16;
} else if(transform->id == xmlSecMSCryptoTransformAes192CbcId) {
- ctx->algorithmIdentifier = CALG_AES_192;
- ctx->keyId = xmlSecMSCryptoKeyDataAesId;
- ctx->providerName = MS_ENH_RSA_AES_PROV_PROTO;
- ctx->providerType = PROV_RSA_AES;
- ctx->keySize = 24;
+ ctx->algorithmIdentifier = CALG_AES_192;
+ ctx->keyId = xmlSecMSCryptoKeyDataAesId;
+ ctx->providerName = MS_ENH_RSA_AES_PROV_PROTO;
+ ctx->providerType = PROV_RSA_AES;
+ ctx->keySize = 24;
} else if(transform->id == xmlSecMSCryptoTransformAes256CbcId) {
- ctx->algorithmIdentifier = CALG_AES_256;
- ctx->keyId = xmlSecMSCryptoKeyDataAesId;
- ctx->providerName = MS_ENH_RSA_AES_PROV_PROTO;
- ctx->providerType = PROV_RSA_AES;
- ctx->keySize = 32;
+ ctx->algorithmIdentifier = CALG_AES_256;
+ ctx->keyId = xmlSecMSCryptoKeyDataAesId;
+ ctx->providerName = MS_ENH_RSA_AES_PROV_PROTO;
+ ctx->providerType = PROV_RSA_AES;
+ ctx->keySize = 32;
} else
#endif /* XMLSEC_NO_AES */
if(1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
-
+
if(!CryptAcquireContext(&ctx->cryptProvider, NULL /*"xmlSecMSCryptoTempContainer"*/,
- ctx->providerName, ctx->providerType, 0)) {
+ ctx->providerName, ctx->providerType, 0)) {
DWORD dwError = GetLastError();
- if (dwError == NTE_EXISTS) {
- if (!CryptAcquireContext(&ctx->cryptProvider, "xmlSecMSCryptoTempContainer",
- ctx->providerName, ctx->providerType, 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "CryptAcquireContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
-
- return(-1);
- }
- } else if (dwError == NTE_BAD_KEYSET) {
- /* This error can indicate that a newly installed provider
- * does not have a usable key container yet. It needs to be
- * created, and then we have to try again CryptAcquireContext.
- * This is also referenced in
- * http://www.microsoft.com/mind/0697/crypto.asp (inituser)
- */
- if(!CryptAcquireContext(&ctx->cryptProvider, NULL, ctx->providerName,
- ctx->providerType, CRYPT_NEWKEYSET)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "CryptAcquireContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- } else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "CryptAcquireContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ if (dwError == NTE_EXISTS) {
+ if (!CryptAcquireContext(&ctx->cryptProvider, "xmlSecMSCryptoTempContainer",
+ ctx->providerName, ctx->providerType, 0)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "CryptAcquireContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+
+ return(-1);
+ }
+ } else if (dwError == NTE_BAD_KEYSET) {
+ /* This error can indicate that a newly installed provider
+ * does not have a usable key container yet. It needs to be
+ * created, and then we have to try again CryptAcquireContext.
+ * This is also referenced in
+ * http://www.microsoft.com/mind/0697/crypto.asp (inituser)
+ */
+ if(!CryptAcquireContext(&ctx->cryptProvider, NULL, ctx->providerName,
+ ctx->providerType, CRYPT_NEWKEYSET)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "CryptAcquireContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ } else {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "CryptAcquireContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
/* Create dummy key to be able to import plain session keys */
if (!xmlSecMSCryptoCreatePrivateExponentOneKey(ctx->cryptProvider, &(ctx->pubPrivKey))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecMSCryptoCreatePrivateExponentOneKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecMSCryptoCreatePrivateExponentOneKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ return(-1);
}
ctx->ctxInitialized = 0;
@@ -608,15 +608,15 @@ xmlSecMSCryptoBlockCipherFinalize(xmlSecTransformPtr transform) {
xmlSecAssert(ctx != NULL);
if (ctx->cryptKey) {
- CryptDestroyKey(ctx->cryptKey);
+ CryptDestroyKey(ctx->cryptKey);
}
if (ctx->pubPrivKey) {
- CryptDestroyKey(ctx->pubPrivKey);
+ CryptDestroyKey(ctx->pubPrivKey);
}
if (ctx->cryptProvider) {
- CryptReleaseContext(ctx->cryptProvider, 0);
- CryptAcquireContext(&ctx->cryptProvider, "xmlSecMSCryptoTempContainer",
- MS_ENHANCED_PROV, ctx->providerType, CRYPT_DELETEKEYSET);
+ CryptReleaseContext(ctx->cryptProvider, 0);
+ CryptAcquireContext(&ctx->cryptProvider, "xmlSecMSCryptoTempContainer",
+ MS_ENHANCED_PROV, ctx->providerType, CRYPT_DELETEKEYSET);
}
memset(ctx, 0, sizeof(xmlSecMSCryptoBlockCipherCtx));
@@ -635,12 +635,12 @@ xmlSecMSCryptoBlockCipherSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPt
xmlSecAssert2(ctx != NULL, -1);
xmlSecAssert2(ctx->cryptProvider != 0, -1);
- keyReq->keyId = ctx->keyId;
- keyReq->keyType = xmlSecKeyDataTypeSymmetric;
+ keyReq->keyId = ctx->keyId;
+ keyReq->keyType = xmlSecKeyDataTypeSymmetric;
if(transform->operation == xmlSecTransformOperationEncrypt) {
- keyReq->keyUsage = xmlSecKeyUsageEncrypt;
+ keyReq->keyUsage = xmlSecKeyUsageEncrypt;
} else {
- keyReq->keyUsage = xmlSecKeyUsageDecrypt;
+ keyReq->keyUsage = xmlSecKeyUsageDecrypt;
}
keyReq->keyBitsSize = 8 * ctx->keySize;
@@ -670,13 +670,13 @@ xmlSecMSCryptoBlockCipherSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key)
xmlSecAssert2(buffer != NULL, -1);
if(xmlSecBufferGetSize(buffer) < ctx->keySize) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
- "keySize=%d;expected=%d",
- xmlSecBufferGetSize(buffer), ctx->keySize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
+ "keySize=%d;expected=%d",
+ xmlSecBufferGetSize(buffer), ctx->keySize);
+ return(-1);
}
bufData = xmlSecBufferGetData(buffer);
@@ -684,18 +684,18 @@ xmlSecMSCryptoBlockCipherSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key)
/* Import this key and get an HCRYPTKEY handle */
if (!xmlSecMSCryptoImportPlainSessionBlob(ctx->cryptProvider,
- ctx->pubPrivKey,
- ctx->algorithmIdentifier,
- bufData,
- ctx->keySize,
- &(ctx->cryptKey))) {
-
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecMSCryptoImportPlainSessionBlob",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ ctx->pubPrivKey,
+ ctx->algorithmIdentifier,
+ bufData,
+ ctx->keySize,
+ &(ctx->cryptKey))) {
+
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecMSCryptoImportPlainSessionBlob",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ctx->keyInitialized = 1;
@@ -712,7 +712,7 @@ xmlSecMSCryptoBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecT
xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecMSCryptoBlockCipherSize), -1);
xmlSecAssert2(transformCtx != NULL, -1);
-
+
in = &(transform->inBuf);
out = &(transform->outBuf);
@@ -720,77 +720,77 @@ xmlSecMSCryptoBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecT
xmlSecAssert2(ctx != NULL, -1);
if(transform->status == xmlSecTransformStatusNone) {
- transform->status = xmlSecTransformStatusWorking;
+ transform->status = xmlSecTransformStatusWorking;
}
if(transform->status == xmlSecTransformStatusWorking) {
- if(ctx->ctxInitialized == 0) {
- ret = xmlSecMSCryptoBlockCipherCtxInit(ctx,
- in,
- out,
- (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
- xmlSecTransformGetName(transform),
- transformCtx);
-
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecMSCryptoBlockCipherCtxInit",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- }
- if((ctx->ctxInitialized == 0) && (last != 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "not enough data to initialize transform");
- return(-1);
- }
- if(ctx->ctxInitialized != 0) {
- ret = xmlSecMSCryptoBlockCipherCtxUpdate(ctx, in, out,
- (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
- xmlSecTransformGetName(transform), transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecMSCryptoBlockCipherCtxUpdate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- }
-
- if(last) {
- ret = xmlSecMSCryptoBlockCipherCtxFinal(ctx, in, out,
- (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
- xmlSecTransformGetName(transform), transformCtx);
-
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecMSCryptoBlockCipherCtxFinal",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- transform->status = xmlSecTransformStatusFinished;
- }
+ if(ctx->ctxInitialized == 0) {
+ ret = xmlSecMSCryptoBlockCipherCtxInit(ctx,
+ in,
+ out,
+ (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
+ xmlSecTransformGetName(transform),
+ transformCtx);
+
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecMSCryptoBlockCipherCtxInit",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ }
+ if((ctx->ctxInitialized == 0) && (last != 0)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "not enough data to initialize transform");
+ return(-1);
+ }
+ if(ctx->ctxInitialized != 0) {
+ ret = xmlSecMSCryptoBlockCipherCtxUpdate(ctx, in, out,
+ (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
+ xmlSecTransformGetName(transform), transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecMSCryptoBlockCipherCtxUpdate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ }
+
+ if(last) {
+ ret = xmlSecMSCryptoBlockCipherCtxFinal(ctx, in, out,
+ (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
+ xmlSecTransformGetName(transform), transformCtx);
+
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecMSCryptoBlockCipherCtxFinal",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ transform->status = xmlSecTransformStatusFinished;
+ }
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
} else if(transform->status == xmlSecTransformStatusNone) {
- /* the only way we can get here is if there is no enough data in the input */
- xmlSecAssert2(last == 0, -1);
+ /* the only way we can get here is if there is no enough data in the input */
+ xmlSecAssert2(last == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
@@ -804,29 +804,29 @@ xmlSecMSCryptoBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecT
********************************************************************/
static xmlSecTransformKlass xmlSecMSCryptoAes128CbcKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecMSCryptoBlockCipherSize, /* xmlSecSize objSize */
-
- xmlSecNameAes128Cbc, /* const xmlChar* name; */
- xmlSecHrefAes128Cbc, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecMSCryptoBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecMSCryptoBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecMSCryptoBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecMSCryptoBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecMSCryptoBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
-
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecMSCryptoBlockCipherSize, /* xmlSecSize objSize */
+
+ xmlSecNameAes128Cbc, /* const xmlChar* name; */
+ xmlSecHrefAes128Cbc, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecMSCryptoBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecMSCryptoBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecMSCryptoBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecMSCryptoBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecMSCryptoBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
+
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -843,29 +843,29 @@ xmlSecMSCryptoTransformAes128CbcGetKlass(void) {
static xmlSecTransformKlass xmlSecMSCryptoAes192CbcKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecMSCryptoBlockCipherSize, /* xmlSecSize objSize */
-
- xmlSecNameAes192Cbc, /* const xmlChar* name; */
- xmlSecHrefAes192Cbc, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecMSCryptoBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecMSCryptoBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecMSCryptoBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecMSCryptoBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecMSCryptoBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecMSCryptoBlockCipherSize, /* xmlSecSize objSize */
+
+ xmlSecNameAes192Cbc, /* const xmlChar* name; */
+ xmlSecHrefAes192Cbc, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecMSCryptoBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecMSCryptoBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecMSCryptoBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecMSCryptoBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecMSCryptoBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -882,29 +882,29 @@ xmlSecMSCryptoTransformAes192CbcGetKlass(void) {
static xmlSecTransformKlass xmlSecMSCryptoAes256CbcKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecMSCryptoBlockCipherSize, /* xmlSecSize objSize */
-
- xmlSecNameAes256Cbc, /* const xmlChar* name; */
- xmlSecHrefAes256Cbc, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecMSCryptoBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecMSCryptoBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecMSCryptoBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecMSCryptoBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecMSCryptoBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecMSCryptoBlockCipherSize, /* xmlSecSize objSize */
+
+ xmlSecNameAes256Cbc, /* const xmlChar* name; */
+ xmlSecHrefAes256Cbc, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecMSCryptoBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecMSCryptoBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecMSCryptoBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecMSCryptoBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecMSCryptoBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -925,29 +925,29 @@ xmlSecMSCryptoTransformAes256CbcGetKlass(void) {
#ifndef XMLSEC_NO_DES
static xmlSecTransformKlass xmlSecMSCryptoDes3CbcKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* size_t klassSize */
- xmlSecMSCryptoBlockCipherSize, /* size_t objSize */
+ sizeof(xmlSecTransformKlass), /* size_t klassSize */
+ xmlSecMSCryptoBlockCipherSize, /* size_t objSize */
- xmlSecNameDes3Cbc, /* const xmlChar* name; */
- xmlSecHrefDes3Cbc, /* const xmlChar* href; */
+ xmlSecNameDes3Cbc, /* const xmlChar* name; */
+ xmlSecHrefDes3Cbc, /* const xmlChar* href; */
xmlSecTransformUsageEncryptionMethod,/* xmlSecAlgorithmUsage usage; */
xmlSecMSCryptoBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecMSCryptoBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecMSCryptoBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecMSCryptoBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecMSCryptoBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecMSCryptoBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecMSCryptoBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecMSCryptoBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecMSCryptoBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -992,70 +992,70 @@ xmlSecMSCryptoCreatePrivateExponentOneKey(HCRYPTPROV hProv, HCRYPTKEY *hPrivateK
/* Generate the private key */
if(!CryptGenKey(hProv, AT_KEYEXCHANGE, CRYPT_EXPORTABLE, &hKey)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptGenKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptGenKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
/* Export the private key, we'll convert it to a private exponent of one key */
if(!CryptExportKey(hKey, 0, PRIVATEKEYBLOB, 0, NULL, &keyBlobLen)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptExportKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptExportKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
keyBlob = (LPBYTE)xmlMalloc(sizeof(BYTE) * keyBlobLen);
if(keyBlob == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
if(!CryptExportKey(hKey, 0, PRIVATEKEYBLOB, 0, keyBlob, &keyBlobLen)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptExportKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptExportKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
CryptDestroyKey(hKey);
hKey = 0;
/* Get the bit length of the key */
if(keyBlobLen < sizeof(PUBLICKEYSTRUC) + sizeof(RSAPUBKEY)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptExportKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "len=%ld", keyBlobLen);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptExportKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "len=%ld", keyBlobLen);
+ goto done;
}
pubKeyStruc = (PUBLICKEYSTRUC*)keyBlob;
if(pubKeyStruc->bVersion != 0x02) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptExportKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "pubKeyStruc->bVersion=%d", pubKeyStruc->bVersion);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptExportKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "pubKeyStruc->bVersion=%d", pubKeyStruc->bVersion);
+ goto done;
}
if(pubKeyStruc->bType != PRIVATEKEYBLOB) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptExportKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "pubKeyStruc->bType=%d", (int)pubKeyStruc->bType);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptExportKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "pubKeyStruc->bType=%d", (int)pubKeyStruc->bType);
+ goto done;
}
/* aleksey: don't ask me why it is RSAPUBKEY, just don't ask */
@@ -1063,12 +1063,12 @@ xmlSecMSCryptoCreatePrivateExponentOneKey(HCRYPTPROV hProv, HCRYPTKEY *hPrivateK
/* check that we have RSA private key */
if(rsaPubKey->magic != 0x32415352) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptExportKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "rsaPubKey->magic=0x%08lx", rsaPubKey->magic);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptExportKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "rsaPubKey->magic=0x%08lx", rsaPubKey->magic);
+ goto done;
}
bitLen = rsaPubKey->bitlen;
@@ -1080,21 +1080,21 @@ xmlSecMSCryptoCreatePrivateExponentOneKey(HCRYPTPROV hProv, HCRYPTKEY *hPrivateK
*
* PUBLICKEYSTRUC publickeystruc ;
* RSAPUBKEY rsapubkey;
- * BYTE modulus[rsapubkey.bitlen/8]; 1/8
- * BYTE prime1[rsapubkey.bitlen/16]; 1/16
- * BYTE prime2[rsapubkey.bitlen/16]; 1/16
- * BYTE exponent1[rsapubkey.bitlen/16]; 1/16
- * BYTE exponent2[rsapubkey.bitlen/16]; 1/16
- * BYTE coefficient[rsapubkey.bitlen/16]; 1/16
- * BYTE privateExponent[rsapubkey.bitlen/8]; 1/8
+ * BYTE modulus[rsapubkey.bitlen/8]; 1/8
+ * BYTE prime1[rsapubkey.bitlen/16]; 1/16
+ * BYTE prime2[rsapubkey.bitlen/16]; 1/16
+ * BYTE exponent1[rsapubkey.bitlen/16]; 1/16
+ * BYTE exponent2[rsapubkey.bitlen/16]; 1/16
+ * BYTE coefficient[rsapubkey.bitlen/16]; 1/16
+ * BYTE privateExponent[rsapubkey.bitlen/8]; 1/8
*/
if(keyBlobLen < sizeof(PUBLICKEYSTRUC) + sizeof(RSAPUBKEY) + bitLen / 2 + bitLen / 16) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptExportKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "len=%ld", keyBlobLen);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptExportKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "len=%ld", keyBlobLen);
+ goto done;
}
ptr = (BYTE*)(keyBlob + sizeof(PUBLICKEYSTRUC) + sizeof(RSAPUBKEY));
@@ -1105,15 +1105,15 @@ xmlSecMSCryptoCreatePrivateExponentOneKey(HCRYPTPROV hProv, HCRYPTKEY *hPrivateK
/* Convert exponent1 to 1 */
for (n = 0; n < (bitLen / 16); n++) {
- if (n == 0) ptr[n] = 1;
- else ptr[n] = 0;
+ if (n == 0) ptr[n] = 1;
+ else ptr[n] = 0;
}
ptr += bitLen / 16;
/* Convert exponent2 to 1 */
for (n = 0; n < (bitLen / 16); n++) {
- if (n == 0) ptr[n] = 1;
- else ptr[n] = 0;
+ if (n == 0) ptr[n] = 1;
+ else ptr[n] = 0;
}
ptr += bitLen / 16;
@@ -1122,18 +1122,18 @@ xmlSecMSCryptoCreatePrivateExponentOneKey(HCRYPTPROV hProv, HCRYPTKEY *hPrivateK
/* Convert privateExponent to 1 */
for (n = 0; n < (bitLen / 16); n++) {
- if (n == 0) ptr[n] = 1;
- else ptr[n] = 0;
+ if (n == 0) ptr[n] = 1;
+ else ptr[n] = 0;
}
/* Import the exponent-of-one private key. */
if (!CryptImportKey(hProv, keyBlob, keyBlobLen, 0, 0, &hKey)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptImportKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptImportKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
(*hPrivateKey) = hKey;
hKey = 0;
@@ -1141,10 +1141,10 @@ xmlSecMSCryptoCreatePrivateExponentOneKey(HCRYPTPROV hProv, HCRYPTKEY *hPrivateK
done:
if(keyBlob != NULL) {
- xmlFree(keyBlob);
+ xmlFree(keyBlob);
}
if (hKey != 0) {
- CryptDestroyKey(hKey);
+ CryptDestroyKey(hKey);
}
return res;
@@ -1152,8 +1152,8 @@ done:
static BOOL
xmlSecMSCryptoImportPlainSessionBlob(HCRYPTPROV hProv, HCRYPTKEY hPrivateKey,
- ALG_ID dwAlgId, LPBYTE pbKeyMaterial,
- DWORD dwKeyMaterial, HCRYPTKEY *hSessionKey) {
+ ALG_ID dwAlgId, LPBYTE pbKeyMaterial,
+ DWORD dwKeyMaterial, HCRYPTKEY *hSessionKey) {
ALG_ID dwPrivKeyAlg;
LPBYTE keyBlob = NULL;
DWORD keyBlobLen, rndBlobSize, dwSize, n;
@@ -1179,88 +1179,88 @@ xmlSecMSCryptoImportPlainSessionBlob(HCRYPTPROV hProv, HCRYPTKEY hPrivateKey,
dwFlags = CRYPT_FIRST;
dwSize = sizeof(ProvEnum);
while(CryptGetProvParam(hProv, PP_ENUMALGS_EX, (LPBYTE)&ProvEnum, &dwSize, dwFlags)) {
- if (ProvEnum.aiAlgid == dwAlgId) {
- fFound = TRUE;
- break;
- }
+ if (ProvEnum.aiAlgid == dwAlgId) {
+ fFound = TRUE;
+ break;
+ }
dwSize = sizeof(ProvEnum);
- dwFlags = 0;
+ dwFlags = 0;
}
if(!fFound) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptGetProvParam",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "algId=%d is not supported", dwAlgId);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptGetProvParam",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "algId=%d is not supported", dwAlgId);
+ goto done;
}
/* We have to get the key size(including padding) from an HCRYPTKEY handle.
* PP_ENUMALGS_EX contains the key size without the padding so we can't use it.
*/
if(!CryptGenKey(hProv, dwAlgId, 0, &hTempKey)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptGenKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "algId=%d", dwAlgId);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptGenKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "algId=%d", dwAlgId);
+ goto done;
}
dwSize = sizeof(DWORD);
if(!CryptGetKeyParam(hTempKey, KP_KEYLEN, (LPBYTE)&dwProvSessionKeySize, &dwSize, 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptGetKeyParam(KP_KEYLEN)",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "algId=%d", dwAlgId);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptGetKeyParam(KP_KEYLEN)",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "algId=%d", dwAlgId);
+ goto done;
}
CryptDestroyKey(hTempKey);
hTempKey = 0;
/* Our key is too big, leave */
if ((dwKeyMaterial * 8) > dwProvSessionKeySize) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "dwKeyMaterial=%ld;dwProvSessionKeySize=%ld",
- dwKeyMaterial, dwProvSessionKeySize);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "dwKeyMaterial=%ld;dwProvSessionKeySize=%ld",
+ dwKeyMaterial, dwProvSessionKeySize);
+ goto done;
}
/* Get private key's algorithm */
dwSize = sizeof(ALG_ID);
if(!CryptGetKeyParam(hPrivateKey, KP_ALGID, (LPBYTE)&dwPrivKeyAlg, &dwSize, 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptGetKeyParam(KP_ALGID)",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "algId=%d", dwAlgId);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptGetKeyParam(KP_ALGID)",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "algId=%d", dwAlgId);
+ goto done;
}
/* Get private key's length in bits */
dwSize = sizeof(DWORD);
if(!CryptGetKeyParam(hPrivateKey, KP_KEYLEN, (LPBYTE)&dwPublicKeySize, &dwSize, 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptGetKeyParam(KP_KEYLEN)",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "algId=%d", dwAlgId);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptGetKeyParam(KP_KEYLEN)",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "algId=%d", dwAlgId);
+ goto done;
}
/* 3 is for the first reserved byte after the key material and the 2 reserved bytes at the end. */
if(dwPublicKeySize / 8 < dwKeyMaterial + 3) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "dwKeyMaterial=%ld;dwPublicKeySize=%ld",
- dwKeyMaterial, dwPublicKeySize);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "dwKeyMaterial=%ld;dwPublicKeySize=%ld",
+ dwKeyMaterial, dwPublicKeySize);
+ goto done;
}
rndBlobSize = dwPublicKeySize / 8 - (dwKeyMaterial + 3);
@@ -1279,30 +1279,30 @@ xmlSecMSCryptoImportPlainSessionBlob(HCRYPTPROV hProv, HCRYPTKEY hPrivateKey,
/* allocate simple blob buffer */
keyBlob = (LPBYTE)xmlMalloc(sizeof(BYTE) * keyBlobLen);
if(keyBlob == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
memset(keyBlob, 0, keyBlobLen);
/* initialize PUBLICKEYSTRUC */
- pubKeyStruc = (PUBLICKEYSTRUC*)(keyBlob);
- pubKeyStruc->bType = SIMPLEBLOB;
+ pubKeyStruc = (PUBLICKEYSTRUC*)(keyBlob);
+ pubKeyStruc->bType = SIMPLEBLOB;
pubKeyStruc->bVersion = 0x02;
pubKeyStruc->reserved = 0;
- pubKeyStruc->aiKeyAlg = dwAlgId;
+ pubKeyStruc->aiKeyAlg = dwAlgId;
/* Copy private key algorithm to buffer */
- algId = (ALG_ID*)(keyBlob + sizeof(PUBLICKEYSTRUC));
- (*algId) = dwPrivKeyAlg;
+ algId = (ALG_ID*)(keyBlob + sizeof(PUBLICKEYSTRUC));
+ (*algId) = dwPrivKeyAlg;
/* Place the key material in reverse order */
- pbPtr = (BYTE*)(keyBlob + sizeof(PUBLICKEYSTRUC) + sizeof(ALG_ID));
+ pbPtr = (BYTE*)(keyBlob + sizeof(PUBLICKEYSTRUC) + sizeof(ALG_ID));
for (n = 0; n < dwKeyMaterial; n++) {
- pbPtr[n] = pbKeyMaterial[dwKeyMaterial - n - 1];
+ pbPtr[n] = pbKeyMaterial[dwKeyMaterial - n - 1];
}
pbPtr += dwKeyMaterial;
@@ -1311,28 +1311,28 @@ xmlSecMSCryptoImportPlainSessionBlob(HCRYPTPROV hProv, HCRYPTKEY hPrivateKey,
/* Generate random data for the rest of the buffer */
if((rndBlobSize > 0) && !CryptGenRandom(hProv, rndBlobSize, pbPtr)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptGenRandom",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "rndBlobSize=%ld", rndBlobSize);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptGenRandom",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "rndBlobSize=%ld", rndBlobSize);
+ goto done;
}
/* aleksey: why are we doing this? */
for (n = 0; n < rndBlobSize; n++) {
- if (pbPtr[n] == 0) pbPtr[n] = 1;
+ if (pbPtr[n] == 0) pbPtr[n] = 1;
}
/* set magic number at the end */
keyBlob[keyBlobLen - 2] = 2;
if(!CryptImportKey(hProv, keyBlob , keyBlobLen, hPrivateKey, CRYPT_EXPORTABLE, hSessionKey)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptImportKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "algId=%d", dwAlgId);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptImportKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "algId=%d", dwAlgId);
+ goto done;
}
/* success */
@@ -1340,10 +1340,10 @@ xmlSecMSCryptoImportPlainSessionBlob(HCRYPTPROV hProv, HCRYPTKEY hPrivateKey,
done:
if(hTempKey != 0) {
- CryptDestroyKey(hTempKey);
+ CryptDestroyKey(hTempKey);
}
if(keyBlob != NULL) {
- xmlFree(keyBlob);
+ xmlFree(keyBlob);
}
return(res);
}
diff --git a/src/mscrypto/crypto.c b/src/mscrypto/crypto.c
index 484108c..374ca56 100644
--- a/src/mscrypto/crypto.c
+++ b/src/mscrypto/crypto.c
@@ -42,7 +42,7 @@ xmlSecCryptoGetFunctions_mscrypto(void) {
static xmlSecCryptoDLFunctions functions;
if(gXmlSecMSCryptoFunctions != NULL) {
- return(gXmlSecMSCryptoFunctions);
+ return(gXmlSecMSCryptoFunctions);
}
memset(&functions, 0, sizeof(functions));
@@ -51,99 +51,99 @@ xmlSecCryptoGetFunctions_mscrypto(void) {
/**
* Crypto Init/shutdown
*/
- gXmlSecMSCryptoFunctions->cryptoInit = xmlSecMSCryptoInit;
- gXmlSecMSCryptoFunctions->cryptoShutdown = xmlSecMSCryptoShutdown;
- gXmlSecMSCryptoFunctions->cryptoKeysMngrInit = xmlSecMSCryptoKeysMngrInit;
+ gXmlSecMSCryptoFunctions->cryptoInit = xmlSecMSCryptoInit;
+ gXmlSecMSCryptoFunctions->cryptoShutdown = xmlSecMSCryptoShutdown;
+ gXmlSecMSCryptoFunctions->cryptoKeysMngrInit = xmlSecMSCryptoKeysMngrInit;
/**
* Key data ids
*/
#ifndef XMLSEC_NO_DES
- gXmlSecMSCryptoFunctions->keyDataDesGetKlass = xmlSecMSCryptoKeyDataDesGetKlass;
+ gXmlSecMSCryptoFunctions->keyDataDesGetKlass = xmlSecMSCryptoKeyDataDesGetKlass;
#endif /* XMLSEC_NO_DES */
#ifndef XMLSEC_NO_AES
- gXmlSecMSCryptoFunctions->keyDataAesGetKlass = xmlSecMSCryptoKeyDataAesGetKlass;
+ gXmlSecMSCryptoFunctions->keyDataAesGetKlass = xmlSecMSCryptoKeyDataAesGetKlass;
#endif /* XMLSEC_NO_AES */
#ifndef XMLSEC_NO_RSA
- gXmlSecMSCryptoFunctions->keyDataRsaGetKlass = xmlSecMSCryptoKeyDataRsaGetKlass;
+ gXmlSecMSCryptoFunctions->keyDataRsaGetKlass = xmlSecMSCryptoKeyDataRsaGetKlass;
#endif /* XMLSEC_NO_RSA */
#ifndef XMLSEC_NO_DSA
- gXmlSecMSCryptoFunctions->keyDataDsaGetKlass = xmlSecMSCryptoKeyDataDsaGetKlass;
+ gXmlSecMSCryptoFunctions->keyDataDsaGetKlass = xmlSecMSCryptoKeyDataDsaGetKlass;
#endif /* XMLSEC_NO_DSA */
#ifndef XMLSEC_NO_GOST
- gXmlSecMSCryptoFunctions->keyDataGost2001GetKlass = xmlSecMSCryptoKeyDataGost2001GetKlass;
+ gXmlSecMSCryptoFunctions->keyDataGost2001GetKlass = xmlSecMSCryptoKeyDataGost2001GetKlass;
#endif /* XMLSEC_NO_GOST*/
#ifndef XMLSEC_NO_X509
- gXmlSecMSCryptoFunctions->keyDataX509GetKlass = xmlSecMSCryptoKeyDataX509GetKlass;
- gXmlSecMSCryptoFunctions->keyDataRawX509CertGetKlass = xmlSecMSCryptoKeyDataRawX509CertGetKlass;
+ gXmlSecMSCryptoFunctions->keyDataX509GetKlass = xmlSecMSCryptoKeyDataX509GetKlass;
+ gXmlSecMSCryptoFunctions->keyDataRawX509CertGetKlass = xmlSecMSCryptoKeyDataRawX509CertGetKlass;
#endif /* XMLSEC_NO_X509 */
/**
* Key data store ids
*/
#ifndef XMLSEC_NO_X509
- gXmlSecMSCryptoFunctions->x509StoreGetKlass = xmlSecMSCryptoX509StoreGetKlass;
+ gXmlSecMSCryptoFunctions->x509StoreGetKlass = xmlSecMSCryptoX509StoreGetKlass;
#endif /* XMLSEC_NO_X509 */
/**
* Crypto transforms ids
*/
#ifndef XMLSEC_NO_AES
- gXmlSecMSCryptoFunctions->transformAes128CbcGetKlass = xmlSecMSCryptoTransformAes128CbcGetKlass;
- gXmlSecMSCryptoFunctions->transformAes192CbcGetKlass = xmlSecMSCryptoTransformAes192CbcGetKlass;
- gXmlSecMSCryptoFunctions->transformAes256CbcGetKlass = xmlSecMSCryptoTransformAes256CbcGetKlass;
+ gXmlSecMSCryptoFunctions->transformAes128CbcGetKlass = xmlSecMSCryptoTransformAes128CbcGetKlass;
+ gXmlSecMSCryptoFunctions->transformAes192CbcGetKlass = xmlSecMSCryptoTransformAes192CbcGetKlass;
+ gXmlSecMSCryptoFunctions->transformAes256CbcGetKlass = xmlSecMSCryptoTransformAes256CbcGetKlass;
#endif /* XMLSEC_NO_AES */
#ifndef XMLSEC_NO_DES
- gXmlSecMSCryptoFunctions->transformDes3CbcGetKlass = xmlSecMSCryptoTransformDes3CbcGetKlass;
+ gXmlSecMSCryptoFunctions->transformDes3CbcGetKlass = xmlSecMSCryptoTransformDes3CbcGetKlass;
#endif /* XMLSEC_NO_DES */
#ifndef XMLSEC_NO_RSA
- gXmlSecMSCryptoFunctions->transformRsaSha1GetKlass = xmlSecMSCryptoTransformRsaSha1GetKlass;
- gXmlSecMSCryptoFunctions->transformRsaPkcs1GetKlass = xmlSecMSCryptoTransformRsaPkcs1GetKlass;
+ gXmlSecMSCryptoFunctions->transformRsaSha1GetKlass = xmlSecMSCryptoTransformRsaSha1GetKlass;
+ gXmlSecMSCryptoFunctions->transformRsaPkcs1GetKlass = xmlSecMSCryptoTransformRsaPkcs1GetKlass;
#endif /* XMLSEC_NO_RSA */
#ifndef XMLSEC_NO_DSA
- gXmlSecMSCryptoFunctions->transformDsaSha1GetKlass = xmlSecMSCryptoTransformDsaSha1GetKlass;
+ gXmlSecMSCryptoFunctions->transformDsaSha1GetKlass = xmlSecMSCryptoTransformDsaSha1GetKlass;
#endif /* XMLSEC_NO_DSA */
#ifndef XMLSEC_NO_GOST
- gXmlSecMSCryptoFunctions->transformGost2001GostR3411_94GetKlass = xmlSecMSCryptoTransformGost2001GostR3411_94GetKlass;
+ gXmlSecMSCryptoFunctions->transformGost2001GostR3411_94GetKlass = xmlSecMSCryptoTransformGost2001GostR3411_94GetKlass;
#endif /* XMLSEC_NO_GOST */
#ifndef XMLSEC_NO_SHA1
- gXmlSecMSCryptoFunctions->transformSha1GetKlass = xmlSecMSCryptoTransformSha1GetKlass;
+ gXmlSecMSCryptoFunctions->transformSha1GetKlass = xmlSecMSCryptoTransformSha1GetKlass;
#endif /* XMLSEC_NO_SHA1 */
#ifndef XMLSEC_NO_GOST
- gXmlSecMSCryptoFunctions->transformGostR3411_94GetKlass = xmlSecMSCryptoTransformGostR3411_94GetKlass;
+ gXmlSecMSCryptoFunctions->transformGostR3411_94GetKlass = xmlSecMSCryptoTransformGostR3411_94GetKlass;
#endif /* XMLSEC_NO_GOST */
/**
* High level routines form xmlsec command line utility
*/
- gXmlSecMSCryptoFunctions->cryptoAppInit = xmlSecMSCryptoAppInit;
- gXmlSecMSCryptoFunctions->cryptoAppShutdown = xmlSecMSCryptoAppShutdown;
- gXmlSecMSCryptoFunctions->cryptoAppDefaultKeysMngrInit = xmlSecMSCryptoAppDefaultKeysMngrInit;
- gXmlSecMSCryptoFunctions->cryptoAppDefaultKeysMngrAdoptKey = xmlSecMSCryptoAppDefaultKeysMngrAdoptKey;
- gXmlSecMSCryptoFunctions->cryptoAppDefaultKeysMngrLoad = xmlSecMSCryptoAppDefaultKeysMngrLoad;
- gXmlSecMSCryptoFunctions->cryptoAppDefaultKeysMngrSave = xmlSecMSCryptoAppDefaultKeysMngrSave;
+ gXmlSecMSCryptoFunctions->cryptoAppInit = xmlSecMSCryptoAppInit;
+ gXmlSecMSCryptoFunctions->cryptoAppShutdown = xmlSecMSCryptoAppShutdown;
+ gXmlSecMSCryptoFunctions->cryptoAppDefaultKeysMngrInit = xmlSecMSCryptoAppDefaultKeysMngrInit;
+ gXmlSecMSCryptoFunctions->cryptoAppDefaultKeysMngrAdoptKey = xmlSecMSCryptoAppDefaultKeysMngrAdoptKey;
+ gXmlSecMSCryptoFunctions->cryptoAppDefaultKeysMngrLoad = xmlSecMSCryptoAppDefaultKeysMngrLoad;
+ gXmlSecMSCryptoFunctions->cryptoAppDefaultKeysMngrSave = xmlSecMSCryptoAppDefaultKeysMngrSave;
#ifndef XMLSEC_NO_X509
- gXmlSecMSCryptoFunctions->cryptoAppKeysMngrCertLoad = xmlSecMSCryptoAppKeysMngrCertLoad;
- gXmlSecMSCryptoFunctions->cryptoAppKeysMngrCertLoadMemory = xmlSecMSCryptoAppKeysMngrCertLoadMemory;
- gXmlSecMSCryptoFunctions->cryptoAppPkcs12Load = xmlSecMSCryptoAppPkcs12Load;
- gXmlSecMSCryptoFunctions->cryptoAppPkcs12LoadMemory = xmlSecMSCryptoAppPkcs12LoadMemory;
- gXmlSecMSCryptoFunctions->cryptoAppKeyCertLoad = xmlSecMSCryptoAppKeyCertLoad;
- gXmlSecMSCryptoFunctions->cryptoAppKeyCertLoadMemory = xmlSecMSCryptoAppKeyCertLoadMemory;
+ gXmlSecMSCryptoFunctions->cryptoAppKeysMngrCertLoad = xmlSecMSCryptoAppKeysMngrCertLoad;
+ gXmlSecMSCryptoFunctions->cryptoAppKeysMngrCertLoadMemory = xmlSecMSCryptoAppKeysMngrCertLoadMemory;
+ gXmlSecMSCryptoFunctions->cryptoAppPkcs12Load = xmlSecMSCryptoAppPkcs12Load;
+ gXmlSecMSCryptoFunctions->cryptoAppPkcs12LoadMemory = xmlSecMSCryptoAppPkcs12LoadMemory;
+ gXmlSecMSCryptoFunctions->cryptoAppKeyCertLoad = xmlSecMSCryptoAppKeyCertLoad;
+ gXmlSecMSCryptoFunctions->cryptoAppKeyCertLoadMemory = xmlSecMSCryptoAppKeyCertLoadMemory;
#endif /* XMLSEC_NO_X509 */
- gXmlSecMSCryptoFunctions->cryptoAppKeyLoad = xmlSecMSCryptoAppKeyLoad;
- gXmlSecMSCryptoFunctions->cryptoAppKeyLoadMemory = xmlSecMSCryptoAppKeyLoadMemory;
- gXmlSecMSCryptoFunctions->cryptoAppDefaultPwdCallback = (void*)xmlSecMSCryptoAppGetDefaultPwdCallback();
+ gXmlSecMSCryptoFunctions->cryptoAppKeyLoad = xmlSecMSCryptoAppKeyLoad;
+ gXmlSecMSCryptoFunctions->cryptoAppKeyLoadMemory = xmlSecMSCryptoAppKeyLoadMemory;
+ gXmlSecMSCryptoFunctions->cryptoAppDefaultPwdCallback = (void*)xmlSecMSCryptoAppGetDefaultPwdCallback();
return(gXmlSecMSCryptoFunctions);
}
@@ -159,12 +159,12 @@ int
xmlSecMSCryptoInit (void) {
/* Check loaded xmlsec library version */
if(xmlSecCheckVersionExact() != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCheckVersionExact",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCheckVersionExact",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* set default errors callback for xmlsec to us */
@@ -172,12 +172,12 @@ xmlSecMSCryptoInit (void) {
/* register our klasses */
if(xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(xmlSecCryptoGetFunctions_mscrypto()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
@@ -197,7 +197,7 @@ xmlSecMSCryptoShutdown(void) {
/**
* xmlSecMSCryptoKeysMngrInit:
- * @mngr: the pointer to keys manager.
+ * @mngr: the pointer to keys manager.
*
* Adds MSCrypto specific key data stores in keys manager.
*
@@ -243,8 +243,8 @@ xmlSecMSCryptoKeysMngrInit(xmlSecKeysMngrPtr mngr) {
/**
* xmlSecMSCryptoGenerateRandom:
- * @buffer: the destination buffer.
- * @size: the numer of bytes to generate.
+ * @buffer: the destination buffer.
+ * @size: the numer of bytes to generate.
*
* Generates @size random bytes and puts result in @buffer
* (not implemented yet).
@@ -252,7 +252,7 @@ xmlSecMSCryptoKeysMngrInit(xmlSecKeysMngrPtr mngr) {
* Returns: 0 on success or a negative value otherwise.
*/
int
-xmlSecMSCryptoGenerateRandom(xmlSecBufferPtr buffer, size_t size) {
+xmlSecMSCryptoGenerateRandom(xmlSecBufferPtr buffer, size_t size) {
HCRYPTPROV hProv = 0;
int ret;
@@ -261,30 +261,30 @@ xmlSecMSCryptoGenerateRandom(xmlSecBufferPtr buffer, size_t size) {
ret = xmlSecBufferSetSize(buffer, size);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", size);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", size);
+ return(-1);
}
if (FALSE == CryptAcquireContext(&hProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptAcquireContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptAcquireContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if (FALSE == CryptGenRandom(hProv, (DWORD)size, xmlSecBufferGetData(buffer))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptGenRandom",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CryptReleaseContext(hProv,0);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptGenRandom",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CryptReleaseContext(hProv,0);
+ return(-1);
}
CryptReleaseContext(hProv, 0);
@@ -293,52 +293,52 @@ xmlSecMSCryptoGenerateRandom(xmlSecBufferPtr buffer, size_t size) {
/**
* xmlSecMSCryptoErrorsDefaultCallback:
- * @file: the error location file name (__FILE__ macro).
- * @line: the error location line number (__LINE__ macro).
- * @func: the error location function name (__FUNCTION__ macro).
- * @errorObject: the error specific error object
- * @errorSubject: the error specific error subject.
- * @reason: the error code.
- * @msg: the additional error message.
+ * @file: the error location file name (__FILE__ macro).
+ * @line: the error location line number (__LINE__ macro).
+ * @func: the error location function name (__FUNCTION__ macro).
+ * @errorObject: the error specific error object
+ * @errorSubject: the error specific error subject.
+ * @reason: the error code.
+ * @msg: the additional error message.
*
* The default errors reporting callback function.
*/
void
xmlSecMSCryptoErrorsDefaultCallback(const char* file, int line, const char* func,
- const char* errorObject, const char* errorSubject,
- int reason, const char* msg) {
+ const char* errorObject, const char* errorSubject,
+ int reason, const char* msg) {
DWORD dwError;
LPVOID lpMsgBuf;
xmlChar buf[500];
dwError = GetLastError();
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- dwError,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
- (LPTSTR) &lpMsgBuf,
- 0,
- NULL);
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ dwError,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
+ (LPTSTR) &lpMsgBuf,
+ 0,
+ NULL);
if((msg != NULL) && ((*msg) != '\0')) {
xmlSecStrPrintf(buf, sizeof(buf), BAD_CAST "%s;last error=%d (0x%08x);last error msg=%s", msg, dwError, dwError, (LPTSTR)lpMsgBuf);
} else {
xmlSecStrPrintf(buf, sizeof(buf), BAD_CAST "last error=%d (0x%08x);last error msg=%s", dwError, dwError, (LPTSTR)lpMsgBuf);
}
xmlSecErrorsDefaultCallback(file, line, func,
- errorObject, errorSubject,
- reason, (char*)buf);
+ errorObject, errorSubject,
+ reason, (char*)buf);
LocalFree(lpMsgBuf);
}
/**
* xmlSecMSCryptoCertStrToName:
- * @dwCertEncodingType: the encoding used.
- * @pszX500: the string to convert.
- * @dwStrType: the string type.
- * @len: the result len.
+ * @dwCertEncodingType: the encoding used.
+ * @pszX500: the string to convert.
+ * @dwStrType: the string type.
+ * @len: the result len.
*
* Converts input string to name by calling @CertStrToName function.
*
@@ -353,32 +353,32 @@ xmlSecMSCryptoCertStrToName(DWORD dwCertEncodingType, LPCTSTR pszX500, DWORD dwS
xmlSecAssert2(len != NULL, NULL);
if (!CertStrToName(dwCertEncodingType, pszX500, dwStrType,
- NULL, NULL, len, &ppszError)) {
- /* this might not be an error, string might just not exist */
+ NULL, NULL, len, &ppszError)) {
+ /* this might not be an error, string might just not exist */
DWORD dw = GetLastError();
- return(NULL);
+ return(NULL);
}
-
+
str = (BYTE *)xmlMalloc((*len) + 1);
if(str == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "len=%ld", (*len));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "len=%ld", (*len));
+ return(NULL);
}
memset(str, 0, (*len) + 1);
-
+
if (!CertStrToName(dwCertEncodingType, pszX500, dwStrType,
- NULL, str, len, NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CertStrToName",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(str);
- return(NULL);
+ NULL, str, len, NULL)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CertStrToName",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(str);
+ return(NULL);
}
return(str);
diff --git a/src/mscrypto/csp_calg.h b/src/mscrypto/csp_calg.h
index 139b722..706a898 100644
--- a/src/mscrypto/csp_calg.h
+++ b/src/mscrypto/csp_calg.h
@@ -12,22 +12,22 @@
#define ALG_TYPE_GR3410 (7 << 9)
-#define ALG_SID_MAGPRO_R3410_94 64
-#define ALG_SID_MAGPRO_R3410_94_EPHEM 65
-#define ALG_SID_MAGPRO_R3410_2001 66
-#define ALG_SID_MAGPRO_R3410_2001_EPHEM 67
-#define ALG_SID_MAGPRO_28147_89 68
-#define ALG_SID_GR3411 30
-#define ALG_SID_G28147 30
-
-#define ALG_SID_GR3410 30
-#define ALG_SID_DH_EX_SF 30
-#define ALG_SID_DH_EX_EPHEM 31
-#define ALG_SID_PRO_AGREEDKEY_DH 33
-#define ALG_SID_PRO_SIMMETRYKEY 34
-#define ALG_SID_GR3410EL 35
-#define ALG_SID_DH_EL_SF 36
-#define ALG_SID_DH_EL_EPHEM 37
+#define ALG_SID_MAGPRO_R3410_94 64
+#define ALG_SID_MAGPRO_R3410_94_EPHEM 65
+#define ALG_SID_MAGPRO_R3410_2001 66
+#define ALG_SID_MAGPRO_R3410_2001_EPHEM 67
+#define ALG_SID_MAGPRO_28147_89 68
+#define ALG_SID_GR3411 30
+#define ALG_SID_G28147 30
+
+#define ALG_SID_GR3410 30
+#define ALG_SID_DH_EX_SF 30
+#define ALG_SID_DH_EX_EPHEM 31
+#define ALG_SID_PRO_AGREEDKEY_DH 33
+#define ALG_SID_PRO_SIMMETRYKEY 34
+#define ALG_SID_GR3410EL 35
+#define ALG_SID_DH_EL_SF 36
+#define ALG_SID_DH_EL_EPHEM 37
/*! \defgroup CALG_MAGPRO CALG_MAGPRO
* \brief The description of CALG_MAGPRO
@@ -54,17 +54,17 @@
#define CALG_MAGPRO_ENCR_28147_89 (ALG_CLASS_DATA_ENCRYPT | ALG_TYPE_BLOCK | ALG_SID_G28147)
-#define CALG_GR3410 (ALG_CLASS_SIGNATURE | ALG_TYPE_GR3410 | ALG_SID_GR3410)
+#define CALG_GR3410 (ALG_CLASS_SIGNATURE | ALG_TYPE_GR3410 | ALG_SID_GR3410)
-#define CALG_GR3410EL (ALG_CLASS_SIGNATURE | ALG_TYPE_GR3410 | ALG_SID_GR3410EL)
+#define CALG_GR3410EL (ALG_CLASS_SIGNATURE | ALG_TYPE_GR3410 | ALG_SID_GR3410EL)
-#define CALG_DH_EX_SF (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_EX_SF)
+#define CALG_DH_EX_SF (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_EX_SF)
-#define CALG_DH_EX_EPHEM (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_EX_EPHEM)
+#define CALG_DH_EX_EPHEM (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_EX_EPHEM)
-#define CALG_DH_EL_SF (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_EL_SF)
+#define CALG_DH_EL_SF (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_EL_SF)
-#define CALG_DH_EL_EPHEM (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_EL_EPHEM)
+#define CALG_DH_EL_EPHEM (ALG_CLASS_KEY_EXCHANGE | ALG_TYPE_DH | ALG_SID_DH_EL_EPHEM)
/*! @} */
/*! \defgroup PROV_TYPE PROV_TYPE
@@ -83,9 +83,9 @@
* @{
*/
-#define PP_RNGTYPE 201
-#define PP_RNGSHARED 202
-#define PP_SETUP_UI 203
+#define PP_RNGTYPE 201
+#define PP_RNGSHARED 202
+#define PP_SETUP_UI 203
/*! @} */
diff --git a/src/mscrypto/csp_oid.h b/src/mscrypto/csp_oid.h
index d3cd19e..b4de688 100644
--- a/src/mscrypto/csp_oid.h
+++ b/src/mscrypto/csp_oid.h
@@ -79,21 +79,21 @@
#define szOID_MAGPRO_PARAM_PK_CC_94 "1.2.643.2.2.32.2"
-#define szOID_CP_PARAM_R3411_94_DEF "1.2.643.2.2.30.1"
-#define szOID_CP_PARAM_R3411_94_1 "1.2.643.2.2.30.2"
-#define szOID_CP_PARAM_R3411_94_2 "1.2.643.2.2.30.3"
-#define szOID_CP_PARAM_R3411_94_3 "1.2.643.2.2.30.4"
-
-#define szOID_CP_PARAM_28147_89_DEF "1.2.643.2.2.31.1"
-#define szOID_CP_PARAM_28147_89_1 "1.2.643.2.2.31.2"
-#define szOID_CP_PARAM_28147_89_2 "1.2.643.2.2.31.3"
-#define szOID_CP_PARAM_28147_89_3 "1.2.643.2.2.31.4"
-#define szOID_CP_PARAM_28147_89_4 "1.2.643.2.2.31.5"
-#define szOID_CP_PARAM_28147_89_5 "1.2.643.2.2.31.6"
-#define szOID_CP_PARAM_28147_89_6 "1.2.643.2.2.31.7"
+#define szOID_CP_PARAM_R3411_94_DEF "1.2.643.2.2.30.1"
+#define szOID_CP_PARAM_R3411_94_1 "1.2.643.2.2.30.2"
+#define szOID_CP_PARAM_R3411_94_2 "1.2.643.2.2.30.3"
+#define szOID_CP_PARAM_R3411_94_3 "1.2.643.2.2.30.4"
+
+#define szOID_CP_PARAM_28147_89_DEF "1.2.643.2.2.31.1"
+#define szOID_CP_PARAM_28147_89_1 "1.2.643.2.2.31.2"
+#define szOID_CP_PARAM_28147_89_2 "1.2.643.2.2.31.3"
+#define szOID_CP_PARAM_28147_89_3 "1.2.643.2.2.31.4"
+#define szOID_CP_PARAM_28147_89_4 "1.2.643.2.2.31.5"
+#define szOID_CP_PARAM_28147_89_5 "1.2.643.2.2.31.6"
+#define szOID_CP_PARAM_28147_89_6 "1.2.643.2.2.31.7"
/* OID for Signature 1024*/
-#define szOID_CP_PARAM_PK_R3410_94_DEF "1.2.643.2.2.32.2" /*VerbaO*/
+#define szOID_CP_PARAM_PK_R3410_94_DEF "1.2.643.2.2.32.2" /*VerbaO*/
#define szOID_CP_PARAM_PK_R3410_94_S1 "1.2.643.2.2.32.3"
#define szOID_CP_PARAM_PK_R3410_94_S2 "1.2.643.2.2.32.4"
#define szOID_CP_PARAM_PK_R3410_94_S3 "1.2.643.2.2.32.5"
@@ -102,11 +102,11 @@
#define szOID_CP_PARAM_PK_R3410_94_E2 "1.2.643.2.2.33.2"
#define szOID_CP_PARAM_PK_R3410_94_E3 "1.2.643.2.2.33.3"
-#define szOID_CP_PARAM_PK_R3410_2001_DEF "1.2.643.2.2.35.1"
-#define szOID_CP_PARAM_PK_R3410_2001_S0 "1.2.643.2.2.35.2"
-#define szOID_CP_PARAM_PK_R3410_2001_S1 "1.2.643.2.2.35.3"
-#define szOID_CP_PARAM_PK_R3410_2001_E0 "1.2.643.2.2.36.0"
-#define szOID_CP_PARAM_PK_R3410_2001_E1 "1.2.643.2.2.36.1"
+#define szOID_CP_PARAM_PK_R3410_2001_DEF "1.2.643.2.2.35.1"
+#define szOID_CP_PARAM_PK_R3410_2001_S0 "1.2.643.2.2.35.2"
+#define szOID_CP_PARAM_PK_R3410_2001_S1 "1.2.643.2.2.35.3"
+#define szOID_CP_PARAM_PK_R3410_2001_E0 "1.2.643.2.2.36.0"
+#define szOID_CP_PARAM_PK_R3410_2001_E1 "1.2.643.2.2.36.1"
/*! @} */
diff --git a/src/mscrypto/digests.c b/src/mscrypto/digests.c
index 92f76a3..e4d58a9 100644
--- a/src/mscrypto/digests.c
+++ b/src/mscrypto/digests.c
@@ -25,14 +25,14 @@
#define MSCRYPTO_MAX_HASH_SIZE 256
-typedef struct _xmlSecMSCryptoDigestCtx xmlSecMSCryptoDigestCtx, *xmlSecMSCryptoDigestCtxPtr;
+typedef struct _xmlSecMSCryptoDigestCtx xmlSecMSCryptoDigestCtx, *xmlSecMSCryptoDigestCtxPtr;
struct _xmlSecMSCryptoDigestCtx {
- HCRYPTPROV provider;
- ALG_ID alg_id;
- HCRYPTHASH mscHash;
+ HCRYPTPROV provider;
+ ALG_ID alg_id;
+ HCRYPTHASH mscHash;
unsigned char dgst[MSCRYPTO_MAX_HASH_SIZE];
- size_t dgstSize; /* dgst size in bytes */
-};
+ size_t dgstSize; /* dgst size in bytes */
+};
/******************************************************************************
*
@@ -41,35 +41,35 @@ struct _xmlSecMSCryptoDigestCtx {
* xmlSecMSCryptoDigestCtx is located after xmlSecTransform
*
*****************************************************************************/
-#define xmlSecMSCryptoDigestSize \
- (sizeof(xmlSecTransform) + sizeof(xmlSecMSCryptoDigestCtx))
+#define xmlSecMSCryptoDigestSize \
+ (sizeof(xmlSecTransform) + sizeof(xmlSecMSCryptoDigestCtx))
#define xmlSecMSCryptoDigestGetCtx(transform) \
((xmlSecMSCryptoDigestCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-static int xmlSecMSCryptoDigestInitialize (xmlSecTransformPtr transform);
-static void xmlSecMSCryptoDigestFinalize (xmlSecTransformPtr transform);
-static int xmlSecMSCryptoDigestVerify (xmlSecTransformPtr transform,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecMSCryptoDigestExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecMSCryptoDigestCheckId (xmlSecTransformPtr transform);
+static int xmlSecMSCryptoDigestInitialize (xmlSecTransformPtr transform);
+static void xmlSecMSCryptoDigestFinalize (xmlSecTransformPtr transform);
+static int xmlSecMSCryptoDigestVerify (xmlSecTransformPtr transform,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecMSCryptoDigestExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecMSCryptoDigestCheckId (xmlSecTransformPtr transform);
static int
xmlSecMSCryptoDigestCheckId(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_SHA1
if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformSha1Id)) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_SHA1 */
#ifndef XMLSEC_NO_GOST
if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformGostR3411_94Id)) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_GOST*/
@@ -91,23 +91,23 @@ xmlSecMSCryptoDigestInitialize(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_SHA1
if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformSha1Id)) {
- ctx->alg_id = CALG_SHA;
+ ctx->alg_id = CALG_SHA;
} else
#endif /* XMLSEC_NO_SHA1 */
#ifndef XMLSEC_NO_GOST
if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformGostR3411_94Id)) {
- ctx->alg_id = CALG_MAGPRO_HASH_R3411_94;
+ ctx->alg_id = CALG_MAGPRO_HASH_R3411_94;
/* TODO: Check what provider is best suited here.... */
if (!CryptAcquireContext(&ctx->provider, NULL, 0, PROV_MAGPRO_GOST, CRYPT_VERIFYCONTEXT)) {
if (!CryptAcquireContext(&ctx->provider, NULL, 0, PROV_CRYPTOPRO_GOST, CRYPT_VERIFYCONTEXT)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
}
return(0);
@@ -115,24 +115,24 @@ xmlSecMSCryptoDigestInitialize(xmlSecTransformPtr transform) {
#endif /* XMLSEC_NO_GOST*/
{
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* TODO: Check what provider is best suited here.... */
if (!CryptAcquireContext(&ctx->provider, NULL, MS_STRONG_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
- if (!CryptAcquireContext(&ctx->provider, NULL, MS_ENHANCED_PROV,PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ if (!CryptAcquireContext(&ctx->provider, NULL, MS_ENHANCED_PROV,PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
return(0);
@@ -157,9 +157,9 @@ static void xmlSecMSCryptoDigestFinalize(xmlSecTransformPtr transform) {
static int
xmlSecMSCryptoDigestVerify(xmlSecTransformPtr transform,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx) {
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecMSCryptoDigestCtxPtr ctx;
xmlSecAssert2(xmlSecMSCryptoDigestCheckId(transform), -1);
@@ -174,24 +174,24 @@ xmlSecMSCryptoDigestVerify(xmlSecTransformPtr transform,
xmlSecAssert2(ctx->dgstSize > 0, -1);
if(dataSize != ctx->dgstSize) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "data_size=%d;dgst_size=%d",
- dataSize, ctx->dgstSize);
- transform->status = xmlSecTransformStatusFail;
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "data_size=%d;dgst_size=%d",
+ dataSize, ctx->dgstSize);
+ transform->status = xmlSecTransformStatusFail;
+ return(0);
}
if(memcmp(ctx->dgst, data, ctx->dgstSize) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "data and digest do not match");
- transform->status = xmlSecTransformStatusFail;
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "data and digest do not match");
+ transform->status = xmlSecTransformStatusFail;
+ return(0);
}
transform->status = xmlSecTransformStatusOk;
@@ -200,8 +200,8 @@ xmlSecMSCryptoDigestVerify(xmlSecTransformPtr transform,
static int
xmlSecMSCryptoDigestExecute(xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx) {
+ int last,
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecMSCryptoDigestCtxPtr ctx;
xmlSecBufferPtr in, out;
int ret;
@@ -221,102 +221,102 @@ xmlSecMSCryptoDigestExecute(xmlSecTransformPtr transform,
xmlSecAssert2(ctx != NULL, -1);
if(transform->status == xmlSecTransformStatusNone) {
- ret = CryptCreateHash(ctx->provider,
- ctx->alg_id,
- 0,
- 0,
- &(ctx->mscHash));
-
- if((ret == 0) || (ctx->mscHash == 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "CryptHashData",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- transform->status = xmlSecTransformStatusWorking;
+ ret = CryptCreateHash(ctx->provider,
+ ctx->alg_id,
+ 0,
+ 0,
+ &(ctx->mscHash));
+
+ if((ret == 0) || (ctx->mscHash == 0)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "CryptHashData",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ transform->status = xmlSecTransformStatusWorking;
}
if (transform->status == xmlSecTransformStatusWorking) {
- xmlSecSize inSize;
-
- inSize = xmlSecBufferGetSize(in);
- if(inSize > 0) {
- ret = CryptHashData(ctx->mscHash,
- xmlSecBufferGetData(in),
- inSize,
- 0);
-
- if(ret == 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "CryptHashData",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "size=%d", inSize);
- return(-1);
- }
-
- ret = xmlSecBufferRemoveHead(in, inSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
- }
- }
- if(last) {
- /* TODO: make a MSCrypto compatible assert here */
- /* xmlSecAssert2((xmlSecSize)EVP_MD_size(ctx->digest) <= sizeof(ctx->dgst), -1); */
- DWORD retLen;
- retLen = MSCRYPTO_MAX_HASH_SIZE;
-
- ret = CryptGetHashParam(ctx->mscHash,
- HP_HASHVAL,
- ctx->dgst,
- &retLen,
- 0);
-
- if (ret == 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "CryptGetHashParam",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
- }
-
- ctx->dgstSize = (size_t)retLen;
-
- xmlSecAssert2(ctx->dgstSize > 0, -1);
-
- /* copy result to output */
- if(transform->operation == xmlSecTransformOperationSign) {
- ret = xmlSecBufferAppend(out, ctx->dgst, ctx->dgstSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", ctx->dgstSize);
- return(-1);
- }
- }
- transform->status = xmlSecTransformStatusFinished;
- }
+ xmlSecSize inSize;
+
+ inSize = xmlSecBufferGetSize(in);
+ if(inSize > 0) {
+ ret = CryptHashData(ctx->mscHash,
+ xmlSecBufferGetData(in),
+ inSize,
+ 0);
+
+ if(ret == 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "CryptHashData",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "size=%d", inSize);
+ return(-1);
+ }
+
+ ret = xmlSecBufferRemoveHead(in, inSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
+ }
+ }
+ if(last) {
+ /* TODO: make a MSCrypto compatible assert here */
+ /* xmlSecAssert2((xmlSecSize)EVP_MD_size(ctx->digest) <= sizeof(ctx->dgst), -1); */
+ DWORD retLen;
+ retLen = MSCRYPTO_MAX_HASH_SIZE;
+
+ ret = CryptGetHashParam(ctx->mscHash,
+ HP_HASHVAL,
+ ctx->dgst,
+ &retLen,
+ 0);
+
+ if (ret == 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "CryptGetHashParam",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
+ }
+
+ ctx->dgstSize = (size_t)retLen;
+
+ xmlSecAssert2(ctx->dgstSize > 0, -1);
+
+ /* copy result to output */
+ if(transform->operation == xmlSecTransformOperationSign) {
+ ret = xmlSecBufferAppend(out, ctx->dgst, ctx->dgstSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", ctx->dgstSize);
+ return(-1);
+ }
+ }
+ transform->status = xmlSecTransformStatusFinished;
+ }
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
@@ -331,27 +331,27 @@ xmlSecMSCryptoDigestExecute(xmlSecTransformPtr transform,
*****************************************************************************/
static xmlSecTransformKlass xmlSecMSCryptoSha1Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* size_t klassSize */
- xmlSecMSCryptoDigestSize, /* size_t objSize */
-
- xmlSecNameSha1, /* const xmlChar* name; */
- xmlSecHrefSha1, /* const xmlChar* href; */
- xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
- xmlSecMSCryptoDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecMSCryptoDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecMSCryptoDigestVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecMSCryptoDigestExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ sizeof(xmlSecTransformKlass), /* size_t klassSize */
+ xmlSecMSCryptoDigestSize, /* size_t objSize */
+
+ xmlSecNameSha1, /* const xmlChar* name; */
+ xmlSecHrefSha1, /* const xmlChar* href; */
+ xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
+ xmlSecMSCryptoDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecMSCryptoDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecMSCryptoDigestVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecMSCryptoDigestExecute, /* xmlSecTransformExecuteMethod execute; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -375,27 +375,27 @@ xmlSecMSCryptoTransformSha1GetKlass(void) {
*****************************************************************************/
static xmlSecTransformKlass xmlSecMSCryptoGostR3411_94Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* size_t klassSize */
- xmlSecMSCryptoDigestSize, /* size_t objSize */
-
- xmlSecNameGostR3411_94, /* const xmlChar* name; */
- xmlSecHrefGostR3411_94, /* const xmlChar* href; */
- xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
- xmlSecMSCryptoDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecMSCryptoDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecMSCryptoDigestVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecMSCryptoDigestExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ sizeof(xmlSecTransformKlass), /* size_t klassSize */
+ xmlSecMSCryptoDigestSize, /* size_t objSize */
+
+ xmlSecNameGostR3411_94, /* const xmlChar* name; */
+ xmlSecHrefGostR3411_94, /* const xmlChar* href; */
+ xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
+ xmlSecMSCryptoDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecMSCryptoDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecMSCryptoDigestVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecMSCryptoDigestExecute, /* xmlSecTransformExecuteMethod execute; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
diff --git a/src/mscrypto/keysstore.c b/src/mscrypto/keysstore.c
index 2533f22..4afba44 100644
--- a/src/mscrypto/keysstore.c
+++ b/src/mscrypto/keysstore.c
@@ -43,7 +43,7 @@
# include "xmlsec-mingw.h"
#endif
-#define XMLSEC_MSCRYPTO_APP_DEFAULT_CERT_STORE_NAME "MY"
+#define XMLSEC_MSCRYPTO_APP_DEFAULT_CERT_STORE_NAME "MY"
/****************************************************************************
*
@@ -53,34 +53,34 @@
*
***************************************************************************/
#define xmlSecMSCryptoKeysStoreSize \
- (sizeof(xmlSecKeyStore) + sizeof(xmlSecKeyStorePtr))
+ (sizeof(xmlSecKeyStore) + sizeof(xmlSecKeyStorePtr))
#define xmlSecMSCryptoKeysStoreGetSS(store) \
((xmlSecKeyStoreCheckSize((store), xmlSecMSCryptoKeysStoreSize)) ? \
(xmlSecKeyStorePtr*)(((xmlSecByte*)(store)) + sizeof(xmlSecKeyStore)) : \
(xmlSecKeyStorePtr*)NULL)
-static int xmlSecMSCryptoKeysStoreInitialize (xmlSecKeyStorePtr store);
-static void xmlSecMSCryptoKeysStoreFinalize (xmlSecKeyStorePtr store);
-static xmlSecKeyPtr xmlSecMSCryptoKeysStoreFindKey (xmlSecKeyStorePtr store,
- const xmlChar* name,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoKeysStoreInitialize (xmlSecKeyStorePtr store);
+static void xmlSecMSCryptoKeysStoreFinalize (xmlSecKeyStorePtr store);
+static xmlSecKeyPtr xmlSecMSCryptoKeysStoreFindKey (xmlSecKeyStorePtr store,
+ const xmlChar* name,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
static xmlSecKeyStoreKlass xmlSecMSCryptoKeysStoreKlass = {
sizeof(xmlSecKeyStoreKlass),
xmlSecMSCryptoKeysStoreSize,
/* data */
- BAD_CAST "MSCrypto-keys-store", /* const xmlChar* name; */
+ BAD_CAST "MSCrypto-keys-store", /* const xmlChar* name; */
/* constructors/destructor */
- xmlSecMSCryptoKeysStoreInitialize, /* xmlSecKeyStoreInitializeMethod initialize; */
- xmlSecMSCryptoKeysStoreFinalize, /* xmlSecKeyStoreFinalizeMethod finalize; */
- xmlSecMSCryptoKeysStoreFindKey, /* xmlSecKeyStoreFindKeyMethod findKey; */
+ xmlSecMSCryptoKeysStoreInitialize, /* xmlSecKeyStoreInitializeMethod initialize; */
+ xmlSecMSCryptoKeysStoreFinalize, /* xmlSecKeyStoreFinalizeMethod finalize; */
+ xmlSecMSCryptoKeysStoreFindKey, /* xmlSecKeyStoreFindKeyMethod findKey; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -97,8 +97,8 @@ xmlSecMSCryptoKeysStoreGetKlass(void) {
/**
* xmlSecMSCryptoKeysStoreAdoptKey:
- * @store: the pointer to MSCrypto keys store.
- * @key: the pointer to key.
+ * @store: the pointer to MSCrypto keys store.
+ * @key: the pointer to key.
*
* Adds @key to the @store.
*
@@ -113,16 +113,16 @@ xmlSecMSCryptoKeysStoreAdoptKey(xmlSecKeyStorePtr store, xmlSecKeyPtr key) {
ss = xmlSecMSCryptoKeysStoreGetSS(store);
xmlSecAssert2(((ss != NULL) && (*ss != NULL) &&
- (xmlSecKeyStoreCheckId(*ss, xmlSecSimpleKeysStoreId))), -1);
+ (xmlSecKeyStoreCheckId(*ss, xmlSecSimpleKeysStoreId))), -1);
return (xmlSecSimpleKeysStoreAdoptKey(*ss, key));
}
/**
* xmlSecMSCryptoKeysStoreLoad:
- * @store: the pointer to MSCrypto keys store.
- * @uri: the filename.
- * @keysMngr: the pointer to associated keys manager.
+ * @store: the pointer to MSCrypto keys store.
+ * @uri: the filename.
+ * @keysMngr: the pointer to associated keys manager.
*
* Reads keys from an XML file.
*
@@ -130,7 +130,7 @@ xmlSecMSCryptoKeysStoreAdoptKey(xmlSecKeyStorePtr store, xmlSecKeyPtr key) {
*/
int
xmlSecMSCryptoKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
- xmlSecKeysMngrPtr keysMngr) {
+ xmlSecKeysMngrPtr keysMngr) {
xmlDocPtr doc;
xmlNodePtr root;
xmlNodePtr cur;
@@ -143,101 +143,101 @@ xmlSecMSCryptoKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
doc = xmlParseFile(uri);
if(doc == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlParseFile",
- XMLSEC_ERRORS_R_XML_FAILED,
- "uri=%s",
- xmlSecErrorsSafeString(uri));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlParseFile",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "uri=%s",
+ xmlSecErrorsSafeString(uri));
+ return(-1);
}
root = xmlDocGetRootElement(doc);
if(!xmlSecCheckNodeName(root, BAD_CAST "Keys", xmlSecNs)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(root)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "expected-node=<xmlsec:Keys>");
- xmlFreeDoc(doc);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(root)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "expected-node=<xmlsec:Keys>");
+ xmlFreeDoc(doc);
+ return(-1);
}
cur = xmlSecGetNextElementNode(root->children);
while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeKeyInfo, xmlSecDSigNs)) {
- key = xmlSecKeyCreate();
- if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "expected-node=%s",
- xmlSecErrorsSafeString(xmlSecNodeKeyInfo));
- xmlFreeDoc(doc);
- return(-1);
- }
-
- ret = xmlSecKeyInfoCtxInitialize(&keyInfoCtx, NULL);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecKeyInfoCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(key);
- xmlFreeDoc(doc);
- return(-1);
- }
-
- keyInfoCtx.mode = xmlSecKeyInfoModeRead;
- keyInfoCtx.keysMngr = keysMngr;
- keyInfoCtx.flags = XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND |
- XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS;
- keyInfoCtx.keyReq.keyId = xmlSecKeyDataIdUnknown;
- keyInfoCtx.keyReq.keyType = xmlSecKeyDataTypeAny;
- keyInfoCtx.keyReq.keyUsage= xmlSecKeyDataUsageAny;
-
- ret = xmlSecKeyInfoNodeRead(cur, key, &keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecKeyInfoNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
- xmlSecKeyDestroy(key);
- xmlFreeDoc(doc);
- return(-1);
- }
- xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
-
- if(xmlSecKeyIsValid(key)) {
- ret = xmlSecMSCryptoKeysStoreAdoptKey(store, key);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecMSCryptoKeysStoreAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(key);
- xmlFreeDoc(doc);
- return(-1);
- }
- } else {
- /* we have an unknown key in our file, just ignore it */
- xmlSecKeyDestroy(key);
- }
+ key = xmlSecKeyCreate();
+ if(key == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "expected-node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeKeyInfo));
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+
+ ret = xmlSecKeyInfoCtxInitialize(&keyInfoCtx, NULL);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecKeyInfoCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(key);
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+
+ keyInfoCtx.mode = xmlSecKeyInfoModeRead;
+ keyInfoCtx.keysMngr = keysMngr;
+ keyInfoCtx.flags = XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND |
+ XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS;
+ keyInfoCtx.keyReq.keyId = xmlSecKeyDataIdUnknown;
+ keyInfoCtx.keyReq.keyType = xmlSecKeyDataTypeAny;
+ keyInfoCtx.keyReq.keyUsage= xmlSecKeyDataUsageAny;
+
+ ret = xmlSecKeyInfoNodeRead(cur, key, &keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecKeyInfoNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
+ xmlSecKeyDestroy(key);
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+ xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
+
+ if(xmlSecKeyIsValid(key)) {
+ ret = xmlSecMSCryptoKeysStoreAdoptKey(store, key);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecMSCryptoKeysStoreAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(key);
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+ } else {
+ /* we have an unknown key in our file, just ignore it */
+ xmlSecKeyDestroy(key);
+ }
cur = xmlSecGetNextElementNode(cur->next);
}
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFreeDoc(doc);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFreeDoc(doc);
+ return(-1);
}
xmlFreeDoc(doc);
@@ -246,9 +246,9 @@ xmlSecMSCryptoKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
/**
* xmlSecMSCryptoKeysStoreSave:
- * @store: the pointer to MSCrypto keys store.
- * @filename: the filename.
- * @type: the saved keys type (public, private, ...).
+ * @store: the pointer to MSCrypto keys store.
+ * @filename: the filename.
+ * @type: the saved keys type (public, private, ...).
*
* Writes keys from @store to an XML file.
*
@@ -263,7 +263,7 @@ xmlSecMSCryptoKeysStoreSave(xmlSecKeyStorePtr store, const char *filename, xmlSe
ss = xmlSecMSCryptoKeysStoreGetSS(store);
xmlSecAssert2(((ss != NULL) && (*ss != NULL) &&
- (xmlSecKeyStoreCheckId(*ss, xmlSecSimpleKeysStoreId))), -1);
+ (xmlSecKeyStoreCheckId(*ss, xmlSecSimpleKeysStoreId))), -1);
return (xmlSecSimpleKeysStoreSave(*ss, filename, type));
}
@@ -279,12 +279,12 @@ xmlSecMSCryptoKeysStoreInitialize(xmlSecKeyStorePtr store) {
*ss = xmlSecKeyStoreCreate(xmlSecSimpleKeysStoreId);
if(*ss == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecKeyStoreCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecSimpleKeysStoreId");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecKeyStoreCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecSimpleKeysStoreId");
+ return(-1);
}
return(0);
@@ -304,48 +304,48 @@ xmlSecMSCryptoKeysStoreFinalize(xmlSecKeyStorePtr store) {
static LPWSTR
xmlSecMSCryptoConvertUtf8ToUnicode(const xmlChar* str) {
- LPWSTR res = NULL;
- int len;
- int ret;
+ LPWSTR res = NULL;
+ int len;
+ int ret;
xmlSecAssert2(str != NULL, NULL);
- /* call MultiByteToWideChar first to get the buffer size */
- ret = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
- if(ret <= 0) {
- return(NULL);
- }
- len = ret;
-
- /* allocate buffer */
- res = (LPWSTR)xmlMalloc(sizeof(WCHAR) * len);
- if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
-
- /* convert */
- ret = MultiByteToWideChar(CP_UTF8, 0, str, -1, res, len);
- if(ret <= 0) {
- xmlFree(res);
- return(NULL);
- }
-
- /* done */
- return(res);
+ /* call MultiByteToWideChar first to get the buffer size */
+ ret = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
+ if(ret <= 0) {
+ return(NULL);
+ }
+ len = ret;
+
+ /* allocate buffer */
+ res = (LPWSTR)xmlMalloc(sizeof(WCHAR) * len);
+ if(res == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+
+ /* convert */
+ ret = MultiByteToWideChar(CP_UTF8, 0, str, -1, res, len);
+ if(ret <= 0) {
+ xmlFree(res);
+ return(NULL);
+ }
+
+ /* done */
+ return(res);
}
static PCCERT_CONTEXT
xmlSecMSCryptoKeysStoreFindCert(xmlSecKeyStorePtr store, const xmlChar* name,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
const char* storeName;
HCERTSTORE hStoreHandle = NULL;
PCCERT_CONTEXT pCertContext = NULL;
- LPWSTR wcName = NULL;
+ LPWSTR wcName = NULL;
xmlSecAssert2(xmlSecKeyStoreCheckId(store, xmlSecMSCryptoKeysStoreId), NULL);
xmlSecAssert2(name != NULL, NULL);
@@ -353,139 +353,139 @@ xmlSecMSCryptoKeysStoreFindCert(xmlSecKeyStorePtr store, const xmlChar* name,
storeName = xmlSecMSCryptoAppGetCertStoreName();
if(storeName == NULL) {
- storeName = XMLSEC_MSCRYPTO_APP_DEFAULT_CERT_STORE_NAME;
+ storeName = XMLSEC_MSCRYPTO_APP_DEFAULT_CERT_STORE_NAME;
}
hStoreHandle = CertOpenSystemStore(0, storeName);
if (NULL == hStoreHandle) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CertOpenSystemStore",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "storeName=%s",
- xmlSecErrorsSafeString(storeName));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CertOpenSystemStore",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "storeName=%s",
+ xmlSecErrorsSafeString(storeName));
+ return(NULL);
}
- wcName = xmlSecMSCryptoConvertUtf8ToUnicode(name);
- if(wcName == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecMSCryptoConvertUtf8ToUnicode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "wcName");
- CertCloseStore(hStoreHandle, 0);
- return(NULL);
- }
-
- /* first attempt: search by cert id == name */
+ wcName = xmlSecMSCryptoConvertUtf8ToUnicode(name);
+ if(wcName == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecMSCryptoConvertUtf8ToUnicode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "wcName");
+ CertCloseStore(hStoreHandle, 0);
+ return(NULL);
+ }
+
+ /* first attempt: search by cert id == name */
if(pCertContext == NULL) {
- pCertContext = CertFindCertificateInStore(
- hStoreHandle,
- X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
- 0,
- CERT_FIND_SUBJECT_STR,
- wcName,
- NULL);
+ pCertContext = CertFindCertificateInStore(
+ hStoreHandle,
+ X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
+ 0,
+ CERT_FIND_SUBJECT_STR,
+ wcName,
+ NULL);
}
/* We don't give up easily, now try to fetch the cert with a full blown
* subject dn
*/
if (NULL == pCertContext) {
- BYTE* bdata;
- DWORD len;
-
- bdata = xmlSecMSCryptoCertStrToName(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
- name,
- CERT_OID_NAME_STR,
- &len);
- if(bdata != NULL) {
- CERT_NAME_BLOB cnb;
+ BYTE* bdata;
+ DWORD len;
+
+ bdata = xmlSecMSCryptoCertStrToName(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
+ name,
+ CERT_OID_NAME_STR,
+ &len);
+ if(bdata != NULL) {
+ CERT_NAME_BLOB cnb;
- cnb.cbData = len;
- cnb.pbData = bdata;
-
- pCertContext = CertFindCertificateInStore(hStoreHandle,
- X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
- 0,
- CERT_FIND_SUBJECT_NAME,
- &cnb,
- NULL);
- xmlFree(bdata);
- }
+ cnb.cbData = len;
+ cnb.pbData = bdata;
+
+ pCertContext = CertFindCertificateInStore(hStoreHandle,
+ X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
+ 0,
+ CERT_FIND_SUBJECT_NAME,
+ &cnb,
+ NULL);
+ xmlFree(bdata);
+ }
}
-
+
/* We don't give up easily, now try to fetch the cert with a full blown
* subject dn, and try with a reversed dn
*/
if (NULL == pCertContext) {
- BYTE* bdata;
- DWORD len;
-
- bdata = xmlSecMSCryptoCertStrToName(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
- name,
- CERT_OID_NAME_STR | CERT_NAME_STR_REVERSE_FLAG,
- &len);
- if(bdata != NULL) {
- CERT_NAME_BLOB cnb;
+ BYTE* bdata;
+ DWORD len;
+
+ bdata = xmlSecMSCryptoCertStrToName(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
+ name,
+ CERT_OID_NAME_STR | CERT_NAME_STR_REVERSE_FLAG,
+ &len);
+ if(bdata != NULL) {
+ CERT_NAME_BLOB cnb;
- cnb.cbData = len;
- cnb.pbData = bdata;
-
- pCertContext = CertFindCertificateInStore(hStoreHandle,
- X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
- 0,
- CERT_FIND_SUBJECT_NAME,
- &cnb,
- NULL);
- xmlFree(bdata);
- }
+ cnb.cbData = len;
+ cnb.pbData = bdata;
+
+ pCertContext = CertFindCertificateInStore(hStoreHandle,
+ X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
+ 0,
+ CERT_FIND_SUBJECT_NAME,
+ &cnb,
+ NULL);
+ xmlFree(bdata);
+ }
}
/*
* Try ro find certificate with name="Friendly Name"
*/
if (NULL == pCertContext) {
- DWORD dwPropSize;
+ DWORD dwPropSize;
PBYTE pbFriendlyName;
PCCERT_CONTEXT pCertCtxIter = NULL;
-
-
+
+
while (pCertCtxIter = CertEnumCertificatesInStore(hStoreHandle, pCertCtxIter)) {
- if (TRUE != CertGetCertificateContextProperty(pCertCtxIter,
- CERT_FRIENDLY_NAME_PROP_ID,
- NULL,
- &dwPropSize)) {
- continue;
- }
-
- pbFriendlyName = xmlMalloc(dwPropSize);
- if(pbFriendlyName == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(wcName);
- CertCloseStore(hStoreHandle, 0);
- return(NULL);
- }
- if (TRUE != CertGetCertificateContextProperty(pCertCtxIter,
- CERT_FRIENDLY_NAME_PROP_ID,
- pbFriendlyName,
- &dwPropSize)) {
- xmlFree(pbFriendlyName);
- continue;
- }
-
- /* Compare FriendlyName to name */
- if (!wcscmp(wcName, (const wchar_t *)pbFriendlyName)) {
- pCertContext = pCertCtxIter;
- xmlFree(pbFriendlyName);
- break;
- }
- xmlFree(pbFriendlyName);
+ if (TRUE != CertGetCertificateContextProperty(pCertCtxIter,
+ CERT_FRIENDLY_NAME_PROP_ID,
+ NULL,
+ &dwPropSize)) {
+ continue;
+ }
+
+ pbFriendlyName = xmlMalloc(dwPropSize);
+ if(pbFriendlyName == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(wcName);
+ CertCloseStore(hStoreHandle, 0);
+ return(NULL);
+ }
+ if (TRUE != CertGetCertificateContextProperty(pCertCtxIter,
+ CERT_FRIENDLY_NAME_PROP_ID,
+ pbFriendlyName,
+ &dwPropSize)) {
+ xmlFree(pbFriendlyName);
+ continue;
+ }
+
+ /* Compare FriendlyName to name */
+ if (!wcscmp(wcName, (const wchar_t *)pbFriendlyName)) {
+ pCertContext = pCertCtxIter;
+ xmlFree(pbFriendlyName);
+ break;
+ }
+ xmlFree(pbFriendlyName);
}
}
@@ -501,7 +501,7 @@ xmlSecMSCryptoKeysStoreFindCert(xmlSecKeyStorePtr store, const xmlChar* name,
/* aleksey todo: is it a right idea to close store if we have a handle to
* a cert in this store? */
- xmlFree(wcName);
+ xmlFree(wcName);
CertCloseStore(hStoreHandle, 0);
return(pCertContext);
}
@@ -509,7 +509,7 @@ xmlSecMSCryptoKeysStoreFindCert(xmlSecKeyStorePtr store, const xmlChar* name,
static xmlSecKeyPtr
xmlSecMSCryptoKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyStorePtr* ss;
xmlSecKeyPtr key = NULL;
xmlSecKeyReqPtr keyReq = NULL;
@@ -529,14 +529,14 @@ xmlSecMSCryptoKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name,
/* first try to find key in the simple keys store */
key = xmlSecKeyStoreFindKey(*ss, name, keyInfoCtx);
if (key != NULL) {
- return (key);
+ return (key);
}
/* Next try to find the key in the MS Certificate store, and construct an xmlSecKey.
* we must have a name to lookup keys in the certificate store.
*/
if (name == NULL) {
- goto done;
+ goto done;
}
/* what type of key are we looking for?
@@ -546,150 +546,150 @@ xmlSecMSCryptoKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name,
*/
keyReq = &(keyInfoCtx->keyReq);
if (keyReq->keyType & (xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate)) {
- pCertContext = xmlSecMSCryptoKeysStoreFindCert(store, name, keyInfoCtx);
- if(pCertContext == NULL) {
- goto done;
- }
-
- /* set cert in x509 data */
- x509Data = xmlSecKeyDataCreate(xmlSecMSCryptoKeyDataX509Id);
- if(x509Data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
- }
-
- pCertContext2 = CertDuplicateCertificateContext(pCertContext);
- if (NULL == pCertContext2) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CertDuplicateCertificateContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
- }
-
- ret = xmlSecMSCryptoKeyDataX509AdoptCert(x509Data, pCertContext2);
- if (ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
- }
- pCertContext2 = NULL;
-
- pCertContext2 = CertDuplicateCertificateContext(pCertContext);
- if (NULL == pCertContext2) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CertDuplicateCertificateContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
- }
-
- ret = xmlSecMSCryptoKeyDataX509AdoptKeyCert(x509Data, pCertContext2);
- if (ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoKeyDataX509AdoptKeyCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
- }
- pCertContext2 = NULL;
-
- /* set cert in key data */
- data = xmlSecMSCryptoCertAdopt(pCertContext, keyReq->keyType);
- if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoCertAdopt",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
- pCertContext = NULL;
-
- /* create key and add key data and x509 data to it */
- key = xmlSecKeyCreate();
- if (key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
-
- ret = xmlSecKeySetValue(key, data);
- if (ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)));
- goto done;
- }
- data = NULL;
-
- ret = xmlSecKeyAdoptData(key, x509Data);
- if (ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyAdoptData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
- }
- x509Data = NULL;
-
- /* Set the name of the key to the given name */
- ret = xmlSecKeySetName(key, name);
- if (ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecKeySetName",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
+ pCertContext = xmlSecMSCryptoKeysStoreFindCert(store, name, keyInfoCtx);
+ if(pCertContext == NULL) {
+ goto done;
+ }
+
+ /* set cert in x509 data */
+ x509Data = xmlSecKeyDataCreate(xmlSecMSCryptoKeyDataX509Id);
+ if(x509Data == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
+ }
+
+ pCertContext2 = CertDuplicateCertificateContext(pCertContext);
+ if (NULL == pCertContext2) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CertDuplicateCertificateContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
+ }
+
+ ret = xmlSecMSCryptoKeyDataX509AdoptCert(x509Data, pCertContext2);
+ if (ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
+ }
+ pCertContext2 = NULL;
+
+ pCertContext2 = CertDuplicateCertificateContext(pCertContext);
+ if (NULL == pCertContext2) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CertDuplicateCertificateContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
+ }
+
+ ret = xmlSecMSCryptoKeyDataX509AdoptKeyCert(x509Data, pCertContext2);
+ if (ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoKeyDataX509AdoptKeyCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
+ }
+ pCertContext2 = NULL;
+
+ /* set cert in key data */
+ data = xmlSecMSCryptoCertAdopt(pCertContext, keyReq->keyType);
+ if(data == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoCertAdopt",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
+ pCertContext = NULL;
+
+ /* create key and add key data and x509 data to it */
+ key = xmlSecKeyCreate();
+ if (key == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
+
+ ret = xmlSecKeySetValue(key, data);
+ if (ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)));
+ goto done;
+ }
+ data = NULL;
+
+ ret = xmlSecKeyAdoptData(key, x509Data);
+ if (ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyAdoptData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
+ }
+ x509Data = NULL;
+
+ /* Set the name of the key to the given name */
+ ret = xmlSecKeySetName(key, name);
+ if (ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecKeySetName",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
/* now that we have a key, make sure it is valid and let the simple
- * store adopt it */
- if (xmlSecKeyIsValid(key)) {
- res = key;
- key = NULL;
- }
+ * store adopt it */
+ if (xmlSecKeyIsValid(key)) {
+ res = key;
+ key = NULL;
+ }
}
done:
if (NULL != pCertContext) {
- CertFreeCertificateContext(pCertContext);
+ CertFreeCertificateContext(pCertContext);
}
if (NULL != pCertContext2) {
- CertFreeCertificateContext(pCertContext2);
+ CertFreeCertificateContext(pCertContext2);
}
if (data != NULL) {
- xmlSecKeyDataDestroy(data);
+ xmlSecKeyDataDestroy(data);
}
if (x509Data != NULL) {
- xmlSecKeyDataDestroy(x509Data);
+ xmlSecKeyDataDestroy(x509Data);
}
if (key != NULL) {
- xmlSecKeyDestroy(key);
+ xmlSecKeyDestroy(key);
}
return (res);
diff --git a/src/mscrypto/kt_rsa.c b/src/mscrypto/kt_rsa.c
index 700cb7d..8dee2d5 100644
--- a/src/mscrypto/kt_rsa.c
+++ b/src/mscrypto/kt_rsa.c
@@ -35,12 +35,12 @@
* Internal MSCRYPTO RSA PKCS1 CTX
*
*************************************************************************/
-typedef struct _xmlSecMSCryptoRsaPkcs1Ctx xmlSecMSCryptoRsaPkcs1Ctx,
- *xmlSecMSCryptoRsaPkcs1CtxPtr;
+typedef struct _xmlSecMSCryptoRsaPkcs1Ctx xmlSecMSCryptoRsaPkcs1Ctx,
+ *xmlSecMSCryptoRsaPkcs1CtxPtr;
struct _xmlSecMSCryptoRsaPkcs1Ctx {
xmlSecKeyDataPtr data;
DWORD typeFlags;
-};
+};
/*********************************************************************
*
@@ -49,48 +49,48 @@ struct _xmlSecMSCryptoRsaPkcs1Ctx {
* xmlSecMSCryptoRsaPkcs1Ctx is located after xmlSecTransform
*
********************************************************************/
-#define xmlSecMSCryptoRsaPkcs1Size \
- (sizeof(xmlSecTransform) + sizeof(xmlSecMSCryptoRsaPkcs1Ctx))
+#define xmlSecMSCryptoRsaPkcs1Size \
+ (sizeof(xmlSecTransform) + sizeof(xmlSecMSCryptoRsaPkcs1Ctx))
#define xmlSecMSCryptoRsaPkcs1GetCtx(transform) \
((xmlSecMSCryptoRsaPkcs1CtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-static int xmlSecMSCryptoRsaPkcs1Initialize (xmlSecTransformPtr transform);
-static void xmlSecMSCryptoRsaPkcs1Finalize (xmlSecTransformPtr transform);
-static int xmlSecMSCryptoRsaPkcs1SetKeyReq (xmlSecTransformPtr transform,
- xmlSecKeyReqPtr keyReq);
-static int xmlSecMSCryptoRsaPkcs1SetKey (xmlSecTransformPtr transform,
- xmlSecKeyPtr key);
-static int xmlSecMSCryptoRsaPkcs1Execute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecMSCryptoRsaPkcs1Process (xmlSecTransformPtr transform,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecMSCryptoRsaPkcs1Initialize (xmlSecTransformPtr transform);
+static void xmlSecMSCryptoRsaPkcs1Finalize (xmlSecTransformPtr transform);
+static int xmlSecMSCryptoRsaPkcs1SetKeyReq (xmlSecTransformPtr transform,
+ xmlSecKeyReqPtr keyReq);
+static int xmlSecMSCryptoRsaPkcs1SetKey (xmlSecTransformPtr transform,
+ xmlSecKeyPtr key);
+static int xmlSecMSCryptoRsaPkcs1Execute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecMSCryptoRsaPkcs1Process (xmlSecTransformPtr transform,
+ xmlSecTransformCtxPtr transformCtx);
static xmlSecTransformKlass xmlSecMSCryptoRsaPkcs1Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecMSCryptoRsaPkcs1Size, /* xmlSecSize objSize */
-
- xmlSecNameRsaPkcs1, /* const xmlChar* name; */
- xmlSecHrefRsaPkcs1, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecMSCryptoRsaPkcs1Initialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecMSCryptoRsaPkcs1Finalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecMSCryptoRsaPkcs1SetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecMSCryptoRsaPkcs1SetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecMSCryptoRsaPkcs1Execute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecMSCryptoRsaPkcs1Size, /* xmlSecSize objSize */
+
+ xmlSecNameRsaPkcs1, /* const xmlChar* name; */
+ xmlSecHrefRsaPkcs1, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecMSCryptoRsaPkcs1Initialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecMSCryptoRsaPkcs1Finalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecMSCryptoRsaPkcs1SetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecMSCryptoRsaPkcs1SetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecMSCryptoRsaPkcs1Execute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
@@ -131,8 +131,8 @@ xmlSecMSCryptoRsaPkcs1Finalize(xmlSecTransformPtr transform) {
xmlSecAssert(ctx != NULL);
if (ctx->data != NULL) {
- xmlSecKeyDataDestroy(ctx->data);
- ctx->data = NULL;
+ xmlSecKeyDataDestroy(ctx->data);
+ ctx->data = NULL;
}
memset(ctx, 0, sizeof(xmlSecMSCryptoRsaPkcs1Ctx));
@@ -150,18 +150,18 @@ xmlSecMSCryptoRsaPkcs1SetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr k
ctx = xmlSecMSCryptoRsaPkcs1GetCtx(transform);
xmlSecAssert2(ctx != NULL, -1);
- keyReq->keyId = xmlSecMSCryptoKeyDataRsaId;
+ keyReq->keyId = xmlSecMSCryptoKeyDataRsaId;
if(transform->operation == xmlSecTransformOperationEncrypt) {
keyReq->keyType = xmlSecKeyDataTypePublic;
- keyReq->keyUsage = xmlSecKeyUsageEncrypt;
+ keyReq->keyUsage = xmlSecKeyUsageEncrypt;
} else {
keyReq->keyType = xmlSecKeyDataTypePrivate;
- keyReq->keyUsage = xmlSecKeyUsageDecrypt;
+ keyReq->keyUsage = xmlSecKeyUsageDecrypt;
}
return(0);
}
-static int
+static int
xmlSecMSCryptoRsaPkcs1SetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
xmlSecMSCryptoRsaPkcs1CtxPtr ctx;
@@ -177,12 +177,12 @@ xmlSecMSCryptoRsaPkcs1SetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
ctx->data = xmlSecKeyDataDuplicate(xmlSecKeyGetValue(key));
if(ctx->data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecKeyDataDuplicate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecKeyDataDuplicate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -206,27 +206,27 @@ xmlSecMSCryptoRsaPkcs1Execute(xmlSecTransformPtr transform, int last, xmlSecTran
}
if((transform->status == xmlSecTransformStatusWorking) && (last == 0)) {
- /* just do nothing */
+ /* just do nothing */
} else if((transform->status == xmlSecTransformStatusWorking) && (last != 0)) {
- ret = xmlSecMSCryptoRsaPkcs1Process(transform, transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecMSCryptoRsaPkcs1Process",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- transform->status = xmlSecTransformStatusFinished;
+ ret = xmlSecMSCryptoRsaPkcs1Process(transform, transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecMSCryptoRsaPkcs1Process",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ transform->status = xmlSecTransformStatusFinished;
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
return(-1);
}
return(0);
@@ -261,11 +261,11 @@ xmlSecMSCryptoRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPt
in = &(transform->inBuf);
out = &(transform->outBuf);
-
+
inSize = xmlSecBufferGetSize(in);
outSize = xmlSecBufferGetSize(out);
xmlSecAssert2(outSize == 0, -1);
-
+
/* the encoded size is equal to the keys size so we could not
* process more than that */
if((transform->operation == xmlSecTransformOperationEncrypt) && (inSize >= keySize)) {
@@ -283,7 +283,7 @@ xmlSecMSCryptoRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPt
"%d when expected %d", inSize, keySize);
return(-1);
}
-
+
outSize = keySize;
ret = xmlSecBufferSetMaxSize(out, outSize);
if(ret < 0) {
@@ -296,42 +296,42 @@ xmlSecMSCryptoRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPt
}
if(transform->operation == xmlSecTransformOperationEncrypt) {
- BYTE ch;
-
- if(inSize > outSize) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "inSize=%d;outSize=%d",
- inSize, outSize);
- return(-1);
- }
-
- ret = xmlSecBufferSetData(out, xmlSecBufferGetData(in), inSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
- }
+ BYTE ch;
+
+ if(inSize > outSize) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "inSize=%d;outSize=%d",
+ inSize, outSize);
+ return(-1);
+ }
+
+ ret = xmlSecBufferSetData(out, xmlSecBufferGetData(in), inSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
+ }
dwInLen = inSize;
dwBufLen = outSize;
- if (0 == (hKey = xmlSecMSCryptoKeyDataGetKey(ctx->data, xmlSecKeyDataTypePublic))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
+ if (0 == (hKey = xmlSecMSCryptoKeyDataGetKey(ctx->data, xmlSecKeyDataTypePublic))) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
"xmlSecMSCryptoKeyDataGetKey",
XMLSEC_ERRORS_R_CRYPTO_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
return (-1);
- }
+ }
- outBuf = xmlSecBufferGetData(out);
- xmlSecAssert2(outBuf != NULL, -1);
- if (!CryptEncrypt(hKey, 0, TRUE, 0, outBuf, &dwInLen, dwBufLen)) {
+ outBuf = xmlSecBufferGetData(out);
+ xmlSecAssert2(outBuf != NULL, -1);
+ if (!CryptEncrypt(hKey, 0, TRUE, 0, outBuf, &dwInLen, dwBufLen)) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
"CryptEncrypt",
@@ -340,38 +340,38 @@ xmlSecMSCryptoRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPt
return (-1);
}
- /* The output of CryptEncrypt is in little-endian format, so we have to convert to
- * big-endian first.
- */
- for(i = 0; i < outSize / 2; i++) {
- ch = outBuf[i];
- outBuf[i] = outBuf[outSize - (i + 1)];
- outBuf[outSize - (i + 1)] = ch;
- }
+ /* The output of CryptEncrypt is in little-endian format, so we have to convert to
+ * big-endian first.
+ */
+ for(i = 0; i < outSize / 2; i++) {
+ ch = outBuf[i];
+ outBuf[i] = outBuf[outSize - (i + 1)];
+ outBuf[outSize - (i + 1)] = ch;
+ }
} else {
- dwOutLen = inSize;
-
- /* The input of CryptDecrypt is expected to be little-endian,
- * so we have to convert from big-endian to little endian.
- */
- inBuf = xmlSecBufferGetData(in);
- outBuf = xmlSecBufferGetData(out);
-
- xmlSecAssert2(inBuf != 0, -1);
- xmlSecAssert2(outBuf != 0, -1);
- for (i = 0; i < inSize; i++) {
- outBuf[i] = inBuf[inSize - (i + 1)];
- }
-
- if (0 == (hKey = xmlSecMSCryptoKeyDataGetDecryptKey(ctx->data))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
+ dwOutLen = inSize;
+
+ /* The input of CryptDecrypt is expected to be little-endian,
+ * so we have to convert from big-endian to little endian.
+ */
+ inBuf = xmlSecBufferGetData(in);
+ outBuf = xmlSecBufferGetData(out);
+
+ xmlSecAssert2(inBuf != 0, -1);
+ xmlSecAssert2(outBuf != 0, -1);
+ for (i = 0; i < inSize; i++) {
+ outBuf[i] = inBuf[inSize - (i + 1)];
+ }
+
+ if (0 == (hKey = xmlSecMSCryptoKeyDataGetDecryptKey(ctx->data))) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
"xmlSecMSCryptoKeyDataGetKey",
XMLSEC_ERRORS_R_CRYPTO_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
return (-1);
- }
- if (!CryptDecrypt(hKey, 0, TRUE, 0, outBuf, &dwOutLen)) {
+ }
+ if (!CryptDecrypt(hKey, 0, TRUE, 0, outBuf, &dwOutLen)) {
xmlSecError(XMLSEC_ERRORS_HERE,
xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
"CryptDecrypt",
@@ -387,7 +387,7 @@ xmlSecMSCryptoRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPt
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetSize",
+ "xmlSecBufferSetSize",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
"size=%d", outSize);
return(-1);
diff --git a/src/mscrypto/signatures.c b/src/mscrypto/signatures.c
index cd77f28..2dbc8fd 100644
--- a/src/mscrypto/signatures.c
+++ b/src/mscrypto/signatures.c
@@ -41,15 +41,15 @@ extern DWORD xmlSecMSCryptoKeyDataGetMSCryptoKeySpec(xmlSecKeyDataPtr data);
* Internal MSCrypto signatures ctx
*
*****************************************************************************/
-typedef struct _xmlSecMSCryptoSignatureCtx xmlSecMSCryptoSignatureCtx,
- *xmlSecMSCryptoSignatureCtxPtr;
+typedef struct _xmlSecMSCryptoSignatureCtx xmlSecMSCryptoSignatureCtx,
+ *xmlSecMSCryptoSignatureCtxPtr;
struct _xmlSecMSCryptoSignatureCtx {
- xmlSecKeyDataPtr data;
- ALG_ID alg_id;
- HCRYPTHASH mscHash;
- ALG_ID digestAlgId;
- xmlSecKeyDataId keyId;
-};
+ xmlSecKeyDataPtr data;
+ ALG_ID alg_id;
+ HCRYPTHASH mscHash;
+ ALG_ID digestAlgId;
+ xmlSecKeyDataId keyId;
+};
/******************************************************************************
*
@@ -58,44 +58,44 @@ struct _xmlSecMSCryptoSignatureCtx {
* xmlSecMSCryptoSignatureCtx is located after xmlSecTransform
*
*****************************************************************************/
-#define xmlSecMSCryptoSignatureSize \
+#define xmlSecMSCryptoSignatureSize \
(sizeof(xmlSecTransform) + sizeof(xmlSecMSCryptoSignatureCtx))
#define xmlSecMSCryptoSignatureGetCtx(transform) \
((xmlSecMSCryptoSignatureCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-static int xmlSecMSCryptoSignatureCheckId (xmlSecTransformPtr transform);
-static int xmlSecMSCryptoSignatureInitialize (xmlSecTransformPtr transform);
-static void xmlSecMSCryptoSignatureFinalize (xmlSecTransformPtr transform);
-static int xmlSecMSCryptoSignatureSetKeyReq (xmlSecTransformPtr transform,
- xmlSecKeyReqPtr keyReq);
-static int xmlSecMSCryptoSignatureSetKey (xmlSecTransformPtr transform,
- xmlSecKeyPtr key);
-static int xmlSecMSCryptoSignatureVerify (xmlSecTransformPtr transform,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecMSCryptoSignatureExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecMSCryptoSignatureCheckId (xmlSecTransformPtr transform);
+static int xmlSecMSCryptoSignatureInitialize (xmlSecTransformPtr transform);
+static void xmlSecMSCryptoSignatureFinalize (xmlSecTransformPtr transform);
+static int xmlSecMSCryptoSignatureSetKeyReq (xmlSecTransformPtr transform,
+ xmlSecKeyReqPtr keyReq);
+static int xmlSecMSCryptoSignatureSetKey (xmlSecTransformPtr transform,
+ xmlSecKeyPtr key);
+static int xmlSecMSCryptoSignatureVerify (xmlSecTransformPtr transform,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecMSCryptoSignatureExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
static int xmlSecMSCryptoSignatureCheckId(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_DSA
if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformDsaSha1Id)) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_DSA */
#ifndef XMLSEC_NO_GOST
if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformGost2001GostR3411_94Id)) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_GOST*/
#ifndef XMLSEC_NO_RSA
if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformRsaSha1Id)) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_RSA */
@@ -115,32 +115,32 @@ static int xmlSecMSCryptoSignatureInitialize(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_RSA
if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformRsaSha1Id)) {
- ctx->digestAlgId = CALG_SHA1;
- ctx->keyId = xmlSecMSCryptoKeyDataRsaId;
+ ctx->digestAlgId = CALG_SHA1;
+ ctx->keyId = xmlSecMSCryptoKeyDataRsaId;
} else
#endif /* XMLSEC_NO_RSA */
#ifndef XMLSEC_NO_GOST
if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformGost2001GostR3411_94Id)) {
- ctx->digestAlgId = CALG_MAGPRO_HASH_R3411_94;
- ctx->keyId = xmlSecMSCryptoKeyDataGost2001Id;
+ ctx->digestAlgId = CALG_MAGPRO_HASH_R3411_94;
+ ctx->keyId = xmlSecMSCryptoKeyDataGost2001Id;
} else
#endif /* XMLSEC_NO_GOST*/
#ifndef XMLSEC_NO_DSA
if(xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformDsaSha1Id)) {
- ctx->digestAlgId = CALG_SHA1;
- ctx->keyId = xmlSecMSCryptoKeyDataDsaId;
+ ctx->digestAlgId = CALG_SHA1;
+ ctx->keyId = xmlSecMSCryptoKeyDataDsaId;
} else
#endif /* XMLSEC_NO_DSA */
if(1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -156,12 +156,12 @@ static void xmlSecMSCryptoSignatureFinalize(xmlSecTransformPtr transform) {
xmlSecAssert(ctx != NULL);
if (ctx->mscHash) {
- CryptDestroyHash(ctx->mscHash);
+ CryptDestroyHash(ctx->mscHash);
}
if (ctx->data != NULL) {
- xmlSecKeyDataDestroy(ctx->data);
- ctx->data = NULL;
+ xmlSecKeyDataDestroy(ctx->data);
+ ctx->data = NULL;
}
memset(ctx, 0, sizeof(xmlSecMSCryptoSignatureCtx));
@@ -187,12 +187,12 @@ static int xmlSecMSCryptoSignatureSetKey(xmlSecTransformPtr transform, xmlSecKey
ctx->data = xmlSecKeyDataDuplicate(value);
if(ctx->data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecKeyDataDuplicate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecKeyDataDuplicate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -212,20 +212,20 @@ static int xmlSecMSCryptoSignatureSetKeyReq(xmlSecTransformPtr transform, xmlSe
keyReq->keyId = ctx->keyId;
if(transform->operation == xmlSecTransformOperationSign) {
- keyReq->keyType = xmlSecKeyDataTypePrivate;
- keyReq->keyUsage = xmlSecKeyUsageSign;
+ keyReq->keyType = xmlSecKeyDataTypePrivate;
+ keyReq->keyUsage = xmlSecKeyUsageSign;
} else {
- keyReq->keyType = xmlSecKeyDataTypePublic;
- keyReq->keyUsage = xmlSecKeyUsageVerify;
+ keyReq->keyType = xmlSecKeyDataTypePublic;
+ keyReq->keyUsage = xmlSecKeyUsageVerify;
}
return(0);
}
static int xmlSecMSCryptoSignatureVerify(xmlSecTransformPtr transform,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx) {
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecMSCryptoSignatureCtxPtr ctx;
xmlSecBuffer tmp;
HCRYPTKEY hKey;
@@ -246,12 +246,12 @@ static int xmlSecMSCryptoSignatureVerify(xmlSecTransformPtr transform,
ret = xmlSecBufferInitialize(&tmp, dataSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "dataSize=%d", dataSize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "dataSize=%d", dataSize);
+ return(-1);
}
tmpBuf = xmlSecBufferGetData(&tmp);
@@ -260,73 +260,73 @@ static int xmlSecMSCryptoSignatureVerify(xmlSecTransformPtr transform,
/* Reverse the sig - Windows stores integers as octet streams in little endian
* order. The I2OSP algorithm used by XMLDSig to store integers is big endian */
if (xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformDsaSha1Id)) {
- j = (BYTE *)data;
- k = (BYTE *)data + 20;
- l = tmpBuf + 19;
- m = tmpBuf + 39;
- while (l >= tmpBuf) {
- *l-- = *j++;
- *m-- = *k++;
- }
+ j = (BYTE *)data;
+ k = (BYTE *)data + 20;
+ l = tmpBuf + 19;
+ m = tmpBuf + 39;
+ while (l >= tmpBuf) {
+ *l-- = *j++;
+ *m-- = *k++;
+ }
#ifndef XMLSEC_NO_GOST
} else if (xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformGost2001GostR3411_94Id)) {
- j = (BYTE *)data;
- l = tmpBuf + dataSize - 1;
- while (l >= tmpBuf) {
- *l-- = *j++;
- }
+ j = (BYTE *)data;
+ l = tmpBuf + dataSize - 1;
+ while (l >= tmpBuf) {
+ *l-- = *j++;
+ }
#endif /*ndef XMLSEC_NO_GOST*/
} else if (xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformRsaSha1Id)) {
- j = (BYTE *)data;
- l = tmpBuf + dataSize - 1;
- while (l >= tmpBuf) {
- *l-- = *j++;
- }
+ j = (BYTE *)data;
+ l = tmpBuf + dataSize - 1;
+ while (l >= tmpBuf) {
+ *l-- = *j++;
+ }
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "Invalid algo");
- xmlSecBufferFinalize(&tmp);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "Invalid algo");
+ xmlSecBufferFinalize(&tmp);
+ return(-1);
}
hKey = xmlSecMSCryptoKeyDataGetKey(ctx->data, xmlSecKeyDataTypePublic);
if (hKey == 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecMSCryptoKeyDataGetKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBufferFinalize(&tmp);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecMSCryptoKeyDataGetKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBufferFinalize(&tmp);
+ return(-1);
}
if (!CryptVerifySignature(ctx->mscHash,
- tmpBuf,
- dataSize,
- hKey,
- NULL,
- 0)) {
- dwError = GetLastError();
- if (NTE_BAD_SIGNATURE == dwError) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "CryptVerifySignature",
- XMLSEC_ERRORS_R_DATA_NOT_MATCH,
- "signature do not match");
- transform->status = xmlSecTransformStatusFail;
- xmlSecBufferFinalize(&tmp);
- return(0);
- } else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "CryptVerifySignature",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBufferFinalize(&tmp);
- return (-1);
- }
+ tmpBuf,
+ dataSize,
+ hKey,
+ NULL,
+ 0)) {
+ dwError = GetLastError();
+ if (NTE_BAD_SIGNATURE == dwError) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "CryptVerifySignature",
+ XMLSEC_ERRORS_R_DATA_NOT_MATCH,
+ "signature do not match");
+ transform->status = xmlSecTransformStatusFail;
+ xmlSecBufferFinalize(&tmp);
+ return(0);
+ } else {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "CryptVerifySignature",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBufferFinalize(&tmp);
+ return (-1);
+ }
}
xmlSecBufferFinalize(&tmp);
transform->status = xmlSecTransformStatusOk;
@@ -362,156 +362,156 @@ xmlSecMSCryptoSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTra
xmlSecAssert2(ctx->digestAlgId != 0, -1);
if(transform->status == xmlSecTransformStatusNone) {
- xmlSecAssert2(outSize == 0, -1);
-
- if (0 == (hProv = xmlSecMSCryptoKeyDataGetMSCryptoProvider(ctx->data))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecMSCryptoKeyDataGetMSCryptoProvider",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return (-1);
- }
- if (!CryptCreateHash(hProv, ctx->digestAlgId, 0, 0, &(ctx->mscHash))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptCreateHash",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- transform->status = xmlSecTransformStatusWorking;
+ xmlSecAssert2(outSize == 0, -1);
+
+ if (0 == (hProv = xmlSecMSCryptoKeyDataGetMSCryptoProvider(ctx->data))) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecMSCryptoKeyDataGetMSCryptoProvider",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return (-1);
+ }
+ if (!CryptCreateHash(hProv, ctx->digestAlgId, 0, 0, &(ctx->mscHash))) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptCreateHash",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ transform->status = xmlSecTransformStatusWorking;
}
if((transform->status == xmlSecTransformStatusWorking) && (inSize > 0)) {
- xmlSecAssert2(outSize == 0, -1);
-
- if (!CryptHashData(ctx->mscHash, xmlSecBufferGetData(in), inSize, 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptHashData",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- ret = xmlSecBufferRemoveHead(in, inSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ xmlSecAssert2(outSize == 0, -1);
+
+ if (!CryptHashData(ctx->mscHash, xmlSecBufferGetData(in), inSize, 0)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptHashData",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ ret = xmlSecBufferRemoveHead(in, inSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
if((transform->status == xmlSecTransformStatusWorking) && (last != 0)) {
- xmlSecBuffer tmp;
-
- xmlSecAssert2(outSize == 0, -1);
-
- if(transform->operation == xmlSecTransformOperationSign) {
- dwKeySpec = xmlSecMSCryptoKeyDataGetMSCryptoKeySpec(ctx->data);
- if (!CryptSignHash(ctx->mscHash, dwKeySpec, NULL, 0, NULL, &dwSigLen)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptSignHash",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- outSize = (xmlSecSize)dwSigLen;
-
- ret = xmlSecBufferInitialize(&tmp, outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize);
- return(-1);
- }
- tmpBuf = xmlSecBufferGetData(&tmp);
- xmlSecAssert2(tmpBuf != NULL, -1);
-
- if (!CryptSignHash(ctx->mscHash, dwKeySpec, NULL, 0, tmpBuf, &dwSigLen)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CryptSignHash",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBufferFinalize(&tmp);
- return(-1);
- }
- outSize = (xmlSecSize)dwSigLen;
-
- ret = xmlSecBufferSetSize(out, outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize);
- xmlSecBufferFinalize(&tmp);
- return(-1);
- }
- outBuf = xmlSecBufferGetData(out);
- xmlSecAssert2(outBuf != NULL, -1);
-
- /* Now encode into a signature block,
- * convert signature value to big endian */
- if (xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformDsaSha1Id)) {
- i = tmpBuf;
- j = tmpBuf + 20;
- m = outBuf + 19;
- n = outBuf + 39;
- while (m >= outBuf) {
- *m-- = *i++;
- *n-- = *j++;
- }
+ xmlSecBuffer tmp;
+
+ xmlSecAssert2(outSize == 0, -1);
+
+ if(transform->operation == xmlSecTransformOperationSign) {
+ dwKeySpec = xmlSecMSCryptoKeyDataGetMSCryptoKeySpec(ctx->data);
+ if (!CryptSignHash(ctx->mscHash, dwKeySpec, NULL, 0, NULL, &dwSigLen)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptSignHash",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ outSize = (xmlSecSize)dwSigLen;
+
+ ret = xmlSecBufferInitialize(&tmp, outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize);
+ return(-1);
+ }
+ tmpBuf = xmlSecBufferGetData(&tmp);
+ xmlSecAssert2(tmpBuf != NULL, -1);
+
+ if (!CryptSignHash(ctx->mscHash, dwKeySpec, NULL, 0, tmpBuf, &dwSigLen)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CryptSignHash",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBufferFinalize(&tmp);
+ return(-1);
+ }
+ outSize = (xmlSecSize)dwSigLen;
+
+ ret = xmlSecBufferSetSize(out, outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize);
+ xmlSecBufferFinalize(&tmp);
+ return(-1);
+ }
+ outBuf = xmlSecBufferGetData(out);
+ xmlSecAssert2(outBuf != NULL, -1);
+
+ /* Now encode into a signature block,
+ * convert signature value to big endian */
+ if (xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformDsaSha1Id)) {
+ i = tmpBuf;
+ j = tmpBuf + 20;
+ m = outBuf + 19;
+ n = outBuf + 39;
+ while (m >= outBuf) {
+ *m-- = *i++;
+ *n-- = *j++;
+ }
#ifndef XMLSEC_NO_GOST
} else if (xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformGost2001GostR3411_94Id)) {
- i = tmpBuf;
- j = outBuf + dwSigLen - 1;
+ i = tmpBuf;
+ j = outBuf + dwSigLen - 1;
- while (j >= outBuf) {
- *j-- = *i++;
- }
+ while (j >= outBuf) {
+ *j-- = *i++;
+ }
#endif /*ndef XMLSEC_NO_GOST*/
- } else if (xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformRsaSha1Id)) {
- i = tmpBuf;
- j = outBuf + dwSigLen - 1;
-
- while (j >= outBuf) {
- *j-- = *i++;
- }
- } else {
- /* We shouldn't get at this place */
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "Invalid algo");
- xmlSecBufferFinalize(&tmp);
- return(-1);
- }
- xmlSecBufferFinalize(&tmp);
- }
- transform->status = xmlSecTransformStatusFinished;
+ } else if (xmlSecTransformCheckId(transform, xmlSecMSCryptoTransformRsaSha1Id)) {
+ i = tmpBuf;
+ j = outBuf + dwSigLen - 1;
+
+ while (j >= outBuf) {
+ *j-- = *i++;
+ }
+ } else {
+ /* We shouldn't get at this place */
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "Invalid algo");
+ xmlSecBufferFinalize(&tmp);
+ return(-1);
+ }
+ xmlSecBufferFinalize(&tmp);
+ }
+ transform->status = xmlSecTransformStatusFinished;
}
if((transform->status == xmlSecTransformStatusWorking) || (transform->status == xmlSecTransformStatusFinished)) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
@@ -526,29 +526,29 @@ xmlSecMSCryptoSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTra
***************************************************************************/
static xmlSecTransformKlass xmlSecMSCryptoRsaSha1Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecMSCryptoSignatureSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecMSCryptoSignatureSize, /* xmlSecSize objSize */
- xmlSecNameRsaSha1, /* const xmlChar* name; */
- xmlSecHrefRsaSha1, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameRsaSha1, /* const xmlChar* name; */
+ xmlSecHrefRsaSha1, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecMSCryptoSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecMSCryptoSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecMSCryptoSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecMSCryptoSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecMSCryptoSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecMSCryptoSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecMSCryptoSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecMSCryptoSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecMSCryptoSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecMSCryptoSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecMSCryptoSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecMSCryptoSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -574,29 +574,29 @@ xmlSecMSCryptoTransformRsaSha1GetKlass(void) {
static xmlSecTransformKlass xmlSecMSCryptoDsaSha1Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecMSCryptoSignatureSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecMSCryptoSignatureSize, /* xmlSecSize objSize */
- xmlSecNameDsaSha1, /* const xmlChar* name; */
- xmlSecHrefDsaSha1, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameDsaSha1, /* const xmlChar* name; */
+ xmlSecHrefDsaSha1, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecMSCryptoSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecMSCryptoSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecMSCryptoSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecMSCryptoSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecMSCryptoSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecMSCryptoSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecMSCryptoSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecMSCryptoSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecMSCryptoSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecMSCryptoSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecMSCryptoSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecMSCryptoSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -622,29 +622,29 @@ xmlSecMSCryptoTransformDsaSha1GetKlass(void) {
static xmlSecTransformKlass xmlSecMSCryptoGost2001GostR3411_94Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecMSCryptoSignatureSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecMSCryptoSignatureSize, /* xmlSecSize objSize */
- xmlSecNameGost2001GostR3411_94, /* const xmlChar* name; */
- xmlSecHrefGost2001GostR3411_94, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameGost2001GostR3411_94, /* const xmlChar* name; */
+ xmlSecHrefGost2001GostR3411_94, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecMSCryptoSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecMSCryptoSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecMSCryptoSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecMSCryptoSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecMSCryptoSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecMSCryptoSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecMSCryptoSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecMSCryptoSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecMSCryptoSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecMSCryptoSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecMSCryptoSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecMSCryptoSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
diff --git a/src/mscrypto/symkeys.c b/src/mscrypto/symkeys.c
index de9d98c..3f8eead 100644
--- a/src/mscrypto/symkeys.c
+++ b/src/mscrypto/symkeys.c
@@ -32,39 +32,39 @@
* Symmetic (binary) keys - just a wrapper for xmlSecKeyDataBinary
*
****************************************************************************/
-static int xmlSecMSCryptoSymKeyDataInitialize (xmlSecKeyDataPtr data);
-static int xmlSecMSCryptoSymKeyDataDuplicate (xmlSecKeyDataPtr dst,
- xmlSecKeyDataPtr src);
-static void xmlSecMSCryptoSymKeyDataFinalize (xmlSecKeyDataPtr data);
-static int xmlSecMSCryptoSymKeyDataXmlRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecMSCryptoSymKeyDataXmlWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecMSCryptoSymKeyDataBinRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- const unsigned char* buf,
- size_t bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecMSCryptoSymKeyDataBinWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- unsigned char** buf,
- size_t* bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecMSCryptoSymKeyDataGenerate (xmlSecKeyDataPtr data,
- size_t sizeBits,
- xmlSecKeyDataType type);
+static int xmlSecMSCryptoSymKeyDataInitialize (xmlSecKeyDataPtr data);
+static int xmlSecMSCryptoSymKeyDataDuplicate (xmlSecKeyDataPtr dst,
+ xmlSecKeyDataPtr src);
+static void xmlSecMSCryptoSymKeyDataFinalize (xmlSecKeyDataPtr data);
+static int xmlSecMSCryptoSymKeyDataXmlRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoSymKeyDataXmlWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoSymKeyDataBinRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ const unsigned char* buf,
+ size_t bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoSymKeyDataBinWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ unsigned char** buf,
+ size_t* bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoSymKeyDataGenerate (xmlSecKeyDataPtr data,
+ size_t sizeBits,
+ xmlSecKeyDataType type);
static xmlSecKeyDataType xmlSecMSCryptoSymKeyDataGetType(xmlSecKeyDataPtr data);
-static size_t xmlSecMSCryptoSymKeyDataGetSize (xmlSecKeyDataPtr data);
-static void xmlSecMSCryptoSymKeyDataDebugDump (xmlSecKeyDataPtr data,
- FILE* output);
-static void xmlSecMSCryptoSymKeyDataDebugXmlDump (xmlSecKeyDataPtr data,
- FILE* output);
-static int xmlSecMSCryptoSymKeyDataKlassCheck (xmlSecKeyDataKlass* klass);
+static size_t xmlSecMSCryptoSymKeyDataGetSize (xmlSecKeyDataPtr data);
+static void xmlSecMSCryptoSymKeyDataDebugDump (xmlSecKeyDataPtr data,
+ FILE* output);
+static void xmlSecMSCryptoSymKeyDataDebugXmlDump (xmlSecKeyDataPtr data,
+ FILE* output);
+static int xmlSecMSCryptoSymKeyDataKlassCheck (xmlSecKeyDataKlass* klass);
#ifndef XMLSEC_NO_AES
/**************************************************************************
@@ -79,35 +79,35 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataAesKlass = {
/* data */
xmlSecNameAESKeyValue,
xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefAESKeyValue, /* const xmlChar* href; */
- xmlSecNodeAESKeyValue, /* const xmlChar* dataNodeName; */
- xmlSecNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefAESKeyValue, /* const xmlChar* href; */
+ xmlSecNodeAESKeyValue, /* const xmlChar* dataNodeName; */
+ xmlSecNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecMSCryptoSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecMSCryptoSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecMSCryptoSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- xmlSecMSCryptoSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecMSCryptoSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecMSCryptoSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecMSCryptoSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ xmlSecMSCryptoSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecMSCryptoSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
- xmlSecMSCryptoSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecMSCryptoSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ xmlSecMSCryptoSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecMSCryptoSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecMSCryptoSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- xmlSecMSCryptoSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
- xmlSecMSCryptoSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecMSCryptoSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecMSCryptoSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ xmlSecMSCryptoSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
+ xmlSecMSCryptoSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecMSCryptoSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- xmlSecMSCryptoSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ xmlSecMSCryptoSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecMSCryptoSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -124,9 +124,9 @@ xmlSecMSCryptoKeyDataAesGetKlass(void) {
/**
* xmlSecMSCryptoKeyDataAesSet:
- * @data: the pointer to AES key data.
- * @buf: the pointer to key value.
- * @bufSize: the key value size (in bytes).
+ * @data: the pointer to AES key data.
+ * @buf: the pointer to key value.
+ * @bufSize: the key value size (in bytes).
*
* Sets the value of AES key data.
*
@@ -160,35 +160,35 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataDesKlass = {
/* data */
xmlSecNameDESKeyValue,
xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefDESKeyValue, /* const xmlChar* href; */
- xmlSecNodeDESKeyValue, /* const xmlChar* dataNodeName; */
- xmlSecNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefDESKeyValue, /* const xmlChar* href; */
+ xmlSecNodeDESKeyValue, /* const xmlChar* dataNodeName; */
+ xmlSecNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecMSCryptoSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecMSCryptoSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecMSCryptoSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- xmlSecMSCryptoSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecMSCryptoSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecMSCryptoSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecMSCryptoSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ xmlSecMSCryptoSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecMSCryptoSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
- xmlSecMSCryptoSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecMSCryptoSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ xmlSecMSCryptoSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecMSCryptoSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecMSCryptoSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- xmlSecMSCryptoSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
- xmlSecMSCryptoSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecMSCryptoSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecMSCryptoSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ xmlSecMSCryptoSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
+ xmlSecMSCryptoSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecMSCryptoSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- xmlSecMSCryptoSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ xmlSecMSCryptoSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecMSCryptoSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -237,7 +237,7 @@ xmlSecMSCryptoSymKeyDataFinalize(xmlSecKeyDataPtr data) {
static int
xmlSecMSCryptoSymKeyDataXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecAssert2(xmlSecMSCryptoSymKeyDataKlassCheck(id), -1);
return(xmlSecKeyDataBinaryValueXmlRead(id, key, node, keyInfoCtx));
@@ -245,7 +245,7 @@ xmlSecMSCryptoSymKeyDataXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
static int
xmlSecMSCryptoSymKeyDataXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecAssert2(xmlSecMSCryptoSymKeyDataKlassCheck(id), -1);
return(xmlSecKeyDataBinaryValueXmlWrite(id, key, node, keyInfoCtx));
@@ -253,8 +253,8 @@ xmlSecMSCryptoSymKeyDataXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
static int
xmlSecMSCryptoSymKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- const unsigned char* buf, size_t bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ const unsigned char* buf, size_t bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecAssert2(xmlSecMSCryptoSymKeyDataKlassCheck(id), -1);
return(xmlSecKeyDataBinaryValueBinRead(id, key, buf, bufSize, keyInfoCtx));
@@ -262,8 +262,8 @@ xmlSecMSCryptoSymKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
static int
xmlSecMSCryptoSymKeyDataBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
- unsigned char** buf, size_t* bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ unsigned char** buf, size_t* bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecAssert2(xmlSecMSCryptoSymKeyDataKlassCheck(id), -1);
return(xmlSecKeyDataBinaryValueBinWrite(id, key, buf, bufSize, keyInfoCtx));
@@ -319,13 +319,13 @@ static int
xmlSecMSCryptoSymKeyDataKlassCheck(xmlSecKeyDataKlass* klass) {
#ifndef XMLSEC_NO_DES
if(klass == xmlSecMSCryptoKeyDataDesId) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_DES */
#ifndef XMLSEC_NO_AES
if(klass == xmlSecMSCryptoKeyDataAesId) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_AES */
diff --git a/src/mscrypto/x509.c b/src/mscrypto/x509.c
index a08d5a4..6eedf88 100644
--- a/src/mscrypto/x509.c
+++ b/src/mscrypto/x509.c
@@ -51,73 +51,73 @@
* X509 utility functions
*
************************************************************************/
-static int xmlSecMSCryptoX509DataNodeRead (xmlSecKeyDataPtr data,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecMSCryptoX509CertificateNodeRead (xmlSecKeyDataPtr data,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecMSCryptoX509CertificateNodeWrite (PCCERT_CONTEXT cert,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecMSCryptoX509SubjectNameNodeRead (xmlSecKeyDataPtr data,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecMSCryptoX509SubjectNameNodeWrite (PCCERT_CONTEXT cert,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecMSCryptoX509IssuerSerialNodeRead (xmlSecKeyDataPtr data,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecMSCryptoX509IssuerSerialNodeWrite (PCCERT_CONTEXT cert,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecMSCryptoX509SKINodeRead (xmlSecKeyDataPtr data,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecMSCryptoX509SKINodeWrite (PCCERT_CONTEXT cert,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecMSCryptoX509CRLNodeRead (xmlSecKeyDataPtr data,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecMSCryptoX509CRLNodeWrite (PCCRL_CONTEXT crl,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecMSCryptoKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data,
- xmlSecKeyPtr key,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-
-static PCCERT_CONTEXT xmlSecMSCryptoX509CertDerRead (const xmlSecByte* buf,
- xmlSecSize size);
-static PCCERT_CONTEXT xmlSecMSCryptoX509CertBase64DerRead (xmlChar* buf);
-static xmlChar* xmlSecMSCryptoX509CertBase64DerWrite (PCCERT_CONTEXT cert,
- int base64LineWrap);
-static PCCRL_CONTEXT xmlSecMSCryptoX509CrlDerRead (xmlSecByte* buf,
- xmlSecSize size,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static PCCRL_CONTEXT xmlSecMSCryptoX509CrlBase64DerRead (xmlChar* buf,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static xmlChar* xmlSecMSCryptoX509CrlBase64DerWrite (PCCRL_CONTEXT crl,
- int base64LineWrap);
-static xmlChar* xmlSecMSCryptoX509NameWrite(PCERT_NAME_BLOB nm);
-static int xmlSecMSCryptoASN1IntegerWrite (xmlNodePtr node,
- PCRYPT_INTEGER_BLOB num);
-static xmlChar* xmlSecMSCryptoX509SKIWrite (PCCERT_CONTEXT cert);
-static void xmlSecMSCryptoX509CertDebugDump (PCCERT_CONTEXT cert,
- FILE* output);
-static void xmlSecMSCryptoX509CertDebugXmlDump (PCCERT_CONTEXT cert,
- FILE* output);
-static int xmlSecMSCryptoX509CertGetTime (FILETIME t,
- time_t* res);
+static int xmlSecMSCryptoX509DataNodeRead (xmlSecKeyDataPtr data,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoX509CertificateNodeRead (xmlSecKeyDataPtr data,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoX509CertificateNodeWrite (PCCERT_CONTEXT cert,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoX509SubjectNameNodeRead (xmlSecKeyDataPtr data,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoX509SubjectNameNodeWrite (PCCERT_CONTEXT cert,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoX509IssuerSerialNodeRead (xmlSecKeyDataPtr data,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoX509IssuerSerialNodeWrite (PCCERT_CONTEXT cert,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoX509SKINodeRead (xmlSecKeyDataPtr data,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoX509SKINodeWrite (PCCERT_CONTEXT cert,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoX509CRLNodeRead (xmlSecKeyDataPtr data,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoX509CRLNodeWrite (PCCRL_CONTEXT crl,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data,
+ xmlSecKeyPtr key,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+
+static PCCERT_CONTEXT xmlSecMSCryptoX509CertDerRead (const xmlSecByte* buf,
+ xmlSecSize size);
+static PCCERT_CONTEXT xmlSecMSCryptoX509CertBase64DerRead (xmlChar* buf);
+static xmlChar* xmlSecMSCryptoX509CertBase64DerWrite (PCCERT_CONTEXT cert,
+ int base64LineWrap);
+static PCCRL_CONTEXT xmlSecMSCryptoX509CrlDerRead (xmlSecByte* buf,
+ xmlSecSize size,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static PCCRL_CONTEXT xmlSecMSCryptoX509CrlBase64DerRead (xmlChar* buf,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static xmlChar* xmlSecMSCryptoX509CrlBase64DerWrite (PCCRL_CONTEXT crl,
+ int base64LineWrap);
+static xmlChar* xmlSecMSCryptoX509NameWrite(PCERT_NAME_BLOB nm);
+static int xmlSecMSCryptoASN1IntegerWrite (xmlNodePtr node,
+ PCRYPT_INTEGER_BLOB num);
+static xmlChar* xmlSecMSCryptoX509SKIWrite (PCCERT_CONTEXT cert);
+static void xmlSecMSCryptoX509CertDebugDump (PCCERT_CONTEXT cert,
+ FILE* output);
+static void xmlSecMSCryptoX509CertDebugXmlDump (PCCERT_CONTEXT cert,
+ FILE* output);
+static int xmlSecMSCryptoX509CertGetTime (FILETIME t,
+ time_t* res);
/*************************************************************************
*
* Internal MSCrypto X509 data CTX
*
************************************************************************/
-typedef struct _xmlSecMSCryptoX509DataCtx xmlSecMSCryptoX509DataCtx,
- *xmlSecMSCryptoX509DataCtxPtr;
+typedef struct _xmlSecMSCryptoX509DataCtx xmlSecMSCryptoX509DataCtx,
+ *xmlSecMSCryptoX509DataCtxPtr;
struct _xmlSecMSCryptoX509DataCtx {
PCCERT_CONTEXT keyCert;
@@ -141,18 +141,18 @@ struct _xmlSecMSCryptoX509DataCtx {
* 1. At least one element, from the following set of element types; any of these may appear together or more than once iff (if and only if) each instance describes or is related to the same certificate:
* 2.
* * The X509IssuerSerial element, which contains an X.509 issuer
- * distinguished name/serial number pair that SHOULD be compliant
- * with RFC2253 [LDAP-DN],
+ * distinguished name/serial number pair that SHOULD be compliant
+ * with RFC2253 [LDAP-DN],
* * The X509SubjectName element, which contains an X.509 subject
- * distinguished name that SHOULD be compliant with RFC2253 [LDAP-DN],
+ * distinguished name that SHOULD be compliant with RFC2253 [LDAP-DN],
* * The X509SKI element, which contains the base64 encoded plain (i.e.
- * non-DER-encoded) value of a X509 V.3 SubjectKeyIdentifier extension.
+ * non-DER-encoded) value of a X509 V.3 SubjectKeyIdentifier extension.
* * The X509Certificate element, which contains a base64-encoded [X509v3]
- * certificate, and
+ * certificate, and
* * Elements from an external namespace which accompanies/complements any
- * of the elements above.
+ * of the elements above.
* * The X509CRL element, which contains a base64-encoded certificate
- * revocation list (CRL) [X509v3].
+ * revocation list (CRL) [X509v3].
*
* Any X509IssuerSerial, X509SKI, and X509SubjectName elements that appear
* MUST refer to the certificate or certificates containing the validation key.
@@ -216,30 +216,30 @@ struct _xmlSecMSCryptoX509DataCtx {
* xmlSecMSCryptoX509DataCtx is located after xmlSecTransform
*
*************************************************************************/
-#define xmlSecMSCryptoX509DataSize \
- (sizeof(xmlSecKeyData) + sizeof(xmlSecMSCryptoX509DataCtx))
+#define xmlSecMSCryptoX509DataSize \
+ (sizeof(xmlSecKeyData) + sizeof(xmlSecMSCryptoX509DataCtx))
#define xmlSecMSCryptoX509DataGetCtx(data) \
((xmlSecMSCryptoX509DataCtxPtr)(((xmlSecByte*)(data)) + sizeof(xmlSecKeyData)))
-static int xmlSecMSCryptoKeyDataX509Initialize (xmlSecKeyDataPtr data);
-static int xmlSecMSCryptoKeyDataX509Duplicate (xmlSecKeyDataPtr dst,
- xmlSecKeyDataPtr src);
-static void xmlSecMSCryptoKeyDataX509Finalize (xmlSecKeyDataPtr data);
-static int xmlSecMSCryptoKeyDataX509XmlRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecMSCryptoKeyDataX509XmlWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static xmlSecKeyDataType xmlSecMSCryptoKeyDataX509GetType (xmlSecKeyDataPtr data);
-static const xmlChar* xmlSecMSCryptoKeyDataX509GetIdentifier (xmlSecKeyDataPtr data);
+static int xmlSecMSCryptoKeyDataX509Initialize (xmlSecKeyDataPtr data);
+static int xmlSecMSCryptoKeyDataX509Duplicate (xmlSecKeyDataPtr dst,
+ xmlSecKeyDataPtr src);
+static void xmlSecMSCryptoKeyDataX509Finalize (xmlSecKeyDataPtr data);
+static int xmlSecMSCryptoKeyDataX509XmlRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoKeyDataX509XmlWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static xmlSecKeyDataType xmlSecMSCryptoKeyDataX509GetType (xmlSecKeyDataPtr data);
+static const xmlChar* xmlSecMSCryptoKeyDataX509GetIdentifier (xmlSecKeyDataPtr data);
-static void xmlSecMSCryptoKeyDataX509DebugDump (xmlSecKeyDataPtr data,
- FILE* output);
-static void xmlSecMSCryptoKeyDataX509DebugXmlDump (xmlSecKeyDataPtr data,
- FILE* output);
+static void xmlSecMSCryptoKeyDataX509DebugDump (xmlSecKeyDataPtr data,
+ FILE* output);
+static void xmlSecMSCryptoKeyDataX509DebugXmlDump (xmlSecKeyDataPtr data,
+ FILE* output);
@@ -250,35 +250,35 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataX509Klass = {
/* data */
xmlSecNameX509Data,
xmlSecKeyDataUsageKeyInfoNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefX509Data, /* const xmlChar* href; */
- xmlSecNodeX509Data, /* const xmlChar* dataNodeName; */
- xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefX509Data, /* const xmlChar* href; */
+ xmlSecNodeX509Data, /* const xmlChar* dataNodeName; */
+ xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecMSCryptoKeyDataX509Initialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecMSCryptoKeyDataX509Duplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecMSCryptoKeyDataX509Finalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- NULL, /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecMSCryptoKeyDataX509Initialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecMSCryptoKeyDataX509Duplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecMSCryptoKeyDataX509Finalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ NULL, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecMSCryptoKeyDataX509GetType, /* xmlSecKeyDataGetTypeMethod getType; */
- NULL, /* xmlSecKeyDataGetSizeMethod getSize; */
- xmlSecMSCryptoKeyDataX509GetIdentifier, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecMSCryptoKeyDataX509GetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ NULL, /* xmlSecKeyDataGetSizeMethod getSize; */
+ xmlSecMSCryptoKeyDataX509GetIdentifier, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecMSCryptoKeyDataX509XmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecMSCryptoKeyDataX509XmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- NULL, /* xmlSecKeyDataBinReadMethod binRead; */
- NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecMSCryptoKeyDataX509XmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecMSCryptoKeyDataX509XmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ NULL, /* xmlSecKeyDataBinReadMethod binRead; */
+ NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecMSCryptoKeyDataX509DebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- xmlSecMSCryptoKeyDataX509DebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ xmlSecMSCryptoKeyDataX509DebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecMSCryptoKeyDataX509DebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -295,7 +295,7 @@ xmlSecMSCryptoKeyDataX509GetKlass(void) {
/**
* xmlSecMSCryptoKeyDataX509GetKeyCert:
- * @data: the pointer to X509 key data.
+ * @data: the pointer to X509 key data.
*
* Gets the certificate from which the key was extracted.
*
@@ -316,8 +316,8 @@ xmlSecMSCryptoKeyDataX509GetKeyCert(xmlSecKeyDataPtr data) {
/**
* xmlSecMSCryptoKeyDataX509AdoptKeyCert:
- * @data: the pointer to X509 key data.
- * @cert: the pointer to MSCRYPTO X509 certificate.
+ * @data: the pointer to X509 key data.
+ * @cert: the pointer to MSCRYPTO X509 certificate.
*
* Sets the key's certificate in @data.
*
@@ -334,8 +334,8 @@ xmlSecMSCryptoKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data, PCCERT_CONTEXT cert
xmlSecAssert2(ctx != NULL, -1);
if(ctx->keyCert != NULL) {
- CertFreeCertificateContext(ctx->keyCert);
- ctx->keyCert = 0;
+ CertFreeCertificateContext(ctx->keyCert);
+ ctx->keyCert = 0;
}
ctx->keyCert = cert;
@@ -344,8 +344,8 @@ xmlSecMSCryptoKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data, PCCERT_CONTEXT cert
/**
* xmlSecMSCryptoKeyDataX509AdoptCert:
- * @data: the pointer to X509 key data.
- * @cert: the pointer to MSCRYPTO X509 certificate.
+ * @data: the pointer to X509 key data.
+ * @cert: the pointer to MSCRYPTO X509 certificate.
*
* Adds certificate to the X509 key data.
*
@@ -363,12 +363,12 @@ xmlSecMSCryptoKeyDataX509AdoptCert(xmlSecKeyDataPtr data, PCCERT_CONTEXT cert) {
xmlSecAssert2(ctx->hMemStore != 0, -1);
if (!CertAddCertificateContextToStore(ctx->hMemStore, cert, CERT_STORE_ADD_ALWAYS, NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "CertAddCertificateContextToStore",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "CertAddCertificateContextToStore",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
CertFreeCertificateContext(cert);
ctx->numCerts++;
@@ -378,8 +378,8 @@ xmlSecMSCryptoKeyDataX509AdoptCert(xmlSecKeyDataPtr data, PCCERT_CONTEXT cert) {
/**
* xmlSecMSCryptoKeyDataX509GetCert:
- * @data: the pointer to X509 key data.
- * @pos: the desired certificate position.
+ * @data: the pointer to X509 key data.
+ * @pos: the desired certificate position.
*
* Gets a certificate from X509 key data.
*
@@ -399,7 +399,7 @@ xmlSecMSCryptoKeyDataX509GetCert(xmlSecKeyDataPtr data, xmlSecSize pos) {
xmlSecAssert2(ctx->numCerts > pos, NULL);
while ((pCert = CertEnumCertificatesInStore(ctx->hMemStore, pCert)) && (pos > 0)) {
- pos--;
+ pos--;
}
return(pCert);
@@ -407,13 +407,13 @@ xmlSecMSCryptoKeyDataX509GetCert(xmlSecKeyDataPtr data, xmlSecSize pos) {
/**
* xmlSecMSCryptoKeyDataX509GetCertsSize:
- * @data: the pointer to X509 key data.
+ * @data: the pointer to X509 key data.
*
* Gets the number of certificates in @data.
*
* Returns: te number of certificates in @data.
*/
-xmlSecSize
+xmlSecSize
xmlSecMSCryptoKeyDataX509GetCertsSize(xmlSecKeyDataPtr data) {
xmlSecMSCryptoX509DataCtxPtr ctx;
@@ -427,8 +427,8 @@ xmlSecMSCryptoKeyDataX509GetCertsSize(xmlSecKeyDataPtr data) {
/**
* xmlSecMSCryptoKeyDataX509AdoptCrl:
- * @data: the pointer to X509 key data.
- * @crl: the pointer to MSCrypto X509 CRL.
+ * @data: the pointer to X509 key data.
+ * @crl: the pointer to MSCrypto X509 CRL.
*
* Adds CRL to the X509 key data.
*
@@ -446,12 +446,12 @@ xmlSecMSCryptoKeyDataX509AdoptCrl(xmlSecKeyDataPtr data, PCCRL_CONTEXT crl) {
xmlSecAssert2(ctx->hMemStore != 0, -1);
if (!CertAddCRLContextToStore(ctx->hMemStore, crl, CERT_STORE_ADD_ALWAYS, NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "CertAddCRLContextToStore",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "CertAddCRLContextToStore",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ctx->numCrls++;
@@ -480,7 +480,7 @@ xmlSecMSCryptoKeyDataX509GetCrl(xmlSecKeyDataPtr data, xmlSecSize pos) {
xmlSecAssert2(ctx->numCrls > pos, NULL);
while ((pCRL = CertEnumCRLsInStore(ctx->hMemStore, pCRL)) && (pos > 0)) {
- pos--;
+ pos--;
}
return(pCRL);
@@ -506,7 +506,7 @@ xmlSecMSCryptoKeyDataX509GetCrlsSize(xmlSecKeyDataPtr data) {
return(ctx->numCrls);
}
-static int
+static int
xmlSecMSCryptoKeyDataX509Initialize(xmlSecKeyDataPtr data) {
xmlSecMSCryptoX509DataCtxPtr ctx;
@@ -518,17 +518,17 @@ xmlSecMSCryptoKeyDataX509Initialize(xmlSecKeyDataPtr data) {
memset(ctx, 0, sizeof(xmlSecMSCryptoX509DataCtx));
ctx->hMemStore = CertOpenStore(CERT_STORE_PROV_MEMORY,
- 0,
- 0,
- CERT_STORE_CREATE_NEW_FLAG,
- NULL);
+ 0,
+ 0,
+ CERT_STORE_CREATE_NEW_FLAG,
+ NULL);
if (ctx->hMemStore == 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "CertOpenStore",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "CertOpenStore",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -547,98 +547,98 @@ xmlSecMSCryptoKeyDataX509Duplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
/* copy certsList */
size = xmlSecMSCryptoKeyDataX509GetCertsSize(src);
for(pos = 0; pos < size; ++pos) {
- /* TBD: function below does linear scan, eliminate loop within
- * loop
- */
- certSrc = xmlSecMSCryptoKeyDataX509GetCert(src, pos);
- if(certSrc == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(src)),
- "xmlSecMSCryptoKeyDataX509GetCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
-
- certDst = CertDuplicateCertificateContext(certSrc);
- if(certDst == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "CertDuplicateCertificateContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- ret = xmlSecMSCryptoKeyDataX509AdoptCert(dst, certDst);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "xmlSecMSCryptoKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CertFreeCertificateContext(certDst);
- return(-1);
- }
+ /* TBD: function below does linear scan, eliminate loop within
+ * loop
+ */
+ certSrc = xmlSecMSCryptoKeyDataX509GetCert(src, pos);
+ if(certSrc == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(src)),
+ "xmlSecMSCryptoKeyDataX509GetCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+
+ certDst = CertDuplicateCertificateContext(certSrc);
+ if(certDst == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "CertDuplicateCertificateContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ ret = xmlSecMSCryptoKeyDataX509AdoptCert(dst, certDst);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "xmlSecMSCryptoKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CertFreeCertificateContext(certDst);
+ return(-1);
+ }
}
/* copy crls */
size = xmlSecMSCryptoKeyDataX509GetCrlsSize(src);
for(pos = 0; pos < size; ++pos) {
- crlSrc = xmlSecMSCryptoKeyDataX509GetCrl(src, pos);
- if(crlSrc == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(src)),
- "xmlSecMSCryptoKeyDataX509GetCrl",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
-
- crlDst = CertDuplicateCRLContext(crlSrc);
- if(crlDst == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "CertDuplicateCRLContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- ret = xmlSecMSCryptoKeyDataX509AdoptCrl(dst, crlDst);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "xmlSecMSCryptoKeyDataX509AdoptCrl",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CertFreeCRLContext(crlDst);
- return(-1);
- }
+ crlSrc = xmlSecMSCryptoKeyDataX509GetCrl(src, pos);
+ if(crlSrc == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(src)),
+ "xmlSecMSCryptoKeyDataX509GetCrl",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+
+ crlDst = CertDuplicateCRLContext(crlSrc);
+ if(crlDst == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "CertDuplicateCRLContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ ret = xmlSecMSCryptoKeyDataX509AdoptCrl(dst, crlDst);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "xmlSecMSCryptoKeyDataX509AdoptCrl",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CertFreeCRLContext(crlDst);
+ return(-1);
+ }
}
/* copy key cert if exist */
certSrc = xmlSecMSCryptoKeyDataX509GetKeyCert(src);
if(certSrc != NULL) {
- certDst = CertDuplicateCertificateContext(certSrc);
- if(certDst == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "CertDuplicateCertificateContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- ret = xmlSecMSCryptoKeyDataX509AdoptKeyCert(dst, certDst);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "xmlSecMSCryptoKeyDataX509AdoptKeyCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CertFreeCertificateContext(certDst);
- return(-1);
- }
+ certDst = CertDuplicateCertificateContext(certSrc);
+ if(certDst == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "CertDuplicateCertificateContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ ret = xmlSecMSCryptoKeyDataX509AdoptKeyCert(dst, certDst);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "xmlSecMSCryptoKeyDataX509AdoptKeyCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CertFreeCertificateContext(certDst);
+ return(-1);
+ }
}
return(0);
}
@@ -653,19 +653,19 @@ xmlSecMSCryptoKeyDataX509Finalize(xmlSecKeyDataPtr data) {
xmlSecAssert(ctx != NULL);
if(ctx->keyCert != NULL) {
- CertFreeCertificateContext(ctx->keyCert);
- ctx->keyCert = NULL;
+ CertFreeCertificateContext(ctx->keyCert);
+ ctx->keyCert = NULL;
}
if (ctx->hMemStore != 0) {
- if (!CertCloseStore(ctx->hMemStore, CERT_CLOSE_STORE_FORCE_FLAG)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CertCloseStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return;
- }
+ if (!CertCloseStore(ctx->hMemStore, CERT_CLOSE_STORE_FORCE_FLAG)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CertCloseStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return;
+ }
}
memset(ctx, 0, sizeof(xmlSecMSCryptoX509DataCtx));
@@ -673,7 +673,7 @@ xmlSecMSCryptoKeyDataX509Finalize(xmlSecKeyDataPtr data) {
static int
xmlSecMSCryptoKeyDataX509XmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyDataPtr data;
int ret;
@@ -684,48 +684,48 @@ xmlSecMSCryptoKeyDataX509XmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
data = xmlSecKeyEnsureData(key, id);
if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyEnsureData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyEnsureData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecMSCryptoX509DataNodeRead(data, node, keyInfoCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecMSCryptoX509DataNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecMSCryptoX509DataNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS) == 0) {
- ret = xmlSecMSCryptoKeyDataX509VerifyAndExtractKey(data, key, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecMSCryptoKeyDataX509VerifyAndExtractKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ret = xmlSecMSCryptoKeyDataX509VerifyAndExtractKey(data, key, keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecMSCryptoKeyDataX509VerifyAndExtractKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
return(0);
}
static int
xmlSecMSCryptoKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyDataPtr data;
PCCERT_CONTEXT cert;
PCCRL_CONTEXT crl;
xmlSecSize size, pos;
int content = 0;
int ret;
-
+
xmlSecAssert2(id == xmlSecMSCryptoKeyDataX509Id, -1);
xmlSecAssert2(key != NULL, -1);
xmlSecAssert2(node != NULL, -1);
@@ -733,110 +733,110 @@ xmlSecMSCryptoKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
content = xmlSecX509DataGetNodeContent (node, 1, keyInfoCtx);
if (content < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecX509DataGetNodeContent",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "content=%d", content);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecX509DataGetNodeContent",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "content=%d", content);
+ return(-1);
} else if(content == 0) {
- /* by default we are writing certificates and crls */
- content = XMLSEC_X509DATA_DEFAULT;
+ /* by default we are writing certificates and crls */
+ content = XMLSEC_X509DATA_DEFAULT;
}
/* get x509 data */
data = xmlSecKeyGetData(key, id);
if(data == NULL) {
- /* no x509 data in the key */
- return(0);
+ /* no x509 data in the key */
+ return(0);
}
/* write certs */
size = xmlSecMSCryptoKeyDataX509GetCertsSize(data);
for(pos = 0; pos < size; ++pos) {
- cert = xmlSecMSCryptoKeyDataX509GetCert(data, pos);
- if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecMSCryptoKeyDataX509GetCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
-
- if((content & XMLSEC_X509DATA_CERTIFICATE_NODE) != 0) {
- ret = xmlSecMSCryptoX509CertificateNodeWrite(cert, node, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecMSCryptoX509CertificateNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
- }
-
- if((content & XMLSEC_X509DATA_SUBJECTNAME_NODE) != 0) {
- ret = xmlSecMSCryptoX509SubjectNameNodeWrite(cert, node, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecMSCryptoX509SubjectNameNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
- }
-
- if((content & XMLSEC_X509DATA_ISSUERSERIAL_NODE) != 0) {
- ret = xmlSecMSCryptoX509IssuerSerialNodeWrite(cert, node, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecMSCryptoX509IssuerSerialNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
- }
-
- if((content & XMLSEC_X509DATA_SKI_NODE) != 0) {
- ret = xmlSecMSCryptoX509SKINodeWrite(cert, node, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecMSCryptoX509SKINodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
- }
+ cert = xmlSecMSCryptoKeyDataX509GetCert(data, pos);
+ if(cert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecMSCryptoKeyDataX509GetCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+
+ if((content & XMLSEC_X509DATA_CERTIFICATE_NODE) != 0) {
+ ret = xmlSecMSCryptoX509CertificateNodeWrite(cert, node, keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecMSCryptoX509CertificateNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+ }
+
+ if((content & XMLSEC_X509DATA_SUBJECTNAME_NODE) != 0) {
+ ret = xmlSecMSCryptoX509SubjectNameNodeWrite(cert, node, keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecMSCryptoX509SubjectNameNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+ }
+
+ if((content & XMLSEC_X509DATA_ISSUERSERIAL_NODE) != 0) {
+ ret = xmlSecMSCryptoX509IssuerSerialNodeWrite(cert, node, keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecMSCryptoX509IssuerSerialNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+ }
+
+ if((content & XMLSEC_X509DATA_SKI_NODE) != 0) {
+ ret = xmlSecMSCryptoX509SKINodeWrite(cert, node, keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecMSCryptoX509SKINodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+ }
}
/* write crls if needed */
if((content & XMLSEC_X509DATA_CRL_NODE) != 0) {
- size = xmlSecMSCryptoKeyDataX509GetCrlsSize(data);
- for(pos = 0; pos < size; ++pos) {
- crl = xmlSecMSCryptoKeyDataX509GetCrl(data, pos);
- if(crl == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecMSCryptoKeyDataX509GetCrl",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
-
- ret = xmlSecMSCryptoX509CRLNodeWrite(crl, node, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecMSCryptoX509CRLNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
- }
+ size = xmlSecMSCryptoKeyDataX509GetCrlsSize(data);
+ for(pos = 0; pos < size; ++pos) {
+ crl = xmlSecMSCryptoKeyDataX509GetCrl(data, pos);
+ if(crl == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecMSCryptoKeyDataX509GetCrl",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+
+ ret = xmlSecMSCryptoX509CRLNodeWrite(crl, node, keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecMSCryptoX509CRLNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+ }
}
return(0);
@@ -869,23 +869,23 @@ xmlSecMSCryptoKeyDataX509DebugDump(xmlSecKeyDataPtr data, FILE* output) {
fprintf(output, "=== X509 Data:\n");
cert = xmlSecMSCryptoKeyDataX509GetKeyCert(data);
if(cert != NULL) {
- fprintf(output, "==== Key Certificate:\n");
- xmlSecMSCryptoX509CertDebugDump(cert, output);
+ fprintf(output, "==== Key Certificate:\n");
+ xmlSecMSCryptoX509CertDebugDump(cert, output);
}
size = xmlSecMSCryptoKeyDataX509GetCertsSize(data);
for(pos = 0; pos < size; ++pos) {
- cert = xmlSecMSCryptoKeyDataX509GetCert(data, pos);
- if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecMSCryptoKeyDataX509GetCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return;
- }
- fprintf(output, "==== Certificate:\n");
- xmlSecMSCryptoX509CertDebugDump(cert, output);
+ cert = xmlSecMSCryptoKeyDataX509GetCert(data, pos);
+ if(cert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecMSCryptoKeyDataX509GetCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return;
+ }
+ fprintf(output, "==== Certificate:\n");
+ xmlSecMSCryptoX509CertDebugDump(cert, output);
}
/* we don't print out crls */
@@ -902,25 +902,25 @@ xmlSecMSCryptoKeyDataX509DebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
fprintf(output, "<X509Data>\n");
cert = xmlSecMSCryptoKeyDataX509GetKeyCert(data);
if(cert != NULL) {
- fprintf(output, "<KeyCertificate>\n");
- xmlSecMSCryptoX509CertDebugXmlDump(cert, output);
- fprintf(output, "</KeyCertificate>\n");
+ fprintf(output, "<KeyCertificate>\n");
+ xmlSecMSCryptoX509CertDebugXmlDump(cert, output);
+ fprintf(output, "</KeyCertificate>\n");
}
size = xmlSecMSCryptoKeyDataX509GetCertsSize(data);
for(pos = 0; pos < size; ++pos) {
- cert = xmlSecMSCryptoKeyDataX509GetCert(data, pos);
- if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecMSCryptoKeyDataX509GetCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return;
- }
- fprintf(output, "<Certificate>\n");
- xmlSecMSCryptoX509CertDebugXmlDump(cert, output);
- fprintf(output, "</Certificate>\n");
+ cert = xmlSecMSCryptoKeyDataX509GetCert(data, pos);
+ if(cert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecMSCryptoKeyDataX509GetCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return;
+ }
+ fprintf(output, "<Certificate>\n");
+ xmlSecMSCryptoX509CertDebugXmlDump(cert, output);
+ fprintf(output, "</Certificate>\n");
}
/* we don't print out crls */
@@ -937,43 +937,43 @@ xmlSecMSCryptoX509DataNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKey
xmlSecAssert2(keyInfoCtx != NULL, -1);
for(cur = xmlSecGetNextElementNode(node->children);
- cur != NULL;
- cur = xmlSecGetNextElementNode(cur->next)) {
-
- ret = 0;
- if(xmlSecCheckNodeName(cur, xmlSecNodeX509Certificate, xmlSecDSigNs)) {
- ret = xmlSecMSCryptoX509CertificateNodeRead(data, cur, keyInfoCtx);
- } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509SubjectName, xmlSecDSigNs)) {
- ret = xmlSecMSCryptoX509SubjectNameNodeRead(data, cur, keyInfoCtx);
- } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509IssuerSerial, xmlSecDSigNs)) {
- ret = xmlSecMSCryptoX509IssuerSerialNodeRead(data, cur, keyInfoCtx);
- } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509SKI, xmlSecDSigNs)) {
- ret = xmlSecMSCryptoX509SKINodeRead(data, cur, keyInfoCtx);
- } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509CRL, xmlSecDSigNs)) {
- ret = xmlSecMSCryptoX509CRLNodeRead(data, cur, keyInfoCtx);
- } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CHILD) != 0) {
- /* laxi schema validation: ignore unknown nodes */
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "read node failed");
- return(-1);
- }
+ cur != NULL;
+ cur = xmlSecGetNextElementNode(cur->next)) {
+
+ ret = 0;
+ if(xmlSecCheckNodeName(cur, xmlSecNodeX509Certificate, xmlSecDSigNs)) {
+ ret = xmlSecMSCryptoX509CertificateNodeRead(data, cur, keyInfoCtx);
+ } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509SubjectName, xmlSecDSigNs)) {
+ ret = xmlSecMSCryptoX509SubjectNameNodeRead(data, cur, keyInfoCtx);
+ } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509IssuerSerial, xmlSecDSigNs)) {
+ ret = xmlSecMSCryptoX509IssuerSerialNodeRead(data, cur, keyInfoCtx);
+ } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509SKI, xmlSecDSigNs)) {
+ ret = xmlSecMSCryptoX509SKINodeRead(data, cur, keyInfoCtx);
+ } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509CRL, xmlSecDSigNs)) {
+ ret = xmlSecMSCryptoX509CRLNodeRead(data, cur, keyInfoCtx);
+ } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CHILD) != 0) {
+ /* laxi schema validation: ignore unknown nodes */
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "read node failed");
+ return(-1);
+ }
}
return(0);
}
static int
-xmlSecMSCryptoX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+xmlSecMSCryptoX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlChar *content;
PCCERT_CONTEXT cert;
int ret;
@@ -984,41 +984,41 @@ xmlSecMSCryptoX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xm
content = xmlNodeGetContent(node);
if((content == NULL) || (xmlSecIsEmptyString(content) == 1)) {
- if(content != NULL) {
- xmlFree(content);
- }
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- return(0);
+ if(content != NULL) {
+ xmlFree(content);
+ }
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ return(0);
}
cert = xmlSecMSCryptoX509CertBase64DerRead(content);
if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecMSCryptoX509CertBase64DerRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(content);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecMSCryptoX509CertBase64DerRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(content);
+ return(-1);
}
ret = xmlSecMSCryptoKeyDataX509AdoptCert(data, cert);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecMSCryptoKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CertFreeCertificateContext(cert);
- xmlFree(content);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecMSCryptoKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CertFreeCertificateContext(cert);
+ xmlFree(content);
+ return(-1);
}
xmlFree(content);
@@ -1027,7 +1027,7 @@ xmlSecMSCryptoX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xm
static int
xmlSecMSCryptoX509CertificateNodeWrite(PCCERT_CONTEXT cert, xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlChar* buf;
xmlNodePtr cur;
@@ -1038,24 +1038,24 @@ xmlSecMSCryptoX509CertificateNodeWrite(PCCERT_CONTEXT cert, xmlNodePtr node,
/* set base64 lines size from context */
buf = xmlSecMSCryptoX509CertBase64DerWrite(cert, keyInfoCtx->base64LineSize);
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoX509CertBase64DerWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoX509CertBase64DerWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecAddChild(node, xmlSecNodeX509Certificate, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509Certificate));
- xmlFree(buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509Certificate));
+ xmlFree(buf);
+ return(-1);
}
/* todo: add \n around base64 data - from context */
@@ -1066,8 +1066,8 @@ xmlSecMSCryptoX509CertificateNodeWrite(PCCERT_CONTEXT cert, xmlNodePtr node,
return(0);
}
-static int
-xmlSecMSCryptoX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+static int
+xmlSecMSCryptoX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyDataStorePtr x509Store;
xmlChar* subject;
PCCERT_CONTEXT cert;
@@ -1080,56 +1080,56 @@ xmlSecMSCryptoX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xm
x509Store = xmlSecKeysMngrGetDataStore(keyInfoCtx->keysMngr, xmlSecMSCryptoX509StoreId);
if(x509Store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeysMngrGetDataStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeysMngrGetDataStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
subject = xmlNodeGetContent(node);
if((subject == NULL) || (xmlSecIsEmptyString(subject) == 1)) {
- if(subject != NULL) {
- xmlFree(subject);
- }
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- return(0);
+ if(subject != NULL) {
+ xmlFree(subject);
+ }
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ return(0);
}
cert = xmlSecMSCryptoX509StoreFindCert(x509Store, subject, NULL, NULL, NULL, keyInfoCtx);
if(cert == NULL){
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- NULL,
- XMLSEC_ERRORS_R_CERT_NOT_FOUND,
- "subject=%s",
- xmlSecErrorsSafeString(subject));
- xmlFree(subject);
- return(-1);
- }
- xmlFree(subject);
- return(0);
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ NULL,
+ XMLSEC_ERRORS_R_CERT_NOT_FOUND,
+ "subject=%s",
+ xmlSecErrorsSafeString(subject));
+ xmlFree(subject);
+ return(-1);
+ }
+ xmlFree(subject);
+ return(0);
}
ret = xmlSecMSCryptoKeyDataX509AdoptCert(data, cert);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecMSCryptoKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CertFreeCertificateContext(cert);
- xmlFree(subject);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecMSCryptoKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CertFreeCertificateContext(cert);
+ xmlFree(subject);
+ return(-1);
}
xmlFree(subject);
@@ -1146,24 +1146,24 @@ xmlSecMSCryptoX509SubjectNameNodeWrite(PCCERT_CONTEXT cert, xmlNodePtr node, xml
buf = xmlSecMSCryptoX509NameWrite(&(cert->pCertInfo->Subject));
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoX509NameWrite(&(cert->pCertInfo->Subject))",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoX509NameWrite(&(cert->pCertInfo->Subject))",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecAddChild(node, xmlSecNodeX509SubjectName, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509SubjectName));
- xmlFree(buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509SubjectName));
+ xmlFree(buf);
+ return(-1);
}
xmlSecNodeEncodeAndSetContent(cur, buf);
xmlFree(buf);
@@ -1186,116 +1186,116 @@ xmlSecMSCryptoX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, x
x509Store = xmlSecKeysMngrGetDataStore(keyInfoCtx->keysMngr, xmlSecMSCryptoX509StoreId);
if(x509Store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeysMngrGetDataStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeysMngrGetDataStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecGetNextElementNode(node->children);
if(cur == NULL) {
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeX509IssuerName),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
- }
- return(0);
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeX509IssuerName),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
+ }
+ return(0);
}
/* the first is required node X509IssuerName */
if(!xmlSecCheckNodeName(cur, xmlSecNodeX509IssuerName, xmlSecDSigNs)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeX509IssuerName),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeX509IssuerName),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
}
issuerName = xmlNodeGetContent(cur);
if(issuerName == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509IssuerName));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509IssuerName));
+ return(-1);
}
cur = xmlSecGetNextElementNode(cur->next);
/* next is required node X509SerialNumber */
if((cur == NULL) || !xmlSecCheckNodeName(cur, xmlSecNodeX509SerialNumber, xmlSecDSigNs)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber));
- xmlFree(issuerName);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber));
+ xmlFree(issuerName);
+ return(-1);
}
issuerSerial = xmlNodeGetContent(cur);
if(issuerSerial == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- xmlFree(issuerName);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ xmlFree(issuerName);
+ return(-1);
}
cur = xmlSecGetNextElementNode(cur->next);
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(issuerSerial);
- xmlFree(issuerName);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(issuerSerial);
+ xmlFree(issuerName);
+ return(-1);
}
cert = xmlSecMSCryptoX509StoreFindCert(x509Store, NULL, issuerName, issuerSerial, NULL, keyInfoCtx);
if(cert == NULL){
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- NULL,
- XMLSEC_ERRORS_R_CERT_NOT_FOUND,
- "issuerName=%s;issuerSerial=%s",
- xmlSecErrorsSafeString(issuerName),
- xmlSecErrorsSafeString(issuerSerial));
- xmlFree(issuerSerial);
- xmlFree(issuerName);
- return(-1);
- }
-
- xmlFree(issuerSerial);
- xmlFree(issuerName);
- return(0);
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ NULL,
+ XMLSEC_ERRORS_R_CERT_NOT_FOUND,
+ "issuerName=%s;issuerSerial=%s",
+ xmlSecErrorsSafeString(issuerName),
+ xmlSecErrorsSafeString(issuerSerial));
+ xmlFree(issuerSerial);
+ xmlFree(issuerName);
+ return(-1);
+ }
+
+ xmlFree(issuerSerial);
+ xmlFree(issuerName);
+ return(0);
}
ret = xmlSecMSCryptoKeyDataX509AdoptCert(data, cert);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecMSCryptoKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CertFreeCertificateContext(cert);
- xmlFree(issuerSerial);
- xmlFree(issuerName);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecMSCryptoKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CertFreeCertificateContext(cert);
+ xmlFree(issuerSerial);
+ xmlFree(issuerName);
+ return(-1);
}
xmlFree(issuerSerial);
@@ -1305,8 +1305,8 @@ xmlSecMSCryptoX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, x
static int
xmlSecMSCryptoX509IssuerSerialNodeWrite(PCCERT_CONTEXT cert,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx ATTRIBUTE_UNUSED) {
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx ATTRIBUTE_UNUSED) {
xmlNodePtr cur;
xmlNodePtr issuerNameNode;
xmlNodePtr issuerNumberNode;
@@ -1319,58 +1319,58 @@ xmlSecMSCryptoX509IssuerSerialNodeWrite(PCCERT_CONTEXT cert,
/* create xml nodes */
cur = xmlSecAddChild(node, xmlSecNodeX509IssuerSerial, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509IssuerSerial));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509IssuerSerial));
+ return(-1);
}
issuerNameNode = xmlSecAddChild(cur, xmlSecNodeX509IssuerName, xmlSecDSigNs);
if(issuerNameNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509IssuerName));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509IssuerName));
+ return(-1);
}
issuerNumberNode = xmlSecAddChild(cur, xmlSecNodeX509SerialNumber, xmlSecDSigNs);
if(issuerNumberNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber));
+ return(-1);
}
/* write data */
buf = xmlSecMSCryptoX509NameWrite(&(cert->pCertInfo->Issuer));
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoX509NameWrite(&(cert->pCertInfo->Issuer))",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoX509NameWrite(&(cert->pCertInfo->Issuer))",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
xmlSecNodeEncodeAndSetContent(issuerNameNode, buf);
xmlFree(buf);
ret = xmlSecMSCryptoASN1IntegerWrite(issuerNumberNode, &(cert->pCertInfo->SerialNumber));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoASN1IntegerWrite(&(cert->serialNumber))",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoASN1IntegerWrite(&(cert->serialNumber))",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
@@ -1389,57 +1389,57 @@ xmlSecMSCryptoX509SKINodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyI
x509Store = xmlSecKeysMngrGetDataStore(keyInfoCtx->keysMngr, xmlSecMSCryptoX509StoreId);
if(x509Store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeysMngrGetDataStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeysMngrGetDataStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ski = xmlNodeGetContent(node);
if((ski == NULL) || (xmlSecIsEmptyString(ski) == 1)) {
- if(ski != NULL) {
- xmlFree(ski);
- }
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509SKI));
- return(-1);
- }
- return(0);
+ if(ski != NULL) {
+ xmlFree(ski);
+ }
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509SKI));
+ return(-1);
+ }
+ return(0);
}
cert = xmlSecMSCryptoX509StoreFindCert(x509Store, NULL, NULL, NULL, ski, keyInfoCtx);
if(cert == NULL){
- xmlFree(ski);
+ xmlFree(ski);
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- NULL,
- XMLSEC_ERRORS_R_CERT_NOT_FOUND,
- "ski=%s",
- xmlSecErrorsSafeString(ski));
- return(-1);
- }
- return(0);
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ NULL,
+ XMLSEC_ERRORS_R_CERT_NOT_FOUND,
+ "ski=%s",
+ xmlSecErrorsSafeString(ski));
+ return(-1);
+ }
+ return(0);
}
ret = xmlSecMSCryptoKeyDataX509AdoptCert(data, cert);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecMSCryptoKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CertFreeCertificateContext(cert);
- xmlFree(ski);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecMSCryptoKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CertFreeCertificateContext(cert);
+ xmlFree(ski);
+ return(-1);
}
xmlFree(ski);
@@ -1456,24 +1456,24 @@ xmlSecMSCryptoX509SKINodeWrite(PCCERT_CONTEXT cert, xmlNodePtr node, xmlSecKeyIn
buf = xmlSecMSCryptoX509SKIWrite(cert);
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoX509SKIWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoX509SKIWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecAddChild(node, xmlSecNodeX509SKI, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "new_node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509SKI));
- xmlFree(buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "new_node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509SKI));
+ xmlFree(buf);
+ return(-1);
}
xmlSecNodeEncodeAndSetContent(cur, buf);
xmlFree(buf);
@@ -1492,40 +1492,40 @@ xmlSecMSCryptoX509CRLNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyI
content = xmlNodeGetContent(node);
if((content == NULL) || (xmlSecIsEmptyString(content) == 1)) {
- if(content != NULL) {
- xmlFree(content);
- }
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- return(0);
+ if(content != NULL) {
+ xmlFree(content);
+ }
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ return(0);
}
crl = xmlSecMSCryptoX509CrlBase64DerRead(content, keyInfoCtx);
if(crl == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecMSCryptoX509CrlBase64DerRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(content);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecMSCryptoX509CrlBase64DerRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(content);
+ return(-1);
}
if (0 != xmlSecMSCryptoKeyDataX509AdoptCrl(data, crl)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecMSCryptoKeyDataX509AdoptCrl",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(content);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecMSCryptoKeyDataX509AdoptCrl",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(content);
CertFreeCRLContext(crl);
- return(-1);
+ return(-1);
}
xmlFree(content);
@@ -1544,24 +1544,24 @@ xmlSecMSCryptoX509CRLNodeWrite(PCCRL_CONTEXT crl, xmlNodePtr node, xmlSecKeyInfo
/* set base64 lines size from context */
buf = xmlSecMSCryptoX509CrlBase64DerWrite(crl, keyInfoCtx->base64LineSize);
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoX509CrlBase64DerWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoX509CrlBase64DerWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecAddChild(node, xmlSecNodeX509CRL, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "new_node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509CRL));
- xmlFree(buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "new_node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509CRL));
+ xmlFree(buf);
+ return(-1);
}
/* todo: add \n around base64 data - from context */
/* todo: add errors check */
@@ -1575,7 +1575,7 @@ xmlSecMSCryptoX509CRLNodeWrite(PCCRL_CONTEXT crl, xmlNodePtr node, xmlSecKeyInfo
static int
xmlSecMSCryptoKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr key,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecMSCryptoX509DataCtxPtr ctx;
xmlSecKeyDataStorePtr x509Store;
int ret;
@@ -1591,119 +1591,119 @@ xmlSecMSCryptoKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr
x509Store = xmlSecKeysMngrGetDataStore(keyInfoCtx->keysMngr, xmlSecMSCryptoX509StoreId);
if(x509Store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeysMngrGetDataStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeysMngrGetDataStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((ctx->keyCert == NULL) && (xmlSecKeyGetValue(key) == NULL)) {
- PCCERT_CONTEXT cert;
+ PCCERT_CONTEXT cert;
- cert = xmlSecMSCryptoX509StoreVerify(x509Store, ctx->hMemStore, keyInfoCtx);
- if(cert != NULL) {
- xmlSecKeyDataPtr keyValue = NULL;
+ cert = xmlSecMSCryptoX509StoreVerify(x509Store, ctx->hMemStore, keyInfoCtx);
+ if(cert != NULL) {
+ xmlSecKeyDataPtr keyValue = NULL;
PCCERT_CONTEXT pCert = NULL;
- ctx->keyCert = CertDuplicateCertificateContext(cert);
- if(ctx->keyCert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "CertDuplicateCertificateContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- /* search key according to KeyReq */
- pCert = CertDuplicateCertificateContext( ctx->keyCert ) ;
- if( pCert == NULL ) {
- xmlSecError( XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "CertDuplicateCertificateContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
-
- return(-1);
- }
-
- if( ( keyInfoCtx->keyReq.keyType & xmlSecKeyDataTypePrivate ) == xmlSecKeyDataTypePrivate ) {
- keyValue = xmlSecMSCryptoCertAdopt( pCert, xmlSecKeyDataTypePrivate ) ;
- if(keyValue == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecMSCryptoCertAdopt",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CertFreeCertificateContext( pCert ) ;
- return(-1);
- }
- pCert = NULL ;
- } else if( ( keyInfoCtx->keyReq.keyType & xmlSecKeyDataTypePublic ) == xmlSecKeyDataTypePublic ) {
- keyValue = xmlSecMSCryptoCertAdopt( pCert, xmlSecKeyDataTypePublic ) ;
- if(keyValue == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecMSCryptoCertAdopt",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CertFreeCertificateContext( pCert ) ;
- return(-1);
- }
- pCert = NULL ;
- }
-
- /* verify that the key matches our expectations */
- if(xmlSecKeyReqMatchKeyValue(&(keyInfoCtx->keyReq), keyValue) != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeyReqMatchKeyValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(keyValue);
- return(-1);
- }
-
- ret = xmlSecKeySetValue(key, keyValue);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(keyValue);
- return(-1);
- }
-
- ret = xmlSecMSCryptoX509CertGetTime(ctx->keyCert->pCertInfo->NotBefore, &(key->notValidBefore));
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecMSCryptoX509CertGetTime",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "notValidBefore");
- return(-1);
- }
-
- ret = xmlSecMSCryptoX509CertGetTime(ctx->keyCert->pCertInfo->NotAfter, &(key->notValidAfter));
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecMSCryptoX509CertGetTime",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "notValidAfter");
- return(-1);
- }
- } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_INVALID_CERT) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- NULL,
- XMLSEC_ERRORS_R_CERT_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ctx->keyCert = CertDuplicateCertificateContext(cert);
+ if(ctx->keyCert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "CertDuplicateCertificateContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ /* search key according to KeyReq */
+ pCert = CertDuplicateCertificateContext( ctx->keyCert ) ;
+ if( pCert == NULL ) {
+ xmlSecError( XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "CertDuplicateCertificateContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+
+ return(-1);
+ }
+
+ if( ( keyInfoCtx->keyReq.keyType & xmlSecKeyDataTypePrivate ) == xmlSecKeyDataTypePrivate ) {
+ keyValue = xmlSecMSCryptoCertAdopt( pCert, xmlSecKeyDataTypePrivate ) ;
+ if(keyValue == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecMSCryptoCertAdopt",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CertFreeCertificateContext( pCert ) ;
+ return(-1);
+ }
+ pCert = NULL ;
+ } else if( ( keyInfoCtx->keyReq.keyType & xmlSecKeyDataTypePublic ) == xmlSecKeyDataTypePublic ) {
+ keyValue = xmlSecMSCryptoCertAdopt( pCert, xmlSecKeyDataTypePublic ) ;
+ if(keyValue == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecMSCryptoCertAdopt",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CertFreeCertificateContext( pCert ) ;
+ return(-1);
+ }
+ pCert = NULL ;
+ }
+
+ /* verify that the key matches our expectations */
+ if(xmlSecKeyReqMatchKeyValue(&(keyInfoCtx->keyReq), keyValue) != 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeyReqMatchKeyValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(keyValue);
+ return(-1);
+ }
+
+ ret = xmlSecKeySetValue(key, keyValue);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(keyValue);
+ return(-1);
+ }
+
+ ret = xmlSecMSCryptoX509CertGetTime(ctx->keyCert->pCertInfo->NotBefore, &(key->notValidBefore));
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecMSCryptoX509CertGetTime",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "notValidBefore");
+ return(-1);
+ }
+
+ ret = xmlSecMSCryptoX509CertGetTime(ctx->keyCert->pCertInfo->NotAfter, &(key->notValidAfter));
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecMSCryptoX509CertGetTime",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "notValidAfter");
+ return(-1);
+ }
+ } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_INVALID_CERT) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ NULL,
+ XMLSEC_ERRORS_R_CERT_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
return(0);
}
@@ -1738,12 +1738,12 @@ xmlSecMSCryptoX509CertBase64DerRead(xmlChar* buf) {
/* usual trick with base64 decoding "in-place" */
ret = xmlSecBase64Decode(buf, (xmlSecByte*)buf, xmlStrlen(buf));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64Decode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64Decode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(xmlSecMSCryptoX509CertDerRead((xmlSecByte*)buf, ret));
@@ -1759,12 +1759,12 @@ xmlSecMSCryptoX509CertDerRead(const xmlSecByte* buf, xmlSecSize size) {
cert = CertCreateCertificateContext(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, buf, size);
if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CertCreateCertificateContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CertCreateCertificateContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(cert);
@@ -1781,22 +1781,22 @@ xmlSecMSCryptoX509CertBase64DerWrite(PCCERT_CONTEXT cert, int base64LineWrap) {
p = cert->pbCertEncoded;
size = cert->cbCertEncoded;
if((size <= 0) || (p == NULL)){
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "cert->pbCertEncoded",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "cert->pbCertEncoded",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
res = xmlSecBase64Encode(p, size, base64LineWrap);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64Encode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64Encode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(res);
@@ -1804,7 +1804,7 @@ xmlSecMSCryptoX509CertBase64DerWrite(PCCERT_CONTEXT cert, int base64LineWrap) {
static PCCRL_CONTEXT
xmlSecMSCryptoX509CrlBase64DerRead(xmlChar* buf,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
int ret;
xmlSecAssert2(buf != NULL, NULL);
@@ -1812,21 +1812,21 @@ xmlSecMSCryptoX509CrlBase64DerRead(xmlChar* buf,
/* usual trick with base64 decoding "in-place" */
ret = xmlSecBase64Decode(buf, (xmlSecByte*)buf, xmlStrlen(buf));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64Decode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64Decode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(xmlSecMSCryptoX509CrlDerRead((xmlSecByte*)buf, ret, keyInfoCtx));
}
-static PCCRL_CONTEXT
+static PCCRL_CONTEXT
xmlSecMSCryptoX509CrlDerRead(xmlSecByte* buf, xmlSecSize size,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
PCCRL_CONTEXT crl = NULL;
xmlSecAssert2(buf != NULL, NULL);
@@ -1836,16 +1836,16 @@ xmlSecMSCryptoX509CrlDerRead(xmlSecByte* buf, xmlSecSize size,
crl = CertCreateCRLContext(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, buf, size);
if(crl == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CertCreateCRLContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CertCreateCRLContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(crl);
- }
+ }
static xmlChar*
xmlSecMSCryptoX509CrlBase64DerWrite(PCCRL_CONTEXT crl, int base64LineWrap) {
@@ -1858,22 +1858,22 @@ xmlSecMSCryptoX509CrlBase64DerWrite(PCCRL_CONTEXT crl, int base64LineWrap) {
p = crl->pbCrlEncoded;
size = crl->cbCrlEncoded;
if((size <= 0) || (p == NULL)){
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "crl->pbCrlEncoded",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "crl->pbCrlEncoded",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
res = xmlSecBase64Encode(p, size, base64LineWrap);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64Encode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64Encode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(res);
@@ -1892,23 +1892,23 @@ xmlSecMSCryptoX509NameWrite(PCERT_NAME_BLOB nm) {
csz = CertNameToStr(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, nm, CERT_X500_NAME_STR | CERT_NAME_STR_REVERSE_FLAG, NULL, 0);
str = (char *)xmlMalloc(csz);
if (NULL == str) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlMalloc",
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return (NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlMalloc",
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return (NULL);
}
csz = CertNameToStr(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, nm, CERT_X500_NAME_STR | CERT_NAME_STR_REVERSE_FLAG, str, csz);
if (csz < 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CertNameToStr",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(str);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CertNameToStr",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(str);
+ return(NULL);
}
/* aleksey: this is a hack, but mscrypto can not read E= flag and wants Email= instead.
@@ -1919,10 +1919,10 @@ xmlSecMSCryptoX509NameWrite(PCERT_NAME_BLOB nm) {
res = xmlMalloc(strlen(str) + 13 + 1);
if(res == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlMalloc",
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "size=%d",
+ NULL,
+ "xmlMalloc",
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "size=%d",
strlen(str) + 13 + 1);
xmlFree(str);
return(NULL);
@@ -1934,10 +1934,10 @@ xmlSecMSCryptoX509NameWrite(PCERT_NAME_BLOB nm) {
res = xmlStrdup(BAD_CAST str);
if(res == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlStrdup",
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlStrdup",
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
xmlFree(str);
return(NULL);
}
@@ -1958,23 +1958,23 @@ xmlSecMSCryptoASN1IntegerWrite(xmlNodePtr node, PCRYPT_INTEGER_BLOB num) {
ret = xmlSecBnInitialize(&bn, num->cbData + 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBnInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%ld", num->cbData + 1);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBnInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%ld", num->cbData + 1);
+ return(-1);
}
ret = xmlSecBnSetData(&bn, num->pbData, num->cbData);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBnSetData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBnFinalize(&bn);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBnSetData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBnFinalize(&bn);
+ return(-1);
}
/* I have no clue why at a sudden a swap is needed to
@@ -1983,13 +1983,13 @@ xmlSecMSCryptoASN1IntegerWrite(xmlNodePtr node, PCRYPT_INTEGER_BLOB num) {
*/
ret = xmlSecBnSetNodeValue(&bn, node, xmlSecBnDec, 1, 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBnSetNodeValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBnFinalize(&bn);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBnSetNodeValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBnFinalize(&bn);
+ return(-1);
}
xmlSecBnFinalize(&bn);
@@ -2008,55 +2008,55 @@ xmlSecMSCryptoX509SKIWrite(PCCERT_CONTEXT cert) {
/* First check if the SKI extension actually exists, otherwise we get a SHA1 hash o fthe key/cert */
pCertExt = CertFindExtension(szOID_SUBJECT_KEY_IDENTIFIER, cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension);
if (pCertExt == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CertFindExtension",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return (NULL);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CertFindExtension",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return (NULL);
+ }
if (!CertGetCertificateContextProperty(cert, CERT_KEY_IDENTIFIER_PROP_ID, NULL, &dwSize) || dwSize < 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CertGetCertificateContextProperty",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return (NULL);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CertGetCertificateContextProperty",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return (NULL);
+ }
bSKI = xmlMalloc(dwSize);
if (NULL == bSKI) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlMalloc",
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return (NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlMalloc",
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return (NULL);
}
if (!CertGetCertificateContextProperty(cert, CERT_KEY_IDENTIFIER_PROP_ID, bSKI, &dwSize)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CertGetCertificateContextProperty",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(bSKI);
- return (NULL);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CertGetCertificateContextProperty",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(bSKI);
+ return (NULL);
+ }
if (NULL == bSKI) {
- return(NULL);
+ return(NULL);
}
res = xmlSecBase64Encode(bSKI, dwSize, 0);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64Encode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(bSKI);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64Encode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(bSKI);
+ return(NULL);
}
xmlFree(bSKI);
@@ -2090,11 +2090,11 @@ xmlSecMSCryptoX509CertDebugDump(PCCERT_CONTEXT cert, FILE* output) {
sn = &(cert->pCertInfo->SerialNumber);
for (i = 0; i < sn->cbData; i++) {
- if (i != sn->cbData - 1) {
- fprintf(output, "%02x:", sn->pbData[i]);
- } else {
- fprintf(output, "%02x", sn->pbData[i]);
- }
+ if (i != sn->cbData - 1) {
+ fprintf(output, "%02x:", sn->pbData[i]);
+ } else {
+ fprintf(output, "%02x", sn->pbData[i]);
+ }
}
fprintf(output, "\n");
}
@@ -2137,11 +2137,11 @@ xmlSecMSCryptoX509CertDebugXmlDump(PCCERT_CONTEXT cert, FILE* output) {
fprintf(output, "<SerialNumber>");
sn = &(cert->pCertInfo->SerialNumber);
for (i = 0; i < sn->cbData; i++) {
- if (i != sn->cbData - 1) {
- fprintf(output, "%02x:", sn->pbData[i]);
- } else {
- fprintf(output, "%02x", sn->pbData[i]);
- }
+ if (i != sn->cbData - 1) {
+ fprintf(output, "%02x:", sn->pbData[i]);
+ } else {
+ fprintf(output, "%02x", sn->pbData[i]);
+ }
}
fprintf(output, "</SerialNumber>\n");
}
@@ -2153,11 +2153,11 @@ xmlSecMSCryptoX509CertDebugXmlDump(PCCERT_CONTEXT cert, FILE* output) {
*
*
*************************************************************************/
-static int xmlSecMSCryptoKeyDataRawX509CertBinRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- const xmlSecByte* buf,
- xmlSecSize bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecMSCryptoKeyDataRawX509CertBinRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ const xmlSecByte* buf,
+ xmlSecSize bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataRawX509CertKlass = {
sizeof(xmlSecKeyDataKlass),
@@ -2166,35 +2166,35 @@ static xmlSecKeyDataKlass xmlSecMSCryptoKeyDataRawX509CertKlass = {
/* data */
xmlSecNameRawX509Cert,
xmlSecKeyDataUsageRetrievalMethodNodeBin,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefRawX509Cert, /* const xmlChar* href; */
- NULL, /* const xmlChar* dataNodeName; */
- xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefRawX509Cert, /* const xmlChar* href; */
+ NULL, /* const xmlChar* dataNodeName; */
+ xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- NULL, /* xmlSecKeyDataInitializeMethod initialize; */
- NULL, /* xmlSecKeyDataDuplicateMethod duplicate; */
- NULL, /* xmlSecKeyDataFinalizeMethod finalize; */
- NULL, /* xmlSecKeyDataGenerateMethod generate; */
+ NULL, /* xmlSecKeyDataInitializeMethod initialize; */
+ NULL, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ NULL, /* xmlSecKeyDataFinalizeMethod finalize; */
+ NULL, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- NULL, /* xmlSecKeyDataGetTypeMethod getType; */
- NULL, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ NULL, /* xmlSecKeyDataGetTypeMethod getType; */
+ NULL, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- NULL, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- NULL, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- xmlSecMSCryptoKeyDataRawX509CertBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
- NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ NULL, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ NULL, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ xmlSecMSCryptoKeyDataRawX509CertBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
+ NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- NULL, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- NULL, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ NULL, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ NULL, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -2211,8 +2211,8 @@ xmlSecMSCryptoKeyDataRawX509CertGetKlass(void) {
static int
xmlSecMSCryptoKeyDataRawX509CertBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- const xmlSecByte* buf, xmlSecSize bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ const xmlSecByte* buf, xmlSecSize bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyDataPtr data;
PCCERT_CONTEXT cert;
int ret;
@@ -2225,44 +2225,44 @@ xmlSecMSCryptoKeyDataRawX509CertBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
cert = xmlSecMSCryptoX509CertDerRead(buf, bufSize);
if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecMSCryptoX509CertDerRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecMSCryptoX509CertDerRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
data = xmlSecKeyEnsureData(key, xmlSecMSCryptoKeyDataX509Id);
if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyEnsureData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CertFreeCertificateContext(cert);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyEnsureData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CertFreeCertificateContext(cert);
+ return(-1);
}
ret = xmlSecMSCryptoKeyDataX509AdoptCert(data, cert);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecMSCryptoKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CertFreeCertificateContext(cert);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecMSCryptoKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CertFreeCertificateContext(cert);
+ return(-1);
}
ret = xmlSecMSCryptoKeyDataX509VerifyAndExtractKey(data, key, keyInfoCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecMSCryptoKeyDataX509VerifyAndExtractKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecMSCryptoKeyDataX509VerifyAndExtractKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
diff --git a/src/mscrypto/x509vfy.c b/src/mscrypto/x509vfy.c
index 376a858..c33b66e 100644
--- a/src/mscrypto/x509vfy.c
+++ b/src/mscrypto/x509vfy.c
@@ -272,92 +272,92 @@ xmlSecMSCryptoX509StoreCertError(xmlSecKeyDataStorePtr store, PCCERT_CONTEXT cer
*/
static BOOL
xmlSecBuildChainUsingWinapi (PCCERT_CONTEXT cert, LPFILETIME pfTime,
- HCERTSTORE store_untrusted, HCERTSTORE store_doc)
+ HCERTSTORE store_untrusted, HCERTSTORE store_doc)
{
- PCCERT_CHAIN_CONTEXT pChainContext = NULL;
- CERT_CHAIN_PARA chainPara;
- BOOL rc = FALSE;
- HCERTSTORE store_add = NULL;
+ PCCERT_CHAIN_CONTEXT pChainContext = NULL;
+ CERT_CHAIN_PARA chainPara;
+ BOOL rc = FALSE;
+ HCERTSTORE store_add = NULL;
/* Initialize data structures. */
- memset(&chainPara, 0, sizeof(CERT_CHAIN_PARA));
- chainPara.cbSize = sizeof(CERT_CHAIN_PARA);
-
- /* Create additional store for CertGetCertificateChain() */
- store_add = CertOpenStore(CERT_STORE_PROV_COLLECTION, 0, 0, 0, NULL);
- if (!store_add) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- "chain additional collection store",
- "CertOpenStore",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto end;
- }
- if (!CertAddStoreToCollection(store_add, store_doc, 0, 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- "adding document store",
- "CertAddStoreToCollection",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto end;
- }
- if (!CertAddStoreToCollection(store_add, store_untrusted, 0, 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- "adding untrusted store",
- "CertAddStoreToCollection",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto end;
- }
+ memset(&chainPara, 0, sizeof(CERT_CHAIN_PARA));
+ chainPara.cbSize = sizeof(CERT_CHAIN_PARA);
+
+ /* Create additional store for CertGetCertificateChain() */
+ store_add = CertOpenStore(CERT_STORE_PROV_COLLECTION, 0, 0, 0, NULL);
+ if (!store_add) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ "chain additional collection store",
+ "CertOpenStore",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto end;
+ }
+ if (!CertAddStoreToCollection(store_add, store_doc, 0, 0)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ "adding document store",
+ "CertAddStoreToCollection",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto end;
+ }
+ if (!CertAddStoreToCollection(store_add, store_untrusted, 0, 0)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ "adding untrusted store",
+ "CertAddStoreToCollection",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto end;
+ }
/* Build a chain using CertGetCertificateChain
and the certificate retrieved. */
if(!CertGetCertificateChain(
NULL, /* use the default chain engine */
- cert,
+ cert,
pfTime,
- store_add,
- &chainPara,
- CERT_CHAIN_REVOCATION_CHECK_CHAIN,
+ store_add,
+ &chainPara,
+ CERT_CHAIN_REVOCATION_CHECK_CHAIN,
NULL,
&pChainContext))
{
xmlSecError(XMLSEC_ERRORS_HERE,
- "building certificate chain, checking root",
- "CertGetCertificateChain",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto end;
- }
- if (pChainContext->TrustStatus.dwErrorStatus == CERT_TRUST_REVOCATION_STATUS_UNKNOWN) {
- CertFreeCertificateChain(pChainContext); pChainContext = NULL;
- if(!CertGetCertificateChain(
- NULL, /* use the default chain engine */
- cert,
- pfTime,
- store_add,
- &chainPara,
- CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT,
+ "building certificate chain, checking root",
+ "CertGetCertificateChain",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto end;
+ }
+ if (pChainContext->TrustStatus.dwErrorStatus == CERT_TRUST_REVOCATION_STATUS_UNKNOWN) {
+ CertFreeCertificateChain(pChainContext); pChainContext = NULL;
+ if(!CertGetCertificateChain(
+ NULL, /* use the default chain engine */
+ cert,
+ pfTime,
+ store_add,
+ &chainPara,
+ CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT,
NULL,
- &pChainContext))
- {
- xmlSecError(XMLSEC_ERRORS_HERE,
- "building certificate chain, excluding root",
- "CertGetCertificateChain",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ &pChainContext))
+ {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ "building certificate chain, excluding root",
+ "CertGetCertificateChain",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
- goto end;
- }
+ goto end;
+ }
}
- if (pChainContext->TrustStatus.dwErrorStatus == CERT_TRUST_NO_ERROR)
- rc = TRUE;
+ if (pChainContext->TrustStatus.dwErrorStatus == CERT_TRUST_NO_ERROR)
+ rc = TRUE;
end:
- if (pChainContext) CertFreeCertificateChain(pChainContext);
- if (store_add) CertCloseStore(store_add, 0);
- return (rc);
+ if (pChainContext) CertFreeCertificateChain(pChainContext);
+ if (store_add) CertCloseStore(store_add, 0);
+ return (rc);
}
/**
@@ -375,8 +375,8 @@ end:
*/
static BOOL
xmlSecMSCryptoBuildCertChainManually (PCCERT_CONTEXT cert, LPFILETIME pfTime,
- HCERTSTORE store_trusted, HCERTSTORE store_untrusted, HCERTSTORE certs,
- xmlSecKeyDataStorePtr store) {
+ HCERTSTORE store_trusted, HCERTSTORE store_untrusted, HCERTSTORE certs,
+ xmlSecKeyDataStorePtr store) {
PCCERT_CONTEXT issuerCert = NULL;
DWORD flags;
@@ -401,7 +401,7 @@ xmlSecMSCryptoBuildCertChainManually (PCCERT_CONTEXT cert, LPFILETIME pfTime,
NULL);
if( issuerCert != NULL) {
/* We have found the trusted cert, so return true */
- /* todo: do we want to verify the trusted cert's revocation? we must, I think */
+ /* todo: do we want to verify the trusted cert's revocation? we must, I think */
CertFreeCertificateContext( issuerCert ) ;
return( TRUE ) ;
}
@@ -425,8 +425,8 @@ xmlSecMSCryptoBuildCertChainManually (PCCERT_CONTEXT cert, LPFILETIME pfTime,
CertFreeCertificateContext(issuerCert);
return(FALSE);
}
- /* todo: do we want to verify the trusted cert? we must check
- * revocation, I think */
+ /* todo: do we want to verify the trusted cert? we must check
+ * revocation, I think */
CertFreeCertificateContext(issuerCert);
return(TRUE);
}
@@ -445,7 +445,7 @@ xmlSecMSCryptoBuildCertChainManually (PCCERT_CONTEXT cert, LPFILETIME pfTime,
CertFreeCertificateContext(issuerCert);
return(FALSE);
}
- if(!xmlSecMSCryptoBuildCertChainManually(issuerCert, pfTime, store_trusted, store_untrusted, certs, store)) {
+ if(!xmlSecMSCryptoBuildCertChainManually(issuerCert, pfTime, store_trusted, store_untrusted, certs, store)) {
xmlSecMSCryptoX509StoreCertError(store, issuerCert, flags);
CertFreeCertificateContext(issuerCert);
return(FALSE);
@@ -468,7 +468,7 @@ xmlSecMSCryptoBuildCertChainManually (PCCERT_CONTEXT cert, LPFILETIME pfTime,
CertFreeCertificateContext(issuerCert);
return(FALSE);
}
- if(!xmlSecMSCryptoBuildCertChainManually(issuerCert, pfTime, store_trusted, store_untrusted, certs, store)) {
+ if(!xmlSecMSCryptoBuildCertChainManually(issuerCert, pfTime, store_trusted, store_untrusted, certs, store)) {
CertFreeCertificateContext(issuerCert);
return(FALSE);
}
@@ -481,7 +481,7 @@ xmlSecMSCryptoBuildCertChainManually (PCCERT_CONTEXT cert, LPFILETIME pfTime,
static BOOL
xmlSecMSCryptoX509StoreConstructCertsChain(xmlSecKeyDataStorePtr store, PCCERT_CONTEXT cert, HCERTSTORE certs,
- xmlSecKeyInfoCtx* keyInfoCtx) {
+ xmlSecKeyInfoCtx* keyInfoCtx) {
xmlSecMSCryptoX509StoreCtxPtr ctx;
PCCERT_CONTEXT tempCert = NULL;
FILETIME fTime;
@@ -499,26 +499,26 @@ xmlSecMSCryptoX509StoreConstructCertsChain(xmlSecKeyDataStorePtr store, PCCERT_C
xmlSecAssert2(ctx->untrusted != NULL, FALSE);
if(keyInfoCtx->certsVerificationTime > 0) {
- /* convert the time to FILETIME */
- xmlSecMSCryptoUnixTimeToFileTime(keyInfoCtx->certsVerificationTime, &fTime);
+ /* convert the time to FILETIME */
+ xmlSecMSCryptoUnixTimeToFileTime(keyInfoCtx->certsVerificationTime, &fTime);
} else {
- /* Defaults to current time */
- GetSystemTimeAsFileTime(&fTime);
+ /* Defaults to current time */
+ GetSystemTimeAsFileTime(&fTime);
}
/* try the certificates in the keys manager */
if(!res) {
- tempCert = CertEnumCertificatesInStore(ctx->trusted, NULL);
- if(tempCert) {
- CertFreeCertificateContext(tempCert);
+ tempCert = CertEnumCertificatesInStore(ctx->trusted, NULL);
+ if(tempCert) {
+ CertFreeCertificateContext(tempCert);
res = xmlSecMSCryptoBuildCertChainManually(cert, &fTime, ctx->trusted, ctx->untrusted, certs, store);
}
}
/* try the certificates in the system */
if(!res && !ctx->dont_use_system_trusted_certs) {
- res = xmlSecBuildChainUsingWinapi(cert, &fTime, ctx->untrusted, certs);
- }
+ res = xmlSecBuildChainUsingWinapi(cert, &fTime, ctx->untrusted, certs);
+ }
/* done */
return res;
diff --git a/src/mscrypto/xmlsec-mingw.h b/src/mscrypto/xmlsec-mingw.h
index 85d8cc3..3be3c27 100644
--- a/src/mscrypto/xmlsec-mingw.h
+++ b/src/mscrypto/xmlsec-mingw.h
@@ -13,153 +13,153 @@
/*defines*/
#ifndef CERT_CLOSE_STORE_FORCE_FLAG
-# define CERT_CLOSE_STORE_FORCE_FLAG 1
+# define CERT_CLOSE_STORE_FORCE_FLAG 1
#endif
#ifndef CERT_CLOSE_STORE_CHECK_FLAG
-# define CERT_CLOSE_STORE_CHECK_FLAG 2
+# define CERT_CLOSE_STORE_CHECK_FLAG 2
#endif
#ifndef CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG
-# define CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG 1
+# define CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG 1
#endif
#ifndef CERT_STORE_ADD_ALWAYS
-# define CERT_STORE_ADD_ALWAYS 4
+# define CERT_STORE_ADD_ALWAYS 4
#endif
#ifndef CERT_STORE_CREATE_NEW_FLAG
-# define CERT_STORE_CREATE_NEW_FLAG (2<<12)
+# define CERT_STORE_CREATE_NEW_FLAG (2<<12)
#endif
#ifndef CERT_STORE_SIGNATURE_FLAG
-# define CERT_STORE_SIGNATURE_FLAG 1
+# define CERT_STORE_SIGNATURE_FLAG 1
#endif
#ifndef CERT_STORE_TIME_VALIDITY_FLAG
-# define CERT_STORE_TIME_VALIDITY_FLAG 2
+# define CERT_STORE_TIME_VALIDITY_FLAG 2
#endif
#ifndef CERT_STORE_REVOCATION_FLAG
-# define CERT_STORE_REVOCATION_FLAG 4
+# define CERT_STORE_REVOCATION_FLAG 4
#endif
#ifndef CERT_STORE_NO_CRL_FLAG
-# define CERT_STORE_NO_CRL_FLAG (1<<16)
+# define CERT_STORE_NO_CRL_FLAG (1<<16)
#endif
#ifndef CERT_STORE_PROV_COLLECTION
-# define CERT_STORE_PROV_COLLECTION ((LPCSTR) 11)
+# define CERT_STORE_PROV_COLLECTION ((LPCSTR) 11)
#endif
#ifndef CERT_STORE_PROV_MEMORY
-# define CERT_STORE_PROV_MEMORY ((LPCSTR) 2)
+# define CERT_STORE_PROV_MEMORY ((LPCSTR) 2)
#endif
#ifndef CERT_KEY_SPEC_PROP_ID
-# define CERT_KEY_SPEC_PROP_ID 6
+# define CERT_KEY_SPEC_PROP_ID 6
#endif
#ifndef CERT_FRIENDLY_NAME_PROP_ID
-# define CERT_FRIENDLY_NAME_PROP_ID 11
+# define CERT_FRIENDLY_NAME_PROP_ID 11
#endif
#ifndef CERT_KEY_IDENTIFIER_PROP_ID
-# define CERT_KEY_IDENTIFIER_PROP_ID 20
+# define CERT_KEY_IDENTIFIER_PROP_ID 20
#endif
#ifndef CERT_NAME_ISSUER_FLAG
-# define CERT_NAME_ISSUER_FLAG 1
+# define CERT_NAME_ISSUER_FLAG 1
#endif
#ifndef CERT_NAME_RDN_TYPE
-# define CERT_NAME_RDN_TYPE 2
+# define CERT_NAME_RDN_TYPE 2
#endif
#ifndef CERT_NAME_STR_ENABLE_UTF8_UNICODE_FLAG
-# define CERT_NAME_STR_ENABLE_UTF8_UNICODE_FLAG (4<<16)
+# define CERT_NAME_STR_ENABLE_UTF8_UNICODE_FLAG (4<<16)
#endif
#ifndef CERT_CHAIN_REVOCATION_CHECK_CHAIN
-# define CERT_CHAIN_REVOCATION_CHECK_CHAIN (2<<28)
+# define CERT_CHAIN_REVOCATION_CHECK_CHAIN (2<<28)
#endif
#ifndef CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT
-# define CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT (4<<28)
+# define CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT (4<<28)
#endif
#ifndef szOID_SUBJECT_KEY_IDENTIFIER
-# define szOID_SUBJECT_KEY_IDENTIFIER "2.5.29.14"
+# define szOID_SUBJECT_KEY_IDENTIFIER "2.5.29.14"
#endif
#ifndef CRYPT_ACQUIRE_COMPARE_KEY_FLAG
-# define CRYPT_ACQUIRE_COMPARE_KEY_FLAG 4
+# define CRYPT_ACQUIRE_COMPARE_KEY_FLAG 4
#endif
/*structures/types*/
typedef struct _PUBKEY {
- DWORD magic;
- DWORD bitlen;
+ DWORD magic;
+ DWORD bitlen;
} DSSPUBKEY;
typedef struct _DSSSEED {
- DWORD counter;
- BYTE seed[20];
+ DWORD counter;
+ BYTE seed[20];
} DSSSEED;
typedef struct _PROV_ENUMALGS_EX {
- ALG_ID aiAlgid;
- DWORD dwDefaultLen;
- DWORD dwMinLen;
- DWORD dwMaxLen;
- DWORD dwProtocols;
- DWORD dwNameLen;
- CHAR szName[20];
- DWORD dwLongNameLen;
- CHAR szLongName[40];
+ ALG_ID aiAlgid;
+ DWORD dwDefaultLen;
+ DWORD dwMinLen;
+ DWORD dwMaxLen;
+ DWORD dwProtocols;
+ DWORD dwNameLen;
+ CHAR szName[20];
+ DWORD dwLongNameLen;
+ CHAR szLongName[40];
} PROV_ENUMALGS_EX;
/*methods(functions)*/
-DWORD WINAPI CertGetPublicKeyLength(DWORD,PCERT_PUBLIC_KEY_INFO);
+DWORD WINAPI CertGetPublicKeyLength(DWORD,PCERT_PUBLIC_KEY_INFO);
-BOOL WINAPI CertStrToNameA(DWORD,LPCSTR,DWORD,void*,BYTE*,DWORD*,LPCSTR*);
-BOOL WINAPI CertStrToNameW(DWORD,LPCWSTR,DWORD,void*,BYTE*,DWORD*,LPCWSTR*);
+BOOL WINAPI CertStrToNameA(DWORD,LPCSTR,DWORD,void*,BYTE*,DWORD*,LPCSTR*);
+BOOL WINAPI CertStrToNameW(DWORD,LPCWSTR,DWORD,void*,BYTE*,DWORD*,LPCWSTR*);
#ifdef UNICODE
#define CertStrToName CertStrToNameW
#else
#define CertStrToName CertStrToNameA
#endif
-BOOL WINAPI CertCompareCertificateName(DWORD,PCERT_NAME_BLOB,PCERT_NAME_BLOB);
+BOOL WINAPI CertCompareCertificateName(DWORD,PCERT_NAME_BLOB,PCERT_NAME_BLOB);
-BOOL WINAPI CertAddStoreToCollection(HCERTSTORE,HCERTSTORE,DWORD,DWORD);
+BOOL WINAPI CertAddStoreToCollection(HCERTSTORE,HCERTSTORE,DWORD,DWORD);
-PCCERT_CONTEXT WINAPI CertCreateCertificateContext(DWORD,const BYTE*,DWORD);
-BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT,DWORD,void*,DWORD*);
-BOOL WINAPI CertVerifySubjectCertificateContext(PCCERT_CONTEXT,PCCERT_CONTEXT,DWORD*);
+PCCERT_CONTEXT WINAPI CertCreateCertificateContext(DWORD,const BYTE*,DWORD);
+BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT,DWORD,void*,DWORD*);
+BOOL WINAPI CertVerifySubjectCertificateContext(PCCERT_CONTEXT,PCCERT_CONTEXT,DWORD*);
-BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE,PCCRL_CONTEXT,DWORD,PCCRL_CONTEXT*);
-PCCRL_CONTEXT WINAPI CertDuplicateCRLContext(PCCRL_CONTEXT);
-BOOL WINAPI CertFreeCRLContext(PCCRL_CONTEXT);
+BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE,PCCRL_CONTEXT,DWORD,PCCRL_CONTEXT*);
+PCCRL_CONTEXT WINAPI CertDuplicateCRLContext(PCCRL_CONTEXT);
+BOOL WINAPI CertFreeCRLContext(PCCRL_CONTEXT);
-BOOL WINAPI CertFindCertificateInCRL(PCCERT_CONTEXT,PCCRL_CONTEXT,DWORD,void*,PCRL_ENTRY*);
-PCCRL_CONTEXT WINAPI CertEnumCRLsInStore(HCERTSTORE,PCCRL_CONTEXT);
+BOOL WINAPI CertFindCertificateInCRL(PCCERT_CONTEXT,PCCRL_CONTEXT,DWORD,void*,PCRL_ENTRY*);
+PCCRL_CONTEXT WINAPI CertEnumCRLsInStore(HCERTSTORE,PCCRL_CONTEXT);
-PCCRL_CONTEXT WINAPI CertCreateCRLContext(DWORD,const BYTE*,DWORD);
+PCCRL_CONTEXT WINAPI CertCreateCRLContext(DWORD,const BYTE*,DWORD);
-BOOL WINAPI CryptAcquireCertificatePrivateKey(PCCERT_CONTEXT,DWORD,void*,HCRYPTPROV*,DWORD*,BOOL*);
-BOOL WINAPI CryptDuplicateKey(HCRYPTKEY,DWORD*,DWORD,HCRYPTKEY*);
-BOOL WINAPI CryptImportPublicKeyInfo(HCRYPTPROV,DWORD,PCERT_PUBLIC_KEY_INFO,HCRYPTKEY*);
+BOOL WINAPI CryptAcquireCertificatePrivateKey(PCCERT_CONTEXT,DWORD,void*,HCRYPTPROV*,DWORD*,BOOL*);
+BOOL WINAPI CryptDuplicateKey(HCRYPTKEY,DWORD*,DWORD,HCRYPTKEY*);
+BOOL WINAPI CryptImportPublicKeyInfo(HCRYPTPROV,DWORD,PCERT_PUBLIC_KEY_INFO,HCRYPTKEY*);
#endif /*ndef __XMLSEC_MSCRYPTO_XMLSEC_MINGW_H__*/
diff --git a/src/nodeset.c b/src/nodeset.c
index a5c0a36..ebcff60 100644
--- a/src/nodeset.c
+++ b/src/nodeset.c
@@ -25,21 +25,21 @@
(((node)->type != XML_NAMESPACE_DECL) ? \
(node)->parent : \
(xmlNodePtr)((xmlNsPtr)(node))->next)
-
-static int xmlSecNodeSetOneContains (xmlSecNodeSetPtr nset,
- xmlNodePtr node,
- xmlNodePtr parent);
-static int xmlSecNodeSetWalkRecursive (xmlSecNodeSetPtr nset,
- xmlSecNodeSetWalkCallback walkFunc,
- void* data,
- xmlNodePtr cur,
- xmlNodePtr parent);
+
+static int xmlSecNodeSetOneContains (xmlSecNodeSetPtr nset,
+ xmlNodePtr node,
+ xmlNodePtr parent);
+static int xmlSecNodeSetWalkRecursive (xmlSecNodeSetPtr nset,
+ xmlSecNodeSetWalkCallback walkFunc,
+ void* data,
+ xmlNodePtr cur,
+ xmlNodePtr parent);
/**
* xmlSecNodeSetCreate:
- * @doc: the pointer to parent XML document.
- * @nodes: the list of nodes.
- * @type: the nodes set type.
+ * @doc: the pointer to parent XML document.
+ * @nodes: the list of nodes.
+ * @type: the nodes set type.
*
* Creates new nodes set. Caller is responsible for freeng returend object
* by calling #xmlSecNodeSetDestroy function.
@@ -52,26 +52,26 @@ xmlSecNodeSetCreate(xmlDocPtr doc, xmlNodeSetPtr nodes, xmlSecNodeSetType type)
nset = (xmlSecNodeSetPtr)xmlMalloc(sizeof(xmlSecNodeSet));
if(nset == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "sizeof(xmlSecNodeSet)=%d",
- sizeof(xmlSecNodeSet));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "sizeof(xmlSecNodeSet)=%d",
+ sizeof(xmlSecNodeSet));
+ return(NULL);
}
memset(nset, 0, sizeof(xmlSecNodeSet));
- nset->doc = doc;
+ nset->doc = doc;
nset->nodes = nodes;
- nset->type = type;
- nset->next = nset->prev = nset;
+ nset->type = type;
+ nset->next = nset->prev = nset;
return(nset);
}
/**
* xmlSecNodeSetDestroy:
- * @nset: the pointer to node set.
+ * @nset: the pointer to node set.
*
* Destroys the nodes set created with #xmlSecNodeSetCreate function.
*/
@@ -83,38 +83,38 @@ xmlSecNodeSetDestroy(xmlSecNodeSetPtr nset) {
xmlSecAssert(nset != NULL);
while((tmp = nset) != NULL) {
- if((nset->next != NULL) && (nset->next != nset)) {
- nset->next->prev = nset->prev;
- nset->prev->next = nset->next;
- nset = nset->next;
- } else {
- nset = NULL;
- }
-
- if(tmp->nodes != NULL) {
- xmlXPathFreeNodeSet(tmp->nodes);
- }
- if(tmp->children != NULL) {
- xmlSecNodeSetDestroy(tmp->children);
- }
- if((tmp->doc != NULL) && (tmp->destroyDoc != 0)) {
- /* all nodesets should belong to the same doc */
- xmlSecAssert((destroyDoc == NULL) || (tmp->doc == destroyDoc));
- destroyDoc = tmp->doc; /* can't destroy here because other node sets can refer to it */
- }
- memset(tmp, 0, sizeof(xmlSecNodeSet));
- xmlFree(tmp);
+ if((nset->next != NULL) && (nset->next != nset)) {
+ nset->next->prev = nset->prev;
+ nset->prev->next = nset->next;
+ nset = nset->next;
+ } else {
+ nset = NULL;
+ }
+
+ if(tmp->nodes != NULL) {
+ xmlXPathFreeNodeSet(tmp->nodes);
+ }
+ if(tmp->children != NULL) {
+ xmlSecNodeSetDestroy(tmp->children);
+ }
+ if((tmp->doc != NULL) && (tmp->destroyDoc != 0)) {
+ /* all nodesets should belong to the same doc */
+ xmlSecAssert((destroyDoc == NULL) || (tmp->doc == destroyDoc));
+ destroyDoc = tmp->doc; /* can't destroy here because other node sets can refer to it */
+ }
+ memset(tmp, 0, sizeof(xmlSecNodeSet));
+ xmlFree(tmp);
}
/* finally, destroy the doc if needed */
if(destroyDoc != NULL) {
- xmlFreeDoc(destroyDoc);
+ xmlFreeDoc(destroyDoc);
}
}
/**
* xmlSecNodeSetDocDestroy:
- * @nset: the pointer to node set.
+ * @nset: the pointer to node set.
*
* Instructs node set to destroy nodes parent doc when node set is destroyed.
*/
@@ -134,70 +134,70 @@ xmlSecNodeSetOneContains(xmlSecNodeSetPtr nset, xmlNodePtr node, xmlNodePtr pare
/* special cases: */
switch(nset->type) {
- case xmlSecNodeSetTreeWithoutComments:
+ case xmlSecNodeSetTreeWithoutComments:
case xmlSecNodeSetTreeWithoutCommentsInvert:
- if(node->type == XML_COMMENT_NODE) {
- return(0);
- }
- break;
- case xmlSecNodeSetList:
- return(xmlSecNodeSetContains(nset->children, node, parent));
- default:
- break;
+ if(node->type == XML_COMMENT_NODE) {
+ return(0);
+ }
+ break;
+ case xmlSecNodeSetList:
+ return(xmlSecNodeSetContains(nset->children, node, parent));
+ default:
+ break;
}
if(nset->nodes != NULL) {
- if(node->type != XML_NAMESPACE_DECL) {
- in_nodes_set = xmlXPathNodeSetContains(nset->nodes, node);
- } else {
- xmlNs ns;
-
- memcpy(&ns, node, sizeof(ns));
-
- /* this is a libxml hack! check xpath.c for details */
- if((parent != NULL) && (parent->type == XML_ATTRIBUTE_NODE)) {
- ns.next = (xmlNsPtr)parent->parent;
- } else {
- ns.next = (xmlNsPtr)parent;
- }
-
- /*
- * If the input is an XPath node-set, then the node-set must explicitly
- * contain every node to be rendered to the canonical form.
- */
- in_nodes_set = (xmlXPathNodeSetContains(nset->nodes, (xmlNodePtr)&ns));
- }
+ if(node->type != XML_NAMESPACE_DECL) {
+ in_nodes_set = xmlXPathNodeSetContains(nset->nodes, node);
+ } else {
+ xmlNs ns;
+
+ memcpy(&ns, node, sizeof(ns));
+
+ /* this is a libxml hack! check xpath.c for details */
+ if((parent != NULL) && (parent->type == XML_ATTRIBUTE_NODE)) {
+ ns.next = (xmlNsPtr)parent->parent;
+ } else {
+ ns.next = (xmlNsPtr)parent;
+ }
+
+ /*
+ * If the input is an XPath node-set, then the node-set must explicitly
+ * contain every node to be rendered to the canonical form.
+ */
+ in_nodes_set = (xmlXPathNodeSetContains(nset->nodes, (xmlNodePtr)&ns));
+ }
}
switch(nset->type) {
case xmlSecNodeSetNormal:
- return(in_nodes_set);
+ return(in_nodes_set);
case xmlSecNodeSetInvert:
- return(!in_nodes_set);
+ return(!in_nodes_set);
case xmlSecNodeSetTree:
case xmlSecNodeSetTreeWithoutComments:
- if(in_nodes_set) {
- return(1);
- }
- if((parent != NULL) && (parent->type == XML_ELEMENT_NODE)) {
- return(xmlSecNodeSetOneContains(nset, parent, parent->parent));
- }
- return(0);
+ if(in_nodes_set) {
+ return(1);
+ }
+ if((parent != NULL) && (parent->type == XML_ELEMENT_NODE)) {
+ return(xmlSecNodeSetOneContains(nset, parent, parent->parent));
+ }
+ return(0);
case xmlSecNodeSetTreeInvert:
case xmlSecNodeSetTreeWithoutCommentsInvert:
- if(in_nodes_set) {
- return(0);
- }
- if((parent != NULL) && (parent->type == XML_ELEMENT_NODE)) {
- return(xmlSecNodeSetOneContains(nset, parent, parent->parent));
- }
- return(1);
+ if(in_nodes_set) {
+ return(0);
+ }
+ if((parent != NULL) && (parent->type == XML_ELEMENT_NODE)) {
+ return(xmlSecNodeSetOneContains(nset, parent, parent->parent));
+ }
+ return(1);
default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_TYPE,
- "type=%d", nset->type);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TYPE,
+ "type=%d", nset->type);
}
return(0);
@@ -205,9 +205,9 @@ xmlSecNodeSetOneContains(xmlSecNodeSetPtr nset, xmlNodePtr node, xmlNodePtr pare
/**
* xmlSecNodeSetContains:
- * @nset: the pointer to node set.
- * @node: the pointer to XML node to check.
- * @parent: the pointer to @node parent node.
+ * @nset: the pointer to node set.
+ * @node: the pointer to XML node to check.
+ * @parent: the pointer to @node parent node.
*
* Checks whether the @node is in the nodes set or not.
*
@@ -223,37 +223,37 @@ xmlSecNodeSetContains(xmlSecNodeSetPtr nset, xmlNodePtr node, xmlNodePtr parent)
/* special cases: */
if(nset == NULL) {
- return(1);
+ return(1);
}
status = 1;
cur = nset;
do {
- switch(cur->op) {
- case xmlSecNodeSetIntersection:
- if(status && !xmlSecNodeSetOneContains(cur, node, parent)) {
- status = 0;
- }
- break;
- case xmlSecNodeSetSubtraction:
- if(status && xmlSecNodeSetOneContains(cur, node, parent)) {
- status = 0;
- }
- break;
- case xmlSecNodeSetUnion:
- if(!status && xmlSecNodeSetOneContains(cur, node, parent)) {
- status = 1;
- }
- break;
- default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_OPERATION,
- "operation=%d", cur->op);
- return(-1);
- }
- cur = cur->next;
+ switch(cur->op) {
+ case xmlSecNodeSetIntersection:
+ if(status && !xmlSecNodeSetOneContains(cur, node, parent)) {
+ status = 0;
+ }
+ break;
+ case xmlSecNodeSetSubtraction:
+ if(status && xmlSecNodeSetOneContains(cur, node, parent)) {
+ status = 0;
+ }
+ break;
+ case xmlSecNodeSetUnion:
+ if(!status && xmlSecNodeSetOneContains(cur, node, parent)) {
+ status = 1;
+ }
+ break;
+ default:
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_OPERATION,
+ "operation=%d", cur->op);
+ return(-1);
+ }
+ cur = cur->next;
} while(cur != nset);
return(status);
@@ -261,24 +261,24 @@ xmlSecNodeSetContains(xmlSecNodeSetPtr nset, xmlNodePtr node, xmlNodePtr parent)
/**
* xmlSecNodeSetAdd:
- * @nset: the pointer to currrent nodes set (or NULL).
- * @newNSet: the pointer to new nodes set.
- * @op: the operation type.
+ * @nset: the pointer to currrent nodes set (or NULL).
+ * @newNSet: the pointer to new nodes set.
+ * @op: the operation type.
*
* Adds @newNSet to the @nset using operation @op.
*
* Returns: the pointer to combined nodes set or NULL if an error
* occurs.
*/
-xmlSecNodeSetPtr
+xmlSecNodeSetPtr
xmlSecNodeSetAdd(xmlSecNodeSetPtr nset, xmlSecNodeSetPtr newNSet,
- xmlSecNodeSetOp op) {
+ xmlSecNodeSetOp op) {
xmlSecAssert2(newNSet != NULL, NULL);
xmlSecAssert2(newNSet->next == newNSet, NULL);
- newNSet->op = op;
+ newNSet->op = op;
if(nset == NULL) {
- return(newNSet);
+ return(newNSet);
}
/* all nodesets should belong to the same doc */
@@ -293,16 +293,16 @@ xmlSecNodeSetAdd(xmlSecNodeSetPtr nset, xmlSecNodeSetPtr newNSet,
/**
* xmlSecNodeSetAddList:
- * @nset: the pointer to currrent nodes set (or NULL).
- * @newNSet: the pointer to new nodes set.
- * @op: the operation type.
+ * @nset: the pointer to currrent nodes set (or NULL).
+ * @newNSet: the pointer to new nodes set.
+ * @op: the operation type.
*
* Adds @newNSet to the @nset as child using operation @op.
*
* Returns: the pointer to combined nodes set or NULL if an error
* occurs.
*/
-xmlSecNodeSetPtr
+xmlSecNodeSetPtr
xmlSecNodeSetAddList(xmlSecNodeSetPtr nset, xmlSecNodeSetPtr newNSet, xmlSecNodeSetOp op) {
xmlSecNodeSetPtr tmp1, tmp2;
@@ -310,24 +310,24 @@ xmlSecNodeSetAddList(xmlSecNodeSetPtr nset, xmlSecNodeSetPtr newNSet, xmlSecNode
tmp1 = xmlSecNodeSetCreate(newNSet->doc, NULL, xmlSecNodeSetList);
if(tmp1 == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNodeSetCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNodeSetCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
tmp1->children = newNSet;
tmp2 = xmlSecNodeSetAdd(nset, tmp1, op);
if(tmp2 == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNodeSetAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecNodeSetDestroy(tmp1);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNodeSetAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecNodeSetDestroy(tmp1);
+ return(NULL);
}
return(tmp2);
}
@@ -335,9 +335,9 @@ xmlSecNodeSetAddList(xmlSecNodeSetPtr nset, xmlSecNodeSetPtr newNSet, xmlSecNode
/**
* xmlSecNodeSetWalk:
- * @nset: the pointer to node set.
- * @walkFunc: the callback functions.
- * @data: the application specific data passed to the @walkFunc.
+ * @nset: the pointer to node set.
+ * @walkFunc: the callback functions.
+ * @data: the application specific data passed to the @walkFunc.
*
* Calls the function @walkFunc once per each node in the nodes set @nset.
* If the @walkFunc returns a negative value, then the walk procedure
@@ -356,32 +356,32 @@ xmlSecNodeSetWalk(xmlSecNodeSetPtr nset, xmlSecNodeSetWalkCallback walkFunc, voi
/* special cases */
if(nset->nodes != NULL) {
- int i;
-
- switch(nset->type) {
- case xmlSecNodeSetNormal:
- case xmlSecNodeSetTree:
- case xmlSecNodeSetTreeWithoutComments:
- for(i = 0; (ret >= 0) && (i < nset->nodes->nodeNr); ++i) {
- ret = xmlSecNodeSetWalkRecursive(nset, walkFunc, data,
- nset->nodes->nodeTab[i],
- xmlSecGetParent(nset->nodes->nodeTab[i]));
- }
- return(ret);
- default:
- break;
- }
+ int i;
+
+ switch(nset->type) {
+ case xmlSecNodeSetNormal:
+ case xmlSecNodeSetTree:
+ case xmlSecNodeSetTreeWithoutComments:
+ for(i = 0; (ret >= 0) && (i < nset->nodes->nodeNr); ++i) {
+ ret = xmlSecNodeSetWalkRecursive(nset, walkFunc, data,
+ nset->nodes->nodeTab[i],
+ xmlSecGetParent(nset->nodes->nodeTab[i]));
+ }
+ return(ret);
+ default:
+ break;
+ }
}
for(cur = nset->doc->children; (cur != NULL) && (ret >= 0); cur = cur->next) {
- ret = xmlSecNodeSetWalkRecursive(nset, walkFunc, data, cur, xmlSecGetParent(cur));
+ ret = xmlSecNodeSetWalkRecursive(nset, walkFunc, data, cur, xmlSecGetParent(cur));
}
return(ret);
}
static int
xmlSecNodeSetWalkRecursive(xmlSecNodeSetPtr nset, xmlSecNodeSetWalkCallback walkFunc,
- void* data, xmlNodePtr cur, xmlNodePtr parent) {
+ void* data, xmlNodePtr cur, xmlNodePtr parent) {
int ret;
xmlSecAssert2(nset != NULL, -1);
@@ -390,69 +390,69 @@ xmlSecNodeSetWalkRecursive(xmlSecNodeSetPtr nset, xmlSecNodeSetWalkCallback walk
/* the node itself */
if(xmlSecNodeSetContains(nset, cur, parent)) {
- ret = walkFunc(nset, cur, parent, data);
-
- if(ret < 0) {
- return(ret);
- }
+ ret = walkFunc(nset, cur, parent, data);
+
+ if(ret < 0) {
+ return(ret);
+ }
}
-
- /* element node has attributes, namespaces */
+
+ /* element node has attributes, namespaces */
if(cur->type == XML_ELEMENT_NODE) {
xmlAttrPtr attr;
- xmlNodePtr node;
- xmlNsPtr ns, tmp;
-
+ xmlNodePtr node;
+ xmlNsPtr ns, tmp;
+
attr = (xmlAttrPtr)cur->properties;
while(attr != NULL) {
- if(xmlSecNodeSetContains(nset, (xmlNodePtr)attr, cur)) {
- ret = walkFunc(nset, (xmlNodePtr)attr, cur, data);
- if(ret < 0) {
- return(ret);
- }
- }
- attr = attr->next;
- }
-
- node = cur;
- while(node != NULL) {
- ns = node->nsDef;
- while(ns != NULL) {
- tmp = xmlSearchNs(nset->doc, cur, ns->prefix);
- if((tmp == ns) && xmlSecNodeSetContains(nset, (xmlNodePtr)ns, cur)) {
- ret = walkFunc(nset, (xmlNodePtr)ns, cur, data);
- if(ret < 0) {
- return(ret);
- }
- }
- ns = ns->next;
- }
- node = node->parent;
- }
+ if(xmlSecNodeSetContains(nset, (xmlNodePtr)attr, cur)) {
+ ret = walkFunc(nset, (xmlNodePtr)attr, cur, data);
+ if(ret < 0) {
+ return(ret);
+ }
+ }
+ attr = attr->next;
+ }
+
+ node = cur;
+ while(node != NULL) {
+ ns = node->nsDef;
+ while(ns != NULL) {
+ tmp = xmlSearchNs(nset->doc, cur, ns->prefix);
+ if((tmp == ns) && xmlSecNodeSetContains(nset, (xmlNodePtr)ns, cur)) {
+ ret = walkFunc(nset, (xmlNodePtr)ns, cur, data);
+ if(ret < 0) {
+ return(ret);
+ }
+ }
+ ns = ns->next;
+ }
+ node = node->parent;
+ }
}
/* element and document nodes have children */
if((cur->type == XML_ELEMENT_NODE) || (cur->type == XML_DOCUMENT_NODE)) {
- xmlNodePtr node;
-
- node = cur->children;
- while(node != NULL) {
- ret = xmlSecNodeSetWalkRecursive(nset, walkFunc, data, node, cur);
- if(ret < 0) {
- return(ret);
- }
- node = node->next;
- }
+ xmlNodePtr node;
+
+ node = cur->children;
+ while(node != NULL) {
+ ret = xmlSecNodeSetWalkRecursive(nset, walkFunc, data, node, cur);
+ if(ret < 0) {
+ return(ret);
+ }
+ node = node->next;
+ }
}
return(0);
}
/**
* xmlSecNodeSetGetChildren:
- * @doc: the pointer to an XML document.
- * @parent: the pointer to parent XML node or NULL if we want to include all document nodes.
- * @withComments: the flag include comments or not.
- * @invert: the "invert" flag.
+ * @doc: the pointer to an XML document.
+ * @parent: the pointer to parent XML node or NULL if we want to include all document nodes.
+ * @withComments: the flag include comments or not.
+ * @invert: the "invert" flag.
*
* Creates a new nodes set that contains:
* - if @withComments is not 0 and @invert is 0:
@@ -468,7 +468,7 @@ xmlSecNodeSetWalkRecursive(xmlSecNodeSetPtr nset, xmlSecNodeSetWalkCallback walk
* Returns: pointer to the newly created #xmlSecNodeSet structure
* or NULL if an error occurs.
*/
-xmlSecNodeSetPtr
+xmlSecNodeSetPtr
xmlSecNodeSetGetChildren(xmlDocPtr doc, const xmlNodePtr parent, int withComments, int invert) {
xmlNodeSetPtr nodes;
xmlSecNodeSetType type;
@@ -477,32 +477,32 @@ xmlSecNodeSetGetChildren(xmlDocPtr doc, const xmlNodePtr parent, int withComment
nodes = xmlXPathNodeSetCreate(parent);
if(nodes == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlXPathNodeSetCreate",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlXPathNodeSetCreate",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
/* if parent is NULL then we add all the doc children */
if(parent == NULL) {
- xmlNodePtr cur;
- for(cur = doc->children; cur != NULL; cur = cur->next) {
- if(withComments || (cur->type != XML_COMMENT_NODE)) {
- xmlXPathNodeSetAdd(nodes, cur);
- }
- }
+ xmlNodePtr cur;
+ for(cur = doc->children; cur != NULL; cur = cur->next) {
+ if(withComments || (cur->type != XML_COMMENT_NODE)) {
+ xmlXPathNodeSetAdd(nodes, cur);
+ }
+ }
}
if(withComments && invert) {
- type = xmlSecNodeSetTreeInvert;
+ type = xmlSecNodeSetTreeInvert;
} else if(withComments && !invert) {
- type = xmlSecNodeSetTree;
+ type = xmlSecNodeSetTree;
} else if(!withComments && invert) {
- type = xmlSecNodeSetTreeWithoutCommentsInvert;
+ type = xmlSecNodeSetTreeWithoutCommentsInvert;
} else { /* if(!withComments && !invert) */
- type = xmlSecNodeSetTreeWithoutComments;
+ type = xmlSecNodeSetTreeWithoutComments;
}
return(xmlSecNodeSetCreate(doc, nodes, type));
@@ -510,23 +510,23 @@ xmlSecNodeSetGetChildren(xmlDocPtr doc, const xmlNodePtr parent, int withComment
static int
xmlSecNodeSetDumpTextNodesWalkCallback(xmlSecNodeSetPtr nset, xmlNodePtr cur,
- xmlNodePtr parent ATTRIBUTE_UNUSED,
- void* data) {
+ xmlNodePtr parent ATTRIBUTE_UNUSED,
+ void* data) {
xmlSecAssert2(nset != NULL, -1);
xmlSecAssert2(cur != NULL, -1);
xmlSecAssert2(data != NULL, -1);
if(cur->type == XML_TEXT_NODE) {
- xmlOutputBufferWriteString((xmlOutputBufferPtr)data,
- (char*)(cur->content));
+ xmlOutputBufferWriteString((xmlOutputBufferPtr)data,
+ (char*)(cur->content));
}
return(0);
}
/**
* xmlSecNodeSetDumpTextNodes:
- * @nset: the pointer to node set.
- * @out: the output buffer.
+ * @nset: the pointer to node set.
+ * @out: the output buffer.
*
* Dumps content of all the text nodes from @nset to @out.
*
@@ -542,8 +542,8 @@ xmlSecNodeSetDumpTextNodes(xmlSecNodeSetPtr nset, xmlOutputBufferPtr out) {
/**
* xmlSecNodeSetDebugDump:
- * @nset: the pointer to node set.
- * @output: the pointer to output FILE.
+ * @nset: the pointer to node set.
+ * @output: the pointer to output FILE.
*
* Prints information about @nset to the @output.
*/
@@ -558,53 +558,53 @@ xmlSecNodeSetDebugDump(xmlSecNodeSetPtr nset, FILE *output) {
fprintf(output, "== Nodes set ");
switch(nset->type) {
case xmlSecNodeSetNormal:
- fprintf(output, "(xmlSecNodeSetNormal)\n");
- break;
+ fprintf(output, "(xmlSecNodeSetNormal)\n");
+ break;
case xmlSecNodeSetInvert:
- fprintf(output, "(xmlSecNodeSetInvert)\n");
- break;
+ fprintf(output, "(xmlSecNodeSetInvert)\n");
+ break;
case xmlSecNodeSetTree:
- fprintf(output, "(xmlSecNodeSetTree)\n");
- break;
+ fprintf(output, "(xmlSecNodeSetTree)\n");
+ break;
case xmlSecNodeSetTreeWithoutComments:
- fprintf(output, "(xmlSecNodeSetTreeWithoutComments)\n");
- break;
+ fprintf(output, "(xmlSecNodeSetTreeWithoutComments)\n");
+ break;
case xmlSecNodeSetTreeInvert:
- fprintf(output, "(xmlSecNodeSetTreeInvert)\n");
- break;
+ fprintf(output, "(xmlSecNodeSetTreeInvert)\n");
+ break;
case xmlSecNodeSetTreeWithoutCommentsInvert:
- fprintf(output, "(xmlSecNodeSetTreeWithoutCommentsInvert)\n");
- break;
+ fprintf(output, "(xmlSecNodeSetTreeWithoutCommentsInvert)\n");
+ break;
case xmlSecNodeSetList:
- fprintf(output, "(xmlSecNodeSetList)\n");
- fprintf(output, ">>>\n");
- xmlSecNodeSetDebugDump(nset->children, output);
- fprintf(output, "<<<\n");
- return;
+ fprintf(output, "(xmlSecNodeSetList)\n");
+ fprintf(output, ">>>\n");
+ xmlSecNodeSetDebugDump(nset->children, output);
+ fprintf(output, "<<<\n");
+ return;
default:
- fprintf(output, "(unknown=%d)\n", nset->type);
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_TYPE,
- "type=%d", nset->type);
+ fprintf(output, "(unknown=%d)\n", nset->type);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TYPE,
+ "type=%d", nset->type);
}
l = xmlXPathNodeSetGetLength(nset->nodes);
for(i = 0; i < l; ++i) {
- cur = xmlXPathNodeSetItem(nset->nodes, i);
- if(cur->type != XML_NAMESPACE_DECL) {
- fprintf(output, "%d: %s\n", cur->type,
- (cur->name) ? cur->name : BAD_CAST "null");
- } else {
- xmlNsPtr ns = (xmlNsPtr)cur;
- fprintf(output, "%d: %s=%s (%s:%s)\n", cur->type,
- (ns->prefix) ? ns->prefix : BAD_CAST "null",
- (ns->href) ? ns->href : BAD_CAST "null",
- (((xmlNodePtr)ns->next)->ns &&
- ((xmlNodePtr)ns->next)->ns->prefix) ?
- ((xmlNodePtr)ns->next)->ns->prefix : BAD_CAST "null",
- ((xmlNodePtr)ns->next)->name);
- }
+ cur = xmlXPathNodeSetItem(nset->nodes, i);
+ if(cur->type != XML_NAMESPACE_DECL) {
+ fprintf(output, "%d: %s\n", cur->type,
+ (cur->name) ? cur->name : BAD_CAST "null");
+ } else {
+ xmlNsPtr ns = (xmlNsPtr)cur;
+ fprintf(output, "%d: %s=%s (%s:%s)\n", cur->type,
+ (ns->prefix) ? ns->prefix : BAD_CAST "null",
+ (ns->href) ? ns->href : BAD_CAST "null",
+ (((xmlNodePtr)ns->next)->ns &&
+ ((xmlNodePtr)ns->next)->ns->prefix) ?
+ ((xmlNodePtr)ns->next)->ns->prefix : BAD_CAST "null",
+ ((xmlNodePtr)ns->next)->name);
+ }
}
}
diff --git a/src/nss/app.c b/src/nss/app.c
index 8aaf332..6e7449e 100644
--- a/src/nss/app.c
+++ b/src/nss/app.c
@@ -34,31 +34,31 @@
#include <xmlsec/nss/keysstore.h>
/* workaround - NSS exports this but doesn't declare it */
-extern CERTCertificate * __CERT_NewTempCertificate (CERTCertDBHandle *handle,
- SECItem *derCert,
- char *nickname,
- PRBool isperm,
- PRBool copyDER);
-static int xmlSecNssAppCreateSECItem (SECItem *contents,
- const xmlSecByte* data,
- xmlSecSize dataSize);
-static int xmlSecNssAppReadSECItem (SECItem *contents,
- const char *fn);
-static PRBool xmlSecNssAppAscii2UCS2Conv (PRBool toUnicode,
- unsigned char *inBuf,
- unsigned int inBufLen,
- unsigned char *outBuf,
- unsigned int maxOutBufLen,
- unsigned int *outBufLen,
- PRBool swapBytes);
-static SECItem *xmlSecNssAppNicknameCollisionCallback (SECItem *old_nick,
- PRBool *cancel,
- void *wincx);
-static xmlSecKeyPtr xmlSecNssAppDerKeyLoadSECItem (SECItem* secItem);
+extern CERTCertificate * __CERT_NewTempCertificate (CERTCertDBHandle *handle,
+ SECItem *derCert,
+ char *nickname,
+ PRBool isperm,
+ PRBool copyDER);
+static int xmlSecNssAppCreateSECItem (SECItem *contents,
+ const xmlSecByte* data,
+ xmlSecSize dataSize);
+static int xmlSecNssAppReadSECItem (SECItem *contents,
+ const char *fn);
+static PRBool xmlSecNssAppAscii2UCS2Conv (PRBool toUnicode,
+ unsigned char *inBuf,
+ unsigned int inBufLen,
+ unsigned char *outBuf,
+ unsigned int maxOutBufLen,
+ unsigned int *outBufLen,
+ PRBool swapBytes);
+static SECItem *xmlSecNssAppNicknameCollisionCallback (SECItem *old_nick,
+ PRBool *cancel,
+ void *wincx);
+static xmlSecKeyPtr xmlSecNssAppDerKeyLoadSECItem (SECItem* secItem);
/**
* xmlSecNssAppInit:
- * @config: the path to NSS database files.
+ * @config: the path to NSS database files.
*
* General crypto engine initialization. This function is used
* by XMLSec command line utility and called before
@@ -71,26 +71,26 @@ xmlSecNssAppInit(const char* config) {
SECStatus rv;
if(config) {
- rv = NSS_InitReadWrite(config);
- if(rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "NSS_InitReadWrite",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "config=%s",
- xmlSecErrorsSafeString(config));
- return(-1);
- }
+ rv = NSS_InitReadWrite(config);
+ if(rv != SECSuccess) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "NSS_InitReadWrite",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "config=%s",
+ xmlSecErrorsSafeString(config));
+ return(-1);
+ }
} else {
- rv = NSS_NoDB_Init(NULL);
- if(rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "NSS_NoDB_Init",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ rv = NSS_NoDB_Init(NULL);
+ if(rv != SECSuccess) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "NSS_NoDB_Init",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
/* configure PKCS11 */
@@ -98,7 +98,7 @@ xmlSecNssAppInit(const char* config) {
"tokenDescription", "privateTokenDescription",
"slotDescription", "privateSlotDescription",
"fipsSlotDescription", "fipsPrivateSlotDescription",
- 0, 0);
+ 0, 0);
/* setup for PKCS12 */
PORT_SetUCS2_ASCIIConversionFunction(xmlSecNssAppAscii2UCS2Conv);
@@ -131,12 +131,12 @@ xmlSecNssAppShutdown(void) {
PK11_LogoutAll();
rv = NSS_Shutdown();
if(rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "NSS_Shutdown",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "NSS_Shutdown",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
@@ -149,17 +149,17 @@ xmlSecNssAppCreateSECItem(SECItem *contents, const xmlSecByte* data, xmlSecSize
contents->data = 0;
if (!SECITEM_AllocItem(NULL, contents, dataSize)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "SECITEM_AllocItem",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "SECITEM_AllocItem",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if(dataSize > 0) {
- xmlSecAssert2(contents->data != NULL, -1);
- memcpy(contents->data, data, dataSize);
+ xmlSecAssert2(contents->data != NULL, -1);
+ memcpy(contents->data, data, dataSize);
}
return (0);
@@ -178,46 +178,46 @@ xmlSecNssAppReadSECItem(SECItem *contents, const char *fn) {
file = PR_Open(fn, PR_RDONLY, 00660);
if (file == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PR_Open",
- XMLSEC_ERRORS_R_IO_FAILED,
- "filename=%s",
- xmlSecErrorsSafeString(fn));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PR_Open",
+ XMLSEC_ERRORS_R_IO_FAILED,
+ "filename=%s",
+ xmlSecErrorsSafeString(fn));
+ goto done;
}
prStatus = PR_GetOpenFileInfo(file, &info);
if (prStatus != PR_SUCCESS) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PR_GetOpenFileInfo",
- XMLSEC_ERRORS_R_IO_FAILED,
- "filename=%s",
- xmlSecErrorsSafeString(fn));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PR_GetOpenFileInfo",
+ XMLSEC_ERRORS_R_IO_FAILED,
+ "filename=%s",
+ xmlSecErrorsSafeString(fn));
+ goto done;
}
contents->data = 0;
if (!SECITEM_AllocItem(NULL, contents, info.size)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "SECITEM_AllocItem",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "SECITEM_AllocItem",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
numBytes = PR_Read(file, contents->data, info.size);
if (numBytes != info.size) {
- SECITEM_FreeItem(contents, PR_FALSE);
- goto done;
+ SECITEM_FreeItem(contents, PR_FALSE);
+ goto done;
}
ret = 0;
done:
if (file) {
- PR_Close(file);
+ PR_Close(file);
}
return (ret);
@@ -225,17 +225,17 @@ done:
static PRBool
xmlSecNssAppAscii2UCS2Conv(PRBool toUnicode,
- unsigned char *inBuf,
- unsigned int inBufLen,
- unsigned char *outBuf,
- unsigned int maxOutBufLen,
- unsigned int *outBufLen,
- PRBool swapBytes ATTRIBUTE_UNUSED)
+ unsigned char *inBuf,
+ unsigned int inBufLen,
+ unsigned char *outBuf,
+ unsigned int maxOutBufLen,
+ unsigned int *outBufLen,
+ PRBool swapBytes ATTRIBUTE_UNUSED)
{
SECItem it;
if (toUnicode == PR_FALSE) {
- return (PR_FALSE);
+ return (PR_FALSE);
}
memset(&it, 0, sizeof(it));
@@ -243,16 +243,16 @@ xmlSecNssAppAscii2UCS2Conv(PRBool toUnicode,
it.len = inBufLen;
return(PORT_UCS2_UTF8Conversion(toUnicode, it.data, it.len,
- outBuf, maxOutBufLen, outBufLen));
+ outBuf, maxOutBufLen, outBufLen));
}
static SECItem *
xmlSecNssAppNicknameCollisionCallback(SECItem *old_nick ATTRIBUTE_UNUSED,
- PRBool *cancel,
- void *wincx ATTRIBUTE_UNUSED)
+ PRBool *cancel,
+ void *wincx ATTRIBUTE_UNUSED)
{
if (cancel == NULL) {
- return (NULL);
+ return (NULL);
}
/* XXX not handled yet */
@@ -262,11 +262,11 @@ xmlSecNssAppNicknameCollisionCallback(SECItem *old_nick ATTRIBUTE_UNUSED,
/**
* xmlSecNssAppKeyLoad:
- * @filename: the key filename.
- * @format: the key file format.
- * @pwd: the key file password.
- * @pwdCallback: the key password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @filename: the key filename.
+ * @format: the key file format.
+ * @pwd: the key file password.
+ * @pwdCallback: the key password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key from a file
*
@@ -274,7 +274,7 @@ xmlSecNssAppNicknameCollisionCallback(SECItem *old_nick ATTRIBUTE_UNUSED,
*/
xmlSecKeyPtr
xmlSecNssAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
- const char *pwd, void* pwdCallback, void* pwdCallbackCtx) {
+ const char *pwd, void* pwdCallback, void* pwdCallbackCtx) {
SECItem secItem;
xmlSecKeyPtr res;
int ret;
@@ -286,23 +286,23 @@ xmlSecNssAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
memset(&secItem, 0, sizeof(secItem));
ret = xmlSecNssAppReadSECItem(&secItem, filename);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppReadSECItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppReadSECItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
res = xmlSecNssAppKeyLoadSECItem(&secItem, format, pwd, pwdCallback, pwdCallbackCtx);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppKeyLoadSECItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- SECITEM_FreeItem(&secItem, PR_FALSE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppKeyLoadSECItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ SECITEM_FreeItem(&secItem, PR_FALSE);
+ return(NULL);
}
SECITEM_FreeItem(&secItem, PR_FALSE);
@@ -311,12 +311,12 @@ xmlSecNssAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
/**
* xmlSecNssAppKeyLoadMemory:
- * @data: the key binary data.
- * @dataSize: the key binary data size.
- * @format: the key data format.
- * @pwd: the key data2 password.
- * @pwdCallback: the key password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @data: the key binary data.
+ * @dataSize: the key binary data size.
+ * @format: the key data format.
+ * @pwd: the key data2 password.
+ * @pwdCallback: the key password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key from a binary @data.
*
@@ -324,7 +324,7 @@ xmlSecNssAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
*/
xmlSecKeyPtr
xmlSecNssAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlSecKeyDataFormat format,
- const char *pwd, void* pwdCallback, void* pwdCallbackCtx) {
+ const char *pwd, void* pwdCallback, void* pwdCallbackCtx) {
SECItem secItem;
xmlSecKeyPtr res;
int ret;
@@ -335,23 +335,23 @@ xmlSecNssAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlSecKey
memset(&secItem, 0, sizeof(secItem));
ret = xmlSecNssAppCreateSECItem(&secItem, data, dataSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppCreateSECItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppCreateSECItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
res = xmlSecNssAppKeyLoadSECItem(&secItem, format, pwd, pwdCallback, pwdCallbackCtx);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppKeyLoadSECItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- SECITEM_FreeItem(&secItem, PR_FALSE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppKeyLoadSECItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ SECITEM_FreeItem(&secItem, PR_FALSE);
+ return(NULL);
}
SECITEM_FreeItem(&secItem, PR_FALSE);
@@ -360,11 +360,11 @@ xmlSecNssAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlSecKey
/**
* xmlSecNssAppKeyLoadSECItem:
- * @secItem: the pointer to sec item.
- * @format: the key format.
- * @pwd: the key password.
- * @pwdCallback: the key password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @secItem: the pointer to sec item.
+ * @format: the key format.
+ * @pwd: the key password.
+ * @pwdCallback: the key password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key from a file
*
@@ -372,9 +372,9 @@ xmlSecNssAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlSecKey
*/
xmlSecKeyPtr
xmlSecNssAppKeyLoadSECItem(SECItem* secItem, xmlSecKeyDataFormat format,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx) {
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx) {
xmlSecKeyPtr key = NULL;
xmlSecAssert2(secItem != NULL, NULL);
@@ -383,46 +383,46 @@ xmlSecNssAppKeyLoadSECItem(SECItem* secItem, xmlSecKeyDataFormat format,
switch(format) {
#ifndef XMLSEC_NO_X509
case xmlSecKeyDataFormatPkcs12:
- key = xmlSecNssAppPkcs12LoadSECItem(secItem, pwd, pwdCallback, pwdCallbackCtx);
+ key = xmlSecNssAppPkcs12LoadSECItem(secItem, pwd, pwdCallback, pwdCallbackCtx);
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppPkcs12LoadSECItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
- break;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppPkcs12LoadSECItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+ break;
case xmlSecKeyDataFormatCertDer:
- key = xmlSecNssAppKeyFromCertLoadSECItem(secItem, format);
+ key = xmlSecNssAppKeyFromCertLoadSECItem(secItem, format);
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppKeyFromCertLoadSECItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
- break;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppKeyFromCertLoadSECItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+ break;
#endif /* XMLSEC_NO_X509 */
case xmlSecKeyDataFormatDer:
- key = xmlSecNssAppDerKeyLoadSECItem(secItem);
+ key = xmlSecNssAppDerKeyLoadSECItem(secItem);
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppDerKeyLoadSECItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
- break;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppDerKeyLoadSECItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+ break;
default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppKeyLoad",
- XMLSEC_ERRORS_R_INVALID_FORMAT,
- "format=%d", format);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppKeyLoad",
+ XMLSEC_ERRORS_R_INVALID_FORMAT,
+ "format=%d", format);
+ return(NULL);
}
return(key);
@@ -448,12 +448,12 @@ xmlSecNssAppDerKeyLoadSECItem(SECItem* secItem) {
*/
slot = xmlSecNssGetInternalKeySlot();
if (slot == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssGetInternalKeySlot",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssGetInternalKeySlot",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
nickname.len = 0;
@@ -466,61 +466,61 @@ xmlSecNssAppDerKeyLoadSECItem(SECItem* secItem) {
* format
*/
status = PK11_ImportDERPrivateKeyInfoAndReturnKey(slot, secItem,
- &nickname, NULL, PR_FALSE,
- PR_TRUE, KU_ALL, &privkey, NULL);
+ &nickname, NULL, PR_FALSE,
+ PR_TRUE, KU_ALL, &privkey, NULL);
if (status != SECSuccess) {
- /* TRY PUBLIC KEY */
- spki = SECKEY_DecodeDERSubjectPublicKeyInfo(secItem);
- if (spki == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "SECKEY_DecodeDERSubjectPublicKeyInfo",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- }
-
- pubkey = SECKEY_ExtractPublicKey(spki);
- if (pubkey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "SECKEY_ExtractPublicKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
+ /* TRY PUBLIC KEY */
+ spki = SECKEY_DecodeDERSubjectPublicKeyInfo(secItem);
+ if (spki == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "SECKEY_DecodeDERSubjectPublicKeyInfo",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ }
+
+ pubkey = SECKEY_ExtractPublicKey(spki);
+ if (pubkey == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "SECKEY_ExtractPublicKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
}
data = xmlSecNssPKIAdoptKey(privkey, pubkey);
if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssPKIAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssPKIAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
privkey = NULL;
pubkey = NULL;
key = xmlSecKeyCreate();
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
ret = xmlSecKeySetValue(key, data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)));
+ goto done;
}
retval = key;
key = NULL;
@@ -529,22 +529,22 @@ xmlSecNssAppDerKeyLoadSECItem(SECItem* secItem) {
done:
if(slot != NULL) {
- PK11_FreeSlot(slot);
+ PK11_FreeSlot(slot);
}
if(privkey != NULL) {
- SECKEY_DestroyPrivateKey(privkey);
+ SECKEY_DestroyPrivateKey(privkey);
}
if(pubkey != NULL) {
- SECKEY_DestroyPublicKey(pubkey);
+ SECKEY_DestroyPublicKey(pubkey);
}
if(key != NULL) {
- xmlSecKeyDestroy(key);
+ xmlSecKeyDestroy(key);
}
if(data != NULL) {
- xmlSecKeyDataDestroy(data);
+ xmlSecKeyDataDestroy(data);
}
if(spki != NULL) {
- SECKEY_DestroySubjectPublicKeyInfo(spki);
+ SECKEY_DestroySubjectPublicKeyInfo(spki);
}
return (retval);
}
@@ -552,15 +552,15 @@ done:
#ifndef XMLSEC_NO_X509
/**
* xmlSecNssAppKeyCertLoad:
- * @key: the pointer to key.
- * @filename: the certificate filename.
- * @format: the certificate file format.
+ * @key: the pointer to key.
+ * @filename: the certificate filename.
+ * @format: the certificate file format.
*
* Reads the certificate from $ filename and adds it to key
*
* Returns: 0 on success or a negative value otherwise.
*/
-int
+int
xmlSecNssAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, xmlSecKeyDataFormat format) {
SECItem secItem;
int ret;
@@ -573,23 +573,23 @@ xmlSecNssAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, xmlSecKeyDataFor
memset(&secItem, 0, sizeof(secItem));
ret = xmlSecNssAppReadSECItem(&secItem, filename);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppReadSECItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppReadSECItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecNssAppKeyCertLoadSECItem(key, &secItem, format);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppKeyCertLoadSECItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- SECITEM_FreeItem(&secItem, PR_FALSE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppKeyCertLoadSECItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ SECITEM_FreeItem(&secItem, PR_FALSE);
+ return(-1);
}
SECITEM_FreeItem(&secItem, PR_FALSE);
@@ -598,16 +598,16 @@ xmlSecNssAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, xmlSecKeyDataFor
/**
* xmlSecNssAppKeyCertLoadMemory:
- * @key: the pointer to key.
- * @data: the key binary data.
- * @dataSize: the key binary data size.
- * @format: the certificate format.
+ * @key: the pointer to key.
+ * @data: the key binary data.
+ * @dataSize: the key binary data size.
+ * @format: the certificate format.
*
* Reads the certificate from @data and adds it to key
*
* Returns: 0 on success or a negative value otherwise.
*/
-int
+int
xmlSecNssAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSize dataSize, xmlSecKeyDataFormat format) {
SECItem secItem;
int ret;
@@ -620,23 +620,23 @@ xmlSecNssAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSi
memset(&secItem, 0, sizeof(secItem));
ret = xmlSecNssAppCreateSECItem(&secItem, data, dataSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppCreateSECItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppCreateSECItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecNssAppKeyCertLoadSECItem(key, &secItem, format);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppKeyCertLoadSECItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- SECITEM_FreeItem(&secItem, PR_FALSE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppKeyCertLoadSECItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ SECITEM_FreeItem(&secItem, PR_FALSE);
+ return(-1);
}
SECITEM_FreeItem(&secItem, PR_FALSE);
@@ -645,15 +645,15 @@ xmlSecNssAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSi
/**
* xmlSecNssAppKeyCertLoadSECItem:
- * @key: the pointer to key.
- * @secItem: the pointer to SECItem.
- * @format: the certificate format.
+ * @key: the pointer to key.
+ * @secItem: the pointer to SECItem.
+ * @format: the certificate format.
*
* Reads the certificate from @secItem and adds it to key
*
* Returns: 0 on success or a negative value otherwise.
*/
-int
+int
xmlSecNssAppKeyCertLoadSECItem(xmlSecKeyPtr key, SECItem* secItem, xmlSecKeyDataFormat format) {
CERTCertificate *cert=NULL;
xmlSecKeyDataPtr data;
@@ -665,49 +665,49 @@ xmlSecNssAppKeyCertLoadSECItem(xmlSecKeyPtr key, SECItem* secItem, xmlSecKeyData
data = xmlSecKeyEnsureData(key, xmlSecNssKeyDataX509Id);
if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyEnsureData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecNssKeyDataX509Id)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyEnsureData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecNssKeyDataX509Id)));
+ return(-1);
}
switch(format) {
case xmlSecKeyDataFormatPkcs8Der:
case xmlSecKeyDataFormatDer:
- cert = __CERT_NewTempCertificate(CERT_GetDefaultCertDB(),
- secItem, NULL, PR_FALSE, PR_TRUE);
- if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "__CERT_NewTempCertificate",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "format=%d", format);
- return(-1);
- }
- break;
+ cert = __CERT_NewTempCertificate(CERT_GetDefaultCertDB(),
+ secItem, NULL, PR_FALSE, PR_TRUE);
+ if(cert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "__CERT_NewTempCertificate",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "format=%d", format);
+ return(-1);
+ }
+ break;
default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_FORMAT,
- "format=%d", format);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_FORMAT,
+ "format=%d", format);
+ return(-1);
}
xmlSecAssert2(cert != NULL, -1);
ret = xmlSecNssKeyDataX509AdoptCert(data, cert);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)));
- CERT_DestroyCertificate(cert);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)));
+ CERT_DestroyCertificate(cert);
+ return(-1);
}
return(0);
@@ -715,10 +715,10 @@ xmlSecNssAppKeyCertLoadSECItem(xmlSecKeyPtr key, SECItem* secItem, xmlSecKeyData
/**
* xmlSecNssAppPkcs12Load:
- * @filename: the PKCS12 key filename.
- * @pwd: the PKCS12 file password.
- * @pwdCallback: the password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @filename: the PKCS12 key filename.
+ * @pwd: the PKCS12 file password.
+ * @pwdCallback: the password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key and all associated certificates from the PKCS12 file.
* For uniformity, call xmlSecNssAppKeyLoad instead of this function. Pass
@@ -726,10 +726,10 @@ xmlSecNssAppKeyCertLoadSECItem(xmlSecKeyPtr key, SECItem* secItem, xmlSecKeyData
*
* Returns: pointer to the key or NULL if an error occurs.
*/
-xmlSecKeyPtr
+xmlSecKeyPtr
xmlSecNssAppPkcs12Load(const char *filename, const char *pwd,
- void *pwdCallback ATTRIBUTE_UNUSED,
- void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
+ void *pwdCallback ATTRIBUTE_UNUSED,
+ void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
SECItem secItem;
xmlSecKeyPtr res;
int ret;
@@ -740,23 +740,23 @@ xmlSecNssAppPkcs12Load(const char *filename, const char *pwd,
memset(&secItem, 0, sizeof(secItem));
ret = xmlSecNssAppReadSECItem(&secItem, filename);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppReadSECItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppReadSECItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
res = xmlSecNssAppPkcs12LoadSECItem(&secItem, pwd, pwdCallback, pwdCallbackCtx);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppPkcs12LoadSECItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- SECITEM_FreeItem(&secItem, PR_FALSE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppPkcs12LoadSECItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ SECITEM_FreeItem(&secItem, PR_FALSE);
+ return(NULL);
}
SECITEM_FreeItem(&secItem, PR_FALSE);
@@ -765,11 +765,11 @@ xmlSecNssAppPkcs12Load(const char *filename, const char *pwd,
/**
* xmlSecNssAppPkcs12LoadMemory:
- * @data: the key binary data.
- * @dataSize: the key binary data size.
- * @pwd: the PKCS12 password.
- * @pwdCallback: the password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @data: the key binary data.
+ * @dataSize: the key binary data size.
+ * @pwd: the PKCS12 password.
+ * @pwdCallback: the password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key and all associated certificates from the PKCS12 binary data.
* For uniformity, call xmlSecNssAppKeyLoad instead of this function. Pass
@@ -777,10 +777,10 @@ xmlSecNssAppPkcs12Load(const char *filename, const char *pwd,
*
* Returns: pointer to the key or NULL if an error occurs.
*/
-xmlSecKeyPtr
+xmlSecKeyPtr
xmlSecNssAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize, const char *pwd,
- void *pwdCallback ATTRIBUTE_UNUSED,
- void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
+ void *pwdCallback ATTRIBUTE_UNUSED,
+ void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
SECItem secItem;
xmlSecKeyPtr res;
int ret;
@@ -790,23 +790,23 @@ xmlSecNssAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize, const
memset(&secItem, 0, sizeof(secItem));
ret = xmlSecNssAppCreateSECItem(&secItem, data, dataSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppCreateSECItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppCreateSECItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
res = xmlSecNssAppPkcs12LoadSECItem(&secItem, pwd, pwdCallback, pwdCallbackCtx);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppPkcs12LoadSECItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- SECITEM_FreeItem(&secItem, PR_FALSE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppPkcs12LoadSECItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ SECITEM_FreeItem(&secItem, PR_FALSE);
+ return(NULL);
}
SECITEM_FreeItem(&secItem, PR_FALSE);
@@ -816,10 +816,10 @@ xmlSecNssAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize, const
/**
* xmlSecNssAppPkcs12LoadSECItem:
- * @secItem: the @SECItem object.
- * @pwd: the PKCS12 file password.
- * @pwdCallback: the password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @secItem: the @SECItem object.
+ * @pwd: the PKCS12 file password.
+ * @pwdCallback: the password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key and all associated certificates from the PKCS12 SECItem.
* For uniformity, call xmlSecNssAppKeyLoad instead of this function. Pass
@@ -827,10 +827,10 @@ xmlSecNssAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize, const
*
* Returns: pointer to the key or NULL if an error occurs.
*/
-xmlSecKeyPtr
+xmlSecKeyPtr
xmlSecNssAppPkcs12LoadSECItem(SECItem* secItem, const char *pwd,
- void *pwdCallback ATTRIBUTE_UNUSED,
- void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
+ void *pwdCallback ATTRIBUTE_UNUSED,
+ void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
xmlSecKeyPtr key = NULL;
xmlSecKeyDataPtr data = NULL;
xmlSecKeyDataPtr x509Data = NULL;
@@ -851,7 +851,7 @@ xmlSecNssAppPkcs12LoadSECItem(SECItem* secItem, const char *pwd,
xmlSecAssert2((secItem != NULL), NULL);
if (pwd == NULL) {
- pwd = "";
+ pwd = "";
}
memset(&uc2_pwditem, 0, sizeof(uc2_pwditem));
@@ -860,106 +860,106 @@ xmlSecNssAppPkcs12LoadSECItem(SECItem* secItem, const char *pwd,
*/
slot = xmlSecNssGetInternalKeySlot();
if (slot == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssGetInternalKeySlot",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssGetInternalKeySlot",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
pwditem.data = (unsigned char *)pwd;
pwditem.len = strlen(pwd)+1;
if (!SECITEM_AllocItem(NULL, &uc2_pwditem, 2*pwditem.len)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "SECITEM_AllocItem",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "SECITEM_AllocItem",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
if (PORT_UCS2_ASCIIConversion(PR_TRUE, pwditem.data, pwditem.len,
uc2_pwditem.data, 2*pwditem.len,
&(uc2_pwditem.len), 0) == PR_FALSE) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PORT_UCS2_ASCIIConversion",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PORT_UCS2_ASCIIConversion",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
p12ctx = SEC_PKCS12DecoderStart(&uc2_pwditem, slot, NULL,
NULL, NULL, NULL, NULL, NULL);
if (p12ctx == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "SEC_PKCS12DecoderStart",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "SEC_PKCS12DecoderStart",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
goto done;
}
rv = SEC_PKCS12DecoderUpdate(p12ctx, secItem->data, secItem->len);
if (rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "SEC_PKCS12DecoderUpdate",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "SEC_PKCS12DecoderUpdate",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
goto done;
}
rv = SEC_PKCS12DecoderVerify(p12ctx);
if (rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "SEC_PKCS12DecoderVerify",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "SEC_PKCS12DecoderVerify",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
goto done;
}
rv = SEC_PKCS12DecoderValidateBags(p12ctx, xmlSecNssAppNicknameCollisionCallback);
if (rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "SEC_PKCS12DecoderValidateBags",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "SEC_PKCS12DecoderValidateBags",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
goto done;
}
rv = SEC_PKCS12DecoderImportBags(p12ctx);
if (rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "SEC_PKCS12DecoderImportBags",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "SEC_PKCS12DecoderImportBags",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
goto done;
}
certlist = SEC_PKCS12DecoderGetCerts(p12ctx);
if (certlist == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "SEC_PKCS12DecoderGetCerts",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "SEC_PKCS12DecoderGetCerts",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
goto done;
}
x509Data = xmlSecKeyDataCreate(xmlSecNssKeyDataX509Id);
if(x509Data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecNssKeyDataX509Id)));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecNssKeyDataX509Id)));
+ goto done;
}
for (head = CERT_LIST_HEAD(certlist);
@@ -969,129 +969,129 @@ xmlSecNssAppPkcs12LoadSECItem(SECItem* secItem, const char *pwd,
privkey = PK11_FindKeyByAnyCert(cert, NULL);
if (privkey != NULL) {
- if (data != NULL) {
- /* we already found a private key.
- * assume the first private key we find is THE ONE
- */
- SECKEY_DestroyPrivateKey(privkey);
- privkey = NULL;
- } else {
- pubkey = CERT_ExtractPublicKey(cert);
- if (pubkey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CERT_ExtractPublicKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
- data = xmlSecNssPKIAdoptKey(privkey, pubkey);
- if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssPKIAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
-
- pubkey = NULL;
- privkey = NULL;
-
- tmpcert = CERT_DupCertificate(cert);
- if(tmpcert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CERT_DupCertificate",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
- }
-
- ret = xmlSecNssKeyDataX509AdoptKeyCert(x509Data, tmpcert);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssKeyDataX509AdoptKeyCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- CERT_DestroyCertificate(tmpcert);
- goto done;
+ if (data != NULL) {
+ /* we already found a private key.
+ * assume the first private key we find is THE ONE
+ */
+ SECKEY_DestroyPrivateKey(privkey);
+ privkey = NULL;
+ } else {
+ pubkey = CERT_ExtractPublicKey(cert);
+ if (pubkey == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CERT_ExtractPublicKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
+ data = xmlSecNssPKIAdoptKey(privkey, pubkey);
+ if(data == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssPKIAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
+
+ pubkey = NULL;
+ privkey = NULL;
+
+ tmpcert = CERT_DupCertificate(cert);
+ if(tmpcert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CERT_DupCertificate",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
+ }
+
+ ret = xmlSecNssKeyDataX509AdoptKeyCert(x509Data, tmpcert);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssKeyDataX509AdoptKeyCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ CERT_DestroyCertificate(tmpcert);
+ goto done;
}
- }
+ }
}
- tmpcert = CERT_DupCertificate(cert);
+ tmpcert = CERT_DupCertificate(cert);
if(tmpcert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CERT_DupCertificate",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
- }
- ret = xmlSecNssKeyDataX509AdoptCert(x509Data, tmpcert);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- CERT_DestroyCertificate(tmpcert);
- goto done;
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CERT_DupCertificate",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
+ }
+ ret = xmlSecNssKeyDataX509AdoptCert(x509Data, tmpcert);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ CERT_DestroyCertificate(tmpcert);
+ goto done;
+ }
} /* end for loop */
if (data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppPkcs12Load",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "private key not found in PKCS12 file");
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppPkcs12Load",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "private key not found in PKCS12 file");
+ goto done;
}
key = xmlSecKeyCreate();
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
ret = xmlSecKeySetValue(key, data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- xmlSecKeyDestroy(key);
- key = NULL;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ xmlSecKeyDestroy(key);
+ key = NULL;
+ goto done;
}
data = NULL;
ret = xmlSecKeyAdoptData(key, x509Data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyAdoptData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- xmlSecKeyDestroy(key);
- key = NULL;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyAdoptData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ xmlSecKeyDestroy(key);
+ key = NULL;
+ goto done;
}
x509Data = NULL;
@@ -1107,16 +1107,16 @@ done:
CERT_DestroyCertList(certlist);
}
if(x509Data != NULL) {
- xmlSecKeyDataDestroy(x509Data);
+ xmlSecKeyDataDestroy(x509Data);
}
if(data != NULL) {
xmlSecKeyDataDestroy(data);
}
if (privkey) {
- SECKEY_DestroyPrivateKey(privkey);
+ SECKEY_DestroyPrivateKey(privkey);
}
if (pubkey) {
- SECKEY_DestroyPublicKey(pubkey);
+ SECKEY_DestroyPublicKey(pubkey);
}
return(key);
@@ -1124,8 +1124,8 @@ done:
/**
* xmlSecNssAppKeyFromCertLoadSECItem:
- * @secItem: the @SECItem object.
- * @format: the cert format.
+ * @secItem: the @SECItem object.
+ * @format: the cert format.
*
* Loads public key from cert.
*
@@ -1145,89 +1145,89 @@ xmlSecNssAppKeyFromCertLoadSECItem(SECItem* secItem, xmlSecKeyDataFormat format)
/* load cert */
switch(format) {
case xmlSecKeyDataFormatCertDer:
- cert = __CERT_NewTempCertificate(CERT_GetDefaultCertDB(),
- secItem, NULL, PR_FALSE, PR_TRUE);
- if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "__CERT_NewTempCertificate",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "format=%d", format);
- return(NULL);
- }
- break;
+ cert = __CERT_NewTempCertificate(CERT_GetDefaultCertDB(),
+ secItem, NULL, PR_FALSE, PR_TRUE);
+ if(cert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "__CERT_NewTempCertificate",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "format=%d", format);
+ return(NULL);
+ }
+ break;
default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_FORMAT,
- "format=%d", format);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_FORMAT,
+ "format=%d", format);
+ return(NULL);
}
/* get key value */
keyData = xmlSecNssX509CertGetKey(cert);
if(keyData == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssX509CertGetKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CERT_DestroyCertificate(cert);
- return(NULL);
+ NULL,
+ "xmlSecNssX509CertGetKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CERT_DestroyCertificate(cert);
+ return(NULL);
}
/* create key */
key = xmlSecKeyCreate();
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(keyData);
- CERT_DestroyCertificate(cert);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(keyData);
+ CERT_DestroyCertificate(cert);
+ return(NULL);
}
/* set key value */
ret = xmlSecKeySetValue(key, keyData);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(key);
- xmlSecKeyDataDestroy(keyData);
- CERT_DestroyCertificate(cert);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(key);
+ xmlSecKeyDataDestroy(keyData);
+ CERT_DestroyCertificate(cert);
+ return(NULL);
}
/* create cert data */
certData = xmlSecKeyEnsureData(key, xmlSecNssKeyDataX509Id);
if(certData == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyEnsureData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(key);
- CERT_DestroyCertificate(cert);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyEnsureData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(key);
+ CERT_DestroyCertificate(cert);
+ return(NULL);
}
/* put cert in the cert data */
ret = xmlSecNssKeyDataX509AdoptCert(certData, cert);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(key);
- CERT_DestroyCertificate(cert);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(key);
+ CERT_DestroyCertificate(cert);
+ return(NULL);
}
return(key);
@@ -1236,10 +1236,10 @@ xmlSecNssAppKeyFromCertLoadSECItem(SECItem* secItem, xmlSecKeyDataFormat format)
/**
* xmlSecNssAppKeysMngrCertLoad:
- * @mngr: the pointer to keys manager.
- * @filename: the certificate file.
- * @format: the certificate file format (PEM or DER).
- * @type: the certificate type (trusted/untrusted).
+ * @mngr: the pointer to keys manager.
+ * @filename: the certificate file.
+ * @format: the certificate file format (PEM or DER).
+ * @type: the certificate type (trusted/untrusted).
*
* Reads cert from @filename and adds to the list of trusted or known
* untrusted certs in @store
@@ -1248,8 +1248,8 @@ xmlSecNssAppKeyFromCertLoadSECItem(SECItem* secItem, xmlSecKeyDataFormat format)
*/
int
xmlSecNssAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type) {
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type) {
SECItem secItem;
int ret;
@@ -1261,23 +1261,23 @@ xmlSecNssAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
memset(&secItem, 0, sizeof(secItem));
ret = xmlSecNssAppReadSECItem(&secItem, filename);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppReadSECItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppReadSECItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecNssAppKeysMngrCertLoadSECItem(mngr, &secItem, format, type);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppKeysMngrCertLoadSECItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- SECITEM_FreeItem(&secItem, PR_FALSE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppKeysMngrCertLoadSECItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ SECITEM_FreeItem(&secItem, PR_FALSE);
+ return(-1);
}
SECITEM_FreeItem(&secItem, PR_FALSE);
@@ -1286,11 +1286,11 @@ xmlSecNssAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
/**
* xmlSecNssAppKeysMngrCertLoadMemory:
- * @mngr: the pointer to keys manager.
- * @data: the key binary data.
- * @dataSize: the key binary data size.
- * @format: the certificate format (PEM or DER).
- * @type: the certificate type (trusted/untrusted).
+ * @mngr: the pointer to keys manager.
+ * @data: the key binary data.
+ * @dataSize: the key binary data size.
+ * @format: the certificate format (PEM or DER).
+ * @type: the certificate type (trusted/untrusted).
*
* Reads cert from @data and adds to the list of trusted or known
* untrusted certs in @store
@@ -1299,8 +1299,8 @@ xmlSecNssAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
*/
int
xmlSecNssAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* data,
- xmlSecSize dataSize, xmlSecKeyDataFormat format,
- xmlSecKeyDataType type) {
+ xmlSecSize dataSize, xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type) {
SECItem secItem;
int ret;
@@ -1311,23 +1311,23 @@ xmlSecNssAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* dat
memset(&secItem, 0, sizeof(secItem));
ret = xmlSecNssAppCreateSECItem(&secItem, data, dataSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppCreateSECItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppCreateSECItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecNssAppKeysMngrCertLoadSECItem(mngr, &secItem, format, type);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssAppKeysMngrCertLoadSECItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- SECITEM_FreeItem(&secItem, PR_FALSE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssAppKeysMngrCertLoadSECItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ SECITEM_FreeItem(&secItem, PR_FALSE);
+ return(-1);
}
SECITEM_FreeItem(&secItem, PR_FALSE);
@@ -1336,10 +1336,10 @@ xmlSecNssAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* dat
/**
* xmlSecNssAppKeysMngrCertLoadSECItem:
- * @mngr: the pointer to keys manager.
- * @secItem: the pointer to SECItem.
- * @format: the certificate format (PEM or DER).
- * @type: the certificate type (trusted/untrusted).
+ * @mngr: the pointer to keys manager.
+ * @secItem: the pointer to SECItem.
+ * @format: the certificate format (PEM or DER).
+ * @type: the certificate type (trusted/untrusted).
*
* Reads cert from @secItem and adds to the list of trusted or known
* untrusted certs in @store
@@ -1348,8 +1348,8 @@ xmlSecNssAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* dat
*/
int
xmlSecNssAppKeysMngrCertLoadSECItem(xmlSecKeysMngrPtr mngr, SECItem* secItem,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type) {
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type) {
xmlSecKeyDataStorePtr x509Store;
CERTCertificate* cert;
int ret;
@@ -1370,24 +1370,24 @@ xmlSecNssAppKeysMngrCertLoadSECItem(xmlSecKeysMngrPtr mngr, SECItem* secItem,
switch(format) {
case xmlSecKeyDataFormatDer:
- cert = __CERT_NewTempCertificate(CERT_GetDefaultCertDB(),
- secItem, NULL, PR_FALSE, PR_TRUE);
- if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "__CERT_NewTempCertificate",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "format=%d", format);
- return(-1);
- }
- break;
+ cert = __CERT_NewTempCertificate(CERT_GetDefaultCertDB(),
+ secItem, NULL, PR_FALSE, PR_TRUE);
+ if(cert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "__CERT_NewTempCertificate",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "format=%d", format);
+ return(-1);
+ }
+ break;
default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_FORMAT,
- "format=%d", format);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_FORMAT,
+ "format=%d", format);
+ return(-1);
}
ret = xmlSecNssX509StoreAdoptCert(x509Store, cert, type);
@@ -1397,7 +1397,7 @@ xmlSecNssAppKeysMngrCertLoadSECItem(xmlSecKeysMngrPtr mngr, SECItem* secItem,
"xmlSecNssX509StoreAdoptCert",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
- CERT_DestroyCertificate(cert);
+ CERT_DestroyCertificate(cert);
return(-1);
}
@@ -1408,7 +1408,7 @@ xmlSecNssAppKeysMngrCertLoadSECItem(xmlSecKeysMngrPtr mngr, SECItem* secItem,
/**
* xmlSecNssAppDefaultKeysMngrInit:
- * @mngr: the pointer to keys manager.
+ * @mngr: the pointer to keys manager.
*
* Initializes @mngr with NSS keys store #xmlSecNssKeysStoreId
* and a default NSS crypto key data stores.
@@ -1423,38 +1423,38 @@ xmlSecNssAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
/* create NSS keys store if needed */
if(xmlSecKeysMngrGetKeysStore(mngr) == NULL) {
- xmlSecKeyStorePtr keysStore;
-
- keysStore = xmlSecKeyStoreCreate(xmlSecNssKeysStoreId);
- if(keysStore == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyStoreCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecNssKeysStoreId");
- return(-1);
- }
-
- ret = xmlSecKeysMngrAdoptKeysStore(mngr, keysStore);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrAdoptKeysStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyStoreDestroy(keysStore);
- return(-1);
- }
+ xmlSecKeyStorePtr keysStore;
+
+ keysStore = xmlSecKeyStoreCreate(xmlSecNssKeysStoreId);
+ if(keysStore == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyStoreCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecNssKeysStoreId");
+ return(-1);
+ }
+
+ ret = xmlSecKeysMngrAdoptKeysStore(mngr, keysStore);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrAdoptKeysStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyStoreDestroy(keysStore);
+ return(-1);
+ }
}
ret = xmlSecNssKeysMngrInit(mngr);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssKeysMngrInit",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssKeysMngrInit",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
mngr->getKey = xmlSecKeysMngrGetKey;
@@ -1463,8 +1463,8 @@ xmlSecNssAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
/**
* xmlSecNssAppDefaultKeysMngrAdoptKey:
- * @mngr: the pointer to keys manager.
- * @key: the pointer to key.
+ * @mngr: the pointer to keys manager.
+ * @key: the pointer to key.
*
* Adds @key to the keys manager @mngr created with #xmlSecNssAppDefaultKeysMngrInit
* function.
@@ -1481,22 +1481,22 @@ xmlSecNssAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key) {
store = xmlSecKeysMngrGetKeysStore(mngr);
if(store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrGetKeysStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrGetKeysStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecNssKeysStoreAdoptKey(store, key);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssKeysStoreAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssKeysStoreAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -1504,8 +1504,8 @@ xmlSecNssAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key) {
/**
* xmlSecNssAppDefaultKeysMngrLoad:
- * @mngr: the pointer to keys manager.
- * @uri: the uri.
+ * @mngr: the pointer to keys manager.
+ * @uri: the uri.
*
* Loads XML keys file from @uri to the keys manager @mngr created
* with #xmlSecNssAppDefaultKeysMngrInit function.
@@ -1522,22 +1522,22 @@ xmlSecNssAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
store = xmlSecKeysMngrGetKeysStore(mngr);
if(store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrGetKeysStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrGetKeysStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecNssKeysStoreLoad(store, uri, mngr);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssKeysStoreLoad",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "uri=%s", xmlSecErrorsSafeString(uri));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssKeysStoreLoad",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "uri=%s", xmlSecErrorsSafeString(uri));
+ return(-1);
}
return(0);
@@ -1545,9 +1545,9 @@ xmlSecNssAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
/**
* xmlSecNssAppDefaultKeysMngrSave:
- * @mngr: the pointer to keys manager.
- * @filename: the destination filename.
- * @type: the type of keys to save (public/private/symmetric).
+ * @mngr: the pointer to keys manager.
+ * @filename: the destination filename.
+ * @type: the type of keys to save (public/private/symmetric).
*
* Saves keys from @mngr to XML keys file.
*
@@ -1563,22 +1563,22 @@ xmlSecNssAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename, xm
store = xmlSecKeysMngrGetKeysStore(mngr);
if(store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrGetKeysStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrGetKeysStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecNssKeysStoreSave(store, filename, type);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssKeysStoreSave",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "filename%s", xmlSecErrorsSafeString(filename));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssKeysStoreSave",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "filename%s", xmlSecErrorsSafeString(filename));
+ return(-1);
}
return(0);
diff --git a/src/nss/bignum.c b/src/nss/bignum.c
index 40bd535..0b33229 100644
--- a/src/nss/bignum.c
+++ b/src/nss/bignum.c
@@ -42,7 +42,7 @@
*/
SECItem *
xmlSecNssNodeGetBigNumValue(PRArenaPool *arena, const xmlNodePtr cur,
- SECItem *a) {
+ SECItem *a) {
xmlSecBuffer buf;
int ret;
SECItem *rv;
@@ -53,36 +53,36 @@ 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);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
ret = xmlSecBufferBase64NodeContentRead(&buf, cur);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferBase64NodeContentRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBufferFinalize(&buf);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferBase64NodeContentRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBufferFinalize(&buf);
+ return(NULL);
}
len = xmlSecBufferGetSize(&buf);
if (a == NULL) {
- rv = SECITEM_AllocItem(arena, NULL, len);
+ rv = SECITEM_AllocItem(arena, NULL, len);
} else {
- rv = a;
- xmlSecAssert2(rv->data == NULL, NULL);
+ rv = a;
+ xmlSecAssert2(rv->data == NULL, NULL);
rv->len = len;
rv->data = PORT_ArenaZAlloc(arena, len);
}
-
+
PORT_Memcpy(rv->data, xmlSecBufferGetData(&buf), len);
xmlSecBufferFinalize(&buf);
@@ -94,8 +94,8 @@ xmlSecNssNodeGetBigNumValue(PRArenaPool *arena, const xmlNodePtr cur,
* @cur: the pointer to an XML node.
* @a: a SECItem containing the BigNum value.
* @addLineBreaks: if the flag is equal to 1 then
- * linebreaks will be added before and after
- * new buffer content.
+ * linebreaks will be added before and after
+ * new buffer content.
*
* Converts SECItem to CryptoBinary string
* (http://www.w3.org/TR/xmldsig-core/#sec-CryptoBinary)
@@ -115,46 +115,46 @@ 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);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", a->len + 1);
+ return(-1);
}
PORT_Memcpy(xmlSecBufferGetData(&buf), a->data, a->len);
ret = xmlSecBufferSetSize(&buf, a->len);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", a->len);
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", a->len);
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
if(addLineBreaks) {
- xmlNodeSetContent(cur, xmlSecStringCR);
+ xmlNodeSetContent(cur, xmlSecStringCR);
} else {
- xmlNodeSetContent(cur, xmlSecStringEmpty);
+ 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);
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferBase64NodeContentWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
if(addLineBreaks) {
- xmlNodeAddContent(cur, xmlSecStringCR);
+ xmlNodeAddContent(cur, xmlSecStringCR);
}
xmlSecBufferFinalize(&buf);
diff --git a/src/nss/ciphers.c b/src/nss/ciphers.c
index 48bd6e1..a0b0278 100644
--- a/src/nss/ciphers.c
+++ b/src/nss/ciphers.c
@@ -23,52 +23,52 @@
#include <xmlsec/nss/crypto.h>
-#define XMLSEC_NSS_MAX_KEY_SIZE 32
-#define XMLSEC_NSS_MAX_IV_SIZE 32
-#define XMLSEC_NSS_MAX_BLOCK_SIZE 32
+#define XMLSEC_NSS_MAX_KEY_SIZE 32
+#define XMLSEC_NSS_MAX_IV_SIZE 32
+#define XMLSEC_NSS_MAX_BLOCK_SIZE 32
/**************************************************************************
*
* Internal Nss Block cipher CTX
*
*****************************************************************************/
-typedef struct _xmlSecNssBlockCipherCtx xmlSecNssBlockCipherCtx,
- *xmlSecNssBlockCipherCtxPtr;
+typedef struct _xmlSecNssBlockCipherCtx xmlSecNssBlockCipherCtx,
+ *xmlSecNssBlockCipherCtxPtr;
struct _xmlSecNssBlockCipherCtx {
- CK_MECHANISM_TYPE cipher;
- PK11Context* cipherCtx;
- xmlSecKeyDataId keyId;
- int keyInitialized;
- int ctxInitialized;
- xmlSecByte key[XMLSEC_NSS_MAX_KEY_SIZE];
- xmlSecSize keySize;
- xmlSecByte iv[XMLSEC_NSS_MAX_IV_SIZE];
- xmlSecSize ivSize;
+ CK_MECHANISM_TYPE cipher;
+ PK11Context* cipherCtx;
+ xmlSecKeyDataId keyId;
+ int keyInitialized;
+ int ctxInitialized;
+ xmlSecByte key[XMLSEC_NSS_MAX_KEY_SIZE];
+ xmlSecSize keySize;
+ xmlSecByte iv[XMLSEC_NSS_MAX_IV_SIZE];
+ xmlSecSize ivSize;
};
-static int xmlSecNssBlockCipherCtxInit (xmlSecNssBlockCipherCtxPtr ctx,
- xmlSecBufferPtr in,
- xmlSecBufferPtr out,
- int encrypt,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecNssBlockCipherCtxUpdate (xmlSecNssBlockCipherCtxPtr ctx,
- xmlSecBufferPtr in,
- xmlSecBufferPtr out,
- int encrypt,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecNssBlockCipherCtxFinal (xmlSecNssBlockCipherCtxPtr ctx,
- xmlSecBufferPtr in,
- xmlSecBufferPtr out,
- int encrypt,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecNssBlockCipherCtxInit (xmlSecNssBlockCipherCtxPtr ctx,
+ xmlSecBufferPtr in,
+ xmlSecBufferPtr out,
+ int encrypt,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecNssBlockCipherCtxUpdate (xmlSecNssBlockCipherCtxPtr ctx,
+ xmlSecBufferPtr in,
+ xmlSecBufferPtr out,
+ int encrypt,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecNssBlockCipherCtxFinal (xmlSecNssBlockCipherCtxPtr ctx,
+ xmlSecBufferPtr in,
+ xmlSecBufferPtr out,
+ int encrypt,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx);
static int
xmlSecNssBlockCipherCtxInit(xmlSecNssBlockCipherCtxPtr ctx,
- xmlSecBufferPtr in, xmlSecBufferPtr out,
- int encrypt,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecBufferPtr in, xmlSecBufferPtr out,
+ int encrypt,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx) {
SECItem keyItem;
SECItem ivItem;
PK11SlotInfo* slot;
@@ -93,47 +93,47 @@ xmlSecNssBlockCipherCtxInit(xmlSecNssBlockCipherCtxPtr ctx,
if(encrypt) {
/* generate random iv */
rv = PK11_GenerateRandom(ctx->iv, ivLen);
- if(rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "PK11_GenerateRandom",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "size=%d", ivLen);
- return(-1);
- }
-
- /* write iv to the output */
- ret = xmlSecBufferAppend(out, ctx->iv, ivLen);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", ivLen);
- return(-1);
- }
-
+ if(rv != SECSuccess) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "PK11_GenerateRandom",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "size=%d", ivLen);
+ return(-1);
+ }
+
+ /* write iv to the output */
+ ret = xmlSecBufferAppend(out, ctx->iv, ivLen);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", ivLen);
+ return(-1);
+ }
+
} else {
- /* if we don't have enough data, exit and hope that
- * we'll have iv next time */
- if(xmlSecBufferGetSize(in) < (xmlSecSize)ivLen) {
- return(0);
- }
-
- /* copy iv to our buffer*/
- xmlSecAssert2(xmlSecBufferGetData(in) != NULL, -1);
- memcpy(ctx->iv, xmlSecBufferGetData(in), ivLen);
-
- /* and remove from input */
- ret = xmlSecBufferRemoveHead(in, ivLen);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", ivLen);
- return(-1);
- }
+ /* if we don't have enough data, exit and hope that
+ * we'll have iv next time */
+ if(xmlSecBufferGetSize(in) < (xmlSecSize)ivLen) {
+ return(0);
+ }
+
+ /* copy iv to our buffer*/
+ xmlSecAssert2(xmlSecBufferGetData(in) != NULL, -1);
+ memcpy(ctx->iv, xmlSecBufferGetData(in), ivLen);
+
+ /* and remove from input */
+ ret = xmlSecBufferRemoveHead(in, ivLen);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", ivLen);
+ return(-1);
+ }
}
memset(&keyItem, 0, sizeof(keyItem));
@@ -145,38 +145,38 @@ xmlSecNssBlockCipherCtxInit(xmlSecNssBlockCipherCtxPtr ctx,
slot = PK11_GetBestSlot(ctx->cipher, NULL);
if(slot == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "PK11_GetBestSlot",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "PK11_GetBestSlot",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
-
+
symKey = PK11_ImportSymKey(slot, ctx->cipher, PK11_OriginDerive,
- CKA_SIGN, &keyItem, NULL);
+ CKA_SIGN, &keyItem, NULL);
if(symKey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "PK11_ImportSymKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "PK11_ImportSymKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
PK11_FreeSlot(slot);
- return(-1);
+ return(-1);
}
ctx->cipherCtx = PK11_CreateContextBySymKey(ctx->cipher,
- (encrypt) ? CKA_ENCRYPT : CKA_DECRYPT,
- symKey, &ivItem);
+ (encrypt) ? CKA_ENCRYPT : CKA_DECRYPT,
+ symKey, &ivItem);
if(ctx->cipherCtx == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "PK11_CreateContextBySymKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- PK11_FreeSymKey(symKey);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "PK11_CreateContextBySymKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ PK11_FreeSymKey(symKey);
PK11_FreeSlot(slot);
- return(-1);
+ return(-1);
}
ctx->ctxInitialized = 1;
@@ -187,10 +187,10 @@ xmlSecNssBlockCipherCtxInit(xmlSecNssBlockCipherCtxPtr ctx,
static int
xmlSecNssBlockCipherCtxUpdate(xmlSecNssBlockCipherCtxPtr ctx,
- xmlSecBufferPtr in, xmlSecBufferPtr out,
- int encrypt,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecBufferPtr in, xmlSecBufferPtr out,
+ int encrypt,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecSize inSize, inBlocks, outSize;
int blockLen;
int outLen = 0;
@@ -213,14 +213,14 @@ xmlSecNssBlockCipherCtxUpdate(xmlSecNssBlockCipherCtxPtr ctx,
outSize = xmlSecBufferGetSize(out);
if(inSize < (xmlSecSize)blockLen) {
- return(0);
+ return(0);
}
if(encrypt) {
inBlocks = inSize / ((xmlSecSize)blockLen);
} else {
- /* we want to have the last block in the input buffer
- * for padding check */
+ /* we want to have the last block in the input buffer
+ * for padding check */
inBlocks = (inSize - 1) / ((xmlSecSize)blockLen);
}
inSize = inBlocks * ((xmlSecSize)blockLen);
@@ -228,58 +228,58 @@ xmlSecNssBlockCipherCtxUpdate(xmlSecNssBlockCipherCtxPtr ctx,
/* we write out the input size plus may be one block */
ret = xmlSecBufferSetMaxSize(out, outSize + inSize + blockLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + inSize + blockLen);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + inSize + blockLen);
+ return(-1);
}
outBuf = xmlSecBufferGetData(out) + outSize;
rv = PK11_CipherOp(ctx->cipherCtx, outBuf, &outLen, inSize + blockLen,
- xmlSecBufferGetData(in), inSize);
+ xmlSecBufferGetData(in), inSize);
if(rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "PK11_CipherOp",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "PK11_CipherOp",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
xmlSecAssert2((xmlSecSize)outLen == inSize, -1);
/* set correct output buffer size */
ret = xmlSecBufferSetSize(out, outSize + outLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + outLen);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + outLen);
+ return(-1);
}
/* remove the processed block from input */
ret = xmlSecBufferRemoveHead(in, inSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
}
return(0);
}
static int
xmlSecNssBlockCipherCtxFinal(xmlSecNssBlockCipherCtxPtr ctx,
- xmlSecBufferPtr in,
- xmlSecBufferPtr out,
- int encrypt,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecBufferPtr in,
+ xmlSecBufferPtr out,
+ int encrypt,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecSize inSize, outSize;
int blockLen, outLen = 0;
xmlSecByte* inBuf;
@@ -304,101 +304,101 @@ xmlSecNssBlockCipherCtxFinal(xmlSecNssBlockCipherCtxPtr ctx,
if(encrypt != 0) {
xmlSecAssert2(inSize < (xmlSecSize)blockLen, -1);
- /* create padding */
+ /* create padding */
ret = xmlSecBufferSetMaxSize(in, blockLen);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", blockLen);
- return(-1);
- }
- inBuf = xmlSecBufferGetData(in);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", blockLen);
+ return(-1);
+ }
+ inBuf = xmlSecBufferGetData(in);
/* generate random padding */
- if((xmlSecSize)blockLen > (inSize + 1)) {
- rv = PK11_GenerateRandom(inBuf + inSize, blockLen - inSize - 1);
- if(rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "PK11_GenerateRandom",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "size=%d", blockLen - inSize - 1);
- return(-1);
- }
- }
- inBuf[blockLen - 1] = blockLen - inSize;
- inSize = blockLen;
+ if((xmlSecSize)blockLen > (inSize + 1)) {
+ rv = PK11_GenerateRandom(inBuf + inSize, blockLen - inSize - 1);
+ if(rv != SECSuccess) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "PK11_GenerateRandom",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "size=%d", blockLen - inSize - 1);
+ return(-1);
+ }
+ }
+ inBuf[blockLen - 1] = blockLen - inSize;
+ inSize = blockLen;
} else {
- if(inSize != (xmlSecSize)blockLen) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "data=%d;block=%d", inSize, blockLen);
- return(-1);
- }
+ if(inSize != (xmlSecSize)blockLen) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "data=%d;block=%d", inSize, blockLen);
+ return(-1);
+ }
}
/* process last block */
ret = xmlSecBufferSetMaxSize(out, outSize + 2 * blockLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + 2 * blockLen);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + 2 * blockLen);
+ return(-1);
}
outBuf = xmlSecBufferGetData(out) + outSize;
rv = PK11_CipherOp(ctx->cipherCtx, outBuf, &outLen, 2 * blockLen,
- xmlSecBufferGetData(in), inSize);
+ xmlSecBufferGetData(in), inSize);
if(rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "PK11_CipherOp",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "PK11_CipherOp",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
xmlSecAssert2((xmlSecSize)outLen == inSize, -1);
if(encrypt == 0) {
- /* check padding */
- if(outLen < outBuf[blockLen - 1]) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "padding=%d;buffer=%d",
- outBuf[blockLen - 1], outLen);
- return(-1);
- }
- outLen -= outBuf[blockLen - 1];
+ /* check padding */
+ if(outLen < outBuf[blockLen - 1]) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "padding=%d;buffer=%d",
+ outBuf[blockLen - 1], outLen);
+ return(-1);
+ }
+ outLen -= outBuf[blockLen - 1];
}
/* set correct output buffer size */
ret = xmlSecBufferSetSize(out, outSize + outLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + outLen);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + outLen);
+ return(-1);
}
/* remove the processed block from input */
ret = xmlSecBufferRemoveHead(in, inSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
}
return(0);
@@ -412,29 +412,29 @@ xmlSecNssBlockCipherCtxFinal(xmlSecNssBlockCipherCtxPtr ctx,
* xmlSecNssBlockCipherCtx block is located after xmlSecTransform structure
*
*****************************************************************************/
-#define xmlSecNssBlockCipherSize \
+#define xmlSecNssBlockCipherSize \
(sizeof(xmlSecTransform) + sizeof(xmlSecNssBlockCipherCtx))
#define xmlSecNssBlockCipherGetCtx(transform) \
((xmlSecNssBlockCipherCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-static int xmlSecNssBlockCipherInitialize (xmlSecTransformPtr transform);
-static void xmlSecNssBlockCipherFinalize (xmlSecTransformPtr transform);
-static int xmlSecNssBlockCipherSetKeyReq (xmlSecTransformPtr transform,
- xmlSecKeyReqPtr keyReq);
-static int xmlSecNssBlockCipherSetKey (xmlSecTransformPtr transform,
- xmlSecKeyPtr key);
-static int xmlSecNssBlockCipherExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecNssBlockCipherCheckId (xmlSecTransformPtr transform);
-
+static int xmlSecNssBlockCipherInitialize (xmlSecTransformPtr transform);
+static void xmlSecNssBlockCipherFinalize (xmlSecTransformPtr transform);
+static int xmlSecNssBlockCipherSetKeyReq (xmlSecTransformPtr transform,
+ xmlSecKeyReqPtr keyReq);
+static int xmlSecNssBlockCipherSetKey (xmlSecTransformPtr transform,
+ xmlSecKeyPtr key);
+static int xmlSecNssBlockCipherExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecNssBlockCipherCheckId (xmlSecTransformPtr transform);
+
static int
xmlSecNssBlockCipherCheckId(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_DES
if(xmlSecTransformCheckId(transform, xmlSecNssTransformDes3CbcId)) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_DES */
@@ -464,35 +464,35 @@ xmlSecNssBlockCipherInitialize(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_DES
if(transform->id == xmlSecNssTransformDes3CbcId) {
- ctx->cipher = CKM_DES3_CBC;
- ctx->keyId = xmlSecNssKeyDataDesId;
- ctx->keySize = 24;
+ ctx->cipher = CKM_DES3_CBC;
+ ctx->keyId = xmlSecNssKeyDataDesId;
+ ctx->keySize = 24;
} else
#endif /* XMLSEC_NO_DES */
#ifndef XMLSEC_NO_AES
if(transform->id == xmlSecNssTransformAes128CbcId) {
- ctx->cipher = CKM_AES_CBC;
- ctx->keyId = xmlSecNssKeyDataAesId;
- ctx->keySize = 16;
+ ctx->cipher = CKM_AES_CBC;
+ ctx->keyId = xmlSecNssKeyDataAesId;
+ ctx->keySize = 16;
} else if(transform->id == xmlSecNssTransformAes192CbcId) {
- ctx->cipher = CKM_AES_CBC;
- ctx->keyId = xmlSecNssKeyDataAesId;
- ctx->keySize = 24;
+ ctx->cipher = CKM_AES_CBC;
+ ctx->keyId = xmlSecNssKeyDataAesId;
+ ctx->keySize = 24;
} else if(transform->id == xmlSecNssTransformAes256CbcId) {
- ctx->cipher = CKM_AES_CBC;
- ctx->keyId = xmlSecNssKeyDataAesId;
- ctx->keySize = 32;
+ ctx->cipher = CKM_AES_CBC;
+ ctx->keyId = xmlSecNssKeyDataAesId;
+ ctx->keySize = 32;
} else
#endif /* XMLSEC_NO_AES */
if(1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -528,12 +528,12 @@ xmlSecNssBlockCipherSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr key
xmlSecAssert2(ctx != NULL, -1);
xmlSecAssert2(ctx->keyId != NULL, -1);
- keyReq->keyId = ctx->keyId;
- keyReq->keyType = xmlSecKeyDataTypeSymmetric;
+ keyReq->keyId = ctx->keyId;
+ keyReq->keyType = xmlSecKeyDataTypeSymmetric;
if(transform->operation == xmlSecTransformOperationEncrypt) {
- keyReq->keyUsage = xmlSecKeyUsageEncrypt;
+ keyReq->keyUsage = xmlSecKeyUsageEncrypt;
} else {
- keyReq->keyUsage = xmlSecKeyUsageDecrypt;
+ keyReq->keyUsage = xmlSecKeyUsageDecrypt;
}
keyReq->keyBitsSize = 8 * ctx->keySize;
return(0);
@@ -563,13 +563,13 @@ xmlSecNssBlockCipherSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
xmlSecAssert2(buffer != NULL, -1);
if(xmlSecBufferGetSize(buffer) < ctx->keySize) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
- "keySize=%d;expected=%d",
- xmlSecBufferGetSize(buffer), ctx->keySize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
+ "keySize=%d;expected=%d",
+ xmlSecBufferGetSize(buffer), ctx->keySize);
+ return(-1);
}
xmlSecAssert2(xmlSecBufferGetData(buffer) != NULL, -1);
@@ -597,73 +597,73 @@ xmlSecNssBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecTransf
xmlSecAssert2(ctx != NULL, -1);
if(transform->status == xmlSecTransformStatusNone) {
- transform->status = xmlSecTransformStatusWorking;
+ transform->status = xmlSecTransformStatusWorking;
}
if(transform->status == xmlSecTransformStatusWorking) {
- if(ctx->ctxInitialized == 0) {
- ret = xmlSecNssBlockCipherCtxInit(ctx, in, out,
- (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
- xmlSecTransformGetName(transform), transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecNssBlockCipherCtxInit",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- }
- if((ctx->ctxInitialized == 0) && (last != 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "not enough data to initialize transform");
- return(-1);
- }
-
- if(ctx->ctxInitialized != 0) {
- ret = xmlSecNssBlockCipherCtxUpdate(ctx, in, out,
- (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
- xmlSecTransformGetName(transform), transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecNssBlockCipherCtxUpdate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- }
-
- if(last) {
- ret = xmlSecNssBlockCipherCtxFinal(ctx, in, out,
- (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
- xmlSecTransformGetName(transform), transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecNssBlockCipherCtxFinal",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- transform->status = xmlSecTransformStatusFinished;
- }
+ if(ctx->ctxInitialized == 0) {
+ ret = xmlSecNssBlockCipherCtxInit(ctx, in, out,
+ (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
+ xmlSecTransformGetName(transform), transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecNssBlockCipherCtxInit",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ }
+ if((ctx->ctxInitialized == 0) && (last != 0)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "not enough data to initialize transform");
+ return(-1);
+ }
+
+ if(ctx->ctxInitialized != 0) {
+ ret = xmlSecNssBlockCipherCtxUpdate(ctx, in, out,
+ (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
+ xmlSecTransformGetName(transform), transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecNssBlockCipherCtxUpdate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ }
+
+ if(last) {
+ ret = xmlSecNssBlockCipherCtxFinal(ctx, in, out,
+ (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
+ xmlSecTransformGetName(transform), transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecNssBlockCipherCtxFinal",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ transform->status = xmlSecTransformStatusFinished;
+ }
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
} else if(transform->status == xmlSecTransformStatusNone) {
- /* the only way we can get here is if there is no enough data in the input */
- xmlSecAssert2(last == 0, -1);
+ /* the only way we can get here is if there is no enough data in the input */
+ xmlSecAssert2(last == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
@@ -678,29 +678,29 @@ xmlSecNssBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSecTransf
********************************************************************/
static xmlSecTransformKlass xmlSecNssAes128CbcKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecNssBlockCipherSize, /* xmlSecSize objSize */
-
- xmlSecNameAes128Cbc, /* const xmlChar* name; */
- xmlSecHrefAes128Cbc, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecNssBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecNssBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecNssBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecNssBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecNssBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
-
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecNssBlockCipherSize, /* xmlSecSize objSize */
+
+ xmlSecNameAes128Cbc, /* const xmlChar* name; */
+ xmlSecHrefAes128Cbc, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecNssBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecNssBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecNssBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecNssBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecNssBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
+
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -717,29 +717,29 @@ xmlSecNssTransformAes128CbcGetKlass(void) {
static xmlSecTransformKlass xmlSecNssAes192CbcKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecNssBlockCipherSize, /* xmlSecSize objSize */
-
- xmlSecNameAes192Cbc, /* const xmlChar* name; */
- xmlSecHrefAes192Cbc, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecNssBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecNssBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecNssBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecNssBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecNssBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecNssBlockCipherSize, /* xmlSecSize objSize */
+
+ xmlSecNameAes192Cbc, /* const xmlChar* name; */
+ xmlSecHrefAes192Cbc, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecNssBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecNssBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecNssBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecNssBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecNssBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -756,29 +756,29 @@ xmlSecNssTransformAes192CbcGetKlass(void) {
static xmlSecTransformKlass xmlSecNssAes256CbcKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecNssBlockCipherSize, /* xmlSecSize objSize */
-
- xmlSecNameAes256Cbc, /* const xmlChar* name; */
- xmlSecHrefAes256Cbc, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecNssBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecNssBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecNssBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecNssBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecNssBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecNssBlockCipherSize, /* xmlSecSize objSize */
+
+ xmlSecNameAes256Cbc, /* const xmlChar* name; */
+ xmlSecHrefAes256Cbc, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecNssBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecNssBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecNssBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecNssBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecNssBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -798,29 +798,29 @@ xmlSecNssTransformAes256CbcGetKlass(void) {
#ifndef XMLSEC_NO_DES
static xmlSecTransformKlass xmlSecNssDes3CbcKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecNssBlockCipherSize, /* xmlSecSize objSize */
-
- xmlSecNameDes3Cbc, /* const xmlChar* name; */
- xmlSecHrefDes3Cbc, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecNssBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecNssBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecNssBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecNssBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecNssBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecNssBlockCipherSize, /* xmlSecSize objSize */
+
+ xmlSecNameDes3Cbc, /* const xmlChar* name; */
+ xmlSecHrefDes3Cbc, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecNssBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecNssBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecNssBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecNssBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecNssBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
diff --git a/src/nss/crypto.c b/src/nss/crypto.c
index 141ceea..889087f 100644
--- a/src/nss/crypto.c
+++ b/src/nss/crypto.c
@@ -43,7 +43,7 @@ xmlSecCryptoGetFunctions_nss(void) {
static xmlSecCryptoDLFunctions functions;
if(gXmlSecNssFunctions != NULL) {
- return(gXmlSecNssFunctions);
+ return(gXmlSecNssFunctions);
}
memset(&functions, 0, sizeof(functions));
@@ -52,107 +52,107 @@ xmlSecCryptoGetFunctions_nss(void) {
/**
* Crypto Init/shutdown
*/
- gXmlSecNssFunctions->cryptoInit = xmlSecNssInit;
- gXmlSecNssFunctions->cryptoShutdown = xmlSecNssShutdown;
- gXmlSecNssFunctions->cryptoKeysMngrInit = xmlSecNssKeysMngrInit;
+ gXmlSecNssFunctions->cryptoInit = xmlSecNssInit;
+ gXmlSecNssFunctions->cryptoShutdown = xmlSecNssShutdown;
+ gXmlSecNssFunctions->cryptoKeysMngrInit = xmlSecNssKeysMngrInit;
/**
* Key data ids
*/
#ifndef XMLSEC_NO_AES
- gXmlSecNssFunctions->keyDataAesGetKlass = xmlSecNssKeyDataAesGetKlass;
+ gXmlSecNssFunctions->keyDataAesGetKlass = xmlSecNssKeyDataAesGetKlass;
#endif /* XMLSEC_NO_AES */
#ifndef XMLSEC_NO_DES
- gXmlSecNssFunctions->keyDataDesGetKlass = xmlSecNssKeyDataDesGetKlass;
+ gXmlSecNssFunctions->keyDataDesGetKlass = xmlSecNssKeyDataDesGetKlass;
#endif /* XMLSEC_NO_DES */
#ifndef XMLSEC_NO_DSA
- gXmlSecNssFunctions->keyDataDsaGetKlass = xmlSecNssKeyDataDsaGetKlass;
+ gXmlSecNssFunctions->keyDataDsaGetKlass = xmlSecNssKeyDataDsaGetKlass;
#endif /* XMLSEC_NO_DSA */
#ifndef XMLSEC_NO_HMAC
- gXmlSecNssFunctions->keyDataHmacGetKlass = xmlSecNssKeyDataHmacGetKlass;
+ gXmlSecNssFunctions->keyDataHmacGetKlass = xmlSecNssKeyDataHmacGetKlass;
#endif /* XMLSEC_NO_HMAC */
#ifndef XMLSEC_NO_RSA
- gXmlSecNssFunctions->keyDataRsaGetKlass = xmlSecNssKeyDataRsaGetKlass;
+ gXmlSecNssFunctions->keyDataRsaGetKlass = xmlSecNssKeyDataRsaGetKlass;
#endif /* XMLSEC_NO_RSA */
#ifndef XMLSEC_NO_X509
- gXmlSecNssFunctions->keyDataX509GetKlass = xmlSecNssKeyDataX509GetKlass;
- gXmlSecNssFunctions->keyDataRawX509CertGetKlass = xmlSecNssKeyDataRawX509CertGetKlass;
+ gXmlSecNssFunctions->keyDataX509GetKlass = xmlSecNssKeyDataX509GetKlass;
+ gXmlSecNssFunctions->keyDataRawX509CertGetKlass = xmlSecNssKeyDataRawX509CertGetKlass;
#endif /* XMLSEC_NO_X509 */
/**
* Key data store ids
*/
#ifndef XMLSEC_NO_X509
- gXmlSecNssFunctions->x509StoreGetKlass = xmlSecNssX509StoreGetKlass;
+ gXmlSecNssFunctions->x509StoreGetKlass = xmlSecNssX509StoreGetKlass;
#endif /* XMLSEC_NO_X509 */
/**
* Crypto transforms ids
*/
#ifndef XMLSEC_NO_AES
- gXmlSecNssFunctions->transformAes128CbcGetKlass = xmlSecNssTransformAes128CbcGetKlass;
- gXmlSecNssFunctions->transformAes192CbcGetKlass = xmlSecNssTransformAes192CbcGetKlass;
- gXmlSecNssFunctions->transformAes256CbcGetKlass = xmlSecNssTransformAes256CbcGetKlass;
- gXmlSecNssFunctions->transformKWAes128GetKlass = xmlSecNssTransformKWAes128GetKlass;
- gXmlSecNssFunctions->transformKWAes192GetKlass = xmlSecNssTransformKWAes192GetKlass;
- gXmlSecNssFunctions->transformKWAes256GetKlass = xmlSecNssTransformKWAes256GetKlass;
+ gXmlSecNssFunctions->transformAes128CbcGetKlass = xmlSecNssTransformAes128CbcGetKlass;
+ gXmlSecNssFunctions->transformAes192CbcGetKlass = xmlSecNssTransformAes192CbcGetKlass;
+ gXmlSecNssFunctions->transformAes256CbcGetKlass = xmlSecNssTransformAes256CbcGetKlass;
+ gXmlSecNssFunctions->transformKWAes128GetKlass = xmlSecNssTransformKWAes128GetKlass;
+ gXmlSecNssFunctions->transformKWAes192GetKlass = xmlSecNssTransformKWAes192GetKlass;
+ gXmlSecNssFunctions->transformKWAes256GetKlass = xmlSecNssTransformKWAes256GetKlass;
#endif /* XMLSEC_NO_AES */
#ifndef XMLSEC_NO_DES
- gXmlSecNssFunctions->transformDes3CbcGetKlass = xmlSecNssTransformDes3CbcGetKlass;
- gXmlSecNssFunctions->transformKWDes3GetKlass = xmlSecNssTransformKWDes3GetKlass;
+ gXmlSecNssFunctions->transformDes3CbcGetKlass = xmlSecNssTransformDes3CbcGetKlass;
+ gXmlSecNssFunctions->transformKWDes3GetKlass = xmlSecNssTransformKWDes3GetKlass;
#endif /* XMLSEC_NO_DES */
#ifndef XMLSEC_NO_DSA
- gXmlSecNssFunctions->transformDsaSha1GetKlass = xmlSecNssTransformDsaSha1GetKlass;
+ gXmlSecNssFunctions->transformDsaSha1GetKlass = xmlSecNssTransformDsaSha1GetKlass;
#endif /* XMLSEC_NO_DSA */
#ifndef XMLSEC_NO_HMAC
- gXmlSecNssFunctions->transformHmacSha1GetKlass = xmlSecNssTransformHmacSha1GetKlass;
+ gXmlSecNssFunctions->transformHmacSha1GetKlass = xmlSecNssTransformHmacSha1GetKlass;
gXmlSecNssFunctions->transformHmacRipemd160GetKlass = xmlSecNssTransformHmacRipemd160GetKlass;
- gXmlSecNssFunctions->transformHmacMd5GetKlass = xmlSecNssTransformHmacMd5GetKlass;
+ gXmlSecNssFunctions->transformHmacMd5GetKlass = xmlSecNssTransformHmacMd5GetKlass;
#endif /* XMLSEC_NO_HMAC */
#ifndef XMLSEC_NO_RSA
- gXmlSecNssFunctions->transformRsaSha1GetKlass = xmlSecNssTransformRsaSha1GetKlass;
- gXmlSecNssFunctions->transformRsaPkcs1GetKlass = xmlSecNssTransformRsaPkcs1GetKlass;
+ gXmlSecNssFunctions->transformRsaSha1GetKlass = xmlSecNssTransformRsaSha1GetKlass;
+ gXmlSecNssFunctions->transformRsaPkcs1GetKlass = xmlSecNssTransformRsaPkcs1GetKlass;
/* RSA OAEP is not supported by NSS yet */
#ifdef TODO
- gXmlSecNssFunctions->transformRsaOaepGetKlass = xmlSecNssTransformRsaOaepGetKlass;
+ gXmlSecNssFunctions->transformRsaOaepGetKlass = xmlSecNssTransformRsaOaepGetKlass;
#endif /* TODO: RSA OAEP is not supported by NSS yet */
#endif /* XMLSEC_NO_RSA */
#ifndef XMLSEC_NO_SHA1
- gXmlSecNssFunctions->transformSha1GetKlass = xmlSecNssTransformSha1GetKlass;
+ gXmlSecNssFunctions->transformSha1GetKlass = xmlSecNssTransformSha1GetKlass;
#endif /* XMLSEC_NO_SHA1 */
/**
* High level routines form xmlsec command line utility
*/
- gXmlSecNssFunctions->cryptoAppInit = xmlSecNssAppInit;
- gXmlSecNssFunctions->cryptoAppShutdown = xmlSecNssAppShutdown;
- gXmlSecNssFunctions->cryptoAppDefaultKeysMngrInit = xmlSecNssAppDefaultKeysMngrInit;
- gXmlSecNssFunctions->cryptoAppDefaultKeysMngrAdoptKey = xmlSecNssAppDefaultKeysMngrAdoptKey;
- gXmlSecNssFunctions->cryptoAppDefaultKeysMngrLoad = xmlSecNssAppDefaultKeysMngrLoad;
- gXmlSecNssFunctions->cryptoAppDefaultKeysMngrSave = xmlSecNssAppDefaultKeysMngrSave;
+ gXmlSecNssFunctions->cryptoAppInit = xmlSecNssAppInit;
+ gXmlSecNssFunctions->cryptoAppShutdown = xmlSecNssAppShutdown;
+ gXmlSecNssFunctions->cryptoAppDefaultKeysMngrInit = xmlSecNssAppDefaultKeysMngrInit;
+ gXmlSecNssFunctions->cryptoAppDefaultKeysMngrAdoptKey = xmlSecNssAppDefaultKeysMngrAdoptKey;
+ gXmlSecNssFunctions->cryptoAppDefaultKeysMngrLoad = xmlSecNssAppDefaultKeysMngrLoad;
+ gXmlSecNssFunctions->cryptoAppDefaultKeysMngrSave = xmlSecNssAppDefaultKeysMngrSave;
#ifndef XMLSEC_NO_X509
- gXmlSecNssFunctions->cryptoAppKeysMngrCertLoad = xmlSecNssAppKeysMngrCertLoad;
+ gXmlSecNssFunctions->cryptoAppKeysMngrCertLoad = xmlSecNssAppKeysMngrCertLoad;
gXmlSecNssFunctions->cryptoAppKeysMngrCertLoadMemory= xmlSecNssAppKeysMngrCertLoadMemory;
- gXmlSecNssFunctions->cryptoAppPkcs12Load = xmlSecNssAppPkcs12Load;
- gXmlSecNssFunctions->cryptoAppPkcs12LoadMemory = xmlSecNssAppPkcs12LoadMemory;
- gXmlSecNssFunctions->cryptoAppKeyCertLoad = xmlSecNssAppKeyCertLoad;
- gXmlSecNssFunctions->cryptoAppKeyCertLoadMemory = xmlSecNssAppKeyCertLoadMemory;
+ gXmlSecNssFunctions->cryptoAppPkcs12Load = xmlSecNssAppPkcs12Load;
+ gXmlSecNssFunctions->cryptoAppPkcs12LoadMemory = xmlSecNssAppPkcs12LoadMemory;
+ gXmlSecNssFunctions->cryptoAppKeyCertLoad = xmlSecNssAppKeyCertLoad;
+ gXmlSecNssFunctions->cryptoAppKeyCertLoadMemory = xmlSecNssAppKeyCertLoadMemory;
#endif /* XMLSEC_NO_X509 */
- gXmlSecNssFunctions->cryptoAppKeyLoad = xmlSecNssAppKeyLoad;
- gXmlSecNssFunctions->cryptoAppKeyLoadMemory = xmlSecNssAppKeyLoadMemory;
- gXmlSecNssFunctions->cryptoAppDefaultPwdCallback = (void*)xmlSecNssAppGetDefaultPwdCallback();
+ gXmlSecNssFunctions->cryptoAppKeyLoad = xmlSecNssAppKeyLoad;
+ gXmlSecNssFunctions->cryptoAppKeyLoadMemory = xmlSecNssAppKeyLoadMemory;
+ gXmlSecNssFunctions->cryptoAppDefaultPwdCallback = (void*)xmlSecNssAppGetDefaultPwdCallback();
return(gXmlSecNssFunctions);
}
@@ -168,12 +168,12 @@ int
xmlSecNssInit (void) {
/* Check loaded xmlsec library version */
if(xmlSecCheckVersionExact() != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCheckVersionExact",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCheckVersionExact",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* set default errors callback for xmlsec to us */
@@ -181,12 +181,12 @@ xmlSecNssInit (void) {
/* register our klasses */
if(xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(xmlSecCryptoGetFunctions_nss()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -206,7 +206,7 @@ xmlSecNssShutdown(void) {
/**
* xmlSecNssKeysMngrInit:
- * @mngr: the pointer to keys manager.
+ * @mngr: the pointer to keys manager.
*
* Adds NSS specific key data stores in keys manager.
*
@@ -264,22 +264,22 @@ xmlSecNssGetInternalKeySlot()
slot = PK11_GetInternalKeySlot();
if (slot == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_GetInternalKeySlot",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_GetInternalKeySlot",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
"error code=%d", PORT_GetError());
- return NULL;
+ return NULL;
}
if (PK11_NeedUserInit(slot)) {
rv = PK11_InitPin(slot, NULL, NULL);
if (rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_Authenticate",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_Authenticate",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return NULL;
}
}
@@ -287,11 +287,11 @@ xmlSecNssGetInternalKeySlot()
if(PK11_IsLoggedIn(slot, NULL) != PR_TRUE) {
rv = PK11_Authenticate(slot, PR_TRUE, NULL);
if (rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_Authenticate",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_Authenticate",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return NULL;
}
}
@@ -301,15 +301,15 @@ xmlSecNssGetInternalKeySlot()
/**
* xmlSecNssGenerateRandom:
- * @buffer: the destination buffer.
- * @size: the numer of bytes to generate.
+ * @buffer: the destination buffer.
+ * @size: the numer of bytes to generate.
*
* Generates @size random bytes and puts result in @buffer.
*
* Returns: 0 on success or a negative value otherwise.
*/
int
-xmlSecNssGenerateRandom(xmlSecBufferPtr buffer, xmlSecSize size) {
+xmlSecNssGenerateRandom(xmlSecBufferPtr buffer, xmlSecSize size) {
SECStatus rv;
int ret;
@@ -318,49 +318,49 @@ xmlSecNssGenerateRandom(xmlSecBufferPtr buffer, xmlSecSize size) {
ret = xmlSecBufferSetSize(buffer, size);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", size);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", size);
+ return(-1);
}
/* get random data */
rv = PK11_GenerateRandom((xmlSecByte*)xmlSecBufferGetData(buffer), size);
if(rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_GenerateRandom",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "size=%d", size);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_GenerateRandom",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "size=%d", size);
+ return(-1);
}
return(0);
}
/**
* xmlSecNssErrorsDefaultCallback:
- * @file: the error location file name (__FILE__ macro).
- * @line: the error location line number (__LINE__ macro).
- * @func: the error location function name (__FUNCTION__ macro).
- * @errorObject: the error specific error object
- * @errorSubject: the error specific error subject.
- * @reason: the error code.
- * @msg: the additional error message.
+ * @file: the error location file name (__FILE__ macro).
+ * @line: the error location line number (__LINE__ macro).
+ * @func: the error location function name (__FUNCTION__ macro).
+ * @errorObject: the error specific error object
+ * @errorSubject: the error specific error subject.
+ * @reason: the error code.
+ * @msg: the additional error message.
*
* The default errors reporting callback function.
*/
void
xmlSecNssErrorsDefaultCallback(const char* file, int line, const char* func,
- const char* errorObject, const char* errorSubject,
- int reason, const char* msg) {
+ const char* errorObject, const char* errorSubject,
+ int reason, const char* msg) {
xmlChar buf[500];
int err;
err = PORT_GetError();
xmlSecStrPrintf(buf, sizeof(buf), BAD_CAST "%s;last nss error=%d (0x%08X)", msg, err, err);
xmlSecErrorsDefaultCallback(file, line, func,
- errorObject, errorSubject,
- reason, (char*)buf);
+ errorObject, errorSubject,
+ reason, (char*)buf);
}
diff --git a/src/nss/digests.c b/src/nss/digests.c
index 5a1db91..4e38576 100644
--- a/src/nss/digests.c
+++ b/src/nss/digests.c
@@ -24,20 +24,20 @@
#include <xmlsec/nss/app.h>
#include <xmlsec/nss/crypto.h>
-#define XMLSEC_NSS_MAX_DIGEST_SIZE 32
+#define XMLSEC_NSS_MAX_DIGEST_SIZE 32
/**************************************************************************
*
* Internal NSS Digest CTX
*
*****************************************************************************/
-typedef struct _xmlSecNssDigestCtx xmlSecNssDigestCtx, *xmlSecNssDigestCtxPtr;
+typedef struct _xmlSecNssDigestCtx xmlSecNssDigestCtx, *xmlSecNssDigestCtxPtr;
struct _xmlSecNssDigestCtx {
- SECOidData* digest;
- PK11Context* digestCtx;
- xmlSecByte dgst[XMLSEC_NSS_MAX_DIGEST_SIZE];
- xmlSecSize dgstSize; /* dgst size in bytes */
-};
+ SECOidData* digest;
+ PK11Context* digestCtx;
+ xmlSecByte dgst[XMLSEC_NSS_MAX_DIGEST_SIZE];
+ xmlSecSize dgstSize; /* dgst size in bytes */
+};
/******************************************************************************
*
@@ -46,28 +46,28 @@ struct _xmlSecNssDigestCtx {
* xmlSecNssDigestCtx is located after xmlSecTransform
*
*****************************************************************************/
-#define xmlSecNssDigestSize \
- (sizeof(xmlSecTransform) + sizeof(xmlSecNssDigestCtx))
+#define xmlSecNssDigestSize \
+ (sizeof(xmlSecTransform) + sizeof(xmlSecNssDigestCtx))
#define xmlSecNssDigestGetCtx(transform) \
((xmlSecNssDigestCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-static int xmlSecNssDigestInitialize (xmlSecTransformPtr transform);
-static void xmlSecNssDigestFinalize (xmlSecTransformPtr transform);
-static int xmlSecNssDigestVerify (xmlSecTransformPtr transform,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecNssDigestExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecNssDigestCheckId (xmlSecTransformPtr transform);
+static int xmlSecNssDigestInitialize (xmlSecTransformPtr transform);
+static void xmlSecNssDigestFinalize (xmlSecTransformPtr transform);
+static int xmlSecNssDigestVerify (xmlSecTransformPtr transform,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecNssDigestExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecNssDigestCheckId (xmlSecTransformPtr transform);
static int
xmlSecNssDigestCheckId(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_SHA1
if(xmlSecTransformCheckId(transform, xmlSecNssTransformSha1Id)) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_SHA1 */
@@ -89,38 +89,38 @@ xmlSecNssDigestInitialize(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_SHA1
if(xmlSecTransformCheckId(transform, xmlSecNssTransformSha1Id)) {
- ctx->digest = SECOID_FindOIDByTag(SEC_OID_SHA1);
+ ctx->digest = SECOID_FindOIDByTag(SEC_OID_SHA1);
} else
-#endif /* XMLSEC_NO_SHA1 */
+#endif /* XMLSEC_NO_SHA1 */
if(1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if(ctx->digest == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "SECOID_FindOIDByTag",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "SECOID_FindOIDByTag",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
}
ctx->digestCtx = PK11_CreateDigestContext(ctx->digest->offset);
if(ctx->digestCtx == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "PK11_CreateDigestContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "PK11_CreateDigestContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
}
-
+
return(0);
}
@@ -135,15 +135,15 @@ xmlSecNssDigestFinalize(xmlSecTransformPtr transform) {
xmlSecAssert(ctx != NULL);
if(ctx->digestCtx != NULL) {
- PK11_DestroyContext(ctx->digestCtx, PR_TRUE);
+ PK11_DestroyContext(ctx->digestCtx, PR_TRUE);
}
memset(ctx, 0, sizeof(xmlSecNssDigestCtx));
}
static int
xmlSecNssDigestVerify(xmlSecTransformPtr transform,
- const xmlSecByte* data, xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx) {
+ const xmlSecByte* data, xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecNssDigestCtxPtr ctx;
xmlSecAssert2(xmlSecNssDigestCheckId(transform), -1);
@@ -158,24 +158,24 @@ xmlSecNssDigestVerify(xmlSecTransformPtr transform,
xmlSecAssert2(ctx->dgstSize > 0, -1);
if(dataSize != ctx->dgstSize) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "data and digest sizes are different (data=%d, dgst=%d)",
- dataSize, ctx->dgstSize);
- transform->status = xmlSecTransformStatusFail;
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "data and digest sizes are different (data=%d, dgst=%d)",
+ dataSize, ctx->dgstSize);
+ transform->status = xmlSecTransformStatusFail;
+ return(0);
}
if(memcmp(ctx->dgst, data, dataSize) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "data and digest do not match");
- transform->status = xmlSecTransformStatusFail;
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "data and digest do not match");
+ transform->status = xmlSecTransformStatusFail;
+ return(0);
}
transform->status = xmlSecTransformStatusOk;
@@ -202,78 +202,78 @@ xmlSecNssDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCt
out = &(transform->outBuf);
if(transform->status == xmlSecTransformStatusNone) {
- rv = PK11_DigestBegin(ctx->digestCtx);
- if(rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "PK11_DigestBegin",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
- }
- transform->status = xmlSecTransformStatusWorking;
+ rv = PK11_DigestBegin(ctx->digestCtx);
+ if(rv != SECSuccess) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "PK11_DigestBegin",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
+ }
+ transform->status = xmlSecTransformStatusWorking;
}
if(transform->status == xmlSecTransformStatusWorking) {
- xmlSecSize inSize;
-
- inSize = xmlSecBufferGetSize(in);
- if(inSize > 0) {
- rv = PK11_DigestOp(ctx->digestCtx, xmlSecBufferGetData(in), inSize);
- if (rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "PK11_DigestOp",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
- }
-
- ret = xmlSecBufferRemoveHead(in, inSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
- }
- }
- if(last) {
- rv = PK11_DigestFinal(ctx->digestCtx, ctx->dgst, &ctx->dgstSize, sizeof(ctx->dgst));
- if(rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "PK11_DigestFinal",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
- }
- xmlSecAssert2(ctx->dgstSize > 0, -1);
-
- if(transform->operation == xmlSecTransformOperationSign) {
- ret = xmlSecBufferAppend(out, ctx->dgst, ctx->dgstSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", ctx->dgstSize);
- return(-1);
- }
- }
- transform->status = xmlSecTransformStatusFinished;
- }
+ xmlSecSize inSize;
+
+ inSize = xmlSecBufferGetSize(in);
+ if(inSize > 0) {
+ rv = PK11_DigestOp(ctx->digestCtx, xmlSecBufferGetData(in), inSize);
+ if (rv != SECSuccess) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "PK11_DigestOp",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
+ }
+
+ ret = xmlSecBufferRemoveHead(in, inSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
+ }
+ }
+ if(last) {
+ rv = PK11_DigestFinal(ctx->digestCtx, ctx->dgst, &ctx->dgstSize, sizeof(ctx->dgst));
+ if(rv != SECSuccess) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "PK11_DigestFinal",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
+ }
+ xmlSecAssert2(ctx->dgstSize > 0, -1);
+
+ if(transform->operation == xmlSecTransformOperationSign) {
+ ret = xmlSecBufferAppend(out, ctx->dgst, ctx->dgstSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", ctx->dgstSize);
+ return(-1);
+ }
+ }
+ transform->status = xmlSecTransformStatusFinished;
+ }
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
@@ -287,31 +287,31 @@ xmlSecNssDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCt
*****************************************************************************/
static xmlSecTransformKlass xmlSecNssSha1Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecNssDigestSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecNssDigestSize, /* xmlSecSize objSize */
/* data */
- xmlSecNameSha1, /* const xmlChar* name; */
- xmlSecHrefSha1, /* const xmlChar* href; */
- xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameSha1, /* const xmlChar* name; */
+ xmlSecHrefSha1, /* const xmlChar* href; */
+ xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
/* methods */
- xmlSecNssDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecNssDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecNssDigestVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecNssDigestExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecNssDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecNssDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecNssDigestVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecNssDigestExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
diff --git a/src/nss/hmac.c b/src/nss/hmac.c
index 98bf0c1..fe62647 100644
--- a/src/nss/hmac.c
+++ b/src/nss/hmac.c
@@ -27,8 +27,8 @@
#include <xmlsec/nss/crypto.h>
/* sizes in bits */
-#define XMLSEC_NSS_MIN_HMAC_SIZE 80
-#define XMLSEC_NSS_MAX_HMAC_SIZE (128 * 8)
+#define XMLSEC_NSS_MIN_HMAC_SIZE 80
+#define XMLSEC_NSS_MAX_HMAC_SIZE (128 * 8)
/**************************************************************************
*
@@ -65,13 +65,13 @@ void xmlSecNssHmacSetMinOutputLength(int min_length)
* Internal NSS HMAC CTX
*
*****************************************************************************/
-typedef struct _xmlSecNssHmacCtx xmlSecNssHmacCtx, *xmlSecNssHmacCtxPtr;
+typedef struct _xmlSecNssHmacCtx xmlSecNssHmacCtx, *xmlSecNssHmacCtxPtr;
struct _xmlSecNssHmacCtx {
- CK_MECHANISM_TYPE digestType;
- PK11Context* digestCtx;
- xmlSecByte dgst[XMLSEC_NSS_MAX_HMAC_SIZE / 8];
- xmlSecSize dgstSize; /* dgst size in bits */
-};
+ CK_MECHANISM_TYPE digestType;
+ PK11Context* digestCtx;
+ xmlSecByte dgst[XMLSEC_NSS_MAX_HMAC_SIZE / 8];
+ xmlSecSize dgstSize; /* dgst size in bits */
+};
/******************************************************************************
*
@@ -82,29 +82,29 @@ struct _xmlSecNssHmacCtx {
*****************************************************************************/
#define xmlSecNssHmacGetCtx(transform) \
((xmlSecNssHmacCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-#define xmlSecNssHmacSize \
+#define xmlSecNssHmacSize \
(sizeof(xmlSecTransform) + sizeof(xmlSecNssHmacCtx))
#define xmlSecNssHmacCheckId(transform) \
(xmlSecTransformCheckId((transform), xmlSecNssTransformHmacSha1Id) || \
xmlSecTransformCheckId((transform), xmlSecNssTransformHmacMd5Id) || \
xmlSecTransformCheckId((transform), xmlSecNssTransformHmacRipemd160Id))
-static int xmlSecNssHmacInitialize (xmlSecTransformPtr transform);
-static void xmlSecNssHmacFinalize (xmlSecTransformPtr transform);
-static int xmlSecNssHmacNodeRead (xmlSecTransformPtr transform,
- xmlNodePtr node,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecNssHmacSetKeyReq (xmlSecTransformPtr transform,
- xmlSecKeyReqPtr keyReq);
-static int xmlSecNssHmacSetKey (xmlSecTransformPtr transform,
- xmlSecKeyPtr key);
-static int xmlSecNssHmacVerify (xmlSecTransformPtr transform,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecNssHmacExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecNssHmacInitialize (xmlSecTransformPtr transform);
+static void xmlSecNssHmacFinalize (xmlSecTransformPtr transform);
+static int xmlSecNssHmacNodeRead (xmlSecTransformPtr transform,
+ xmlNodePtr node,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecNssHmacSetKeyReq (xmlSecTransformPtr transform,
+ xmlSecKeyReqPtr keyReq);
+static int xmlSecNssHmacSetKey (xmlSecTransformPtr transform,
+ xmlSecKeyPtr key);
+static int xmlSecNssHmacVerify (xmlSecTransformPtr transform,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecNssHmacExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
static int
xmlSecNssHmacInitialize(xmlSecTransformPtr transform) {
@@ -124,12 +124,12 @@ xmlSecNssHmacInitialize(xmlSecTransformPtr transform) {
} else if(xmlSecTransformCheckId(transform, xmlSecNssTransformHmacRipemd160Id)) {
ctx->digestType = CKM_RIPEMD160_HMAC;
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
@@ -187,37 +187,37 @@ xmlSecNssHmacNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTrans
cur = xmlSecGetNextElementNode(node->children);
if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeHMACOutputLength, xmlSecDSigNs)) {
- xmlChar *content;
-
- content = xmlNodeGetContent(cur);
- if(content != NULL) {
- ctx->dgstSize = atoi((char*)content);
- xmlFree(content);
- }
-
- /* Ensure that HMAC length is greater than min specified.
- Otherwise, an attacker can set this lenght to 0 or very
- small value
- */
- if((int)ctx->dgstSize < xmlSecNssHmacGetMinOutputLength()) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
- "HMAC output length is too small");
- return(-1);
- }
-
- cur = xmlSecGetNextElementNode(cur->next);
+ xmlChar *content;
+
+ content = xmlNodeGetContent(cur);
+ if(content != NULL) {
+ ctx->dgstSize = atoi((char*)content);
+ xmlFree(content);
+ }
+
+ /* Ensure that HMAC length is greater than min specified.
+ Otherwise, an attacker can set this lenght to 0 or very
+ small value
+ */
+ if((int)ctx->dgstSize < xmlSecNssHmacGetMinOutputLength()) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
+ "HMAC output length is too small");
+ return(-1);
+ }
+
+ cur = xmlSecGetNextElementNode(cur->next);
}
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "no nodes expected");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "no nodes expected");
+ return(-1);
}
return(0);
}
@@ -238,9 +238,9 @@ xmlSecNssHmacSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr keyReq) {
keyReq->keyId = xmlSecNssKeyDataHmacId;
keyReq->keyType= xmlSecKeyDataTypeSymmetric;
if(transform->operation == xmlSecTransformOperationSign) {
- keyReq->keyUsage = xmlSecKeyUsageSign;
+ keyReq->keyUsage = xmlSecKeyUsageSign;
} else {
- keyReq->keyUsage = xmlSecKeyUsageVerify;
+ keyReq->keyUsage = xmlSecKeyUsageVerify;
}
return(0);
@@ -273,12 +273,12 @@ xmlSecNssHmacSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
xmlSecAssert2(buffer != NULL, -1);
if(xmlSecBufferGetSize(buffer) == 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
- "key is empty");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
+ "key is empty");
+ return(-1);
}
memset(&ignore, 0, sizeof(ignore));
@@ -288,36 +288,36 @@ xmlSecNssHmacSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
slot = PK11_GetBestSlot(ctx->digestType, NULL);
if(slot == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "PK11_GetBestSlot",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "PK11_GetBestSlot",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
-
+
symKey = PK11_ImportSymKey(slot, ctx->digestType, PK11_OriginDerive,
- CKA_SIGN, &keyItem, NULL);
+ CKA_SIGN, &keyItem, NULL);
if(symKey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "PK11_ImportSymKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "PK11_ImportSymKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
PK11_FreeSlot(slot);
- return(-1);
+ return(-1);
}
ctx->digestCtx = PK11_CreateContextBySymKey(ctx->digestType, CKA_SIGN, symKey, &ignore);
if(ctx->digestCtx == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "PK11_CreateContextBySymKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- PK11_FreeSymKey(symKey);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "PK11_CreateContextBySymKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ PK11_FreeSymKey(symKey);
PK11_FreeSlot(slot);
- return(-1);
+ return(-1);
}
PK11_FreeSymKey(symKey);
@@ -327,10 +327,10 @@ xmlSecNssHmacSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
static int
xmlSecNssHmacVerify(xmlSecTransformPtr transform,
- const xmlSecByte* data, xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx) {
- static xmlSecByte last_byte_masks[] =
- { 0xFF, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE };
+ const xmlSecByte* data, xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx) {
+ static xmlSecByte last_byte_masks[] =
+ { 0xFF, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE };
xmlSecNssHmacCtxPtr ctx;
xmlSecByte mask;
@@ -349,38 +349,38 @@ xmlSecNssHmacVerify(xmlSecTransformPtr transform,
/* compare the digest size in bytes */
if(dataSize != ((ctx->dgstSize + 7) / 8)){
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "data=%d;dgst=%d",
- dataSize, ((ctx->dgstSize + 7) / 8));
- transform->status = xmlSecTransformStatusFail;
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "data=%d;dgst=%d",
+ dataSize, ((ctx->dgstSize + 7) / 8));
+ transform->status = xmlSecTransformStatusFail;
+ return(0);
}
/* we check the last byte separatelly */
xmlSecAssert2(dataSize > 0, -1);
mask = last_byte_masks[ctx->dgstSize % 8];
if((ctx->dgst[dataSize - 1] & mask) != (data[dataSize - 1] & mask)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_DATA_NOT_MATCH,
- "data and digest do not match (last byte)");
- transform->status = xmlSecTransformStatusFail;
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_DATA_NOT_MATCH,
+ "data and digest do not match (last byte)");
+ transform->status = xmlSecTransformStatusFail;
+ return(0);
}
/* now check the rest of the digest */
if((dataSize > 1) && (memcmp(ctx->dgst, data, dataSize - 1) != 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_DATA_NOT_MATCH,
- "data and digest do not match");
- transform->status = xmlSecTransformStatusFail;
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_DATA_NOT_MATCH,
+ "data and digest do not match");
+ transform->status = xmlSecTransformStatusFail;
+ return(0);
}
transform->status = xmlSecTransformStatusOk;
@@ -407,95 +407,95 @@ xmlSecNssHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxP
out = &(transform->outBuf);
if(transform->status == xmlSecTransformStatusNone) {
- rv = PK11_DigestBegin(ctx->digestCtx);
- if(rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "PK11_DigestBegin",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
- }
- transform->status = xmlSecTransformStatusWorking;
+ rv = PK11_DigestBegin(ctx->digestCtx);
+ if(rv != SECSuccess) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "PK11_DigestBegin",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
+ }
+ transform->status = xmlSecTransformStatusWorking;
}
if(transform->status == xmlSecTransformStatusWorking) {
- xmlSecSize inSize;
-
- inSize = xmlSecBufferGetSize(in);
- if(inSize > 0) {
- rv = PK11_DigestOp(ctx->digestCtx, xmlSecBufferGetData(in), inSize);
- if (rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "PK11_DigestOp",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
- }
-
- ret = xmlSecBufferRemoveHead(in, inSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
- }
- }
- if(last) {
- xmlSecSize dgstSize;
-
- rv = PK11_DigestFinal(ctx->digestCtx, ctx->dgst, &dgstSize, sizeof(ctx->dgst));
- if(rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "PK11_DigestFinal",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
- }
- xmlSecAssert2(dgstSize > 0, -1);
-
- /* check/set the result digest size */
- if(ctx->dgstSize == 0) {
- ctx->dgstSize = dgstSize * 8; /* no dgst size specified, use all we have */
- } else if(ctx->dgstSize <= 8 * dgstSize) {
- dgstSize = ((ctx->dgstSize + 7) / 8); /* we need to truncate result digest */
- } else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "result-bits=%d;required-bits=%d",
- 8 * dgstSize, ctx->dgstSize);
- return(-1);
- }
-
- if(transform->operation == xmlSecTransformOperationSign) {
- ret = xmlSecBufferAppend(out, ctx->dgst, dgstSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", dgstSize);
- return(-1);
- }
- }
- transform->status = xmlSecTransformStatusFinished;
- }
+ xmlSecSize inSize;
+
+ inSize = xmlSecBufferGetSize(in);
+ if(inSize > 0) {
+ rv = PK11_DigestOp(ctx->digestCtx, xmlSecBufferGetData(in), inSize);
+ if (rv != SECSuccess) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "PK11_DigestOp",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
+ }
+
+ ret = xmlSecBufferRemoveHead(in, inSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
+ }
+ }
+ if(last) {
+ xmlSecSize dgstSize;
+
+ rv = PK11_DigestFinal(ctx->digestCtx, ctx->dgst, &dgstSize, sizeof(ctx->dgst));
+ if(rv != SECSuccess) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "PK11_DigestFinal",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
+ }
+ xmlSecAssert2(dgstSize > 0, -1);
+
+ /* check/set the result digest size */
+ if(ctx->dgstSize == 0) {
+ ctx->dgstSize = dgstSize * 8; /* no dgst size specified, use all we have */
+ } else if(ctx->dgstSize <= 8 * dgstSize) {
+ dgstSize = ((ctx->dgstSize + 7) / 8); /* we need to truncate result digest */
+ } else {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "result-bits=%d;required-bits=%d",
+ 8 * dgstSize, ctx->dgstSize);
+ return(-1);
+ }
+
+ if(transform->operation == xmlSecTransformOperationSign) {
+ ret = xmlSecBufferAppend(out, ctx->dgst, dgstSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", dgstSize);
+ return(-1);
+ }
+ }
+ transform->status = xmlSecTransformStatusFinished;
+ }
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "size=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "size=%d", transform->status);
+ return(-1);
}
return(0);
@@ -506,29 +506,29 @@ xmlSecNssHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxP
*/
static xmlSecTransformKlass xmlSecNssHmacSha1Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecNssHmacSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecNssHmacSize, /* xmlSecSize objSize */
- xmlSecNameHmacSha1, /* const xmlChar* name; */
- xmlSecHrefHmacSha1, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameHmacSha1, /* const xmlChar* name; */
+ xmlSecHrefHmacSha1, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecNssHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecNssHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- xmlSecNssHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecNssHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecNssHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecNssHmacVerify, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecNssHmacExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecNssHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecNssHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ xmlSecNssHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecNssHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecNssHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecNssHmacVerify, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecNssHmacExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -548,29 +548,29 @@ xmlSecNssTransformHmacSha1GetKlass(void) {
*/
static xmlSecTransformKlass xmlSecNssHmacRipemd160Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecNssHmacSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecNssHmacSize, /* xmlSecSize objSize */
- xmlSecNameHmacRipemd160, /* const xmlChar* name; */
- xmlSecHrefHmacRipemd160, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameHmacRipemd160, /* const xmlChar* name; */
+ xmlSecHrefHmacRipemd160, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecNssHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecNssHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- xmlSecNssHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecNssHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecNssHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecNssHmacVerify, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecNssHmacExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecNssHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecNssHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ xmlSecNssHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecNssHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecNssHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecNssHmacVerify, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecNssHmacExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -590,29 +590,29 @@ xmlSecNssTransformHmacRipemd160GetKlass(void) {
*/
static xmlSecTransformKlass xmlSecNssHmacMd5Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecNssHmacSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecNssHmacSize, /* xmlSecSize objSize */
- xmlSecNameHmacMd5, /* const xmlChar* name; */
- xmlSecHrefHmacMd5, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameHmacMd5, /* const xmlChar* name; */
+ xmlSecHrefHmacMd5, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecNssHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecNssHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- xmlSecNssHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecNssHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecNssHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecNssHmacVerify, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecNssHmacExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecNssHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecNssHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ xmlSecNssHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecNssHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecNssHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecNssHmacVerify, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecNssHmacExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
diff --git a/src/nss/keysstore.c b/src/nss/keysstore.c
index a583f60..453bff9 100644
--- a/src/nss/keysstore.c
+++ b/src/nss/keysstore.c
@@ -49,34 +49,34 @@
*
***************************************************************************/
#define xmlSecNssKeysStoreSize \
- (sizeof(xmlSecKeyStore) + sizeof(xmlSecKeyStorePtr))
+ (sizeof(xmlSecKeyStore) + sizeof(xmlSecKeyStorePtr))
#define xmlSecNssKeysStoreGetSS(store) \
((xmlSecKeyStoreCheckSize((store), xmlSecNssKeysStoreSize)) ? \
(xmlSecKeyStorePtr*)(((xmlSecByte*)(store)) + sizeof(xmlSecKeyStore)) : \
(xmlSecKeyStorePtr*)NULL)
-static int xmlSecNssKeysStoreInitialize (xmlSecKeyStorePtr store);
-static void xmlSecNssKeysStoreFinalize (xmlSecKeyStorePtr store);
-static xmlSecKeyPtr xmlSecNssKeysStoreFindKey (xmlSecKeyStorePtr store,
- const xmlChar* name,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssKeysStoreInitialize (xmlSecKeyStorePtr store);
+static void xmlSecNssKeysStoreFinalize (xmlSecKeyStorePtr store);
+static xmlSecKeyPtr xmlSecNssKeysStoreFindKey (xmlSecKeyStorePtr store,
+ const xmlChar* name,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
static xmlSecKeyStoreKlass xmlSecNssKeysStoreKlass = {
sizeof(xmlSecKeyStoreKlass),
xmlSecNssKeysStoreSize,
/* data */
- BAD_CAST "NSS-keys-store", /* const xmlChar* name; */
+ BAD_CAST "NSS-keys-store", /* const xmlChar* name; */
/* constructors/destructor */
- xmlSecNssKeysStoreInitialize, /* xmlSecKeyStoreInitializeMethod initialize; */
- xmlSecNssKeysStoreFinalize, /* xmlSecKeyStoreFinalizeMethod finalize; */
- xmlSecNssKeysStoreFindKey, /* xmlSecKeyStoreFindKeyMethod findKey; */
+ xmlSecNssKeysStoreInitialize, /* xmlSecKeyStoreInitializeMethod initialize; */
+ xmlSecNssKeysStoreFinalize, /* xmlSecKeyStoreFinalizeMethod finalize; */
+ xmlSecNssKeysStoreFindKey, /* xmlSecKeyStoreFindKeyMethod findKey; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -93,8 +93,8 @@ xmlSecNssKeysStoreGetKlass(void) {
/**
* xmlSecNssKeysStoreAdoptKey:
- * @store: the pointer to Nss keys store.
- * @key: the pointer to key.
+ * @store: the pointer to Nss keys store.
+ * @key: the pointer to key.
*
* Adds @key to the @store.
*
@@ -109,16 +109,16 @@ xmlSecNssKeysStoreAdoptKey(xmlSecKeyStorePtr store, xmlSecKeyPtr key) {
ss = xmlSecNssKeysStoreGetSS(store);
xmlSecAssert2(((ss != NULL) && (*ss != NULL) &&
- (xmlSecKeyStoreCheckId(*ss, xmlSecSimpleKeysStoreId))), -1);
+ (xmlSecKeyStoreCheckId(*ss, xmlSecSimpleKeysStoreId))), -1);
return (xmlSecSimpleKeysStoreAdoptKey(*ss, key));
}
/**
* xmlSecNssKeysStoreLoad:
- * @store: the pointer to Nss keys store.
- * @uri: the filename.
- * @keysMngr: the pointer to associated keys manager.
+ * @store: the pointer to Nss keys store.
+ * @uri: the filename.
+ * @keysMngr: the pointer to associated keys manager.
*
* Reads keys from an XML file.
*
@@ -126,7 +126,7 @@ xmlSecNssKeysStoreAdoptKey(xmlSecKeyStorePtr store, xmlSecKeyPtr key) {
*/
int
xmlSecNssKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
- xmlSecKeysMngrPtr keysMngr) {
+ xmlSecKeysMngrPtr keysMngr) {
xmlDocPtr doc;
xmlNodePtr root;
xmlNodePtr cur;
@@ -139,101 +139,101 @@ xmlSecNssKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
doc = xmlParseFile(uri);
if(doc == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlParseFile",
- XMLSEC_ERRORS_R_XML_FAILED,
- "uri=%s",
- xmlSecErrorsSafeString(uri));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlParseFile",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "uri=%s",
+ xmlSecErrorsSafeString(uri));
+ return(-1);
}
root = xmlDocGetRootElement(doc);
if(!xmlSecCheckNodeName(root, BAD_CAST "Keys", xmlSecNs)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(root)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "expected-node=<xmlsec:Keys>");
- xmlFreeDoc(doc);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(root)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "expected-node=<xmlsec:Keys>");
+ xmlFreeDoc(doc);
+ return(-1);
}
cur = xmlSecGetNextElementNode(root->children);
while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeKeyInfo, xmlSecDSigNs)) {
- key = xmlSecKeyCreate();
- if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "expected-node=%s",
- xmlSecErrorsSafeString(xmlSecNodeKeyInfo));
- xmlFreeDoc(doc);
- return(-1);
- }
-
- ret = xmlSecKeyInfoCtxInitialize(&keyInfoCtx, NULL);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecKeyInfoCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(key);
- xmlFreeDoc(doc);
- return(-1);
- }
-
- keyInfoCtx.mode = xmlSecKeyInfoModeRead;
- keyInfoCtx.keysMngr = keysMngr;
- keyInfoCtx.flags = XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND |
- XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS;
- keyInfoCtx.keyReq.keyId = xmlSecKeyDataIdUnknown;
- keyInfoCtx.keyReq.keyType = xmlSecKeyDataTypeAny;
- keyInfoCtx.keyReq.keyUsage= xmlSecKeyDataUsageAny;
-
- ret = xmlSecKeyInfoNodeRead(cur, key, &keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecKeyInfoNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
- xmlSecKeyDestroy(key);
- xmlFreeDoc(doc);
- return(-1);
- }
- xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
-
- if(xmlSecKeyIsValid(key)) {
- ret = xmlSecNssKeysStoreAdoptKey(store, key);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecNssKeysStoreAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(key);
- xmlFreeDoc(doc);
- return(-1);
- }
- } else {
- /* we have an unknown key in our file, just ignore it */
- xmlSecKeyDestroy(key);
- }
+ key = xmlSecKeyCreate();
+ if(key == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "expected-node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeKeyInfo));
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+
+ ret = xmlSecKeyInfoCtxInitialize(&keyInfoCtx, NULL);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecKeyInfoCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(key);
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+
+ keyInfoCtx.mode = xmlSecKeyInfoModeRead;
+ keyInfoCtx.keysMngr = keysMngr;
+ keyInfoCtx.flags = XMLSEC_KEYINFO_FLAGS_DONT_STOP_ON_KEY_FOUND |
+ XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS;
+ keyInfoCtx.keyReq.keyId = xmlSecKeyDataIdUnknown;
+ keyInfoCtx.keyReq.keyType = xmlSecKeyDataTypeAny;
+ keyInfoCtx.keyReq.keyUsage= xmlSecKeyDataUsageAny;
+
+ ret = xmlSecKeyInfoNodeRead(cur, key, &keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecKeyInfoNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
+ xmlSecKeyDestroy(key);
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+ xmlSecKeyInfoCtxFinalize(&keyInfoCtx);
+
+ if(xmlSecKeyIsValid(key)) {
+ ret = xmlSecNssKeysStoreAdoptKey(store, key);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecNssKeysStoreAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(key);
+ xmlFreeDoc(doc);
+ return(-1);
+ }
+ } else {
+ /* we have an unknown key in our file, just ignore it */
+ xmlSecKeyDestroy(key);
+ }
cur = xmlSecGetNextElementNode(cur->next);
}
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFreeDoc(doc);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFreeDoc(doc);
+ return(-1);
}
xmlFreeDoc(doc);
@@ -242,9 +242,9 @@ xmlSecNssKeysStoreLoad(xmlSecKeyStorePtr store, const char *uri,
/**
* xmlSecNssKeysStoreSave:
- * @store: the pointer to Nss keys store.
- * @filename: the filename.
- * @type: the saved keys type (public, private, ...).
+ * @store: the pointer to Nss keys store.
+ * @filename: the filename.
+ * @type: the saved keys type (public, private, ...).
*
* Writes keys from @store to an XML file.
*
@@ -259,7 +259,7 @@ xmlSecNssKeysStoreSave(xmlSecKeyStorePtr store, const char *filename, xmlSecKeyD
ss = xmlSecNssKeysStoreGetSS(store);
xmlSecAssert2(((ss != NULL) && (*ss != NULL) &&
- (xmlSecKeyStoreCheckId(*ss, xmlSecSimpleKeysStoreId))), -1);
+ (xmlSecKeyStoreCheckId(*ss, xmlSecSimpleKeysStoreId))), -1);
return (xmlSecSimpleKeysStoreSave(*ss, filename, type));
}
@@ -275,12 +275,12 @@ xmlSecNssKeysStoreInitialize(xmlSecKeyStorePtr store) {
*ss = xmlSecKeyStoreCreate(xmlSecSimpleKeysStoreId);
if(*ss == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
- "xmlSecKeyStoreCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecSimpleKeysStoreId");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)),
+ "xmlSecKeyStoreCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecSimpleKeysStoreId");
+ return(-1);
}
return(0);
@@ -300,7 +300,7 @@ xmlSecNssKeysStoreFinalize(xmlSecKeyStorePtr store) {
static xmlSecKeyPtr
xmlSecNssKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyStorePtr* ss;
xmlSecKeyPtr key = NULL;
xmlSecKeyPtr retval = NULL;
@@ -320,14 +320,14 @@ xmlSecNssKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name,
key = xmlSecKeyStoreFindKey(*ss, name, keyInfoCtx);
if (key != NULL) {
- return (key);
+ return (key);
}
/* Try to find the key in the NSS DB, and construct an xmlSecKey.
* we must have a name to lookup keys in NSS DB.
*/
if (name == NULL) {
- goto done;
+ goto done;
}
/* what type of key are we looking for?
@@ -337,148 +337,148 @@ xmlSecNssKeysStoreFindKey(xmlSecKeyStorePtr store, const xmlChar* name,
*/
keyReq = &(keyInfoCtx->keyReq);
if (keyReq->keyType &
- (xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate)) {
- cert = CERT_FindCertByNickname (CERT_GetDefaultCertDB(), (char *)name);
- if (cert == NULL) {
- goto done;
- }
-
- if (keyReq->keyType & xmlSecKeyDataTypePublic) {
- pubkey = CERT_ExtractPublicKey(cert);
- if (pubkey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CERT_ExtractPublicKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
- }
-
- if (keyReq->keyType & xmlSecKeyDataTypePrivate) {
- privkey = PK11_FindKeyByAnyCert(cert, NULL);
- if (privkey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_FindKeyByAnyCert",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
- }
-
- data = xmlSecNssPKIAdoptKey(privkey, pubkey);
- if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssPKIAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
- privkey = NULL;
- pubkey = NULL;
+ (xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate)) {
+ cert = CERT_FindCertByNickname (CERT_GetDefaultCertDB(), (char *)name);
+ if (cert == NULL) {
+ goto done;
+ }
+
+ if (keyReq->keyType & xmlSecKeyDataTypePublic) {
+ pubkey = CERT_ExtractPublicKey(cert);
+ if (pubkey == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CERT_ExtractPublicKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
+ }
+
+ if (keyReq->keyType & xmlSecKeyDataTypePrivate) {
+ privkey = PK11_FindKeyByAnyCert(cert, NULL);
+ if (privkey == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_FindKeyByAnyCert",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
+ }
+
+ data = xmlSecNssPKIAdoptKey(privkey, pubkey);
+ if(data == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssPKIAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
+ privkey = NULL;
+ pubkey = NULL;
key = xmlSecKeyCreate();
if (key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return (NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return (NULL);
+ }
+
+ x509Data = xmlSecKeyDataCreate(xmlSecNssKeyDataX509Id);
+ if(x509Data == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecNssKeyDataX509Id)));
+ goto done;
+ }
+
+ ret = xmlSecNssKeyDataX509AdoptKeyCert(x509Data, cert);
+ if (ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssKeyDataX509AdoptKeyCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
+ }
+ cert = CERT_DupCertificate(cert);
+ if (cert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CERT_DupCertificate",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
+ }
+
+ ret = xmlSecNssKeyDataX509AdoptCert(x509Data, cert);
+ if (ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
+ }
+ cert = NULL;
+
+ ret = xmlSecKeySetValue(key, data);
+ if (ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)));
+ goto done;
+ }
+ data = NULL;
+
+ ret = xmlSecKeyAdoptData(key, x509Data);
+ if (ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyAdoptData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
}
+ x509Data = NULL;
- x509Data = xmlSecKeyDataCreate(xmlSecNssKeyDataX509Id);
- if(x509Data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecNssKeyDataX509Id)));
- goto done;
- }
-
- ret = xmlSecNssKeyDataX509AdoptKeyCert(x509Data, cert);
- if (ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssKeyDataX509AdoptKeyCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
- }
- cert = CERT_DupCertificate(cert);
- if (cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CERT_DupCertificate",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
- }
-
- ret = xmlSecNssKeyDataX509AdoptCert(x509Data, cert);
- if (ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
- }
- cert = NULL;
-
- ret = xmlSecKeySetValue(key, data);
- if (ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)));
- goto done;
- }
- data = NULL;
-
- ret = xmlSecKeyAdoptData(key, x509Data);
- if (ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyAdoptData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
- }
- x509Data = NULL;
-
- retval = key;
- key = NULL;
+ retval = key;
+ key = NULL;
}
done:
if (cert != NULL) {
- CERT_DestroyCertificate(cert);
+ CERT_DestroyCertificate(cert);
}
if (pubkey != NULL) {
- SECKEY_DestroyPublicKey(pubkey);
+ SECKEY_DestroyPublicKey(pubkey);
}
if (privkey != NULL) {
- SECKEY_DestroyPrivateKey(privkey);
+ SECKEY_DestroyPrivateKey(privkey);
}
if (data != NULL) {
- xmlSecKeyDataDestroy(data);
+ xmlSecKeyDataDestroy(data);
}
if (x509Data != NULL) {
- xmlSecKeyDataDestroy(x509Data);
+ xmlSecKeyDataDestroy(x509Data);
}
if (key != NULL) {
- xmlSecKeyDestroy(key);
+ xmlSecKeyDestroy(key);
}
return (retval);
diff --git a/src/nss/keytrans.c b/src/nss/keytrans.c
index 5d256c2..cca9b88 100644
--- a/src/nss/keytrans.c
+++ b/src/nss/keytrans.c
@@ -35,36 +35,36 @@
* key transform transforms
*
********************************************************************/
-typedef struct _xmlSecNssKeyTransportCtx xmlSecNssKeyTransportCtx;
-typedef struct _xmlSecNssKeyTransportCtx* xmlSecNssKeyTransportCtxPtr;
+typedef struct _xmlSecNssKeyTransportCtx xmlSecNssKeyTransportCtx;
+typedef struct _xmlSecNssKeyTransportCtx* xmlSecNssKeyTransportCtxPtr;
-#define xmlSecNssKeyTransportSize \
- ( sizeof( xmlSecTransform ) + sizeof( xmlSecNssKeyTransportCtx ) )
+#define xmlSecNssKeyTransportSize \
+ ( sizeof( xmlSecTransform ) + sizeof( xmlSecNssKeyTransportCtx ) )
#define xmlSecNssKeyTransportGetCtx( transform ) \
- ( ( xmlSecNssKeyTransportCtxPtr )( ( ( xmlSecByte* )( transform ) ) + sizeof( xmlSecTransform ) ) )
+ ( ( xmlSecNssKeyTransportCtxPtr )( ( ( xmlSecByte* )( transform ) ) + sizeof( xmlSecTransform ) ) )
struct _xmlSecNssKeyTransportCtx {
- CK_MECHANISM_TYPE cipher ;
- SECKEYPublicKey* pubkey ;
- SECKEYPrivateKey* prikey ;
- xmlSecKeyDataId keyId ;
- xmlSecBufferPtr material ; /* to be encrypted/decrypted material */
+ CK_MECHANISM_TYPE cipher ;
+ SECKEYPublicKey* pubkey ;
+ SECKEYPrivateKey* prikey ;
+ xmlSecKeyDataId keyId ;
+ xmlSecBufferPtr material ; /* to be encrypted/decrypted material */
} ;
-static int xmlSecNssKeyTransportInitialize(xmlSecTransformPtr transform);
-static void xmlSecNssKeyTransportFinalize(xmlSecTransformPtr transform);
-static int xmlSecNssKeyTransportSetKeyReq(xmlSecTransformPtr transform,
- xmlSecKeyReqPtr keyReq);
-static int xmlSecNssKeyTransportSetKey(xmlSecTransformPtr transform,
- xmlSecKeyPtr key);
-static int xmlSecNssKeyTransportExecute(xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecNssKeyTransportInitialize(xmlSecTransformPtr transform);
+static void xmlSecNssKeyTransportFinalize(xmlSecTransformPtr transform);
+static int xmlSecNssKeyTransportSetKeyReq(xmlSecTransformPtr transform,
+ xmlSecKeyReqPtr keyReq);
+static int xmlSecNssKeyTransportSetKey(xmlSecTransformPtr transform,
+ xmlSecKeyPtr key);
+static int xmlSecNssKeyTransportExecute(xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
static int
xmlSecNssKeyTransportCheckId(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_RSA
- if( xmlSecTransformCheckId( transform, xmlSecNssTransformRsaPkcs1Id )
+ if( xmlSecTransformCheckId( transform, xmlSecNssTransformRsaPkcs1Id )
/* RSA OAEP is not supported by NSS yet */
#ifdef TODO
|| xmlSecTransformCheckId( transform, xmlSecNssTransformRsaOaepId )
@@ -72,7 +72,7 @@ xmlSecNssKeyTransportCheckId(xmlSecTransformPtr transform) {
) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_RSA */
@@ -81,150 +81,150 @@ xmlSecNssKeyTransportCheckId(xmlSecTransformPtr transform) {
static int
xmlSecNssKeyTransportInitialize(xmlSecTransformPtr transform) {
- xmlSecNssKeyTransportCtxPtr context ;
+ xmlSecNssKeyTransportCtxPtr context ;
xmlSecAssert2(xmlSecNssKeyTransportCheckId(transform), -1);
xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssKeyTransportSize), -1);
- context = xmlSecNssKeyTransportGetCtx( transform ) ;
- xmlSecAssert2( context != NULL , -1 ) ;
+ context = xmlSecNssKeyTransportGetCtx( transform ) ;
+ xmlSecAssert2( context != NULL , -1 ) ;
#ifndef XMLSEC_NO_RSA
- if( transform->id == xmlSecNssTransformRsaPkcs1Id ) {
- context->cipher = CKM_RSA_PKCS ;
- context->keyId = xmlSecNssKeyDataRsaId ;
+ if( transform->id == xmlSecNssTransformRsaPkcs1Id ) {
+ context->cipher = CKM_RSA_PKCS ;
+ context->keyId = xmlSecNssKeyDataRsaId ;
/* RSA OAEP is not supported by NSS yet */
#ifdef TODO
- } else if( transform->id == xmlSecNssTransformRsaOaepId ) {
- context->cipher = CKM_RSA_PKCS_OAEP ;
- context->keyId = xmlSecNssKeyDataRsaId ;
+ } else if( transform->id == xmlSecNssTransformRsaOaepId ) {
+ context->cipher = CKM_RSA_PKCS_OAEP ;
+ context->keyId = xmlSecNssKeyDataRsaId ;
#endif /* TODO: RSA OAEP is not supported by NSS yet */
- } else
-#endif /* XMLSEC_NO_RSA */
-
- if( 1 ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1);
- }
-
- context->pubkey = NULL ;
- context->prikey = NULL ;
- context->material = NULL ;
+ } else
+#endif /* XMLSEC_NO_RSA */
+
+ if( 1 ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1);
+ }
+
+ context->pubkey = NULL ;
+ context->prikey = NULL ;
+ context->material = NULL ;
return(0);
}
static void
xmlSecNssKeyTransportFinalize(xmlSecTransformPtr transform) {
- xmlSecNssKeyTransportCtxPtr context ;
+ xmlSecNssKeyTransportCtxPtr context ;
xmlSecAssert(xmlSecNssKeyTransportCheckId(transform));
xmlSecAssert(xmlSecTransformCheckSize(transform, xmlSecNssKeyTransportSize));
- context = xmlSecNssKeyTransportGetCtx( transform ) ;
- xmlSecAssert( context != NULL ) ;
-
- if( context->pubkey != NULL ) {
- SECKEY_DestroyPublicKey( context->pubkey ) ;
- context->pubkey = NULL ;
- }
-
- if( context->prikey != NULL ) {
- SECKEY_DestroyPrivateKey( context->prikey ) ;
- context->prikey = NULL ;
- }
-
- if( context->material != NULL ) {
- xmlSecBufferDestroy(context->material);
- context->material = NULL ;
- }
+ context = xmlSecNssKeyTransportGetCtx( transform ) ;
+ xmlSecAssert( context != NULL ) ;
+
+ if( context->pubkey != NULL ) {
+ SECKEY_DestroyPublicKey( context->pubkey ) ;
+ context->pubkey = NULL ;
+ }
+
+ if( context->prikey != NULL ) {
+ SECKEY_DestroyPrivateKey( context->prikey ) ;
+ context->prikey = NULL ;
+ }
+
+ if( context->material != NULL ) {
+ xmlSecBufferDestroy(context->material);
+ context->material = NULL ;
+ }
}
static int
xmlSecNssKeyTransportSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr keyReq) {
- xmlSecNssKeyTransportCtxPtr context ;
+ xmlSecNssKeyTransportCtxPtr context ;
xmlSecAssert2(xmlSecNssKeyTransportCheckId(transform), -1);
xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssKeyTransportSize), -1);
xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
xmlSecAssert2(keyReq != NULL, -1);
- context = xmlSecNssKeyTransportGetCtx( transform ) ;
- xmlSecAssert2( context != NULL , -1 ) ;
+ context = xmlSecNssKeyTransportGetCtx( transform ) ;
+ xmlSecAssert2( context != NULL , -1 ) ;
- keyReq->keyId = context->keyId;
+ keyReq->keyId = context->keyId;
if(transform->operation == xmlSecTransformOperationEncrypt) {
- keyReq->keyUsage = xmlSecKeyUsageEncrypt;
- keyReq->keyType = xmlSecKeyDataTypePublic;
+ keyReq->keyUsage = xmlSecKeyUsageEncrypt;
+ keyReq->keyType = xmlSecKeyDataTypePublic;
} else {
- keyReq->keyUsage = xmlSecKeyUsageDecrypt;
- keyReq->keyType = xmlSecKeyDataTypePrivate;
+ keyReq->keyUsage = xmlSecKeyUsageDecrypt;
+ keyReq->keyType = xmlSecKeyDataTypePrivate;
}
return(0);
}
-static int
+static int
xmlSecNssKeyTransportSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
- xmlSecNssKeyTransportCtxPtr context = NULL ;
- xmlSecKeyDataPtr keyData = NULL ;
- SECKEYPublicKey* pubkey = NULL ;
- SECKEYPrivateKey* prikey = NULL ;
+ xmlSecNssKeyTransportCtxPtr context = NULL ;
+ xmlSecKeyDataPtr keyData = NULL ;
+ SECKEYPublicKey* pubkey = NULL ;
+ SECKEYPrivateKey* prikey = NULL ;
xmlSecAssert2(xmlSecNssKeyTransportCheckId(transform), -1);
xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssKeyTransportSize), -1);
xmlSecAssert2((transform->operation == xmlSecTransformOperationEncrypt) || (transform->operation == xmlSecTransformOperationDecrypt), -1);
xmlSecAssert2(key != NULL, -1);
- context = xmlSecNssKeyTransportGetCtx( transform ) ;
- if( (context == NULL) || (context->keyId == NULL) || (context->pubkey != NULL) ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
- "xmlSecNssKeyTransportGetCtx" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1);
- }
- xmlSecAssert2( xmlSecKeyCheckId( key, context->keyId ), -1 ) ;
-
- keyData = xmlSecKeyGetValue( key ) ;
- if( keyData == NULL ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- xmlSecErrorsSafeString( xmlSecKeyGetName( key ) ) ,
- "xmlSecKeyGetValue" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1);
- }
+ context = xmlSecNssKeyTransportGetCtx( transform ) ;
+ if( (context == NULL) || (context->keyId == NULL) || (context->pubkey != NULL) ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
+ "xmlSecNssKeyTransportGetCtx" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1);
+ }
+ xmlSecAssert2( xmlSecKeyCheckId( key, context->keyId ), -1 ) ;
+
+ keyData = xmlSecKeyGetValue( key ) ;
+ if( keyData == NULL ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ xmlSecErrorsSafeString( xmlSecKeyGetName( key ) ) ,
+ "xmlSecKeyGetValue" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1);
+ }
if(transform->operation == xmlSecTransformOperationEncrypt) {
- if( ( pubkey = xmlSecNssPKIKeyDataGetPubKey( keyData ) ) == NULL ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- xmlSecErrorsSafeString( xmlSecKeyDataGetName( keyData ) ) ,
- "xmlSecNssPKIKeyDataGetPubKey" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1);
- }
-
- context->pubkey = pubkey ;
- } else {
- if( ( prikey = xmlSecNssPKIKeyDataGetPrivKey( keyData ) ) == NULL ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- xmlSecErrorsSafeString( xmlSecKeyDataGetName( keyData ) ) ,
- "xmlSecNssPKIKeyDataGetPrivKey" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1);
- }
-
- context->prikey = prikey ;
- }
-
- return(0) ;
+ if( ( pubkey = xmlSecNssPKIKeyDataGetPubKey( keyData ) ) == NULL ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ xmlSecErrorsSafeString( xmlSecKeyDataGetName( keyData ) ) ,
+ "xmlSecNssPKIKeyDataGetPubKey" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1);
+ }
+
+ context->pubkey = pubkey ;
+ } else {
+ if( ( prikey = xmlSecNssPKIKeyDataGetPrivKey( keyData ) ) == NULL ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ xmlSecErrorsSafeString( xmlSecKeyDataGetName( keyData ) ) ,
+ "xmlSecNssPKIKeyDataGetPrivKey" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1);
+ }
+
+ context->prikey = prikey ;
+ }
+
+ return(0) ;
}
/**
@@ -232,74 +232,74 @@ xmlSecNssKeyTransportSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
*/
static int
xmlSecNssKeyTransportCtxInit(
- xmlSecNssKeyTransportCtxPtr ctx ,
- xmlSecBufferPtr in ,
- xmlSecBufferPtr out ,
- int encrypt ,
- xmlSecTransformCtxPtr transformCtx
+ xmlSecNssKeyTransportCtxPtr ctx ,
+ xmlSecBufferPtr in ,
+ xmlSecBufferPtr out ,
+ int encrypt ,
+ xmlSecTransformCtxPtr transformCtx
) {
- int blockSize ;
-
- xmlSecAssert2( ctx != NULL , -1 ) ;
- xmlSecAssert2( ctx->cipher != CKM_INVALID_MECHANISM , -1 ) ;
- xmlSecAssert2( ( ctx->pubkey != NULL && encrypt ) || ( ctx->prikey != NULL && !encrypt ), -1 ) ;
- xmlSecAssert2( ctx->keyId != NULL , -1 ) ;
- xmlSecAssert2( in != NULL , -1 ) ;
- xmlSecAssert2( out != NULL , -1 ) ;
- xmlSecAssert2( transformCtx != NULL , -1 ) ;
-
- if( ctx->material != NULL ) {
- xmlSecBufferDestroy( ctx->material ) ;
- ctx->material = NULL ;
- }
-
- if( ctx->pubkey != NULL ) {
- blockSize = SECKEY_PublicKeyStrength( ctx->pubkey ) ;
- } else if( ctx->prikey != NULL ) {
- blockSize = PK11_SignatureLen( ctx->prikey ) ;
- } else {
- blockSize = -1 ;
- }
-
- if( blockSize < 0 ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- NULL ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1);
- }
-
- ctx->material = xmlSecBufferCreate( blockSize ) ;
- if( ctx->material == NULL ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "xmlSecBufferCreate" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1);
- }
-
- /* read raw key material into context */
- if( xmlSecBufferSetData( ctx->material, xmlSecBufferGetData(in), xmlSecBufferGetSize(in) ) < 0 ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "xmlSecBufferSetData" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1);
- }
-
- if( xmlSecBufferRemoveHead( in , xmlSecBufferGetSize(in) ) < 0 ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "xmlSecBufferRemoveHead" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1);
- }
-
- return(0);
+ int blockSize ;
+
+ xmlSecAssert2( ctx != NULL , -1 ) ;
+ xmlSecAssert2( ctx->cipher != CKM_INVALID_MECHANISM , -1 ) ;
+ xmlSecAssert2( ( ctx->pubkey != NULL && encrypt ) || ( ctx->prikey != NULL && !encrypt ), -1 ) ;
+ xmlSecAssert2( ctx->keyId != NULL , -1 ) ;
+ xmlSecAssert2( in != NULL , -1 ) ;
+ xmlSecAssert2( out != NULL , -1 ) ;
+ xmlSecAssert2( transformCtx != NULL , -1 ) ;
+
+ if( ctx->material != NULL ) {
+ xmlSecBufferDestroy( ctx->material ) ;
+ ctx->material = NULL ;
+ }
+
+ if( ctx->pubkey != NULL ) {
+ blockSize = SECKEY_PublicKeyStrength( ctx->pubkey ) ;
+ } else if( ctx->prikey != NULL ) {
+ blockSize = PK11_SignatureLen( ctx->prikey ) ;
+ } else {
+ blockSize = -1 ;
+ }
+
+ if( blockSize < 0 ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ NULL ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1);
+ }
+
+ ctx->material = xmlSecBufferCreate( blockSize ) ;
+ if( ctx->material == NULL ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "xmlSecBufferCreate" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1);
+ }
+
+ /* read raw key material into context */
+ if( xmlSecBufferSetData( ctx->material, xmlSecBufferGetData(in), xmlSecBufferGetSize(in) ) < 0 ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "xmlSecBufferSetData" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1);
+ }
+
+ if( xmlSecBufferRemoveHead( in , xmlSecBufferGetSize(in) ) < 0 ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "xmlSecBufferRemoveHead" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1);
+ }
+
+ return(0);
}
/**
@@ -307,41 +307,41 @@ xmlSecNssKeyTransportCtxInit(
*/
static int
xmlSecNssKeyTransportCtxUpdate(
- xmlSecNssKeyTransportCtxPtr ctx ,
- xmlSecBufferPtr in ,
- xmlSecBufferPtr out ,
- int encrypt ,
- xmlSecTransformCtxPtr transformCtx
+ xmlSecNssKeyTransportCtxPtr ctx ,
+ xmlSecBufferPtr in ,
+ xmlSecBufferPtr out ,
+ int encrypt ,
+ xmlSecTransformCtxPtr transformCtx
) {
- xmlSecAssert2( ctx != NULL , -1 ) ;
- xmlSecAssert2( ctx->cipher != CKM_INVALID_MECHANISM , -1 ) ;
- xmlSecAssert2( ( ctx->pubkey != NULL && encrypt ) || ( ctx->prikey != NULL && !encrypt ), -1 ) ;
- xmlSecAssert2( ctx->keyId != NULL , -1 ) ;
- xmlSecAssert2( ctx->material != NULL , -1 ) ;
- xmlSecAssert2( in != NULL , -1 ) ;
- xmlSecAssert2( out != NULL , -1 ) ;
- xmlSecAssert2( transformCtx != NULL , -1 ) ;
-
- /* read raw key material and append into context */
- if( xmlSecBufferAppend( ctx->material, xmlSecBufferGetData(in), xmlSecBufferGetSize(in) ) < 0 ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "xmlSecBufferAppend" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1);
- }
-
- if( xmlSecBufferRemoveHead( in , xmlSecBufferGetSize(in) ) < 0 ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "xmlSecBufferRemoveHead" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1);
- }
-
- return(0);
+ xmlSecAssert2( ctx != NULL , -1 ) ;
+ xmlSecAssert2( ctx->cipher != CKM_INVALID_MECHANISM , -1 ) ;
+ xmlSecAssert2( ( ctx->pubkey != NULL && encrypt ) || ( ctx->prikey != NULL && !encrypt ), -1 ) ;
+ xmlSecAssert2( ctx->keyId != NULL , -1 ) ;
+ xmlSecAssert2( ctx->material != NULL , -1 ) ;
+ xmlSecAssert2( in != NULL , -1 ) ;
+ xmlSecAssert2( out != NULL , -1 ) ;
+ xmlSecAssert2( transformCtx != NULL , -1 ) ;
+
+ /* read raw key material and append into context */
+ if( xmlSecBufferAppend( ctx->material, xmlSecBufferGetData(in), xmlSecBufferGetSize(in) ) < 0 ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "xmlSecBufferAppend" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1);
+ }
+
+ if( xmlSecBufferRemoveHead( in , xmlSecBufferGetSize(in) ) < 0 ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "xmlSecBufferRemoveHead" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1);
+ }
+
+ return(0);
}
/**
@@ -350,308 +350,308 @@ xmlSecNssKeyTransportCtxUpdate(
static int
xmlSecNssKeyTransportCtxFinal(xmlSecNssKeyTransportCtxPtr ctx, xmlSecBufferPtr in, xmlSecBufferPtr out,
int encrypt, xmlSecTransformCtxPtr transformCtx) {
- PK11SymKey* symKey ;
- PK11SlotInfo* slot ;
- SECItem oriskv ;
- int blockSize ;
- xmlSecBufferPtr result ;
-
- xmlSecAssert2( ctx != NULL , -1 ) ;
- xmlSecAssert2( ctx->cipher != CKM_INVALID_MECHANISM , -1 ) ;
- xmlSecAssert2( ( ctx->pubkey != NULL && encrypt ) || ( ctx->prikey != NULL && !encrypt ), -1 ) ;
- xmlSecAssert2( ctx->keyId != NULL , -1 ) ;
- xmlSecAssert2( ctx->material != NULL , -1 ) ;
- xmlSecAssert2( in != NULL , -1 ) ;
- xmlSecAssert2( out != NULL , -1 ) ;
- xmlSecAssert2( transformCtx != NULL , -1 ) ;
-
- /* read raw key material and append into context */
- if( xmlSecBufferAppend( ctx->material, xmlSecBufferGetData(in), xmlSecBufferGetSize(in) ) < 0 ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "xmlSecBufferAppend" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1);
- }
-
- if( xmlSecBufferRemoveHead( in , xmlSecBufferGetSize(in) ) < 0 ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "xmlSecBufferRemoveHead" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1);
- }
-
- /* Now we get all of the key materail */
- /* from now on we will wrap or unwrap the key */
- if( ctx->pubkey != NULL ) {
- blockSize = SECKEY_PublicKeyStrength( ctx->pubkey ) ;
- } else if( ctx->prikey != NULL ) {
- blockSize = PK11_SignatureLen( ctx->prikey ) ;
- } else {
- blockSize = -1 ;
- }
-
- if( blockSize < 0 ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "PK11_GetBlockSize" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1);
- }
-
- result = xmlSecBufferCreate( blockSize * 2 ) ;
- if( result == NULL ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL,
- "xmlSecBufferCreate" ,
- XMLSEC_ERRORS_R_XMLSEC_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE) ;
- return(-1);
- }
-
- oriskv.type = siBuffer ;
- oriskv.data = xmlSecBufferGetData( ctx->material ) ;
- oriskv.len = xmlSecBufferGetSize( ctx->material ) ;
-
- if( encrypt != 0 ) {
- CK_OBJECT_HANDLE id ;
- SECItem wrpskv ;
-
- /* Create template symmetric key from material */
+ PK11SymKey* symKey ;
+ PK11SlotInfo* slot ;
+ SECItem oriskv ;
+ int blockSize ;
+ xmlSecBufferPtr result ;
+
+ xmlSecAssert2( ctx != NULL , -1 ) ;
+ xmlSecAssert2( ctx->cipher != CKM_INVALID_MECHANISM , -1 ) ;
+ xmlSecAssert2( ( ctx->pubkey != NULL && encrypt ) || ( ctx->prikey != NULL && !encrypt ), -1 ) ;
+ xmlSecAssert2( ctx->keyId != NULL , -1 ) ;
+ xmlSecAssert2( ctx->material != NULL , -1 ) ;
+ xmlSecAssert2( in != NULL , -1 ) ;
+ xmlSecAssert2( out != NULL , -1 ) ;
+ xmlSecAssert2( transformCtx != NULL , -1 ) ;
+
+ /* read raw key material and append into context */
+ if( xmlSecBufferAppend( ctx->material, xmlSecBufferGetData(in), xmlSecBufferGetSize(in) ) < 0 ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "xmlSecBufferAppend" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1);
+ }
+
+ if( xmlSecBufferRemoveHead( in , xmlSecBufferGetSize(in) ) < 0 ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "xmlSecBufferRemoveHead" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1);
+ }
+
+ /* Now we get all of the key materail */
+ /* from now on we will wrap or unwrap the key */
+ if( ctx->pubkey != NULL ) {
+ blockSize = SECKEY_PublicKeyStrength( ctx->pubkey ) ;
+ } else if( ctx->prikey != NULL ) {
+ blockSize = PK11_SignatureLen( ctx->prikey ) ;
+ } else {
+ blockSize = -1 ;
+ }
+
+ if( blockSize < 0 ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "PK11_GetBlockSize" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1);
+ }
+
+ result = xmlSecBufferCreate( blockSize * 2 ) ;
+ if( result == NULL ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL,
+ "xmlSecBufferCreate" ,
+ XMLSEC_ERRORS_R_XMLSEC_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE) ;
+ return(-1);
+ }
+
+ oriskv.type = siBuffer ;
+ oriskv.data = xmlSecBufferGetData( ctx->material ) ;
+ oriskv.len = xmlSecBufferGetSize( ctx->material ) ;
+
+ if( encrypt != 0 ) {
+ CK_OBJECT_HANDLE id ;
+ SECItem wrpskv ;
+
+ /* Create template symmetric key from material */
slot = ctx->pubkey->pkcs11Slot;
- if( slot == NULL ) {
- slot = PK11_GetBestSlot( ctx->cipher, NULL ) ;
- if( slot == NULL ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "xmlSecNssSlotGet" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- xmlSecBufferDestroy(result);
- return(-1);
- }
-
- id = PK11_ImportPublicKey( slot, ctx->pubkey, PR_FALSE ) ;
- if( id == CK_INVALID_HANDLE ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "PK11_ImportPublicKey" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- xmlSecBufferDestroy(result);
- PK11_FreeSlot( slot ) ;
- return(-1);
- }
- }
-
- /* pay attention to mechanism */
- symKey = PK11_ImportSymKey( slot, ctx->cipher, PK11_OriginUnwrap, CKA_WRAP, &oriskv, NULL ) ;
- if( symKey == NULL ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "PK11_ImportSymKey" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- xmlSecBufferDestroy(result);
- PK11_FreeSlot( slot ) ;
- return(-1);
- }
-
- wrpskv.type = siBuffer ;
- wrpskv.data = xmlSecBufferGetData( result ) ;
- wrpskv.len = xmlSecBufferGetMaxSize( result ) ;
-
- if( PK11_PubWrapSymKey( ctx->cipher, ctx->pubkey, symKey, &wrpskv ) != SECSuccess ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "PK11_PubWrapSymKey" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- PK11_FreeSymKey( symKey ) ;
- xmlSecBufferDestroy(result);
- PK11_FreeSlot( slot ) ;
- return(-1);
- }
-
- if( xmlSecBufferSetSize( result , wrpskv.len ) < 0 ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "xmlSecBufferSetSize" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- PK11_FreeSymKey( symKey ) ;
- xmlSecBufferDestroy(result);
- PK11_FreeSlot( slot ) ;
- return(-1);
- }
- PK11_FreeSymKey( symKey ) ;
- PK11_FreeSlot( slot ) ;
- } else {
- SECItem* keyItem ;
-
- /* pay attention to mechanism */
+ if( slot == NULL ) {
+ slot = PK11_GetBestSlot( ctx->cipher, NULL ) ;
+ if( slot == NULL ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "xmlSecNssSlotGet" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ xmlSecBufferDestroy(result);
+ return(-1);
+ }
+
+ id = PK11_ImportPublicKey( slot, ctx->pubkey, PR_FALSE ) ;
+ if( id == CK_INVALID_HANDLE ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "PK11_ImportPublicKey" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ xmlSecBufferDestroy(result);
+ PK11_FreeSlot( slot ) ;
+ return(-1);
+ }
+ }
+
+ /* pay attention to mechanism */
+ symKey = PK11_ImportSymKey( slot, ctx->cipher, PK11_OriginUnwrap, CKA_WRAP, &oriskv, NULL ) ;
+ if( symKey == NULL ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "PK11_ImportSymKey" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ xmlSecBufferDestroy(result);
+ PK11_FreeSlot( slot ) ;
+ return(-1);
+ }
+
+ wrpskv.type = siBuffer ;
+ wrpskv.data = xmlSecBufferGetData( result ) ;
+ wrpskv.len = xmlSecBufferGetMaxSize( result ) ;
+
+ if( PK11_PubWrapSymKey( ctx->cipher, ctx->pubkey, symKey, &wrpskv ) != SECSuccess ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "PK11_PubWrapSymKey" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ PK11_FreeSymKey( symKey ) ;
+ xmlSecBufferDestroy(result);
+ PK11_FreeSlot( slot ) ;
+ return(-1);
+ }
+
+ if( xmlSecBufferSetSize( result , wrpskv.len ) < 0 ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "xmlSecBufferSetSize" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ PK11_FreeSymKey( symKey ) ;
+ xmlSecBufferDestroy(result);
+ PK11_FreeSlot( slot ) ;
+ return(-1);
+ }
+ PK11_FreeSymKey( symKey ) ;
+ PK11_FreeSlot( slot ) ;
+ } else {
+ SECItem* keyItem ;
+
+ /* pay attention to mechanism */
symKey = PK11_PubUnwrapSymKey( ctx->prikey, &oriskv, ctx->cipher, CKA_UNWRAP, 0 );
- if( symKey == NULL ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "PK11_PubUnwrapSymKey" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- xmlSecBufferDestroy(result);
- return(-1);
- }
-
- /* Extract raw data from symmetric key */
- if( PK11_ExtractKeyValue( symKey ) != SECSuccess ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "PK11_ExtractKeyValue" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- PK11_FreeSymKey( symKey ) ;
- xmlSecBufferDestroy(result);
- return(-1);
- }
+ if( symKey == NULL ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "PK11_PubUnwrapSymKey" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ xmlSecBufferDestroy(result);
+ return(-1);
+ }
+
+ /* Extract raw data from symmetric key */
+ if( PK11_ExtractKeyValue( symKey ) != SECSuccess ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "PK11_ExtractKeyValue" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ PK11_FreeSymKey( symKey ) ;
+ xmlSecBufferDestroy(result);
+ return(-1);
+ }
keyItem = PK11_GetKeyData( symKey );
- if( keyItem == NULL ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "PK11_GetKeyData" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- PK11_FreeSymKey( symKey ) ;
- xmlSecBufferDestroy(result);
- return(-1);
- }
-
- if( xmlSecBufferSetData( result, keyItem->data, keyItem->len ) < 0 ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "PK11_PubUnwrapSymKey" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- PK11_FreeSymKey( symKey ) ;
- xmlSecBufferDestroy(result);
- return(-1);
- }
- PK11_FreeSymKey( symKey ) ;
- }
-
- /* Write output */
- if( xmlSecBufferAppend( out, xmlSecBufferGetData(result), xmlSecBufferGetSize(result) ) < 0 ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- "xmlSecBufferAppend" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- xmlSecBufferDestroy(result);
- return(-1);
- }
- xmlSecBufferDestroy(result);
-
- return(0);
+ if( keyItem == NULL ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "PK11_GetKeyData" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ PK11_FreeSymKey( symKey ) ;
+ xmlSecBufferDestroy(result);
+ return(-1);
+ }
+
+ if( xmlSecBufferSetData( result, keyItem->data, keyItem->len ) < 0 ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "PK11_PubUnwrapSymKey" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ PK11_FreeSymKey( symKey ) ;
+ xmlSecBufferDestroy(result);
+ return(-1);
+ }
+ PK11_FreeSymKey( symKey ) ;
+ }
+
+ /* Write output */
+ if( xmlSecBufferAppend( out, xmlSecBufferGetData(result), xmlSecBufferGetSize(result) ) < 0 ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ "xmlSecBufferAppend" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ xmlSecBufferDestroy(result);
+ return(-1);
+ }
+ xmlSecBufferDestroy(result);
+
+ return(0);
}
static int
xmlSecNssKeyTransportExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx) {
- xmlSecNssKeyTransportCtxPtr context = NULL ;
- xmlSecBufferPtr inBuf, outBuf ;
- int operation ;
- int rtv ;
+ xmlSecNssKeyTransportCtxPtr context = NULL ;
+ xmlSecBufferPtr inBuf, outBuf ;
+ int operation ;
+ int rtv ;
- xmlSecAssert2( xmlSecNssKeyTransportCheckId( transform ), -1 ) ;
- xmlSecAssert2( xmlSecTransformCheckSize( transform, xmlSecNssKeyTransportSize ), -1 ) ;
+ xmlSecAssert2( xmlSecNssKeyTransportCheckId( transform ), -1 ) ;
+ xmlSecAssert2( xmlSecTransformCheckSize( transform, xmlSecNssKeyTransportSize ), -1 ) ;
xmlSecAssert2( ( transform->operation == xmlSecTransformOperationEncrypt ) || ( transform->operation == xmlSecTransformOperationDecrypt ), -1 ) ;
- xmlSecAssert2( transformCtx != NULL , -1 ) ;
-
- context = xmlSecNssKeyTransportGetCtx( transform ) ;
- if( context == NULL ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
- "xmlSecNssKeyTransportGetCtx" ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1);
- }
-
- inBuf = &( transform->inBuf ) ;
- outBuf = &( transform->outBuf ) ;
-
- if( transform->status == xmlSecTransformStatusNone ) {
- transform->status = xmlSecTransformStatusWorking ;
- }
-
- operation = ( transform->operation == xmlSecTransformOperationEncrypt ) ? 1 : 0 ;
- if( transform->status == xmlSecTransformStatusWorking ) {
- if( context->material == NULL ) {
- rtv = xmlSecNssKeyTransportCtxInit( context, inBuf , outBuf , operation , transformCtx ) ;
- if( rtv < 0 ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
- "xmlSecNssKeyTransportCtxInit" ,
- XMLSEC_ERRORS_R_INVALID_STATUS ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1);
- }
- }
-
- if( (context->material == NULL) && (last != 0) ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
- NULL ,
- XMLSEC_ERRORS_R_INVALID_STATUS ,
- "No enough data to intialize transform" ) ;
- return(-1);
- }
-
- if( context->material != NULL ) {
- rtv = xmlSecNssKeyTransportCtxUpdate( context, inBuf , outBuf , operation , transformCtx ) ;
- if( rtv < 0 ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
- "xmlSecNssKeyTransportCtxUpdate" ,
- XMLSEC_ERRORS_R_INVALID_STATUS ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1);
- }
- }
-
- if( last ) {
- rtv = xmlSecNssKeyTransportCtxFinal( context, inBuf , outBuf , operation , transformCtx ) ;
- if( rtv < 0 ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
- "xmlSecNssKeyTransportCtxFinal" ,
- XMLSEC_ERRORS_R_INVALID_STATUS ,
- XMLSEC_ERRORS_NO_MESSAGE ) ;
- return(-1);
- }
- transform->status = xmlSecTransformStatusFinished ;
- }
- } else if( transform->status == xmlSecTransformStatusFinished ) {
- if( xmlSecBufferGetSize( inBuf ) != 0 ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
- NULL ,
- XMLSEC_ERRORS_R_INVALID_STATUS ,
- "status=%d", transform->status ) ;
- return(-1);
- }
- } else {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
- NULL ,
- XMLSEC_ERRORS_R_INVALID_STATUS ,
- "status=%d", transform->status ) ;
- return(-1);
- }
-
- return(0);
+ xmlSecAssert2( transformCtx != NULL , -1 ) ;
+
+ context = xmlSecNssKeyTransportGetCtx( transform ) ;
+ if( context == NULL ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
+ "xmlSecNssKeyTransportGetCtx" ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1);
+ }
+
+ inBuf = &( transform->inBuf ) ;
+ outBuf = &( transform->outBuf ) ;
+
+ if( transform->status == xmlSecTransformStatusNone ) {
+ transform->status = xmlSecTransformStatusWorking ;
+ }
+
+ operation = ( transform->operation == xmlSecTransformOperationEncrypt ) ? 1 : 0 ;
+ if( transform->status == xmlSecTransformStatusWorking ) {
+ if( context->material == NULL ) {
+ rtv = xmlSecNssKeyTransportCtxInit( context, inBuf , outBuf , operation , transformCtx ) ;
+ if( rtv < 0 ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
+ "xmlSecNssKeyTransportCtxInit" ,
+ XMLSEC_ERRORS_R_INVALID_STATUS ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1);
+ }
+ }
+
+ if( (context->material == NULL) && (last != 0) ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
+ NULL ,
+ XMLSEC_ERRORS_R_INVALID_STATUS ,
+ "No enough data to intialize transform" ) ;
+ return(-1);
+ }
+
+ if( context->material != NULL ) {
+ rtv = xmlSecNssKeyTransportCtxUpdate( context, inBuf , outBuf , operation , transformCtx ) ;
+ if( rtv < 0 ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
+ "xmlSecNssKeyTransportCtxUpdate" ,
+ XMLSEC_ERRORS_R_INVALID_STATUS ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1);
+ }
+ }
+
+ if( last ) {
+ rtv = xmlSecNssKeyTransportCtxFinal( context, inBuf , outBuf , operation , transformCtx ) ;
+ if( rtv < 0 ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
+ "xmlSecNssKeyTransportCtxFinal" ,
+ XMLSEC_ERRORS_R_INVALID_STATUS ,
+ XMLSEC_ERRORS_NO_MESSAGE ) ;
+ return(-1);
+ }
+ transform->status = xmlSecTransformStatusFinished ;
+ }
+ } else if( transform->status == xmlSecTransformStatusFinished ) {
+ if( xmlSecBufferGetSize( inBuf ) != 0 ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
+ NULL ,
+ XMLSEC_ERRORS_R_INVALID_STATUS ,
+ "status=%d", transform->status ) ;
+ return(-1);
+ }
+ } else {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ xmlSecErrorsSafeString( xmlSecTransformGetName( transform ) ) ,
+ NULL ,
+ XMLSEC_ERRORS_R_INVALID_STATUS ,
+ "status=%d", transform->status ) ;
+ return(-1);
+ }
+
+ return(0);
}
@@ -659,29 +659,29 @@ xmlSecNssKeyTransportExecute(xmlSecTransformPtr transform, int last, xmlSecTrans
static xmlSecTransformKlass xmlSecNssRsaPkcs1Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecNssKeyTransportSize, /* xmlSecSize objSize */
-
- xmlSecNameRsaPkcs1, /* const xmlChar* name; */
- xmlSecHrefRsaPkcs1, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecNssKeyTransportInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecNssKeyTransportFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecNssKeyTransportSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecNssKeyTransportSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecNssKeyTransportExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecNssKeyTransportSize, /* xmlSecSize objSize */
+
+ xmlSecNameRsaPkcs1, /* const xmlChar* name; */
+ xmlSecHrefRsaPkcs1, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecNssKeyTransportInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecNssKeyTransportFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecNssKeyTransportSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecNssKeyTransportSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecNssKeyTransportExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -702,29 +702,29 @@ xmlSecNssTransformRsaPkcs1GetKlass(void) {
static xmlSecTransformKlass xmlSecNssRsaOaepKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecNssKeyTransportSize, /* xmlSecSize objSize */
-
- xmlSecNameRsaOaep, /* const xmlChar* name; */
- xmlSecHrefRsaOaep, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecNssKeyTransportInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecNssKeyTransportFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecNssKeyTransportSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecNssKeyTransportSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecNssKeyTransportExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecNssKeyTransportSize, /* xmlSecSize objSize */
+
+ xmlSecNameRsaOaep, /* const xmlChar* name; */
+ xmlSecHrefRsaOaep, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecNssKeyTransportInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecNssKeyTransportFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecNssKeyTransportSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecNssKeyTransportSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecNssKeyTransportExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
diff --git a/src/nss/kw_aes.c b/src/nss/kw_aes.c
index 0c3a570..d8dd5f9 100644
--- a/src/nss/kw_aes.c
+++ b/src/nss/kw_aes.c
@@ -28,18 +28,18 @@
#include <xmlsec/nss/crypto.h>
-#define XMLSEC_NSS_AES128_KEY_SIZE 16
-#define XMLSEC_NSS_AES192_KEY_SIZE 24
-#define XMLSEC_NSS_AES256_KEY_SIZE 32
-#define XMLSEC_NSS_AES_IV_SIZE 16
-#define XMLSEC_NSS_AES_BLOCK_SIZE 16
+#define XMLSEC_NSS_AES128_KEY_SIZE 16
+#define XMLSEC_NSS_AES192_KEY_SIZE 24
+#define XMLSEC_NSS_AES256_KEY_SIZE 32
+#define XMLSEC_NSS_AES_IV_SIZE 16
+#define XMLSEC_NSS_AES_BLOCK_SIZE 16
#ifndef NSS_AES_KEYWRAP_BUG_FIXED
-static PK11SymKey* xmlSecNssMakeAesKey(const xmlSecByte *key,
- xmlSecSize keySize, int enc);
-static void xmlSecNssAesOp(PK11SymKey *aeskey,
- const xmlSecByte *in, xmlSecByte *out,
- int enc);
+static PK11SymKey* xmlSecNssMakeAesKey(const xmlSecByte *key,
+ xmlSecSize keySize, int enc);
+static void xmlSecNssAesOp(PK11SymKey *aeskey,
+ const xmlSecByte *in, xmlSecByte *out,
+ int enc);
#endif /* NSS_AES_KEYWRAP_BUG_FIXED */
/*********************************************************************
@@ -51,109 +51,109 @@ static void xmlSecNssAesOp(PK11SymKey *aeskey,
********************************************************************/
#define xmlSecNssKWAesGetKey(transform) \
((xmlSecBufferPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-#define xmlSecNssKWAesSize \
+#define xmlSecNssKWAesSize \
(sizeof(xmlSecTransform) + sizeof(xmlSecBuffer))
-static int xmlSecNssKWAesInitialize (xmlSecTransformPtr transform);
-static void xmlSecNssKWAesFinalize (xmlSecTransformPtr transform);
-static int xmlSecNssKWAesSetKeyReq (xmlSecTransformPtr transform,
- xmlSecKeyReqPtr keyReq);
-static int xmlSecNssKWAesSetKey (xmlSecTransformPtr transform,
- xmlSecKeyPtr key);
-static int xmlSecNssKWAesExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
-static xmlSecSize xmlSecNssKWAesGetKeySize (xmlSecTransformPtr transform);
-static int xmlSecNssKWAesOp (const xmlSecByte *key,
- xmlSecSize keySize,
- const xmlSecByte* in,
- xmlSecSize inSize,
- xmlSecByte* out,
- xmlSecSize outSize,
- int enc);
+static int xmlSecNssKWAesInitialize (xmlSecTransformPtr transform);
+static void xmlSecNssKWAesFinalize (xmlSecTransformPtr transform);
+static int xmlSecNssKWAesSetKeyReq (xmlSecTransformPtr transform,
+ xmlSecKeyReqPtr keyReq);
+static int xmlSecNssKWAesSetKey (xmlSecTransformPtr transform,
+ xmlSecKeyPtr key);
+static int xmlSecNssKWAesExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
+static xmlSecSize xmlSecNssKWAesGetKeySize (xmlSecTransformPtr transform);
+static int xmlSecNssKWAesOp (const xmlSecByte *key,
+ xmlSecSize keySize,
+ const xmlSecByte* in,
+ xmlSecSize inSize,
+ xmlSecByte* out,
+ xmlSecSize outSize,
+ int enc);
static xmlSecTransformKlass xmlSecNssKWAes128Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecNssKWAesSize, /* xmlSecSize objSize */
-
- xmlSecNameKWAes128, /* const xmlChar* name; */
- xmlSecHrefKWAes128, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecNssKWAesInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecNssKWAesFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecNssKWAesSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecNssKWAesSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecNssKWAesExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecNssKWAesSize, /* xmlSecSize objSize */
+
+ xmlSecNameKWAes128, /* const xmlChar* name; */
+ xmlSecHrefKWAes128, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecNssKWAesInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecNssKWAesFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecNssKWAesSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecNssKWAesSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecNssKWAesExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
static xmlSecTransformKlass xmlSecNssKWAes192Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecNssKWAesSize, /* xmlSecSize objSize */
-
- xmlSecNameKWAes192, /* const xmlChar* name; */
- xmlSecHrefKWAes192, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecNssKWAesInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecNssKWAesFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecNssKWAesSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecNssKWAesSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecNssKWAesExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecNssKWAesSize, /* xmlSecSize objSize */
+
+ xmlSecNameKWAes192, /* const xmlChar* name; */
+ xmlSecHrefKWAes192, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecNssKWAesInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecNssKWAesFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecNssKWAesSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecNssKWAesSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecNssKWAesExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
static xmlSecTransformKlass xmlSecNssKWAes256Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecNssKWAesSize, /* xmlSecSize objSize */
-
- xmlSecNameKWAes256, /* const xmlChar* name; */
- xmlSecHrefKWAes256, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecNssKWAesInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecNssKWAesFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecNssKWAesSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecNssKWAesSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecNssKWAesExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecNssKWAesSize, /* xmlSecSize objSize */
+
+ xmlSecNameKWAes256, /* const xmlChar* name; */
+ xmlSecHrefKWAes256, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecNssKWAesInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecNssKWAesFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecNssKWAesSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecNssKWAesSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecNssKWAesExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
-#define XMLSEC_NSS_KW_AES_MAGIC_BLOCK_SIZE 8
+#define XMLSEC_NSS_KW_AES_MAGIC_BLOCK_SIZE 8
#define xmlSecNssKWAesCheckId(transform) \
(xmlSecTransformCheckId((transform), xmlSecNssTransformKWAes128Id) || \
@@ -205,12 +205,12 @@ xmlSecNssKWAesInitialize(xmlSecTransformPtr transform) {
ret = xmlSecBufferInitialize(xmlSecNssKWAesGetKey(transform), 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -222,7 +222,7 @@ xmlSecNssKWAesFinalize(xmlSecTransformPtr transform) {
xmlSecAssert(xmlSecTransformCheckSize(transform, xmlSecNssKWAesSize));
if(xmlSecNssKWAesGetKey(transform) != NULL) {
- xmlSecBufferFinalize(xmlSecNssKWAesGetKey(transform));
+ xmlSecBufferFinalize(xmlSecNssKWAesGetKey(transform));
}
}
@@ -233,19 +233,19 @@ xmlSecNssKWAesSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr keyReq) {
xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssKWAesSize), -1);
xmlSecAssert2(keyReq != NULL, -1);
- keyReq->keyId = xmlSecNssKeyDataAesId;
+ keyReq->keyId = xmlSecNssKeyDataAesId;
keyReq->keyType = xmlSecKeyDataTypeSymmetric;
if(transform->operation == xmlSecTransformOperationEncrypt) {
- keyReq->keyUsage = xmlSecKeyUsageEncrypt;
+ keyReq->keyUsage = xmlSecKeyUsageEncrypt;
} else {
- keyReq->keyUsage = xmlSecKeyUsageDecrypt;
+ keyReq->keyUsage = xmlSecKeyUsageDecrypt;
}
keyReq->keyBitsSize = 8 * xmlSecNssKWAesGetKeySize(transform);
return(0);
}
-static int
+static int
xmlSecNssKWAesSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
xmlSecBufferPtr buffer;
xmlSecSize keySize;
@@ -265,25 +265,25 @@ xmlSecNssKWAesSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
keySize = xmlSecBufferGetSize(buffer);
expectedKeySize = xmlSecNssKWAesGetKeySize(transform);
if(keySize < expectedKeySize) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
- "key=%d;expected=%d",
- keySize, expectedKeySize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
+ "key=%d;expected=%d",
+ keySize, expectedKeySize);
+ return(-1);
}
ret = xmlSecBufferSetData(xmlSecNssKWAesGetKey(transform),
- xmlSecBufferGetData(buffer),
- expectedKeySize);
+ xmlSecBufferGetData(buffer),
+ expectedKeySize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "expected-size=%d", expectedKeySize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "expected-size=%d", expectedKeySize);
+ return(-1);
}
return(0);
@@ -314,98 +314,98 @@ xmlSecNssKWAesExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtx
xmlSecAssert2(outSize == 0, -1);
if(transform->status == xmlSecTransformStatusNone) {
- transform->status = xmlSecTransformStatusWorking;
+ transform->status = xmlSecTransformStatusWorking;
}
if((transform->status == xmlSecTransformStatusWorking) && (last == 0)) {
- /* just do nothing */
+ /* just do nothing */
} else if((transform->status == xmlSecTransformStatusWorking) && (last != 0)) {
- if((inSize % 8) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "size=%d(not 8 bytes aligned)", inSize);
- return(-1);
- }
-
- if(transform->operation == xmlSecTransformOperationEncrypt) {
- /* the encoded key might be 8 bytes longer plus 8 bytes just in case */
- outSize = inSize + XMLSEC_NSS_KW_AES_MAGIC_BLOCK_SIZE +
- XMLSEC_NSS_AES_BLOCK_SIZE;
- } else {
- outSize = inSize + XMLSEC_NSS_AES_BLOCK_SIZE;
- }
-
- ret = xmlSecBufferSetMaxSize(out, outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "outSize=%d", outSize);
- return(-1);
- }
-
- if(transform->operation == xmlSecTransformOperationEncrypt) {
- ret = xmlSecNssKWAesOp(xmlSecBufferGetData(key), keySize,
- xmlSecBufferGetData(in), inSize,
- xmlSecBufferGetData(out), outSize, 1);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecNssKWAesOp",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- outSize = ret;
- } else {
- ret = xmlSecNssKWAesOp(xmlSecBufferGetData(key), keySize,
- xmlSecBufferGetData(in), inSize,
- xmlSecBufferGetData(out), outSize, 0);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecNssKWAesOp",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- outSize = ret;
- }
-
- ret = xmlSecBufferSetSize(out, outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "outSize=%d", outSize);
- return(-1);
- }
-
- ret = xmlSecBufferRemoveHead(in, inSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "inSize%d", inSize);
- return(-1);
- }
-
- transform->status = xmlSecTransformStatusFinished;
+ if((inSize % 8) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "size=%d(not 8 bytes aligned)", inSize);
+ return(-1);
+ }
+
+ if(transform->operation == xmlSecTransformOperationEncrypt) {
+ /* the encoded key might be 8 bytes longer plus 8 bytes just in case */
+ outSize = inSize + XMLSEC_NSS_KW_AES_MAGIC_BLOCK_SIZE +
+ XMLSEC_NSS_AES_BLOCK_SIZE;
+ } else {
+ outSize = inSize + XMLSEC_NSS_AES_BLOCK_SIZE;
+ }
+
+ ret = xmlSecBufferSetMaxSize(out, outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "outSize=%d", outSize);
+ return(-1);
+ }
+
+ if(transform->operation == xmlSecTransformOperationEncrypt) {
+ ret = xmlSecNssKWAesOp(xmlSecBufferGetData(key), keySize,
+ xmlSecBufferGetData(in), inSize,
+ xmlSecBufferGetData(out), outSize, 1);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecNssKWAesOp",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ outSize = ret;
+ } else {
+ ret = xmlSecNssKWAesOp(xmlSecBufferGetData(key), keySize,
+ xmlSecBufferGetData(in), inSize,
+ xmlSecBufferGetData(out), outSize, 0);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecNssKWAesOp",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ outSize = ret;
+ }
+
+ ret = xmlSecBufferSetSize(out, outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "outSize=%d", outSize);
+ return(-1);
+ }
+
+ ret = xmlSecBufferRemoveHead(in, inSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "inSize%d", inSize);
+ return(-1);
+ }
+
+ transform->status = xmlSecTransformStatusFinished;
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
}
@@ -413,11 +413,11 @@ xmlSecNssKWAesExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtx
static xmlSecSize
xmlSecNssKWAesGetKeySize(xmlSecTransformPtr transform) {
if(xmlSecTransformCheckId(transform, xmlSecNssTransformKWAes128Id)) {
- return(XMLSEC_NSS_AES128_KEY_SIZE);
+ return(XMLSEC_NSS_AES128_KEY_SIZE);
} else if(xmlSecTransformCheckId(transform, xmlSecNssTransformKWAes192Id)) {
- return(XMLSEC_NSS_AES192_KEY_SIZE);
+ return(XMLSEC_NSS_AES192_KEY_SIZE);
} else if(xmlSecTransformCheckId(transform, xmlSecNssTransformKWAes256Id)) {
- return(XMLSEC_NSS_AES256_KEY_SIZE);
+ return(XMLSEC_NSS_AES256_KEY_SIZE);
}
return(0);
}
@@ -496,11 +496,11 @@ xmlSecNssKWAesGetKeySize(xmlSecTransformPtr transform) {
static const xmlSecByte xmlSecNssKWAesMagicBlock[XMLSEC_NSS_KW_AES_MAGIC_BLOCK_SIZE] = {
0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6
};
-
-static int
+
+static int
xmlSecNssKWAesOp(const xmlSecByte *key, xmlSecSize keySize,
- const xmlSecByte *in, xmlSecSize inSize,
- xmlSecByte *out, xmlSecSize outSize, int enc) {
+ const xmlSecByte *in, xmlSecSize inSize,
+ xmlSecByte *out, xmlSecSize outSize, int enc) {
xmlSecByte block[XMLSEC_NSS_AES_BLOCK_SIZE];
xmlSecByte *p;
int N, i, j, t;
@@ -517,12 +517,12 @@ xmlSecNssKWAesOp(const xmlSecByte *key, xmlSecSize keySize,
if (enc == 1) {
aeskey = xmlSecNssMakeAesKey(key, keySize, enc);
if(aeskey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssMakeAesKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssMakeAesKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
/* prepend magic block */
@@ -537,32 +537,32 @@ xmlSecNssKWAesOp(const xmlSecByte *key, xmlSecSize keySize,
if(N == 1) {
xmlSecNssAesOp(aeskey, out, out, enc);
} else {
- for(j = 0; j <= 5; ++j) {
- for(i = 1; i <= N; ++i) {
- t = i + (j * N);
- p = out + i * 8;
+ for(j = 0; j <= 5; ++j) {
+ for(i = 1; i <= N; ++i) {
+ t = i + (j * N);
+ p = out + i * 8;
- memcpy(block, out, 8);
- memcpy(block + 8, p, 8);
-
+ memcpy(block, out, 8);
+ memcpy(block + 8, p, 8);
+
xmlSecNssAesOp(aeskey, block, block, enc);
- block[7] ^= t;
- memcpy(out, block, 8);
- memcpy(p, block + 8, 8);
- }
- }
+ block[7] ^= t;
+ memcpy(out, block, 8);
+ memcpy(p, block + 8, 8);
+ }
+ }
}
result = inSize + 8;
} else {
aeskey = xmlSecNssMakeAesKey(key, keySize, enc);
if(aeskey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssMakeAesKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssMakeAesKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
/* copy input */
@@ -574,40 +574,40 @@ xmlSecNssKWAesOp(const xmlSecByte *key, xmlSecSize keySize,
if(N == 1) {
xmlSecNssAesOp(aeskey, out, out, enc);
} else {
- for(j = 5; j >= 0; --j) {
- for(i = N; i > 0; --i) {
- t = i + (j * N);
- p = out + i * 8;
+ for(j = 5; j >= 0; --j) {
+ for(i = N; i > 0; --i) {
+ t = i + (j * N);
+ p = out + i * 8;
- memcpy(block, out, 8);
- memcpy(block + 8, p, 8);
- block[7] ^= t;
-
+ memcpy(block, out, 8);
+ memcpy(block + 8, p, 8);
+ block[7] ^= t;
+
xmlSecNssAesOp(aeskey, block, block, enc);
- memcpy(out, block, 8);
- memcpy(p, block + 8, 8);
- }
- }
+ memcpy(out, block, 8);
+ memcpy(p, block + 8, 8);
+ }
+ }
}
/* do not left data in memory */
memset(block, 0, sizeof(block));
if(memcmp(xmlSecNssKWAesMagicBlock, out, XMLSEC_NSS_KW_AES_MAGIC_BLOCK_SIZE) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "bad magic block");
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "bad magic block");
+ goto done;
}
-
+
memmove(out, out + XMLSEC_NSS_KW_AES_MAGIC_BLOCK_SIZE, inSize - XMLSEC_NSS_KW_AES_MAGIC_BLOCK_SIZE);
result = (inSize - XMLSEC_NSS_KW_AES_MAGIC_BLOCK_SIZE);
}
done:
if (aeskey != NULL) {
- PK11_FreeSymKey(aeskey);
+ PK11_FreeSymKey(aeskey);
}
return (result);
@@ -626,30 +626,30 @@ xmlSecNssMakeAesKey(const xmlSecByte *key, xmlSecSize keySize, int enc) {
cipherMech = CKM_AES_ECB;
slot = PK11_GetBestSlot(cipherMech, NULL);
if (slot == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_GetBestSlot",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_GetBestSlot",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
keyItem.data = (unsigned char *)key;
keyItem.len = keySize;
aeskey = PK11_ImportSymKey(slot, cipherMech, PK11_OriginUnwrap,
- enc ? CKA_ENCRYPT : CKA_DECRYPT, &keyItem, NULL);
+ enc ? CKA_ENCRYPT : CKA_DECRYPT, &keyItem, NULL);
if (aeskey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_ImportSymKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_ImportSymKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
done:
if (slot) {
- PK11_FreeSlot(slot);
+ PK11_FreeSlot(slot);
}
return(aeskey);
@@ -658,7 +658,7 @@ done:
/* encrypt a block (XMLSEC_NSS_AES_BLOCK_SIZE), in and out can overlap */
static void
xmlSecNssAesOp(PK11SymKey *aeskey, const xmlSecByte *in, xmlSecByte *out,
- int enc) {
+ int enc) {
CK_MECHANISM_TYPE cipherMech;
SECItem* SecParam = NULL;
@@ -673,56 +673,56 @@ xmlSecNssAesOp(PK11SymKey *aeskey, const xmlSecByte *in, xmlSecByte *out,
cipherMech = CKM_AES_ECB;
SecParam = PK11_ParamFromIV(cipherMech, NULL);
if (SecParam == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_ParamFromIV",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_ParamFromIV",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
EncContext = PK11_CreateContextBySymKey(cipherMech,
- enc ? CKA_ENCRYPT : CKA_DECRYPT,
- aeskey, SecParam);
+ enc ? CKA_ENCRYPT : CKA_DECRYPT,
+ aeskey, SecParam);
if (EncContext == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_CreateContextBySymKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_CreateContextBySymKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
tmp1_outlen = tmp2_outlen = 0;
rv = PK11_CipherOp(EncContext, out, &tmp1_outlen,
- XMLSEC_NSS_AES_BLOCK_SIZE, (unsigned char *)in,
- XMLSEC_NSS_AES_BLOCK_SIZE);
+ XMLSEC_NSS_AES_BLOCK_SIZE, (unsigned char *)in,
+ XMLSEC_NSS_AES_BLOCK_SIZE);
if (rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_CipherOp",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_CipherOp",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
rv = PK11_DigestFinal(EncContext, out+tmp1_outlen,
- &tmp2_outlen, XMLSEC_NSS_AES_BLOCK_SIZE-tmp1_outlen);
+ &tmp2_outlen, XMLSEC_NSS_AES_BLOCK_SIZE-tmp1_outlen);
if (rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_DigestFinal",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_DigestFinal",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
done:
if (SecParam) {
- SECITEM_FreeItem(SecParam, PR_TRUE);
+ SECITEM_FreeItem(SecParam, PR_TRUE);
}
if (EncContext) {
- PK11_DestroyContext(EncContext, PR_TRUE);
+ PK11_DestroyContext(EncContext, PR_TRUE);
}
}
@@ -742,10 +742,10 @@ done:
* http://www.w3.org/TR/xmlenc-core/#sec-Alg-SymmetricKeyWrap
*/
-static int
+static int
xmlSecNssKWAesOp(const xmlSecByte *key, xmlSecSize keySize,
- const xmlSecByte *in, xmlSecSize inSize,
- xmlSecByte *out, xmlSecSize outSize, int enc) {
+ const xmlSecByte *in, xmlSecSize inSize,
+ xmlSecByte *out, xmlSecSize outSize, int enc) {
CK_MECHANISM_TYPE cipherMech;
PK11SlotInfo* slot = NULL;
@@ -768,86 +768,86 @@ xmlSecNssKWAesOp(const xmlSecByte *key, xmlSecSize keySize,
cipherMech = CKM_NETSCAPE_AES_KEY_WRAP;
slot = PK11_GetBestSlot(cipherMech, NULL);
if (slot == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_GetBestSlot",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_GetBestSlot",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
keyItem.data = (unsigned char *)key;
keyItem.len = keySize;
aeskey = PK11_ImportSymKey(slot, cipherMech, PK11_OriginUnwrap,
- enc ? CKA_ENCRYPT : CKA_DECRYPT, &keyItem, NULL);
+ enc ? CKA_ENCRYPT : CKA_DECRYPT, &keyItem, NULL);
if (aeskey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_ImportSymKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_ImportSymKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
SecParam = PK11_ParamFromIV(cipherMech, NULL);
if (SecParam == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_ParamFromIV",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_ParamFromIV",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
EncContext = PK11_CreateContextBySymKey(cipherMech,
- enc ? CKA_ENCRYPT : CKA_DECRYPT,
- aeskey, SecParam);
+ enc ? CKA_ENCRYPT : CKA_DECRYPT,
+ aeskey, SecParam);
if (EncContext == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_CreateContextBySymKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_CreateContextBySymKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
tmp1_outlen = tmp2_outlen = 0;
rv = PK11_CipherOp(EncContext, out, &tmp1_outlen, outSize,
- (unsigned char *)in, inSize);
+ (unsigned char *)in, inSize);
if (rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_CipherOp",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_CipherOp",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
rv = PK11_DigestFinal(EncContext, out+tmp1_outlen,
- &tmp2_outlen, outSize-tmp1_outlen);
+ &tmp2_outlen, outSize-tmp1_outlen);
if (rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_DigestFinal",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_DigestFinal",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
result_len = tmp1_outlen + tmp2_outlen;
done:
if (slot) {
- PK11_FreeSlot(slot);
+ PK11_FreeSlot(slot);
}
if (aeskey) {
- PK11_FreeSymKey(aeskey);
+ PK11_FreeSymKey(aeskey);
}
if (SecParam) {
- SECITEM_FreeItem(SecParam, PR_TRUE);
+ SECITEM_FreeItem(SecParam, PR_TRUE);
}
if (EncContext) {
- PK11_DestroyContext(EncContext, PR_TRUE);
+ PK11_DestroyContext(EncContext, PR_TRUE);
}
return(result_len);
diff --git a/src/nss/kw_des.c b/src/nss/kw_des.c
index 0cb6f24..c738c04 100644
--- a/src/nss/kw_des.c
+++ b/src/nss/kw_des.c
@@ -34,9 +34,9 @@
#define XMLSEC_NSS_DES3_BLOCK_LENGTH 8
static xmlSecByte *xmlSecNssComputeSHA1(const xmlSecByte *in,
- xmlSecSize inSize,
- xmlSecByte *out,
- xmlSecSize outSize);
+ xmlSecSize inSize,
+ xmlSecByte *out,
+ xmlSecSize outSize);
/*********************************************************************
@@ -48,67 +48,67 @@ static xmlSecByte *xmlSecNssComputeSHA1(const xmlSecByte *in,
********************************************************************/
#define xmlSecNssKWDes3GetKey(transform) \
((xmlSecBufferPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-#define xmlSecNssKWDes3Size \
+#define xmlSecNssKWDes3Size \
(sizeof(xmlSecTransform) + sizeof(xmlSecBuffer))
-static int xmlSecNssKWDes3Initialize (xmlSecTransformPtr transform);
-static void xmlSecNssKWDes3Finalize (xmlSecTransformPtr transform);
-static int xmlSecNssKWDes3SetKeyReq (xmlSecTransformPtr transform,
- xmlSecKeyReqPtr keyReq);
-static int xmlSecNssKWDes3SetKey (xmlSecTransformPtr transform,
- xmlSecKeyPtr key);
-static int xmlSecNssKWDes3Execute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecNssKWDes3Encode (const xmlSecByte *key,
- xmlSecSize keySize,
- const xmlSecByte *in,
- xmlSecSize inSize,
- xmlSecByte *out,
- xmlSecSize outSize);
-static int xmlSecNssKWDes3Decode (const xmlSecByte *key,
- xmlSecSize keySize,
- const xmlSecByte *in,
- xmlSecSize inSize,
- xmlSecByte *out,
- xmlSecSize outSize);
-static int xmlSecNssKWDes3Encrypt (const xmlSecByte *key,
- xmlSecSize keySize,
- const xmlSecByte *iv,
- xmlSecSize ivSize,
- const xmlSecByte *in,
- xmlSecSize inSize,
- xmlSecByte *out,
- xmlSecSize outSize,
- int enc);
-static int xmlSecNssKWDes3BufferReverse (xmlSecByte *buf,
- xmlSecSize size);
+static int xmlSecNssKWDes3Initialize (xmlSecTransformPtr transform);
+static void xmlSecNssKWDes3Finalize (xmlSecTransformPtr transform);
+static int xmlSecNssKWDes3SetKeyReq (xmlSecTransformPtr transform,
+ xmlSecKeyReqPtr keyReq);
+static int xmlSecNssKWDes3SetKey (xmlSecTransformPtr transform,
+ xmlSecKeyPtr key);
+static int xmlSecNssKWDes3Execute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecNssKWDes3Encode (const xmlSecByte *key,
+ xmlSecSize keySize,
+ const xmlSecByte *in,
+ xmlSecSize inSize,
+ xmlSecByte *out,
+ xmlSecSize outSize);
+static int xmlSecNssKWDes3Decode (const xmlSecByte *key,
+ xmlSecSize keySize,
+ const xmlSecByte *in,
+ xmlSecSize inSize,
+ xmlSecByte *out,
+ xmlSecSize outSize);
+static int xmlSecNssKWDes3Encrypt (const xmlSecByte *key,
+ xmlSecSize keySize,
+ const xmlSecByte *iv,
+ xmlSecSize ivSize,
+ const xmlSecByte *in,
+ xmlSecSize inSize,
+ xmlSecByte *out,
+ xmlSecSize outSize,
+ int enc);
+static int xmlSecNssKWDes3BufferReverse (xmlSecByte *buf,
+ xmlSecSize size);
static xmlSecTransformKlass xmlSecNssKWDes3Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecNssKWDes3Size, /* xmlSecSize objSize */
-
- xmlSecNameKWDes3, /* const xmlChar* name; */
- xmlSecHrefKWDes3, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecNssKWDes3Initialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecNssKWDes3Finalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecNssKWDes3SetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecNssKWDes3SetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecNssKWDes3Execute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecNssKWDes3Size, /* xmlSecSize objSize */
+
+ xmlSecNameKWDes3, /* const xmlChar* name; */
+ xmlSecHrefKWDes3, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecNssKWDes3Initialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecNssKWDes3Finalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecNssKWDes3SetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecNssKWDes3SetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecNssKWDes3Execute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -132,12 +132,12 @@ xmlSecNssKWDes3Initialize(xmlSecTransformPtr transform) {
ret = xmlSecBufferInitialize(xmlSecNssKWDes3GetKey(transform), 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -149,7 +149,7 @@ xmlSecNssKWDes3Finalize(xmlSecTransformPtr transform) {
xmlSecAssert(xmlSecTransformCheckSize(transform, xmlSecNssKWDes3Size));
if(xmlSecNssKWDes3GetKey(transform) != NULL) {
- xmlSecBufferFinalize(xmlSecNssKWDes3GetKey(transform));
+ xmlSecBufferFinalize(xmlSecNssKWDes3GetKey(transform));
}
}
@@ -160,18 +160,18 @@ xmlSecNssKWDes3SetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr keyReq)
xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecNssKWDes3Size), -1);
xmlSecAssert2(keyReq != NULL, -1);
- keyReq->keyId = xmlSecNssKeyDataDesId;
- keyReq->keyType = xmlSecKeyDataTypeSymmetric;
+ keyReq->keyId = xmlSecNssKeyDataDesId;
+ keyReq->keyType = xmlSecKeyDataTypeSymmetric;
if(transform->operation == xmlSecTransformOperationEncrypt) {
- keyReq->keyUsage= xmlSecKeyUsageEncrypt;
+ keyReq->keyUsage= xmlSecKeyUsageEncrypt;
} else {
- keyReq->keyUsage= xmlSecKeyUsageDecrypt;
+ keyReq->keyUsage= xmlSecKeyUsageDecrypt;
}
keyReq->keyBitsSize = 8 * XMLSEC_NSS_DES3_KEY_LENGTH;
return(0);
}
-static int
+static int
xmlSecNssKWDes3SetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
xmlSecBufferPtr buffer;
xmlSecSize keySize;
@@ -189,25 +189,25 @@ xmlSecNssKWDes3SetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
keySize = xmlSecBufferGetSize(buffer);
if(keySize < XMLSEC_NSS_DES3_KEY_LENGTH) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
- "key length %d is not enough (%d expected)",
- keySize, XMLSEC_NSS_DES3_KEY_LENGTH);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
+ "key length %d is not enough (%d expected)",
+ keySize, XMLSEC_NSS_DES3_KEY_LENGTH);
+ return(-1);
}
ret = xmlSecBufferSetData(xmlSecNssKWDes3GetKey(transform),
- xmlSecBufferGetData(buffer),
- XMLSEC_NSS_DES3_KEY_LENGTH);
+ xmlSecBufferGetData(buffer),
+ XMLSEC_NSS_DES3_KEY_LENGTH);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", XMLSEC_NSS_DES3_KEY_LENGTH);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", XMLSEC_NSS_DES3_KEY_LENGTH);
+ return(-1);
}
return(0);
@@ -237,102 +237,102 @@ xmlSecNssKWDes3Execute(xmlSecTransformPtr transform, int last, xmlSecTransformCt
xmlSecAssert2(outSize == 0, -1);
if(transform->status == xmlSecTransformStatusNone) {
- transform->status = xmlSecTransformStatusWorking;
+ transform->status = xmlSecTransformStatusWorking;
}
if((transform->status == xmlSecTransformStatusWorking) && (last == 0)) {
- /* just do nothing */
+ /* just do nothing */
} else if((transform->status == xmlSecTransformStatusWorking) && (last != 0)) {
- if((inSize % XMLSEC_NSS_DES3_BLOCK_LENGTH) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "%d bytes - not %d bytes aligned",
- inSize, XMLSEC_NSS_DES3_BLOCK_LENGTH);
- return(-1);
- }
-
- if(transform->operation == xmlSecTransformOperationEncrypt) {
- /* the encoded key might be 16 bytes longer plus one block just in case */
- outSize = inSize + XMLSEC_NSS_DES3_IV_LENGTH +
- XMLSEC_NSS_DES3_BLOCK_LENGTH +
- XMLSEC_NSS_DES3_BLOCK_LENGTH;
- } else {
- outSize = inSize + XMLSEC_NSS_DES3_BLOCK_LENGTH;
- }
-
- ret = xmlSecBufferSetMaxSize(out, outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize);
- return(-1);
- }
-
- if(transform->operation == xmlSecTransformOperationEncrypt) {
- ret = xmlSecNssKWDes3Encode(xmlSecBufferGetData(key), keySize,
- xmlSecBufferGetData(in), inSize,
- xmlSecBufferGetData(out), outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecNssKWDes3Encode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "key=%d,in=%d,out=%d",
- keySize, inSize, outSize);
- return(-1);
- }
- outSize = ret;
- } else {
- ret = xmlSecNssKWDes3Decode(xmlSecBufferGetData(key), keySize,
- xmlSecBufferGetData(in), inSize,
- xmlSecBufferGetData(out), outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecNssKWDes3Decode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "key=%d,in=%d,out=%d",
- keySize, inSize, outSize);
- return(-1);
- }
- outSize = ret;
- }
-
- ret = xmlSecBufferSetSize(out, outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize);
- return(-1);
- }
-
- ret = xmlSecBufferRemoveHead(in, inSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
- }
-
- transform->status = xmlSecTransformStatusFinished;
+ if((inSize % XMLSEC_NSS_DES3_BLOCK_LENGTH) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "%d bytes - not %d bytes aligned",
+ inSize, XMLSEC_NSS_DES3_BLOCK_LENGTH);
+ return(-1);
+ }
+
+ if(transform->operation == xmlSecTransformOperationEncrypt) {
+ /* the encoded key might be 16 bytes longer plus one block just in case */
+ outSize = inSize + XMLSEC_NSS_DES3_IV_LENGTH +
+ XMLSEC_NSS_DES3_BLOCK_LENGTH +
+ XMLSEC_NSS_DES3_BLOCK_LENGTH;
+ } else {
+ outSize = inSize + XMLSEC_NSS_DES3_BLOCK_LENGTH;
+ }
+
+ ret = xmlSecBufferSetMaxSize(out, outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize);
+ return(-1);
+ }
+
+ if(transform->operation == xmlSecTransformOperationEncrypt) {
+ ret = xmlSecNssKWDes3Encode(xmlSecBufferGetData(key), keySize,
+ xmlSecBufferGetData(in), inSize,
+ xmlSecBufferGetData(out), outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecNssKWDes3Encode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "key=%d,in=%d,out=%d",
+ keySize, inSize, outSize);
+ return(-1);
+ }
+ outSize = ret;
+ } else {
+ ret = xmlSecNssKWDes3Decode(xmlSecBufferGetData(key), keySize,
+ xmlSecBufferGetData(in), inSize,
+ xmlSecBufferGetData(out), outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecNssKWDes3Decode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "key=%d,in=%d,out=%d",
+ keySize, inSize, outSize);
+ return(-1);
+ }
+ outSize = ret;
+ }
+
+ ret = xmlSecBufferSetSize(out, outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize);
+ return(-1);
+ }
+
+ ret = xmlSecBufferRemoveHead(in, inSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
+ }
+
+ transform->status = xmlSecTransformStatusFinished;
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
}
@@ -363,10 +363,10 @@ static xmlSecByte xmlSecNssKWDes3Iv[XMLSEC_NSS_DES3_IV_LENGTH] = {
* It is 40 octets long if a 168 bit key is being wrapped.
*
*/
-static int
+static int
xmlSecNssKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
- const xmlSecByte *in, xmlSecSize inSize,
- xmlSecByte *out, xmlSecSize outSize) {
+ const xmlSecByte *in, xmlSecSize inSize,
+ xmlSecByte *out, xmlSecSize outSize) {
xmlSecByte sha1[SHA1_LENGTH];
xmlSecByte iv[XMLSEC_NSS_DES3_IV_LENGTH];
xmlSecSize s;
@@ -382,12 +382,12 @@ xmlSecNssKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
/* step 2: calculate sha1 and CMS */
if(xmlSecNssComputeSHA1(in, inSize, sha1, SHA1_LENGTH) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssComputeSHA1",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssComputeSHA1",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* step 3: construct WKCKS */
@@ -397,56 +397,56 @@ xmlSecNssKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
/* step 4: generate random iv */
status = PK11_GenerateRandom(iv, XMLSEC_NSS_DES3_IV_LENGTH);
if(status != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_GenerateRandom",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_GenerateRandom",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
/* step 5: first encryption, result is TEMP1 */
ret = xmlSecNssKWDes3Encrypt(key, keySize,
- iv, XMLSEC_NSS_DES3_IV_LENGTH,
- out, inSize + XMLSEC_NSS_DES3_BLOCK_LENGTH,
- out, outSize, 1);
+ iv, XMLSEC_NSS_DES3_IV_LENGTH,
+ out, inSize + XMLSEC_NSS_DES3_BLOCK_LENGTH,
+ out, outSize, 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssKWDes3Encrypt",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssKWDes3Encrypt",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* step 6: construct TEMP2=IV || TEMP1 */
memmove(out + XMLSEC_NSS_DES3_IV_LENGTH, out,
- inSize + XMLSEC_NSS_DES3_IV_LENGTH);
+ inSize + XMLSEC_NSS_DES3_IV_LENGTH);
memcpy(out, iv, XMLSEC_NSS_DES3_IV_LENGTH);
s = ret + XMLSEC_NSS_DES3_IV_LENGTH;
/* step 7: reverse octets order, result is TEMP3 */
ret = xmlSecNssKWDes3BufferReverse(out, s);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssKWDes3BufferReverse",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssKWDes3BufferReverse",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* step 8: second encryption with static IV */
ret = xmlSecNssKWDes3Encrypt(key, keySize,
- xmlSecNssKWDes3Iv, XMLSEC_NSS_DES3_IV_LENGTH,
- out, s, out, outSize, 1);
+ xmlSecNssKWDes3Iv, XMLSEC_NSS_DES3_IV_LENGTH,
+ out, s, out, outSize, 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssKWDes3Encrypt",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssKWDes3Encrypt",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
s = ret;
return(s);
@@ -478,10 +478,10 @@ xmlSecNssKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
* error.
* 8. WK is the wrapped key, now extracted for use in data decryption.
*/
-static int
+static int
xmlSecNssKWDes3Decode(const xmlSecByte *key, xmlSecSize keySize,
- const xmlSecByte *in, xmlSecSize inSize,
- xmlSecByte *out, xmlSecSize outSize) {
+ const xmlSecByte *in, xmlSecSize inSize,
+ xmlSecByte *out, xmlSecSize outSize) {
xmlSecByte sha1[SHA1_LENGTH];
xmlSecSize s;
int ret;
@@ -495,62 +495,62 @@ xmlSecNssKWDes3Decode(const xmlSecByte *key, xmlSecSize keySize,
/* step 2: first decryption with static IV, result is TEMP3 */
ret = xmlSecNssKWDes3Encrypt(key, keySize,
- xmlSecNssKWDes3Iv, XMLSEC_NSS_DES3_IV_LENGTH,
- in, inSize, out, outSize, 0);
+ xmlSecNssKWDes3Iv, XMLSEC_NSS_DES3_IV_LENGTH,
+ in, inSize, out, outSize, 0);
if((ret < 0) || (ret < XMLSEC_NSS_DES3_IV_LENGTH)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssKWDes3Encrypt",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssKWDes3Encrypt",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
s = ret;
/* step 3: reverse octets order in TEMP3, result is TEMP2 */
ret = xmlSecNssKWDes3BufferReverse(out, s);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssKWDes3BufferReverse",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssKWDes3BufferReverse",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* steps 4 and 5: get IV and decrypt second time, result is WKCKS */
ret = xmlSecNssKWDes3Encrypt(key, keySize,
- out, XMLSEC_NSS_DES3_IV_LENGTH,
- out + XMLSEC_NSS_DES3_IV_LENGTH,
- s - XMLSEC_NSS_DES3_IV_LENGTH,
- out, outSize, 0);
+ out, XMLSEC_NSS_DES3_IV_LENGTH,
+ out + XMLSEC_NSS_DES3_IV_LENGTH,
+ s - XMLSEC_NSS_DES3_IV_LENGTH,
+ out, outSize, 0);
if((ret < 0) || (ret < XMLSEC_NSS_DES3_BLOCK_LENGTH)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssKWDes3Encrypt",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssKWDes3Encrypt",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
s = ret - XMLSEC_NSS_DES3_BLOCK_LENGTH;
/* steps 6 and 7: calculate SHA1 and validate it */
if(xmlSecNssComputeSHA1(out, s, sha1, SHA1_LENGTH) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssComputeSHA1",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssComputeSHA1",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if(memcmp(sha1, out + s, XMLSEC_NSS_DES3_BLOCK_LENGTH) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "SHA1 does not match");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "SHA1 does not match");
+ return(-1);
}
return(s);
@@ -558,9 +558,9 @@ xmlSecNssKWDes3Decode(const xmlSecByte *key, xmlSecSize keySize,
static int
xmlSecNssKWDes3Encrypt(const xmlSecByte *key, xmlSecSize keySize,
- const xmlSecByte *iv, xmlSecSize ivSize,
- const xmlSecByte *in, xmlSecSize inSize,
- xmlSecByte *out, xmlSecSize outSize, int enc) {
+ const xmlSecByte *iv, xmlSecSize ivSize,
+ const xmlSecByte *in, xmlSecSize inSize,
+ xmlSecByte *out, xmlSecSize outSize, int enc) {
CK_MECHANISM_TYPE cipherMech;
PK11SlotInfo* slot = NULL;
PK11SymKey* SymKey = NULL;
@@ -584,25 +584,25 @@ xmlSecNssKWDes3Encrypt(const xmlSecByte *key, xmlSecSize keySize,
cipherMech = CKM_DES3_CBC;
slot = PK11_GetBestSlot(cipherMech, NULL);
if (slot == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_GetBestSlot",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_GetBestSlot",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
keyItem.data = (unsigned char *)key;
keyItem.len = keySize;
SymKey = PK11_ImportSymKey(slot, cipherMech, PK11_OriginUnwrap,
- enc ? CKA_ENCRYPT : CKA_DECRYPT, &keyItem, NULL);
+ enc ? CKA_ENCRYPT : CKA_DECRYPT, &keyItem, NULL);
if (SymKey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_ImportSymKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_ImportSymKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
ivItem.data = (unsigned char *)iv;
@@ -610,67 +610,67 @@ xmlSecNssKWDes3Encrypt(const xmlSecByte *key, xmlSecSize keySize,
SecParam = PK11_ParamFromIV(cipherMech, &ivItem);
if (SecParam == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_ParamFromIV",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_ParamFromIV",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
EncContext = PK11_CreateContextBySymKey(cipherMech,
- enc ? CKA_ENCRYPT : CKA_DECRYPT,
- SymKey, SecParam);
+ enc ? CKA_ENCRYPT : CKA_DECRYPT,
+ SymKey, SecParam);
if (EncContext == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_CreateContextBySymKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_CreateContextBySymKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
tmp1_outlen = tmp2_outlen = 0;
rv = PK11_CipherOp(EncContext, out, &tmp1_outlen, outSize,
- (unsigned char *)in, inSize);
+ (unsigned char *)in, inSize);
if (rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_CipherOp",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_CipherOp",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
rv = PK11_DigestFinal(EncContext, out+tmp1_outlen,
- &tmp2_outlen, outSize-tmp1_outlen);
+ &tmp2_outlen, outSize-tmp1_outlen);
if (rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_DigestFinal",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_DigestFinal",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
result_len = tmp1_outlen + tmp2_outlen;
done:
if (slot) {
- PK11_FreeSlot(slot);
+ PK11_FreeSlot(slot);
}
if (SymKey) {
- PK11_FreeSymKey(SymKey);
+ PK11_FreeSymKey(SymKey);
}
if (SecParam) {
- SECITEM_FreeItem(SecParam, PR_TRUE);
+ SECITEM_FreeItem(SecParam, PR_TRUE);
}
if (EncContext) {
- PK11_DestroyContext(EncContext, PR_TRUE);
+ PK11_DestroyContext(EncContext, PR_TRUE);
}
return(result_len);
-}
+}
static int
xmlSecNssKWDes3BufferReverse(xmlSecByte *buf, xmlSecSize size) {
@@ -683,16 +683,16 @@ xmlSecNssKWDes3BufferReverse(xmlSecByte *buf, xmlSecSize size) {
s = size / 2;
--size;
for(i = 0; i < s; ++i) {
- c = buf[i];
- buf[i] = buf[size - i];
- buf[size - i] = c;
+ c = buf[i];
+ buf[i] = buf[size - i];
+ buf[size - i] = c;
}
return(0);
}
static xmlSecByte *
xmlSecNssComputeSHA1(const xmlSecByte *in, xmlSecSize inSize,
- xmlSecByte *out, xmlSecSize outSize)
+ xmlSecByte *out, xmlSecSize outSize)
{
PK11Context *context = NULL;
SECStatus s;
@@ -706,42 +706,42 @@ xmlSecNssComputeSHA1(const xmlSecByte *in, xmlSecSize inSize,
/* Create a context for hashing (digesting) */
context = PK11_CreateDigestContext(SEC_OID_SHA1);
if (context == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_CreateDigestContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_CreateDigestContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
s = PK11_DigestBegin(context);
if (s != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_DigestBegin",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_DigestBegin",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
s = PK11_DigestOp(context, in, inSize);
if (s != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_DigestOp",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_DigestOp",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
s = PK11_DigestFinal(context, out, &len, outSize);
if (s != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_DigestFinal",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_DigestFinal",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
xmlSecAssert2(len == SHA1_LENGTH, NULL);
@@ -749,7 +749,7 @@ xmlSecNssComputeSHA1(const xmlSecByte *in, xmlSecSize inSize,
done:
if (context != NULL) {
- PK11_DestroyContext(context, PR_TRUE);
+ PK11_DestroyContext(context, PR_TRUE);
}
return (digest);
}
diff --git a/src/nss/pkikeys.c b/src/nss/pkikeys.c
index f854935..818b2c8 100644
--- a/src/nss/pkikeys.c
+++ b/src/nss/pkikeys.c
@@ -30,12 +30,12 @@
* Internal NSS PKI key CTX
*
*************************************************************************/
-typedef struct _xmlSecNssPKIKeyDataCtx xmlSecNssPKIKeyDataCtx,
- *xmlSecNssPKIKeyDataCtxPtr;
+typedef struct _xmlSecNssPKIKeyDataCtx xmlSecNssPKIKeyDataCtx,
+ *xmlSecNssPKIKeyDataCtxPtr;
struct _xmlSecNssPKIKeyDataCtx {
SECKEYPublicKey *pubkey;
SECKEYPrivateKey *privkey;
-};
+};
/******************************************************************************
*
@@ -44,22 +44,22 @@ struct _xmlSecNssPKIKeyDataCtx {
* xmlSecNssPKIKeyDataCtx is located after xmlSecTransform
*
*****************************************************************************/
-#define xmlSecNssPKIKeyDataSize \
- (sizeof(xmlSecKeyData) + sizeof(xmlSecNssPKIKeyDataCtx))
+#define xmlSecNssPKIKeyDataSize \
+ (sizeof(xmlSecKeyData) + sizeof(xmlSecNssPKIKeyDataCtx))
#define xmlSecNssPKIKeyDataGetCtx(data) \
((xmlSecNssPKIKeyDataCtxPtr)(((xmlSecByte*)(data)) + sizeof(xmlSecKeyData)))
-static int xmlSecNssPKIKeyDataInitialize (xmlSecKeyDataPtr data);
-static void xmlSecNssPKIKeyDataFinalize (xmlSecKeyDataPtr data);
+static int xmlSecNssPKIKeyDataInitialize (xmlSecKeyDataPtr data);
+static void xmlSecNssPKIKeyDataFinalize (xmlSecKeyDataPtr data);
-static void xmlSecNSSPKIKeyDataCtxFree (xmlSecNssPKIKeyDataCtxPtr ctx);
-static int xmlSecNSSPKIKeyDataCtxDup (xmlSecNssPKIKeyDataCtxPtr ctxDst,
- xmlSecNssPKIKeyDataCtxPtr ctxSrc);
-static int xmlSecNssPKIKeyDataAdoptKey (xmlSecKeyDataPtr data,
- SECKEYPrivateKey *privkey,
- SECKEYPublicKey *pubkey);
+static void xmlSecNSSPKIKeyDataCtxFree (xmlSecNssPKIKeyDataCtxPtr ctx);
+static int xmlSecNSSPKIKeyDataCtxDup (xmlSecNssPKIKeyDataCtxPtr ctxDst,
+ xmlSecNssPKIKeyDataCtxPtr ctxSrc);
+static int xmlSecNssPKIKeyDataAdoptKey (xmlSecKeyDataPtr data,
+ SECKEYPrivateKey *privkey,
+ SECKEYPublicKey *pubkey);
static int
@@ -98,14 +98,14 @@ xmlSecNSSPKIKeyDataCtxFree(xmlSecNssPKIKeyDataCtxPtr ctx)
{
xmlSecAssert(ctx != NULL);
if (ctx->privkey != NULL) {
- SECKEY_DestroyPrivateKey(ctx->privkey);
- ctx->privkey = NULL;
+ SECKEY_DestroyPrivateKey(ctx->privkey);
+ ctx->privkey = NULL;
}
if (ctx->pubkey)
{
- SECKEY_DestroyPublicKey(ctx->pubkey);
- ctx->pubkey = NULL;
+ SECKEY_DestroyPublicKey(ctx->pubkey);
+ ctx->pubkey = NULL;
}
}
@@ -116,27 +116,27 @@ xmlSecNSSPKIKeyDataCtxDup(xmlSecNssPKIKeyDataCtxPtr ctxDst,
{
xmlSecNSSPKIKeyDataCtxFree(ctxDst);
if (ctxSrc->privkey != NULL) {
- ctxDst->privkey = SECKEY_CopyPrivateKey(ctxSrc->privkey);
- if(ctxDst->privkey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "SECKEY_CopyPrivateKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
- }
+ ctxDst->privkey = SECKEY_CopyPrivateKey(ctxSrc->privkey);
+ if(ctxDst->privkey == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "SECKEY_CopyPrivateKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
+ }
}
if (ctxSrc->pubkey != NULL) {
- ctxDst->pubkey = SECKEY_CopyPublicKey(ctxSrc->pubkey);
- if(ctxDst->pubkey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "SECKEY_CopyPublicKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
- }
+ ctxDst->pubkey = SECKEY_CopyPublicKey(ctxSrc->pubkey);
+ if(ctxDst->pubkey == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "SECKEY_CopyPublicKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
+ }
}
return (0);
}
@@ -147,41 +147,41 @@ xmlSecNssPKIKeyDataAdoptKey(xmlSecKeyDataPtr data,
SECKEYPublicKey *pubkey)
{
xmlSecNssPKIKeyDataCtxPtr ctx;
- KeyType pubType = nullKey ;
- KeyType priType = nullKey ;
+ KeyType pubType = nullKey ;
+ KeyType priType = nullKey ;
xmlSecAssert2(xmlSecKeyDataIsValid(data), -1);
xmlSecAssert2(xmlSecKeyDataCheckSize(data, xmlSecNssPKIKeyDataSize), -1);
- if( privkey != NULL ) {
- priType = SECKEY_GetPrivateKeyType( privkey ) ;
- }
-
- if( pubkey != NULL ) {
- pubType = SECKEY_GetPublicKeyType( pubkey ) ;
- }
-
- if( priType != nullKey && pubType != nullKey ) {
- if( pubType != priType ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- NULL ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- "different type of private and public key" ) ;
- return -1 ;
- }
- }
+ if( privkey != NULL ) {
+ priType = SECKEY_GetPrivateKeyType( privkey ) ;
+ }
+
+ if( pubkey != NULL ) {
+ pubType = SECKEY_GetPublicKeyType( pubkey ) ;
+ }
+
+ if( priType != nullKey && pubType != nullKey ) {
+ if( pubType != priType ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ NULL ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ "different type of private and public key" ) ;
+ return -1 ;
+ }
+ }
ctx = xmlSecNssPKIKeyDataGetCtx(data);
xmlSecAssert2(ctx != NULL, -1);
if (ctx->privkey) {
- SECKEY_DestroyPrivateKey(ctx->privkey);
+ SECKEY_DestroyPrivateKey(ctx->privkey);
}
ctx->privkey = privkey;
if (ctx->pubkey) {
- SECKEY_DestroyPublicKey(ctx->pubkey);
+ SECKEY_DestroyPublicKey(ctx->pubkey);
}
ctx->pubkey = pubkey;
@@ -204,75 +204,75 @@ xmlSecNssPKIAdoptKey(SECKEYPrivateKey *privkey,
{
xmlSecKeyDataPtr data = NULL;
int ret;
- KeyType pubType = nullKey ;
- KeyType priType = nullKey ;
+ KeyType pubType = nullKey ;
+ KeyType priType = nullKey ;
- if( privkey != NULL ) {
- priType = SECKEY_GetPrivateKeyType( privkey ) ;
- }
-
- if( pubkey != NULL ) {
- pubType = SECKEY_GetPublicKeyType( pubkey ) ;
- }
-
- if( priType != nullKey && pubType != nullKey ) {
- if( pubType != priType ) {
- xmlSecError( XMLSEC_ERRORS_HERE ,
- NULL ,
- NULL ,
- XMLSEC_ERRORS_R_CRYPTO_FAILED ,
- "different type of private and public key" ) ;
- return( NULL ) ;
- }
- }
+ if( privkey != NULL ) {
+ priType = SECKEY_GetPrivateKeyType( privkey ) ;
+ }
+
+ if( pubkey != NULL ) {
+ pubType = SECKEY_GetPublicKeyType( pubkey ) ;
+ }
+
+ if( priType != nullKey && pubType != nullKey ) {
+ if( pubType != priType ) {
+ xmlSecError( XMLSEC_ERRORS_HERE ,
+ NULL ,
+ NULL ,
+ XMLSEC_ERRORS_R_CRYPTO_FAILED ,
+ "different type of private and public key" ) ;
+ return( NULL ) ;
+ }
+ }
- pubType = priType != nullKey ? priType : pubType ;
- switch(pubType) {
+ pubType = priType != nullKey ? priType : pubType ;
+ switch(pubType) {
#ifndef XMLSEC_NO_RSA
case rsaKey:
- data = xmlSecKeyDataCreate(xmlSecNssKeyDataRsaId);
- if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecNssKeyDataRsaId");
- return(NULL);
- }
- break;
-#endif /* XMLSEC_NO_RSA */
-#ifndef XMLSEC_NO_DSA
+ data = xmlSecKeyDataCreate(xmlSecNssKeyDataRsaId);
+ if(data == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecNssKeyDataRsaId");
+ return(NULL);
+ }
+ break;
+#endif /* XMLSEC_NO_RSA */
+#ifndef XMLSEC_NO_DSA
case dsaKey:
- data = xmlSecKeyDataCreate(xmlSecNssKeyDataDsaId);
- if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecNssKeyDataDsaId");
- return(NULL);
- }
- break;
-#endif /* XMLSEC_NO_DSA */
- default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_TYPE,
- "PKI key type %d not supported", pubType);
- return(NULL);
+ data = xmlSecKeyDataCreate(xmlSecNssKeyDataDsaId);
+ if(data == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecNssKeyDataDsaId");
+ return(NULL);
+ }
+ break;
+#endif /* XMLSEC_NO_DSA */
+ default:
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TYPE,
+ "PKI key type %d not supported", pubType);
+ return(NULL);
}
xmlSecAssert2(data != NULL, NULL);
ret = xmlSecNssPKIKeyDataAdoptKey(data, privkey, pubkey);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssPKIKeyDataAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(data);
- return(NULL);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssPKIKeyDataAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(data);
+ return(NULL);
}
return(data);
}
@@ -347,9 +347,9 @@ xmlSecNssPKIKeyDataGetKeyType(xmlSecKeyDataPtr data) {
xmlSecAssert2(ctx != NULL, nullKey);
if (ctx->pubkey != NULL) {
- kt = SECKEY_GetPublicKeyType(ctx->pubkey);
+ kt = SECKEY_GetPublicKeyType(ctx->pubkey);
} else {
- kt = SECKEY_GetPrivateKeyType(ctx->privkey);
+ kt = SECKEY_GetPrivateKeyType(ctx->privkey);
}
return(kt);
}
@@ -381,10 +381,10 @@ xmlSecNssPKIKeyDataDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
if (xmlSecNSSPKIKeyDataCtxDup(ctxDst, ctxSrc) != 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "xmlSecNssPKIKeydataCtxDup",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "xmlSecNssPKIKeydataCtxDup",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -407,7 +407,7 @@ xmlSecNssPKIKeyDataDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
* divisor of P-1
* * G - an integer with certain properties with respect to P and Q
* * Y - G**X mod P (where X is part of the private key and not made
- * public)
+ * public)
* * J - (P - 1) / Q
* * seed - a DSA prime generation seed
* * pgenCounter - a DSA prime generation counter
@@ -465,28 +465,28 @@ xmlSecNssPKIKeyDataDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
* by this the P, Q and G are *required*!
*
*************************************************************************/
-static int xmlSecNssKeyDataDsaInitialize (xmlSecKeyDataPtr data);
-static int xmlSecNssKeyDataDsaDuplicate (xmlSecKeyDataPtr dst,
- xmlSecKeyDataPtr src);
-static void xmlSecNssKeyDataDsaFinalize (xmlSecKeyDataPtr data);
-static int xmlSecNssKeyDataDsaXmlRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecNssKeyDataDsaXmlWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecNssKeyDataDsaGenerate (xmlSecKeyDataPtr data,
- xmlSecSize sizeBits,
- xmlSecKeyDataType type);
-
-static xmlSecKeyDataType xmlSecNssKeyDataDsaGetType (xmlSecKeyDataPtr data);
-static xmlSecSize xmlSecNssKeyDataDsaGetSize (xmlSecKeyDataPtr data);
-static void xmlSecNssKeyDataDsaDebugDump (xmlSecKeyDataPtr data,
- FILE* output);
-static void xmlSecNssKeyDataDsaDebugXmlDump (xmlSecKeyDataPtr data,
- FILE* output);
+static int xmlSecNssKeyDataDsaInitialize (xmlSecKeyDataPtr data);
+static int xmlSecNssKeyDataDsaDuplicate (xmlSecKeyDataPtr dst,
+ xmlSecKeyDataPtr src);
+static void xmlSecNssKeyDataDsaFinalize (xmlSecKeyDataPtr data);
+static int xmlSecNssKeyDataDsaXmlRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssKeyDataDsaXmlWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssKeyDataDsaGenerate (xmlSecKeyDataPtr data,
+ xmlSecSize sizeBits,
+ xmlSecKeyDataType type);
+
+static xmlSecKeyDataType xmlSecNssKeyDataDsaGetType (xmlSecKeyDataPtr data);
+static xmlSecSize xmlSecNssKeyDataDsaGetSize (xmlSecKeyDataPtr data);
+static void xmlSecNssKeyDataDsaDebugDump (xmlSecKeyDataPtr data,
+ FILE* output);
+static void xmlSecNssKeyDataDsaDebugXmlDump (xmlSecKeyDataPtr data,
+ FILE* output);
static xmlSecKeyDataKlass xmlSecNssKeyDataDsaKlass = {
sizeof(xmlSecKeyDataKlass),
@@ -495,35 +495,35 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataDsaKlass = {
/* data */
xmlSecNameDSAKeyValue,
xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefDSAKeyValue, /* const xmlChar* href; */
- xmlSecNodeDSAKeyValue, /* const xmlChar* dataNodeName; */
- xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefDSAKeyValue, /* const xmlChar* href; */
+ xmlSecNodeDSAKeyValue, /* const xmlChar* dataNodeName; */
+ xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecNssKeyDataDsaInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecNssKeyDataDsaDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecNssKeyDataDsaFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- xmlSecNssKeyDataDsaGenerate, /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecNssKeyDataDsaInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecNssKeyDataDsaDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecNssKeyDataDsaFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ xmlSecNssKeyDataDsaGenerate, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecNssKeyDataDsaGetType, /* xmlSecKeyDataGetTypeMethod getType; */
- xmlSecNssKeyDataDsaGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecNssKeyDataDsaGetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ xmlSecNssKeyDataDsaGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecNssKeyDataDsaXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecNssKeyDataDsaXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- NULL, /* xmlSecKeyDataBinReadMethod binRead; */
- NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecNssKeyDataDsaXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecNssKeyDataDsaXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ NULL, /* xmlSecKeyDataBinReadMethod binRead; */
+ NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecNssKeyDataDsaDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- xmlSecNssKeyDataDsaDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ xmlSecNssKeyDataDsaDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecNssKeyDataDsaDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -563,7 +563,7 @@ xmlSecNssKeyDataDsaFinalize(xmlSecKeyDataPtr data) {
static int
xmlSecNssKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyDataPtr data = NULL;
xmlNodePtr cur;
int ret;
@@ -579,48 +579,48 @@ xmlSecNssKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
xmlSecAssert2(keyInfoCtx != NULL, -1);
if(xmlSecKeyGetValue(key) != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_KEY_DATA,
- XMLSEC_ERRORS_NO_MESSAGE);
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_KEY_DATA,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ ret = -1;
+ goto done;
}
slot = PK11_GetBestSlot(CKM_DSA, NULL);
if(slot == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "PK11_GetBestSlot",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "PK11_GetBestSlot",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ ret = -1;
+ goto done;
}
arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
if(arena == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "PORT_NewArena",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "PORT_NewArena",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ ret = -1;
+ goto done;
}
pubkey = (SECKEYPublicKey *)PORT_ArenaZAlloc(arena,
- sizeof(SECKEYPublicKey));
+ sizeof(SECKEYPublicKey));
if(pubkey == NULL ) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "PORT_ArenaZAlloc",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- PORT_FreeArena(arena, PR_FALSE);
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "PORT_ArenaZAlloc",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ PORT_FreeArena(arena, PR_FALSE);
+ ret = -1;
+ goto done;
}
pubkey->arena = arena;
pubkey->u.dsa.params.arena = arena;
@@ -630,159 +630,159 @@ xmlSecNssKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
/* first is P node. It is REQUIRED because we do not support Seed and PgenCounter*/
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeDSAP, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAP));
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAP));
+ ret = -1;
+ goto done;
}
if(xmlSecNssNodeGetBigNumValue(arena, cur, &(pubkey->u.dsa.params.prime)) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssNodeGetBigNumValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAP));
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssNodeGetBigNumValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAP));
+ ret = -1;
+ goto done;
}
cur = xmlSecGetNextElementNode(cur->next);
/* next is Q node. It is REQUIRED because we do not support Seed and PgenCounter*/
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeDSAQ, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAQ));
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAQ));
+ ret = -1;
+ goto done;
}
if(xmlSecNssNodeGetBigNumValue(arena, cur, &(pubkey->u.dsa.params.subPrime)) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssNodeGetBigNumValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAQ));
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssNodeGetBigNumValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAQ));
+ ret = -1;
+ goto done;
}
cur = xmlSecGetNextElementNode(cur->next);
/* next is G node. It is REQUIRED because we do not support Seed and PgenCounter*/
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeDSAG, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAG));
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAG));
+ ret = -1;
+ goto done;
}
if(xmlSecNssNodeGetBigNumValue(arena, cur, &(pubkey->u.dsa.params.base)) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssNodeGetBigNumValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAG));
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssNodeGetBigNumValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAG));
+ ret = -1;
+ goto done;
}
cur = xmlSecGetNextElementNode(cur->next);
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSAX, xmlSecNs))) {
/* next is X node. It is REQUIRED for private key but
- * NSS does not support it, we just ignore it */
+ * NSS does not support it, we just ignore it */
- cur = xmlSecGetNextElementNode(cur->next);
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* next is Y node. */
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeDSAY, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAY));
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAY));
+ ret = -1;
+ goto done;
}
if(xmlSecNssNodeGetBigNumValue(arena, cur, &(pubkey->u.dsa.publicValue)) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssNodeGetBigNumValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s", xmlSecErrorsSafeString(xmlSecNodeDSAY));
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssNodeGetBigNumValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s", xmlSecErrorsSafeString(xmlSecNodeDSAY));
+ ret = -1;
+ goto done;
}
cur = xmlSecGetNextElementNode(cur->next);
/* todo: add support for J */
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSAJ, xmlSecDSigNs))) {
- cur = xmlSecGetNextElementNode(cur->next);
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* todo: add support for seed */
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSASeed, xmlSecDSigNs))) {
- cur = xmlSecGetNextElementNode(cur->next);
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* todo: add support for pgencounter */
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSAPgenCounter, xmlSecDSigNs))) {
- cur = xmlSecGetNextElementNode(cur->next);
+ cur = xmlSecGetNextElementNode(cur->next);
}
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ ret = -1;
+ goto done;
}
handle = PK11_ImportPublicKey(slot, pubkey, PR_FALSE);
data = xmlSecKeyDataCreate(id);
if(data == NULL ) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ ret = -1;
+ goto done;
}
ret = xmlSecNssPKIKeyDataAdoptKey(data, NULL, pubkey);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecNssPKIKeyDataAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecNssPKIKeyDataAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
pubkey = NULL;
ret = xmlSecKeySetValue(key, data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
data = NULL;
@@ -790,22 +790,22 @@ xmlSecNssKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
done:
if (slot != NULL) {
- PK11_FreeSlot(slot);
+ PK11_FreeSlot(slot);
}
if (ret != 0) {
- if (pubkey != NULL) {
- SECKEY_DestroyPublicKey(pubkey);
- }
- if (data != NULL) {
- xmlSecKeyDataDestroy(data);
- }
+ if (pubkey != NULL) {
+ SECKEY_DestroyPublicKey(pubkey);
+ }
+ if (data != NULL) {
+ xmlSecKeyDataDestroy(data);
+ }
}
return(ret);
}
static int
xmlSecNssKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecNssPKIKeyDataCtxPtr ctx;
xmlNodePtr cur;
int ret;
@@ -821,74 +821,74 @@ xmlSecNssKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
xmlSecAssert2(SECKEY_GetPublicKeyType(ctx->pubkey) == dsaKey, -1);
if(((xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate) & keyInfoCtx->keyReq.keyType) == 0) {
- /* we can have only private key or public key */
- return(0);
+ /* we can have only private key or public key */
+ return(0);
}
/* first is P node */
cur = xmlSecAddChild(node, xmlSecNodeDSAP, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAP));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAP));
+ return(-1);
}
ret = xmlSecNssNodeSetBigNumValue(cur, &(ctx->pubkey->u.dsa.params.prime), 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssNodeSetBigNumValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAP));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssNodeSetBigNumValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAP));
+ return(-1);
}
/* next is Q node. */
cur = xmlSecAddChild(node, xmlSecNodeDSAQ, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAQ));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAQ));
+ return(-1);
}
ret = xmlSecNssNodeSetBigNumValue(cur, &(ctx->pubkey->u.dsa.params.subPrime), 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssNodeSetBigNumValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAQ));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssNodeSetBigNumValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAQ));
+ return(-1);
}
/* next is G node. */
cur = xmlSecAddChild(node, xmlSecNodeDSAG, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAG));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAG));
+ return(-1);
}
ret = xmlSecNssNodeSetBigNumValue(cur, &(ctx->pubkey->u.dsa.params.base), 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssNodeSetBigNumValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAG));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssNodeSetBigNumValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAG));
+ return(-1);
}
/* next is X node: not supported in NSS */
@@ -896,23 +896,23 @@ xmlSecNssKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
/* next is Y node. */
cur = xmlSecAddChild(node, xmlSecNodeDSAY, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAY));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAY));
+ return(-1);
}
ret = xmlSecNssNodeSetBigNumValue(cur, &(ctx->pubkey->u.dsa.publicValue), 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssNodeSetBigNumValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAY));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssNodeSetBigNumValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAY));
+ return(-1);
}
return(0);
@@ -936,69 +936,69 @@ xmlSecNssKeyDataDsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, xmlSecKe
j = PQG_PBITS_TO_INDEX(sizeBits);
rv = PK11_PQG_ParamGen(j, &pqgParams, &pqgVerify);
if (rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "PK11_PQG_ParamGen",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "size=%d", sizeBits);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "PK11_PQG_ParamGen",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "size=%d", sizeBits);
+ goto done;
}
rv = PK11_PQG_VerifyParams(pqgParams, pqgVerify, &res);
if (rv != SECSuccess || res != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "PK11_PQG_VerifyParams",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "size=%d", sizeBits);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "PK11_PQG_VerifyParams",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "size=%d", sizeBits);
+ goto done;
}
slot = PK11_GetBestSlot(CKM_DSA_KEY_PAIR_GEN, NULL);
PK11_Authenticate(slot, PR_TRUE, NULL /* default pwd callback */);
privkey = PK11_GenerateKeyPair(slot, CKM_DSA_KEY_PAIR_GEN, pqgParams,
- &pubkey, PR_FALSE, PR_TRUE, NULL);
+ &pubkey, PR_FALSE, PR_TRUE, NULL);
if((privkey == NULL) || (pubkey == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "PK11_GenerateKeyPair",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "PK11_GenerateKeyPair",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ goto done;
}
ret = xmlSecNssPKIKeyDataAdoptKey(data, privkey, pubkey);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecNssPKIKeyDataAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecNssPKIKeyDataAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
ret = 0;
done:
if (slot != NULL) {
- PK11_FreeSlot(slot);
+ PK11_FreeSlot(slot);
}
if (pqgParams != NULL) {
- PK11_PQG_DestroyParams(pqgParams);
+ PK11_PQG_DestroyParams(pqgParams);
}
if (pqgVerify != NULL) {
- PK11_PQG_DestroyVerify(pqgVerify);
+ PK11_PQG_DestroyVerify(pqgVerify);
}
if (ret == 0) {
- return (0);
+ return (0);
}
if (pubkey != NULL) {
- SECKEY_DestroyPublicKey(pubkey);
+ SECKEY_DestroyPublicKey(pubkey);
}
if (privkey != NULL) {
- SECKEY_DestroyPrivateKey(privkey);
+ SECKEY_DestroyPrivateKey(privkey);
}
return(-1);
}
@@ -1012,9 +1012,9 @@ xmlSecNssKeyDataDsaGetType(xmlSecKeyDataPtr data) {
xmlSecAssert2(ctx != NULL, -1);
xmlSecAssert2(SECKEY_GetPublicKeyType(ctx->pubkey) == dsaKey, -1);
if (ctx->privkey != NULL) {
- return(xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic);
+ return(xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic);
} else {
- return(xmlSecKeyDataTypePublic);
+ return(xmlSecKeyDataTypePublic);
}
return(xmlSecKeyDataTypeUnknown);
@@ -1038,7 +1038,7 @@ xmlSecNssKeyDataDsaDebugDump(xmlSecKeyDataPtr data, FILE* output) {
xmlSecAssert(output != NULL);
fprintf(output, "=== dsa key: size = %d\n",
- xmlSecNssKeyDataDsaGetSize(data));
+ xmlSecNssKeyDataDsaGetSize(data));
}
static void
@@ -1047,7 +1047,7 @@ xmlSecNssKeyDataDsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
xmlSecAssert(output != NULL);
fprintf(output, "<DSAKeyValue size=\"%d\" />\n",
- xmlSecNssKeyDataDsaGetSize(data));
+ xmlSecNssKeyDataDsaGetSize(data));
}
#endif /* XMLSEC_NO_DSA */
@@ -1065,7 +1065,7 @@ xmlSecNssKeyDataDsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
* <RSAKeyValue>
* <Modulus>xA7SEU+e0yQH5rm9kbCDN9o3aPIo7HbP7tX6WOocLZAtNfyxSZDU16ksL6W
* jubafOqNEpcwR3RdFsT7bCqnXPBe5ELh5u4VEy19MzxkXRgrMvavzyBpVRgBUwUlV
- * 5foK5hhmbktQhyNdy/6LpQRhDUDsTvK+g9Ucj47es9AQJ3U=
+ * 5foK5hhmbktQhyNdy/6LpQRhDUDsTvK+g9Ucj47es9AQJ3U=
* </Modulus>
* <Exponent>AQAB</Exponent>
* </RSAKeyValue>
@@ -1096,28 +1096,28 @@ xmlSecNssKeyDataDsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
*
*************************************************************************/
-static int xmlSecNssKeyDataRsaInitialize (xmlSecKeyDataPtr data);
-static int xmlSecNssKeyDataRsaDuplicate (xmlSecKeyDataPtr dst,
- xmlSecKeyDataPtr src);
-static void xmlSecNssKeyDataRsaFinalize (xmlSecKeyDataPtr data);
-static int xmlSecNssKeyDataRsaXmlRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecNssKeyDataRsaXmlWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecNssKeyDataRsaGenerate (xmlSecKeyDataPtr data,
- xmlSecSize sizeBits,
- xmlSecKeyDataType type);
-
-static xmlSecKeyDataType xmlSecNssKeyDataRsaGetType (xmlSecKeyDataPtr data);
-static xmlSecSize xmlSecNssKeyDataRsaGetSize (xmlSecKeyDataPtr data);
-static void xmlSecNssKeyDataRsaDebugDump (xmlSecKeyDataPtr data,
- FILE* output);
-static void xmlSecNssKeyDataRsaDebugXmlDump (xmlSecKeyDataPtr data,
- FILE* output);
+static int xmlSecNssKeyDataRsaInitialize (xmlSecKeyDataPtr data);
+static int xmlSecNssKeyDataRsaDuplicate (xmlSecKeyDataPtr dst,
+ xmlSecKeyDataPtr src);
+static void xmlSecNssKeyDataRsaFinalize (xmlSecKeyDataPtr data);
+static int xmlSecNssKeyDataRsaXmlRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssKeyDataRsaXmlWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssKeyDataRsaGenerate (xmlSecKeyDataPtr data,
+ xmlSecSize sizeBits,
+ xmlSecKeyDataType type);
+
+static xmlSecKeyDataType xmlSecNssKeyDataRsaGetType (xmlSecKeyDataPtr data);
+static xmlSecSize xmlSecNssKeyDataRsaGetSize (xmlSecKeyDataPtr data);
+static void xmlSecNssKeyDataRsaDebugDump (xmlSecKeyDataPtr data,
+ FILE* output);
+static void xmlSecNssKeyDataRsaDebugXmlDump (xmlSecKeyDataPtr data,
+ FILE* output);
static xmlSecKeyDataKlass xmlSecNssKeyDataRsaKlass = {
sizeof(xmlSecKeyDataKlass),
@@ -1126,35 +1126,35 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataRsaKlass = {
/* data */
xmlSecNameRSAKeyValue,
xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefRSAKeyValue, /* const xmlChar* href; */
- xmlSecNodeRSAKeyValue, /* const xmlChar* dataNodeName; */
- xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefRSAKeyValue, /* const xmlChar* href; */
+ xmlSecNodeRSAKeyValue, /* const xmlChar* dataNodeName; */
+ xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecNssKeyDataRsaInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecNssKeyDataRsaDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecNssKeyDataRsaFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- xmlSecNssKeyDataRsaGenerate, /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecNssKeyDataRsaInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecNssKeyDataRsaDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecNssKeyDataRsaFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ xmlSecNssKeyDataRsaGenerate, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecNssKeyDataRsaGetType, /* xmlSecKeyDataGetTypeMethod getType; */
- xmlSecNssKeyDataRsaGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecNssKeyDataRsaGetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ xmlSecNssKeyDataRsaGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecNssKeyDataRsaXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecNssKeyDataRsaXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- NULL, /* xmlSecKeyDataBinReadMethod binRead; */
- NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecNssKeyDataRsaXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecNssKeyDataRsaXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ NULL, /* xmlSecKeyDataBinReadMethod binRead; */
+ NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecNssKeyDataRsaDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- xmlSecNssKeyDataRsaDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ xmlSecNssKeyDataRsaDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecNssKeyDataRsaDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -1193,7 +1193,7 @@ xmlSecNssKeyDataRsaFinalize(xmlSecKeyDataPtr data) {
static int
xmlSecNssKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyDataPtr data = NULL;
xmlNodePtr cur;
int ret;
@@ -1207,13 +1207,13 @@ xmlSecNssKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
xmlSecAssert2(keyInfoCtx != NULL, -1);
if(xmlSecKeyGetValue(key) != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_KEY_DATA,
- "key already has a value");
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_KEY_DATA,
+ "key already has a value");
+ ret = -1;
+ goto done;
}
slot = PK11_GetBestSlot(CKM_RSA_PKCS, NULL);
@@ -1246,7 +1246,7 @@ xmlSecNssKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
"PORT_ArenaZAlloc",
XMLSEC_ERRORS_R_CRYPTO_FAILED,
"error code=%d", PORT_GetError());
- PORT_FreeArena(arena, PR_FALSE);
+ PORT_FreeArena(arena, PR_FALSE);
ret = -1;
goto done;
}
@@ -1257,98 +1257,98 @@ xmlSecNssKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
/* first is Modulus node. It is REQUIRED because we do not support Seed and PgenCounter*/
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeRSAModulus, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
+ ret = -1;
+ goto done;
}
if(xmlSecNssNodeGetBigNumValue(arena, cur, &(pubkey->u.rsa.modulus)) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssNodeGetBigNumValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssNodeGetBigNumValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
+ ret = -1;
+ goto done;
}
cur = xmlSecGetNextElementNode(cur->next);
/* next is Exponent node. It is REQUIRED because we do not support Seed and PgenCounter*/
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeRSAExponent, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
+ ret = -1;
+ goto done;
}
if(xmlSecNssNodeGetBigNumValue(arena, cur, &(pubkey->u.rsa.publicExponent)) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssNodeGetBigNumValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssNodeGetBigNumValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
+ ret = -1;
+ goto done;
}
cur = xmlSecGetNextElementNode(cur->next);
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeRSAPrivateExponent, xmlSecNs))) {
/* next is X node. It is REQUIRED for private key but
- * NSS does not support it. We just ignore it */
- cur = xmlSecGetNextElementNode(cur->next);
+ * NSS does not support it. We just ignore it */
+ cur = xmlSecGetNextElementNode(cur->next);
}
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "no nodes expected");
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "no nodes expected");
+ ret = -1;
+ goto done;
}
data = xmlSecKeyDataCreate(id);
if(data == NULL ) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- ret = -1;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ ret = -1;
+ goto done;
}
ret = xmlSecNssPKIKeyDataAdoptKey(data, NULL, pubkey);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssPKIKeyDataAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(data);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssPKIKeyDataAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(data);
+ goto done;
}
pubkey = NULL;
ret = xmlSecKeySetValue(key, data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(data);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(data);
+ goto done;
}
data = NULL;
@@ -1359,19 +1359,19 @@ done:
PK11_FreeSlot(slot);
}
if (ret != 0) {
- if (pubkey != 0) {
+ if (pubkey != 0) {
SECKEY_DestroyPublicKey(pubkey);
- }
- if (data != 0) {
+ }
+ if (data != 0) {
xmlSecKeyDataDestroy(data);
- }
+ }
}
return(ret);
}
static int
xmlSecNssKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecNssPKIKeyDataCtxPtr ctx;
xmlNodePtr cur;
int ret;
@@ -1388,52 +1388,52 @@ xmlSecNssKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
if(((xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate) & keyInfoCtx->keyReq.keyType) == 0) {
- /* we can have only private key or public key */
- return(0);
+ /* we can have only private key or public key */
+ return(0);
}
/* first is Modulus node */
cur = xmlSecAddChild(node, xmlSecNodeRSAModulus, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
+ return(-1);
}
ret = xmlSecNssNodeSetBigNumValue(cur, &(ctx->pubkey->u.rsa.modulus), 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssNodeSetBigNumValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssNodeSetBigNumValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
+ return(-1);
}
/* next is Exponent node. */
cur = xmlSecAddChild(node, xmlSecNodeRSAExponent, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
+ return(-1);
}
ret = xmlSecNssNodeSetBigNumValue(cur, &(ctx->pubkey->u.rsa.publicExponent), 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssNodeSetBigNumValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssNodeSetBigNumValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
+ return(-1);
}
/* next is PrivateExponent node: not supported in NSS */
@@ -1458,43 +1458,43 @@ xmlSecNssKeyDataRsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, xmlSecKe
slot = PK11_GetBestSlot(CKM_RSA_PKCS_KEY_PAIR_GEN, NULL);
PK11_Authenticate(slot, PR_TRUE, NULL /* default pwd callback */);
privkey = PK11_GenerateKeyPair(slot, CKM_RSA_PKCS_KEY_PAIR_GEN, ¶ms,
- &pubkey, PR_FALSE, PR_TRUE, NULL);
+ &pubkey, PR_FALSE, PR_TRUE, NULL);
if(privkey == NULL || pubkey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "PK11_GenerateKeyPair",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "PK11_GenerateKeyPair",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
- goto done;
+ goto done;
}
ret = xmlSecNssPKIKeyDataAdoptKey(data, privkey, pubkey);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecNssPKIKeyDataAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecNssPKIKeyDataAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
ret = 0;
done:
if (slot != NULL) {
- PK11_FreeSlot(slot);
+ PK11_FreeSlot(slot);
}
if (ret == 0) {
- return (0);
+ return (0);
}
if (pubkey != NULL) {
- SECKEY_DestroyPublicKey(pubkey);
+ SECKEY_DestroyPublicKey(pubkey);
}
if (privkey != NULL) {
- SECKEY_DestroyPrivateKey(privkey);
+ SECKEY_DestroyPrivateKey(privkey);
}
return(-1);
}
@@ -1509,9 +1509,9 @@ xmlSecNssKeyDataRsaGetType(xmlSecKeyDataPtr data) {
xmlSecAssert2(ctx != NULL, -1);
xmlSecAssert2(ctx->pubkey == NULL || SECKEY_GetPublicKeyType(ctx->pubkey) == rsaKey, -1);
if (ctx->privkey != NULL) {
- return(xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic);
+ return(xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic);
} else {
- return(xmlSecKeyDataTypePublic);
+ return(xmlSecKeyDataTypePublic);
}
return(xmlSecKeyDataTypeUnknown);
@@ -1536,7 +1536,7 @@ xmlSecNssKeyDataRsaDebugDump(xmlSecKeyDataPtr data, FILE* output) {
xmlSecAssert(output != NULL);
fprintf(output, "=== rsa key: size = %d\n",
- xmlSecNssKeyDataRsaGetSize(data));
+ xmlSecNssKeyDataRsaGetSize(data));
}
static void
@@ -1545,7 +1545,7 @@ xmlSecNssKeyDataRsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
xmlSecAssert(output != NULL);
fprintf(output, "<RSAKeyValue size=\"%d\" />\n",
- xmlSecNssKeyDataRsaGetSize(data));
+ xmlSecNssKeyDataRsaGetSize(data));
}
#endif /* XMLSEC_NO_RSA */
diff --git a/src/nss/signatures.c b/src/nss/signatures.c
index 3c9639c..e3723fd 100644
--- a/src/nss/signatures.c
+++ b/src/nss/signatures.c
@@ -29,24 +29,24 @@
* Internal NSS signatures ctx
*
*****************************************************************************/
-typedef struct _xmlSecNssSignatureCtx xmlSecNssSignatureCtx,
- *xmlSecNssSignatureCtxPtr;
+typedef struct _xmlSecNssSignatureCtx xmlSecNssSignatureCtx,
+ *xmlSecNssSignatureCtxPtr;
struct _xmlSecNssSignatureCtx {
- xmlSecKeyDataId keyId;
+ xmlSecKeyDataId keyId;
SECOidTag alg;
union {
struct {
- SGNContext *sigctx;
- SECKEYPrivateKey *privkey;
+ SGNContext *sigctx;
+ SECKEYPrivateKey *privkey;
} sig;
struct {
- VFYContext *vfyctx;
- SECKEYPublicKey *pubkey;
+ VFYContext *vfyctx;
+ SECKEYPublicKey *pubkey;
} vfy;
} u;
-};
+};
/******************************************************************************
*
@@ -55,37 +55,37 @@ struct _xmlSecNssSignatureCtx {
* xmlSecNssSignatureCtx is located after xmlSecTransform
*
*****************************************************************************/
-#define xmlSecNssSignatureSize \
+#define xmlSecNssSignatureSize \
(sizeof(xmlSecTransform) + sizeof(xmlSecNssSignatureCtx))
#define xmlSecNssSignatureGetCtx(transform) \
((xmlSecNssSignatureCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-static int xmlSecNssSignatureCheckId (xmlSecTransformPtr transform);
-static int xmlSecNssSignatureInitialize (xmlSecTransformPtr transform);
-static void xmlSecNssSignatureFinalize (xmlSecTransformPtr transform);
-static int xmlSecNssSignatureSetKeyReq (xmlSecTransformPtr transform,
- xmlSecKeyReqPtr keyReq);
-static int xmlSecNssSignatureSetKey (xmlSecTransformPtr transform,
- xmlSecKeyPtr key);
-static int xmlSecNssSignatureVerify (xmlSecTransformPtr transform,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecNssSignatureExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecNssSignatureCheckId (xmlSecTransformPtr transform);
+static int xmlSecNssSignatureInitialize (xmlSecTransformPtr transform);
+static void xmlSecNssSignatureFinalize (xmlSecTransformPtr transform);
+static int xmlSecNssSignatureSetKeyReq (xmlSecTransformPtr transform,
+ xmlSecKeyReqPtr keyReq);
+static int xmlSecNssSignatureSetKey (xmlSecTransformPtr transform,
+ xmlSecKeyPtr key);
+static int xmlSecNssSignatureVerify (xmlSecTransformPtr transform,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecNssSignatureExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
static int
xmlSecNssSignatureCheckId(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_DSA
if(xmlSecTransformCheckId(transform, xmlSecNssTransformDsaSha1Id)) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_DSA */
#ifndef XMLSEC_NO_RSA
if(xmlSecTransformCheckId(transform, xmlSecNssTransformRsaSha1Id)) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_RSA */
@@ -105,32 +105,32 @@ xmlSecNssSignatureInitialize(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_DSA
if(xmlSecTransformCheckId(transform, xmlSecNssTransformDsaSha1Id)) {
- ctx->keyId = xmlSecNssKeyDataDsaId;
+ ctx->keyId = xmlSecNssKeyDataDsaId;
- /* This creates a signature which is ASN1 encoded */
- /*ctx->alg = SEC_OID_ANSIX9_DSA_SIGNATURE_WITH_SHA1_DIGEST;*/
+ /* This creates a signature which is ASN1 encoded */
+ /*ctx->alg = SEC_OID_ANSIX9_DSA_SIGNATURE_WITH_SHA1_DIGEST;*/
- /* Fortezza uses the same DSA signature format as XML does.
- * DSA and FORTEZZA keys are treated as equivalent keys for doing
- * DSA signatures (which is how they are supposed to be treated).
- */
- ctx->alg = SEC_OID_MISSI_DSS;
+ /* Fortezza uses the same DSA signature format as XML does.
+ * DSA and FORTEZZA keys are treated as equivalent keys for doing
+ * DSA signatures (which is how they are supposed to be treated).
+ */
+ ctx->alg = SEC_OID_MISSI_DSS;
} else
#endif /* XMLSEC_NO_DSA */
#ifndef XMLSEC_NO_RSA
if(xmlSecTransformCheckId(transform, xmlSecNssTransformRsaSha1Id)) {
- ctx->keyId = xmlSecNssKeyDataRsaId;
- ctx->alg = SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION;
+ ctx->keyId = xmlSecNssKeyDataRsaId;
+ ctx->alg = SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION;
} else
#endif /* XMLSEC_NO_RSA */
if(1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -148,15 +148,15 @@ xmlSecNssSignatureFinalize(xmlSecTransformPtr transform) {
xmlSecAssert(ctx != NULL);
if (transform->operation == xmlSecTransformOperationSign) {
- SGN_DestroyContext(ctx->u.sig.sigctx, PR_TRUE);
- if (ctx->u.sig.privkey) {
- SECKEY_DestroyPrivateKey(ctx->u.sig.privkey);
- }
+ SGN_DestroyContext(ctx->u.sig.sigctx, PR_TRUE);
+ if (ctx->u.sig.privkey) {
+ SECKEY_DestroyPrivateKey(ctx->u.sig.privkey);
+ }
} else {
- VFY_DestroyContext(ctx->u.vfy.vfyctx, PR_TRUE);
- if (ctx->u.vfy.pubkey) {
- SECKEY_DestroyPublicKey(ctx->u.vfy.pubkey);
- }
+ VFY_DestroyContext(ctx->u.vfy.vfyctx, PR_TRUE);
+ if (ctx->u.vfy.pubkey) {
+ SECKEY_DestroyPublicKey(ctx->u.vfy.pubkey);
+ }
}
memset(ctx, 0, sizeof(xmlSecNssSignatureCtx));
@@ -181,49 +181,49 @@ xmlSecNssSignatureSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
xmlSecAssert2(value != NULL, -1);
if (transform->operation == xmlSecTransformOperationSign) {
- if (ctx->u.sig.privkey)
- SECKEY_DestroyPrivateKey(ctx->u.sig.privkey);
- ctx->u.sig.privkey = xmlSecNssPKIKeyDataGetPrivKey(value);
- if(ctx->u.sig.privkey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecNssPKIKeyDataGetPrivKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- ctx->u.sig.sigctx = SGN_NewContext(ctx->alg, ctx->u.sig.privkey);
+ if (ctx->u.sig.privkey)
+ SECKEY_DestroyPrivateKey(ctx->u.sig.privkey);
+ ctx->u.sig.privkey = xmlSecNssPKIKeyDataGetPrivKey(value);
+ if(ctx->u.sig.privkey == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecNssPKIKeyDataGetPrivKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ ctx->u.sig.sigctx = SGN_NewContext(ctx->alg, ctx->u.sig.privkey);
if (ctx->u.sig.sigctx == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "SGN_NewContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "SGN_NewContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
}
} else {
- if (ctx->u.vfy.pubkey)
- SECKEY_DestroyPublicKey(ctx->u.vfy.pubkey);
- ctx->u.vfy.pubkey = xmlSecNssPKIKeyDataGetPubKey(value);
- if(ctx->u.vfy.pubkey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecNssPKIKeyDataGetPubKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- ctx->u.vfy.vfyctx = VFY_CreateContext(ctx->u.vfy.pubkey, NULL,
- ctx->alg, NULL);
- if (ctx->u.vfy.vfyctx == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "VFY_CreateContext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
+ if (ctx->u.vfy.pubkey)
+ SECKEY_DestroyPublicKey(ctx->u.vfy.pubkey);
+ ctx->u.vfy.pubkey = xmlSecNssPKIKeyDataGetPubKey(value);
+ if(ctx->u.vfy.pubkey == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecNssPKIKeyDataGetPubKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ ctx->u.vfy.vfyctx = VFY_CreateContext(ctx->u.vfy.pubkey, NULL,
+ ctx->alg, NULL);
+ if (ctx->u.vfy.vfyctx == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "VFY_CreateContext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
}
}
@@ -246,10 +246,10 @@ xmlSecNssSignatureSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr keyRe
keyReq->keyId = ctx->keyId;
if(transform->operation == xmlSecTransformOperationSign) {
keyReq->keyType = xmlSecKeyDataTypePrivate;
- keyReq->keyUsage = xmlSecKeyUsageSign;
+ keyReq->keyUsage = xmlSecKeyUsageSign;
} else {
keyReq->keyType = xmlSecKeyDataTypePublic;
- keyReq->keyUsage = xmlSecKeyUsageVerify;
+ keyReq->keyUsage = xmlSecKeyUsageVerify;
}
return(0);
}
@@ -257,8 +257,8 @@ xmlSecNssSignatureSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr keyRe
static int
xmlSecNssSignatureVerify(xmlSecTransformPtr transform,
- const xmlSecByte* data, xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx) {
+ const xmlSecByte* data, xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecNssSignatureCtxPtr ctx;
SECStatus status;
SECItem signature;
@@ -278,21 +278,21 @@ xmlSecNssSignatureVerify(xmlSecTransformPtr transform,
status = VFY_EndWithSignature(ctx->u.vfy.vfyctx, &signature);
if (status != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "VFY_Update, VFY_End",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
-
- if (PORT_GetError() == SEC_ERROR_PKCS7_BAD_SIGNATURE) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "VFY_End",
- XMLSEC_ERRORS_R_DATA_NOT_MATCH,
- "signature does not verify");
- transform->status = xmlSecTransformStatusFail;
- }
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "VFY_Update, VFY_End",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+
+ if (PORT_GetError() == SEC_ERROR_PKCS7_BAD_SIGNATURE) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "VFY_End",
+ XMLSEC_ERRORS_R_DATA_NOT_MATCH,
+ "signature does not verify");
+ transform->status = xmlSecTransformStatusFail;
+ }
+ return(-1);
}
transform->status = xmlSecTransformStatusOk;
@@ -324,129 +324,129 @@ xmlSecNssSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
ctx = xmlSecNssSignatureGetCtx(transform);
xmlSecAssert2(ctx != NULL, -1);
if(transform->operation == xmlSecTransformOperationSign) {
- xmlSecAssert2(ctx->u.sig.sigctx != NULL, -1);
- xmlSecAssert2(ctx->u.sig.privkey != NULL, -1);
+ xmlSecAssert2(ctx->u.sig.sigctx != NULL, -1);
+ xmlSecAssert2(ctx->u.sig.privkey != NULL, -1);
} else {
- xmlSecAssert2(ctx->u.vfy.vfyctx != NULL, -1);
- xmlSecAssert2(ctx->u.vfy.pubkey != NULL, -1);
+ xmlSecAssert2(ctx->u.vfy.vfyctx != NULL, -1);
+ xmlSecAssert2(ctx->u.vfy.pubkey != NULL, -1);
}
if(transform->status == xmlSecTransformStatusNone) {
- xmlSecAssert2(outSize == 0, -1);
-
- if(transform->operation == xmlSecTransformOperationSign) {
- status = SGN_Begin(ctx->u.sig.sigctx);
- if(status != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "SGN_Begin",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
- }
- } else {
- status = VFY_Begin(ctx->u.vfy.vfyctx);
- if(status != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "VFY_Begin",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
- }
- }
- transform->status = xmlSecTransformStatusWorking;
+ xmlSecAssert2(outSize == 0, -1);
+
+ if(transform->operation == xmlSecTransformOperationSign) {
+ status = SGN_Begin(ctx->u.sig.sigctx);
+ if(status != SECSuccess) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "SGN_Begin",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
+ }
+ } else {
+ status = VFY_Begin(ctx->u.vfy.vfyctx);
+ if(status != SECSuccess) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "VFY_Begin",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
+ }
+ }
+ transform->status = xmlSecTransformStatusWorking;
}
if((transform->status == xmlSecTransformStatusWorking) && (inSize > 0)) {
- xmlSecAssert2(outSize == 0, -1);
-
- if(transform->operation == xmlSecTransformOperationSign) {
- status = SGN_Update(ctx->u.sig.sigctx, xmlSecBufferGetData(in), inSize);
- if(status != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "SGN_Update",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
- }
- } else {
- status = VFY_Update(ctx->u.vfy.vfyctx, xmlSecBufferGetData(in), inSize);
- if(status != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "VFY_Update",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
- }
- }
-
- ret = xmlSecBufferRemoveHead(in, inSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ xmlSecAssert2(outSize == 0, -1);
+
+ if(transform->operation == xmlSecTransformOperationSign) {
+ status = SGN_Update(ctx->u.sig.sigctx, xmlSecBufferGetData(in), inSize);
+ if(status != SECSuccess) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "SGN_Update",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
+ }
+ } else {
+ status = VFY_Update(ctx->u.vfy.vfyctx, xmlSecBufferGetData(in), inSize);
+ if(status != SECSuccess) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "VFY_Update",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
+ }
+ }
+
+ ret = xmlSecBufferRemoveHead(in, inSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
if((transform->status == xmlSecTransformStatusWorking) && (last != 0)) {
- xmlSecAssert2(outSize == 0, -1);
- if(transform->operation == xmlSecTransformOperationSign) {
- memset(&signature, 0, sizeof(signature));
- status = SGN_End(ctx->u.sig.sigctx, &signature);
- if(status != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "SGN_End",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
- }
-
- outSize = signature.len;
- ret = xmlSecBufferSetMaxSize(out, outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize);
- PR_Free(signature.data);
- return(-1);
- }
-
- memcpy(xmlSecBufferGetData(out), signature.data, signature.len);
-
- ret = xmlSecBufferSetSize(out, outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize);
- PR_Free(signature.data);
- return(-1);
- }
- PR_Free(signature.data);
- }
- transform->status = xmlSecTransformStatusFinished;
+ xmlSecAssert2(outSize == 0, -1);
+ if(transform->operation == xmlSecTransformOperationSign) {
+ memset(&signature, 0, sizeof(signature));
+ status = SGN_End(ctx->u.sig.sigctx, &signature);
+ if(status != SECSuccess) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "SGN_End",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
+ }
+
+ outSize = signature.len;
+ ret = xmlSecBufferSetMaxSize(out, outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize);
+ PR_Free(signature.data);
+ return(-1);
+ }
+
+ memcpy(xmlSecBufferGetData(out), signature.data, signature.len);
+
+ ret = xmlSecBufferSetSize(out, outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize);
+ PR_Free(signature.data);
+ return(-1);
+ }
+ PR_Free(signature.data);
+ }
+ transform->status = xmlSecTransformStatusFinished;
}
if((transform->status == xmlSecTransformStatusWorking) || (transform->status == xmlSecTransformStatusFinished)) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
@@ -461,29 +461,29 @@ xmlSecNssSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
static xmlSecTransformKlass xmlSecNssDsaSha1Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecNssSignatureSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecNssSignatureSize, /* xmlSecSize objSize */
- xmlSecNameDsaSha1, /* const xmlChar* name; */
- xmlSecHrefDsaSha1, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameDsaSha1, /* const xmlChar* name; */
+ xmlSecHrefDsaSha1, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecNssSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecNssSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecNssSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecNssSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecNssSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecNssSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecNssSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecNssSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecNssSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecNssSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecNssSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecNssSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -508,29 +508,29 @@ xmlSecNssTransformDsaSha1GetKlass(void) {
***************************************************************************/
static xmlSecTransformKlass xmlSecNssRsaSha1Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecNssSignatureSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecNssSignatureSize, /* xmlSecSize objSize */
- xmlSecNameRsaSha1, /* const xmlChar* name; */
- xmlSecHrefRsaSha1, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameRsaSha1, /* const xmlChar* name; */
+ xmlSecHrefRsaSha1, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecNssSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecNssSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecNssSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecNssSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecNssSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecNssSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecNssSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecNssSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecNssSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecNssSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecNssSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecNssSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
diff --git a/src/nss/symkeys.c b/src/nss/symkeys.c
index fb23f4f..10b29a3 100644
--- a/src/nss/symkeys.c
+++ b/src/nss/symkeys.c
@@ -29,39 +29,39 @@
* Symmetic (binary) keys - just a wrapper for xmlSecKeyDataBinary
*
****************************************************************************/
-static int xmlSecNssSymKeyDataInitialize (xmlSecKeyDataPtr data);
-static int xmlSecNssSymKeyDataDuplicate (xmlSecKeyDataPtr dst,
- xmlSecKeyDataPtr src);
-static void xmlSecNssSymKeyDataFinalize (xmlSecKeyDataPtr data);
-static int xmlSecNssSymKeyDataXmlRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecNssSymKeyDataXmlWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecNssSymKeyDataBinRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- const xmlSecByte* buf,
- xmlSecSize bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecNssSymKeyDataBinWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlSecByte** buf,
- xmlSecSize* bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecNssSymKeyDataGenerate (xmlSecKeyDataPtr data,
- xmlSecSize sizeBits,
- xmlSecKeyDataType type);
-
-static xmlSecKeyDataType xmlSecNssSymKeyDataGetType (xmlSecKeyDataPtr data);
-static xmlSecSize xmlSecNssSymKeyDataGetSize (xmlSecKeyDataPtr data);
-static void xmlSecNssSymKeyDataDebugDump (xmlSecKeyDataPtr data,
- FILE* output);
-static void xmlSecNssSymKeyDataDebugXmlDump (xmlSecKeyDataPtr data,
- FILE* output);
-static int xmlSecNssSymKeyDataKlassCheck (xmlSecKeyDataKlass* klass);
+static int xmlSecNssSymKeyDataInitialize (xmlSecKeyDataPtr data);
+static int xmlSecNssSymKeyDataDuplicate (xmlSecKeyDataPtr dst,
+ xmlSecKeyDataPtr src);
+static void xmlSecNssSymKeyDataFinalize (xmlSecKeyDataPtr data);
+static int xmlSecNssSymKeyDataXmlRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssSymKeyDataXmlWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssSymKeyDataBinRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ const xmlSecByte* buf,
+ xmlSecSize bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssSymKeyDataBinWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlSecByte** buf,
+ xmlSecSize* bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssSymKeyDataGenerate (xmlSecKeyDataPtr data,
+ xmlSecSize sizeBits,
+ xmlSecKeyDataType type);
+
+static xmlSecKeyDataType xmlSecNssSymKeyDataGetType (xmlSecKeyDataPtr data);
+static xmlSecSize xmlSecNssSymKeyDataGetSize (xmlSecKeyDataPtr data);
+static void xmlSecNssSymKeyDataDebugDump (xmlSecKeyDataPtr data,
+ FILE* output);
+static void xmlSecNssSymKeyDataDebugXmlDump (xmlSecKeyDataPtr data,
+ FILE* output);
+static int xmlSecNssSymKeyDataKlassCheck (xmlSecKeyDataKlass* klass);
#define xmlSecNssSymKeyDataCheckId(data) \
(xmlSecKeyDataIsValid((data)) && \
@@ -92,7 +92,7 @@ xmlSecNssSymKeyDataFinalize(xmlSecKeyDataPtr data) {
static int
xmlSecNssSymKeyDataXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecAssert2(xmlSecNssSymKeyDataKlassCheck(id), -1);
return(xmlSecKeyDataBinaryValueXmlRead(id, key, node, keyInfoCtx));
@@ -100,7 +100,7 @@ xmlSecNssSymKeyDataXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
static int
xmlSecNssSymKeyDataXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecAssert2(xmlSecNssSymKeyDataKlassCheck(id), -1);
return(xmlSecKeyDataBinaryValueXmlWrite(id, key, node, keyInfoCtx));
@@ -108,8 +108,8 @@ xmlSecNssSymKeyDataXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
static int
xmlSecNssSymKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- const xmlSecByte* buf, xmlSecSize bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ const xmlSecByte* buf, xmlSecSize bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecAssert2(xmlSecNssSymKeyDataKlassCheck(id), -1);
return(xmlSecKeyDataBinaryValueBinRead(id, key, buf, bufSize, keyInfoCtx));
@@ -117,8 +117,8 @@ xmlSecNssSymKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
static int
xmlSecNssSymKeyDataBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlSecByte** buf, xmlSecSize* bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlSecByte** buf, xmlSecSize* bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecAssert2(xmlSecNssSymKeyDataKlassCheck(id), -1);
return(xmlSecKeyDataBinaryValueBinWrite(id, key, buf, bufSize, keyInfoCtx));
@@ -174,19 +174,19 @@ static int
xmlSecNssSymKeyDataKlassCheck(xmlSecKeyDataKlass* klass) {
#ifndef XMLSEC_NO_DES
if(klass == xmlSecNssKeyDataDesId) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_DES */
#ifndef XMLSEC_NO_AES
if(klass == xmlSecNssKeyDataAesId) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_AES */
#ifndef XMLSEC_NO_HMAC
if(klass == xmlSecNssKeyDataHmacId) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_HMAC */
@@ -206,35 +206,35 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataAesKlass = {
/* data */
xmlSecNameAESKeyValue,
xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefAESKeyValue, /* const xmlChar* href; */
- xmlSecNodeAESKeyValue, /* const xmlChar* dataNodeName; */
- xmlSecNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefAESKeyValue, /* const xmlChar* href; */
+ xmlSecNodeAESKeyValue, /* const xmlChar* dataNodeName; */
+ xmlSecNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecNssSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecNssSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecNssSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- xmlSecNssSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecNssSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecNssSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecNssSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ xmlSecNssSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecNssSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
- xmlSecNssSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecNssSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ xmlSecNssSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecNssSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecNssSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- xmlSecNssSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
- xmlSecNssSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecNssSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecNssSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ xmlSecNssSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
+ xmlSecNssSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecNssSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- xmlSecNssSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ xmlSecNssSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecNssSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -251,9 +251,9 @@ xmlSecNssKeyDataAesGetKlass(void) {
/**
* xmlSecNssKeyDataAesSet:
- * @data: the pointer to AES key data.
- * @buf: the pointer to key value.
- * @bufSize: the key value size (in bytes).
+ * @data: the pointer to AES key data.
+ * @buf: the pointer to key value.
+ * @bufSize: the key value size (in bytes).
*
* Sets the value of AES key data.
*
@@ -287,35 +287,35 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataDesKlass = {
/* data */
xmlSecNameDESKeyValue,
xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefDESKeyValue, /* const xmlChar* href; */
- xmlSecNodeDESKeyValue, /* const xmlChar* dataNodeName; */
- xmlSecNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefDESKeyValue, /* const xmlChar* href; */
+ xmlSecNodeDESKeyValue, /* const xmlChar* dataNodeName; */
+ xmlSecNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecNssSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecNssSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecNssSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- xmlSecNssSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecNssSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecNssSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecNssSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ xmlSecNssSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecNssSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
- xmlSecNssSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecNssSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ xmlSecNssSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecNssSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecNssSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- xmlSecNssSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
- xmlSecNssSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecNssSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecNssSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ xmlSecNssSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
+ xmlSecNssSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecNssSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- xmlSecNssSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ xmlSecNssSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecNssSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -332,9 +332,9 @@ xmlSecNssKeyDataDesGetKlass(void) {
/**
* xmlSecNssKeyDataDesSet:
- * @data: the pointer to DES key data.
- * @buf: the pointer to key value.
- * @bufSize: the key value size (in bytes).
+ * @data: the pointer to DES key data.
+ * @buf: the pointer to key value.
+ * @bufSize: the key value size (in bytes).
*
* Sets the value of DES key data.
*
@@ -369,35 +369,35 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataHmacKlass = {
/* data */
xmlSecNameHMACKeyValue,
xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefHMACKeyValue, /* const xmlChar* href; */
- xmlSecNodeHMACKeyValue, /* const xmlChar* dataNodeName; */
- xmlSecNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefHMACKeyValue, /* const xmlChar* href; */
+ xmlSecNodeHMACKeyValue, /* const xmlChar* dataNodeName; */
+ xmlSecNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecNssSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecNssSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecNssSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- xmlSecNssSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecNssSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecNssSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecNssSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ xmlSecNssSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecNssSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
- xmlSecNssSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecNssSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ xmlSecNssSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecNssSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecNssSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- xmlSecNssSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
- xmlSecNssSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecNssSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecNssSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ xmlSecNssSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
+ xmlSecNssSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecNssSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- xmlSecNssSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ xmlSecNssSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecNssSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -414,9 +414,9 @@ xmlSecNssKeyDataHmacGetKlass(void) {
/**
* xmlSecNssKeyDataHmacSet:
- * @data: the pointer to HMAC key data.
- * @buf: the pointer to key value.
- * @bufSize: the key value size (in bytes).
+ * @data: the pointer to HMAC key data.
+ * @buf: the pointer to key value.
+ * @bufSize: the key value size (in bytes).
*
* Sets the value of HMAC key data.
*
diff --git a/src/nss/x509.c b/src/nss/x509.c
index aea4012..a00a41c 100644
--- a/src/nss/x509.c
+++ b/src/nss/x509.c
@@ -45,84 +45,84 @@
/* workaround - NSS exports this but doesn't declare it */
extern CERTCertificate * __CERT_NewTempCertificate(CERTCertDBHandle *handle,
- SECItem *derCert,
- char *nickname,
- PRBool isperm,
- PRBool copyDER);
+ SECItem *derCert,
+ char *nickname,
+ PRBool isperm,
+ PRBool copyDER);
/*************************************************************************
*
* X509 utility functions
*
************************************************************************/
-static int xmlSecNssX509DataNodeRead (xmlSecKeyDataPtr data,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecNssX509CertificateNodeRead (xmlSecKeyDataPtr data,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecNssX509CertificateNodeWrite (CERTCertificate* cert,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecNssX509SubjectNameNodeRead (xmlSecKeyDataPtr data,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecNssX509SubjectNameNodeWrite (CERTCertificate* cert,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecNssX509IssuerSerialNodeRead (xmlSecKeyDataPtr data,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecNssX509IssuerSerialNodeWrite (CERTCertificate* cert,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecNssX509SKINodeRead (xmlSecKeyDataPtr data,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecNssX509SKINodeWrite (CERTCertificate* cert,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecNssX509CRLNodeRead (xmlSecKeyDataPtr data,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecNssX509CRLNodeWrite (CERTSignedCrl* crl,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecNssKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data,
- xmlSecKeyPtr key,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-
-static CERTCertificate* xmlSecNssX509CertDerRead (const xmlSecByte* buf,
- xmlSecSize size);
-static CERTCertificate* xmlSecNssX509CertBase64DerRead (xmlChar* buf);
-static xmlChar* xmlSecNssX509CertBase64DerWrite (CERTCertificate* cert,
- int base64LineWrap);
-static CERTSignedCrl* xmlSecNssX509CrlDerRead (xmlSecByte* buf,
- xmlSecSize size,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static CERTSignedCrl* xmlSecNssX509CrlBase64DerRead (xmlChar* buf,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static xmlChar* xmlSecNssX509CrlBase64DerWrite (CERTSignedCrl* crl,
- int base64LineWrap);
-static xmlChar* xmlSecNssX509NameWrite (CERTName* nm);
-static xmlChar* xmlSecNssASN1IntegerWrite (SECItem *num);
-static xmlChar* xmlSecNssX509SKIWrite (CERTCertificate* cert);
-static void xmlSecNssX509CertDebugDump (CERTCertificate* cert,
- FILE* output);
-static void xmlSecNssX509CertDebugXmlDump (CERTCertificate* cert,
- FILE* output);
-static int xmlSecNssX509CertGetTime (PRTime* t,
- time_t* res);
+static int xmlSecNssX509DataNodeRead (xmlSecKeyDataPtr data,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssX509CertificateNodeRead (xmlSecKeyDataPtr data,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssX509CertificateNodeWrite (CERTCertificate* cert,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssX509SubjectNameNodeRead (xmlSecKeyDataPtr data,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssX509SubjectNameNodeWrite (CERTCertificate* cert,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssX509IssuerSerialNodeRead (xmlSecKeyDataPtr data,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssX509IssuerSerialNodeWrite (CERTCertificate* cert,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssX509SKINodeRead (xmlSecKeyDataPtr data,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssX509SKINodeWrite (CERTCertificate* cert,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssX509CRLNodeRead (xmlSecKeyDataPtr data,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssX509CRLNodeWrite (CERTSignedCrl* crl,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data,
+ xmlSecKeyPtr key,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+
+static CERTCertificate* xmlSecNssX509CertDerRead (const xmlSecByte* buf,
+ xmlSecSize size);
+static CERTCertificate* xmlSecNssX509CertBase64DerRead (xmlChar* buf);
+static xmlChar* xmlSecNssX509CertBase64DerWrite (CERTCertificate* cert,
+ int base64LineWrap);
+static CERTSignedCrl* xmlSecNssX509CrlDerRead (xmlSecByte* buf,
+ xmlSecSize size,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static CERTSignedCrl* xmlSecNssX509CrlBase64DerRead (xmlChar* buf,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static xmlChar* xmlSecNssX509CrlBase64DerWrite (CERTSignedCrl* crl,
+ int base64LineWrap);
+static xmlChar* xmlSecNssX509NameWrite (CERTName* nm);
+static xmlChar* xmlSecNssASN1IntegerWrite (SECItem *num);
+static xmlChar* xmlSecNssX509SKIWrite (CERTCertificate* cert);
+static void xmlSecNssX509CertDebugDump (CERTCertificate* cert,
+ FILE* output);
+static void xmlSecNssX509CertDebugXmlDump (CERTCertificate* cert,
+ FILE* output);
+static int xmlSecNssX509CertGetTime (PRTime* t,
+ time_t* res);
/*************************************************************************
*
* Internal NSS X509 data CTX
*
************************************************************************/
-typedef struct _xmlSecNssX509DataCtx xmlSecNssX509DataCtx,
- *xmlSecNssX509DataCtxPtr;
+typedef struct _xmlSecNssX509DataCtx xmlSecNssX509DataCtx,
+ *xmlSecNssX509DataCtxPtr;
typedef struct _xmlSecNssX509CrlNode xmlSecNssX509CrlNode,
- *xmlSecNssX509CrlNodePtr;
+ *xmlSecNssX509CrlNodePtr;
struct _xmlSecNssX509CrlNode {
xmlSecNssX509CrlNodePtr next;
CERTSignedCrl *crl;
@@ -152,18 +152,18 @@ struct _xmlSecNssX509DataCtx {
* 1. At least one element, from the following set of element types; any of these may appear together or more than once iff (if and only if) each instance describes or is related to the same certificate:
* 2.
* * The X509IssuerSerial element, which contains an X.509 issuer
- * distinguished name/serial number pair that SHOULD be compliant
- * with RFC2253 [LDAP-DN],
+ * distinguished name/serial number pair that SHOULD be compliant
+ * with RFC2253 [LDAP-DN],
* * The X509SubjectName element, which contains an X.509 subject
- * distinguished name that SHOULD be compliant with RFC2253 [LDAP-DN],
+ * distinguished name that SHOULD be compliant with RFC2253 [LDAP-DN],
* * The X509SKI element, which contains the base64 encoded plain (i.e.
- * non-DER-encoded) value of a X509 V.3 SubjectKeyIdentifier extension.
+ * non-DER-encoded) value of a X509 V.3 SubjectKeyIdentifier extension.
* * The X509Certificate element, which contains a base64-encoded [X509v3]
- * certificate, and
+ * certificate, and
* * Elements from an external namespace which accompanies/complements any
- * of the elements above.
+ * of the elements above.
* * The X509CRL element, which contains a base64-encoded certificate
- * revocation list (CRL) [X509v3].
+ * revocation list (CRL) [X509v3].
*
* Any X509IssuerSerial, X509SKI, and X509SubjectName elements that appear
* MUST refer to the certificate or certificates containing the validation key.
@@ -227,30 +227,30 @@ struct _xmlSecNssX509DataCtx {
* xmlSecNssX509DataCtx is located after xmlSecTransform
*
*************************************************************************/
-#define xmlSecNssX509DataSize \
- (sizeof(xmlSecKeyData) + sizeof(xmlSecNssX509DataCtx))
+#define xmlSecNssX509DataSize \
+ (sizeof(xmlSecKeyData) + sizeof(xmlSecNssX509DataCtx))
#define xmlSecNssX509DataGetCtx(data) \
((xmlSecNssX509DataCtxPtr)(((xmlSecByte*)(data)) + sizeof(xmlSecKeyData)))
-static int xmlSecNssKeyDataX509Initialize (xmlSecKeyDataPtr data);
-static int xmlSecNssKeyDataX509Duplicate (xmlSecKeyDataPtr dst,
- xmlSecKeyDataPtr src);
-static void xmlSecNssKeyDataX509Finalize (xmlSecKeyDataPtr data);
-static int xmlSecNssKeyDataX509XmlRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecNssKeyDataX509XmlWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static xmlSecKeyDataType xmlSecNssKeyDataX509GetType (xmlSecKeyDataPtr data);
+static int xmlSecNssKeyDataX509Initialize (xmlSecKeyDataPtr data);
+static int xmlSecNssKeyDataX509Duplicate (xmlSecKeyDataPtr dst,
+ xmlSecKeyDataPtr src);
+static void xmlSecNssKeyDataX509Finalize (xmlSecKeyDataPtr data);
+static int xmlSecNssKeyDataX509XmlRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssKeyDataX509XmlWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static xmlSecKeyDataType xmlSecNssKeyDataX509GetType (xmlSecKeyDataPtr data);
static const xmlChar* xmlSecNssKeyDataX509GetIdentifier (xmlSecKeyDataPtr data);
-static void xmlSecNssKeyDataX509DebugDump (xmlSecKeyDataPtr data,
- FILE* output);
-static void xmlSecNssKeyDataX509DebugXmlDump(xmlSecKeyDataPtr data,
- FILE* output);
+static void xmlSecNssKeyDataX509DebugDump (xmlSecKeyDataPtr data,
+ FILE* output);
+static void xmlSecNssKeyDataX509DebugXmlDump(xmlSecKeyDataPtr data,
+ FILE* output);
@@ -261,35 +261,35 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataX509Klass = {
/* data */
xmlSecNameX509Data,
xmlSecKeyDataUsageKeyInfoNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefX509Data, /* const xmlChar* href; */
- xmlSecNodeX509Data, /* const xmlChar* dataNodeName; */
- xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefX509Data, /* const xmlChar* href; */
+ xmlSecNodeX509Data, /* const xmlChar* dataNodeName; */
+ xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecNssKeyDataX509Initialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecNssKeyDataX509Duplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecNssKeyDataX509Finalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- NULL, /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecNssKeyDataX509Initialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecNssKeyDataX509Duplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecNssKeyDataX509Finalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ NULL, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecNssKeyDataX509GetType, /* xmlSecKeyDataGetTypeMethod getType; */
- NULL, /* xmlSecKeyDataGetSizeMethod getSize; */
- xmlSecNssKeyDataX509GetIdentifier, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecNssKeyDataX509GetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ NULL, /* xmlSecKeyDataGetSizeMethod getSize; */
+ xmlSecNssKeyDataX509GetIdentifier, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecNssKeyDataX509XmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecNssKeyDataX509XmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- NULL, /* xmlSecKeyDataBinReadMethod binRead; */
- NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecNssKeyDataX509XmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecNssKeyDataX509XmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ NULL, /* xmlSecKeyDataBinReadMethod binRead; */
+ NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecNssKeyDataX509DebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- xmlSecNssKeyDataX509DebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ xmlSecNssKeyDataX509DebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecNssKeyDataX509DebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -306,7 +306,7 @@ xmlSecNssKeyDataX509GetKlass(void) {
/**
* xmlSecNssKeyDataX509GetKeyCert:
- * @data: the pointer to X509 key data.
+ * @data: the pointer to X509 key data.
*
* Gets the certificate from which the key was extracted.
*
@@ -327,8 +327,8 @@ xmlSecNssKeyDataX509GetKeyCert(xmlSecKeyDataPtr data) {
/**
* xmlSecNssKeyDataX509AdoptKeyCert:
- * @data: the pointer to X509 key data.
- * @cert: the pointer to NSS X509 certificate.
+ * @data: the pointer to X509 key data.
+ * @cert: the pointer to NSS X509 certificate.
*
* Sets the key's certificate in @data.
*
@@ -345,7 +345,7 @@ xmlSecNssKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data, CERTCertificate* cert) {
xmlSecAssert2(ctx != NULL, -1);
if(ctx->keyCert != NULL) {
- CERT_DestroyCertificate(ctx->keyCert);
+ CERT_DestroyCertificate(ctx->keyCert);
}
ctx->keyCert = cert;
return(0);
@@ -353,8 +353,8 @@ xmlSecNssKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data, CERTCertificate* cert) {
/**
* xmlSecNssKeyDataX509AdoptCert:
- * @data: the pointer to X509 key data.
- * @cert: the pointer to NSS X509 certificate.
+ * @data: the pointer to X509 key data.
+ * @cert: the pointer to NSS X509 certificate.
*
* Adds certificate to the X509 key data.
*
@@ -372,25 +372,25 @@ xmlSecNssKeyDataX509AdoptCert(xmlSecKeyDataPtr data, CERTCertificate* cert) {
xmlSecAssert2(ctx != NULL, -1);
if(ctx->certsList == NULL) {
- ctx->certsList = CERT_NewCertList();
- if(ctx->certsList == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "CERT_NewCertList",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
- }
+ ctx->certsList = CERT_NewCertList();
+ if(ctx->certsList == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "CERT_NewCertList",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
+ }
}
ret = CERT_AddCertToListTail(ctx->certsList, cert);
if(ret != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "CERT_AddCertToListTail",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "CERT_AddCertToListTail",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
}
ctx->numCerts++;
@@ -399,8 +399,8 @@ xmlSecNssKeyDataX509AdoptCert(xmlSecKeyDataPtr data, CERTCertificate* cert) {
/**
* xmlSecNssKeyDataX509GetCert:
- * @data: the pointer to X509 key data.
- * @pos: the desired certificate position.
+ * @data: the pointer to X509 key data.
+ * @pos: the desired certificate position.
*
* Gets a certificate from X509 key data.
*
@@ -422,7 +422,7 @@ xmlSecNssKeyDataX509GetCert(xmlSecKeyDataPtr data, xmlSecSize pos) {
head = CERT_LIST_HEAD(ctx->certsList);
while (pos > 0)
{
- head = CERT_LIST_NEXT(head);
+ head = CERT_LIST_NEXT(head);
pos--;
}
@@ -431,13 +431,13 @@ xmlSecNssKeyDataX509GetCert(xmlSecKeyDataPtr data, xmlSecSize pos) {
/**
* xmlSecNssKeyDataX509GetCertsSize:
- * @data: the pointer to X509 key data.
+ * @data: the pointer to X509 key data.
*
* Gets the number of certificates in @data.
*
* Returns: te number of certificates in @data.
*/
-xmlSecSize
+xmlSecSize
xmlSecNssKeyDataX509GetCertsSize(xmlSecKeyDataPtr data) {
xmlSecNssX509DataCtxPtr ctx;
@@ -451,8 +451,8 @@ xmlSecNssKeyDataX509GetCertsSize(xmlSecKeyDataPtr data) {
/**
* xmlSecNssKeyDataX509AdoptCrl:
- * @data: the pointer to X509 key data.
- * @crl: the pointer to NSS X509 CRL.
+ * @data: the pointer to X509 key data.
+ * @crl: the pointer to NSS X509 CRL.
*
* Adds CRL to the X509 key data.
*
@@ -472,12 +472,12 @@ xmlSecNssKeyDataX509AdoptCrl(xmlSecKeyDataPtr data, CERTSignedCrl* crl) {
crlnode = (xmlSecNssX509CrlNodePtr)PR_Malloc(sizeof(xmlSecNssX509CrlNode));
if(crlnode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "PR_Malloc",
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "PR_Malloc",
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
memset(crlnode, 0, sizeof(xmlSecNssX509CrlNode));
@@ -541,7 +541,7 @@ xmlSecNssKeyDataX509GetCrlsSize(xmlSecKeyDataPtr data) {
return(ctx->numCrls);
}
-static int
+static int
xmlSecNssKeyDataX509Initialize(xmlSecKeyDataPtr data) {
xmlSecNssX509DataCtxPtr ctx;
@@ -569,39 +569,39 @@ xmlSecNssKeyDataX509Duplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
/* copy certsList */
size = xmlSecNssKeyDataX509GetCertsSize(src);
for(pos = 0; pos < size; ++pos) {
- /* TBD: function below does linear scan, eliminate loop within
- * loop
- */
- certSrc = xmlSecNssKeyDataX509GetCert(src, pos);
- if(certSrc == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(src)),
- "xmlSecNssKeyDataX509GetCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
-
- certDst = CERT_DupCertificate(certSrc);
- if(certDst == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "CERT_DupCertificate",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
- }
-
- ret = xmlSecNssKeyDataX509AdoptCert(dst, certDst);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "xmlSecNssKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CERT_DestroyCertificate(certDst);
- return(-1);
- }
+ /* TBD: function below does linear scan, eliminate loop within
+ * loop
+ */
+ certSrc = xmlSecNssKeyDataX509GetCert(src, pos);
+ if(certSrc == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(src)),
+ "xmlSecNssKeyDataX509GetCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+
+ certDst = CERT_DupCertificate(certSrc);
+ if(certDst == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "CERT_DupCertificate",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
+ }
+
+ ret = xmlSecNssKeyDataX509AdoptCert(dst, certDst);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "xmlSecNssKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CERT_DestroyCertificate(certDst);
+ return(-1);
+ }
}
/* copy crls */
@@ -617,10 +617,10 @@ xmlSecNssKeyDataX509Duplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
return(-1);
}
- /* TBD: SEC_DupCrl isn't exported by NSS yet */
- /*crlDst = SEC_DupCrl(crlSrc);*/
- crlDst = crlSrc;
- PR_AtomicIncrement(&(crlSrc->referenceCount));
+ /* TBD: SEC_DupCrl isn't exported by NSS yet */
+ /*crlDst = SEC_DupCrl(crlSrc);*/
+ crlDst = crlSrc;
+ PR_AtomicIncrement(&(crlSrc->referenceCount));
if(crlDst == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
@@ -646,25 +646,25 @@ xmlSecNssKeyDataX509Duplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
/* copy key cert if exist */
certSrc = xmlSecNssKeyDataX509GetKeyCert(src);
if(certSrc != NULL) {
- certDst = CERT_DupCertificate(certSrc);
- if(certDst == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "CERT_DupCertificate",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(-1);
- }
- ret = xmlSecNssKeyDataX509AdoptKeyCert(dst, certDst);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "xmlSecNssKeyDataX509AdoptKeyCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CERT_DestroyCertificate(certDst);
- return(-1);
- }
+ certDst = CERT_DupCertificate(certSrc);
+ if(certDst == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "CERT_DupCertificate",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(-1);
+ }
+ ret = xmlSecNssKeyDataX509AdoptKeyCert(dst, certDst);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "xmlSecNssKeyDataX509AdoptKeyCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CERT_DestroyCertificate(certDst);
+ return(-1);
+ }
}
return(0);
}
@@ -679,25 +679,25 @@ xmlSecNssKeyDataX509Finalize(xmlSecKeyDataPtr data) {
xmlSecAssert(ctx != NULL);
if(ctx->certsList != NULL) {
- CERT_DestroyCertList(ctx->certsList);
+ CERT_DestroyCertList(ctx->certsList);
}
if(ctx->crlsList != NULL) {
- xmlSecNssX509CrlNodePtr head;
- xmlSecNssX509CrlNodePtr tmp;
-
- head = ctx->crlsList;
- while (head)
- {
- tmp = head->next;
- SEC_DestroyCrl(head->crl);
- PR_Free(head);
- head = tmp;
- }
+ xmlSecNssX509CrlNodePtr head;
+ xmlSecNssX509CrlNodePtr tmp;
+
+ head = ctx->crlsList;
+ while (head)
+ {
+ tmp = head->next;
+ SEC_DestroyCrl(head->crl);
+ PR_Free(head);
+ head = tmp;
+ }
}
if(ctx->keyCert != NULL) {
- CERT_DestroyCertificate(ctx->keyCert);
+ CERT_DestroyCertificate(ctx->keyCert);
}
memset(ctx, 0, sizeof(xmlSecNssX509DataCtx));
@@ -705,7 +705,7 @@ xmlSecNssKeyDataX509Finalize(xmlSecKeyDataPtr data) {
static int
xmlSecNssKeyDataX509XmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyDataPtr data;
int ret;
@@ -716,33 +716,33 @@ xmlSecNssKeyDataX509XmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
data = xmlSecKeyEnsureData(key, id);
if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyEnsureData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyEnsureData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecNssX509DataNodeRead(data, node, keyInfoCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssX509DataNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssX509DataNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS) == 0) {
ret = xmlSecNssKeyDataX509VerifyAndExtractKey(data, key, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssKeyDataX509VerifyAndExtractKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssKeyDataX509VerifyAndExtractKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
}
return(0);
@@ -750,14 +750,14 @@ xmlSecNssKeyDataX509XmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
static int
xmlSecNssKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyDataPtr data;
CERTCertificate* cert;
CERTSignedCrl* crl;
xmlSecSize size, pos;
int content = 0;
int ret;
-
+
xmlSecAssert2(id == xmlSecNssKeyDataX509Id, -1);
xmlSecAssert2(key != NULL, -1);
xmlSecAssert2(node != NULL, -1);
@@ -765,110 +765,110 @@ xmlSecNssKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
content = xmlSecX509DataGetNodeContent (node, 1, keyInfoCtx);
if (content < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecX509DataGetNodeContent",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "content=%d", content);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecX509DataGetNodeContent",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "content=%d", content);
+ return(-1);
} else if(content == 0) {
- /* by default we are writing certificates and crls */
- content = XMLSEC_X509DATA_DEFAULT;
+ /* by default we are writing certificates and crls */
+ content = XMLSEC_X509DATA_DEFAULT;
}
/* get x509 data */
data = xmlSecKeyGetData(key, id);
if(data == NULL) {
- /* no x509 data in the key */
- return(0);
+ /* no x509 data in the key */
+ return(0);
}
/* write certs */
size = xmlSecNssKeyDataX509GetCertsSize(data);
for(pos = 0; pos < size; ++pos) {
- cert = xmlSecNssKeyDataX509GetCert(data, pos);
- if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssKeyDataX509GetCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
-
- if((content & XMLSEC_X509DATA_CERTIFICATE_NODE) != 0) {
- ret = xmlSecNssX509CertificateNodeWrite(cert, node, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssX509CertificateNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
- }
-
- if((content & XMLSEC_X509DATA_SUBJECTNAME_NODE) != 0) {
- ret = xmlSecNssX509SubjectNameNodeWrite(cert, node, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssX509SubjectNameNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
- }
-
- if((content & XMLSEC_X509DATA_ISSUERSERIAL_NODE) != 0) {
- ret = xmlSecNssX509IssuerSerialNodeWrite(cert, node, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssX509IssuerSerialNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
- }
-
- if((content & XMLSEC_X509DATA_SKI_NODE) != 0) {
- ret = xmlSecNssX509SKINodeWrite(cert, node, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssX509SKINodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
- }
+ cert = xmlSecNssKeyDataX509GetCert(data, pos);
+ if(cert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssKeyDataX509GetCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+
+ if((content & XMLSEC_X509DATA_CERTIFICATE_NODE) != 0) {
+ ret = xmlSecNssX509CertificateNodeWrite(cert, node, keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssX509CertificateNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+ }
+
+ if((content & XMLSEC_X509DATA_SUBJECTNAME_NODE) != 0) {
+ ret = xmlSecNssX509SubjectNameNodeWrite(cert, node, keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssX509SubjectNameNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+ }
+
+ if((content & XMLSEC_X509DATA_ISSUERSERIAL_NODE) != 0) {
+ ret = xmlSecNssX509IssuerSerialNodeWrite(cert, node, keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssX509IssuerSerialNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+ }
+
+ if((content & XMLSEC_X509DATA_SKI_NODE) != 0) {
+ ret = xmlSecNssX509SKINodeWrite(cert, node, keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssX509SKINodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+ }
}
/* write crls if needed */
if((content & XMLSEC_X509DATA_CRL_NODE) != 0) {
- size = xmlSecNssKeyDataX509GetCrlsSize(data);
- for(pos = 0; pos < size; ++pos) {
- crl = xmlSecNssKeyDataX509GetCrl(data, pos);
- if(crl == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssKeyDataX509GetCrl",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
-
- ret = xmlSecNssX509CRLNodeWrite(crl, node, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssX509CRLNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
- }
+ size = xmlSecNssKeyDataX509GetCrlsSize(data);
+ for(pos = 0; pos < size; ++pos) {
+ crl = xmlSecNssKeyDataX509GetCrl(data, pos);
+ if(crl == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssKeyDataX509GetCrl",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+
+ ret = xmlSecNssX509CRLNodeWrite(crl, node, keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssX509CRLNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+ }
}
return(0);
@@ -901,23 +901,23 @@ xmlSecNssKeyDataX509DebugDump(xmlSecKeyDataPtr data, FILE* output) {
fprintf(output, "=== X509 Data:\n");
cert = xmlSecNssKeyDataX509GetKeyCert(data);
if(cert != NULL) {
- fprintf(output, "==== Key Certificate:\n");
- xmlSecNssX509CertDebugDump(cert, output);
+ fprintf(output, "==== Key Certificate:\n");
+ xmlSecNssX509CertDebugDump(cert, output);
}
size = xmlSecNssKeyDataX509GetCertsSize(data);
for(pos = 0; pos < size; ++pos) {
- cert = xmlSecNssKeyDataX509GetCert(data, pos);
- if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecNssKeyDataX509GetCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return;
- }
- fprintf(output, "==== Certificate:\n");
- xmlSecNssX509CertDebugDump(cert, output);
+ cert = xmlSecNssKeyDataX509GetCert(data, pos);
+ if(cert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecNssKeyDataX509GetCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return;
+ }
+ fprintf(output, "==== Certificate:\n");
+ xmlSecNssX509CertDebugDump(cert, output);
}
/* we don't print out crls */
@@ -934,25 +934,25 @@ xmlSecNssKeyDataX509DebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
fprintf(output, "<X509Data>\n");
cert = xmlSecNssKeyDataX509GetKeyCert(data);
if(cert != NULL) {
- fprintf(output, "<KeyCertificate>\n");
- xmlSecNssX509CertDebugXmlDump(cert, output);
- fprintf(output, "</KeyCertificate>\n");
+ fprintf(output, "<KeyCertificate>\n");
+ xmlSecNssX509CertDebugXmlDump(cert, output);
+ fprintf(output, "</KeyCertificate>\n");
}
size = xmlSecNssKeyDataX509GetCertsSize(data);
for(pos = 0; pos < size; ++pos) {
- cert = xmlSecNssKeyDataX509GetCert(data, pos);
- if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecNssKeyDataX509GetCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return;
- }
- fprintf(output, "<Certificate>\n");
- xmlSecNssX509CertDebugXmlDump(cert, output);
- fprintf(output, "</Certificate>\n");
+ cert = xmlSecNssKeyDataX509GetCert(data, pos);
+ if(cert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecNssKeyDataX509GetCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return;
+ }
+ fprintf(output, "<Certificate>\n");
+ xmlSecNssX509CertDebugXmlDump(cert, output);
+ fprintf(output, "</Certificate>\n");
}
/* we don't print out crls */
@@ -969,43 +969,43 @@ xmlSecNssX509DataNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoC
xmlSecAssert2(keyInfoCtx != NULL, -1);
for(cur = xmlSecGetNextElementNode(node->children);
- cur != NULL;
- cur = xmlSecGetNextElementNode(cur->next)) {
-
- ret = 0;
- if(xmlSecCheckNodeName(cur, xmlSecNodeX509Certificate, xmlSecDSigNs)) {
- ret = xmlSecNssX509CertificateNodeRead(data, cur, keyInfoCtx);
- } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509SubjectName, xmlSecDSigNs)) {
- ret = xmlSecNssX509SubjectNameNodeRead(data, cur, keyInfoCtx);
- } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509IssuerSerial, xmlSecDSigNs)) {
- ret = xmlSecNssX509IssuerSerialNodeRead(data, cur, keyInfoCtx);
- } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509SKI, xmlSecDSigNs)) {
- ret = xmlSecNssX509SKINodeRead(data, cur, keyInfoCtx);
- } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509CRL, xmlSecDSigNs)) {
- ret = xmlSecNssX509CRLNodeRead(data, cur, keyInfoCtx);
- } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CHILD) != 0) {
- /* laxi schema validation: ignore unknown nodes */
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "read node failed");
- return(-1);
- }
+ cur != NULL;
+ cur = xmlSecGetNextElementNode(cur->next)) {
+
+ ret = 0;
+ if(xmlSecCheckNodeName(cur, xmlSecNodeX509Certificate, xmlSecDSigNs)) {
+ ret = xmlSecNssX509CertificateNodeRead(data, cur, keyInfoCtx);
+ } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509SubjectName, xmlSecDSigNs)) {
+ ret = xmlSecNssX509SubjectNameNodeRead(data, cur, keyInfoCtx);
+ } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509IssuerSerial, xmlSecDSigNs)) {
+ ret = xmlSecNssX509IssuerSerialNodeRead(data, cur, keyInfoCtx);
+ } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509SKI, xmlSecDSigNs)) {
+ ret = xmlSecNssX509SKINodeRead(data, cur, keyInfoCtx);
+ } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509CRL, xmlSecDSigNs)) {
+ ret = xmlSecNssX509CRLNodeRead(data, cur, keyInfoCtx);
+ } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CHILD) != 0) {
+ /* laxi schema validation: ignore unknown nodes */
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "read node failed");
+ return(-1);
+ }
}
return(0);
}
static int
-xmlSecNssX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+xmlSecNssX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlChar *content;
CERTCertificate* cert;
int ret;
@@ -1016,41 +1016,41 @@ xmlSecNssX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecK
content = xmlNodeGetContent(node);
if((content == NULL) || (xmlSecIsEmptyString(content) == 1)) {
- if(content != NULL) {
- xmlFree(content);
- }
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- return(0);
+ if(content != NULL) {
+ xmlFree(content);
+ }
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ return(0);
}
cert = xmlSecNssX509CertBase64DerRead(content);
if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecNssX509CertBase64DerRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(content);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecNssX509CertBase64DerRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(content);
+ return(-1);
}
ret = xmlSecNssKeyDataX509AdoptCert(data, cert);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecNssKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CERT_DestroyCertificate(cert);
- xmlFree(content);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecNssKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CERT_DestroyCertificate(cert);
+ xmlFree(content);
+ return(-1);
}
xmlFree(content);
@@ -1069,24 +1069,24 @@ xmlSecNssX509CertificateNodeWrite(CERTCertificate* cert, xmlNodePtr node, xmlSec
/* set base64 lines size from context */
buf = xmlSecNssX509CertBase64DerWrite(cert, keyInfoCtx->base64LineSize);
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssX509CertBase64DerWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssX509CertBase64DerWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
cur = xmlSecAddChild(node, xmlSecNodeX509Certificate, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509Certificate));
- xmlFree(buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509Certificate));
+ xmlFree(buf);
+ return(-1);
}
/* todo: add \n around base64 data - from context */
@@ -1097,8 +1097,8 @@ xmlSecNssX509CertificateNodeWrite(CERTCertificate* cert, xmlNodePtr node, xmlSec
return(0);
}
-static int
-xmlSecNssX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+static int
+xmlSecNssX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyDataStorePtr x509Store;
xmlChar* subject;
CERTCertificate* cert;
@@ -1111,58 +1111,58 @@ xmlSecNssX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecK
x509Store = xmlSecKeysMngrGetDataStore(keyInfoCtx->keysMngr, xmlSecNssX509StoreId);
if(x509Store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeysMngrGetDataStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeysMngrGetDataStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
subject = xmlNodeGetContent(node);
if((subject == NULL) || (xmlSecIsEmptyString(subject) == 1)) {
- if(subject != NULL) {
- xmlFree(subject);
- }
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- return(0);
+ if(subject != NULL) {
+ xmlFree(subject);
+ }
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ return(0);
}
cert = xmlSecNssX509StoreFindCert(x509Store, subject, NULL, NULL, NULL, keyInfoCtx);
if(cert == NULL){
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- NULL,
- XMLSEC_ERRORS_R_CERT_NOT_FOUND,
- "subject=%s",
- xmlSecErrorsSafeString(subject));
- xmlFree(subject);
- return(-1);
- }
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ NULL,
+ XMLSEC_ERRORS_R_CERT_NOT_FOUND,
+ "subject=%s",
+ xmlSecErrorsSafeString(subject));
+ xmlFree(subject);
+ return(-1);
+ }
- xmlFree(subject);
- return(0);
+ xmlFree(subject);
+ return(0);
}
ret = xmlSecNssKeyDataX509AdoptCert(data, cert);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecNssKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CERT_DestroyCertificate(cert);
- xmlFree(subject);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecNssKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CERT_DestroyCertificate(cert);
+ xmlFree(subject);
+ return(-1);
}
xmlFree(subject);
@@ -1179,24 +1179,24 @@ xmlSecNssX509SubjectNameNodeWrite(CERTCertificate* cert, xmlNodePtr node, xmlSec
buf = xmlSecNssX509NameWrite(&(cert->subject));
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssX509NameWrite(&(cert->subject))",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssX509NameWrite(&(cert->subject))",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecAddChild(node, xmlSecNodeX509SubjectName, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509SubjectName));
- xmlFree(buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509SubjectName));
+ xmlFree(buf);
+ return(-1);
}
xmlSecNodeEncodeAndSetContent(cur, buf);
xmlFree(buf);
@@ -1219,116 +1219,116 @@ xmlSecNssX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSec
x509Store = xmlSecKeysMngrGetDataStore(keyInfoCtx->keysMngr, xmlSecNssX509StoreId);
if(x509Store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeysMngrGetDataStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeysMngrGetDataStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecGetNextElementNode(node->children);
if(cur == NULL) {
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeX509IssuerName),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
- }
- return(0);
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeX509IssuerName),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
+ }
+ return(0);
}
/* the first is required node X509IssuerName */
if(!xmlSecCheckNodeName(cur, xmlSecNodeX509IssuerName, xmlSecDSigNs)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeX509IssuerName),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeX509IssuerName),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
}
issuerName = xmlNodeGetContent(cur);
if(issuerName == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509IssuerName));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509IssuerName));
+ return(-1);
}
cur = xmlSecGetNextElementNode(cur->next);
/* next is required node X509SerialNumber */
if((cur == NULL) || !xmlSecCheckNodeName(cur, xmlSecNodeX509SerialNumber, xmlSecDSigNs)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber));
- xmlFree(issuerName);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber));
+ xmlFree(issuerName);
+ return(-1);
}
issuerSerial = xmlNodeGetContent(cur);
if(issuerSerial == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- xmlFree(issuerName);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ xmlFree(issuerName);
+ return(-1);
}
cur = xmlSecGetNextElementNode(cur->next);
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(issuerSerial);
- xmlFree(issuerName);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(issuerSerial);
+ xmlFree(issuerName);
+ return(-1);
}
cert = xmlSecNssX509StoreFindCert(x509Store, NULL, issuerName, issuerSerial, NULL, keyInfoCtx);
if(cert == NULL){
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- NULL,
- XMLSEC_ERRORS_R_CERT_NOT_FOUND,
- "issuerName=%s;issuerSerial=%s",
- xmlSecErrorsSafeString(issuerName),
- xmlSecErrorsSafeString(issuerSerial));
- xmlFree(issuerSerial);
- xmlFree(issuerName);
- return(-1);
- }
-
- xmlFree(issuerSerial);
- xmlFree(issuerName);
- return(0);
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ NULL,
+ XMLSEC_ERRORS_R_CERT_NOT_FOUND,
+ "issuerName=%s;issuerSerial=%s",
+ xmlSecErrorsSafeString(issuerName),
+ xmlSecErrorsSafeString(issuerSerial));
+ xmlFree(issuerSerial);
+ xmlFree(issuerName);
+ return(-1);
+ }
+
+ xmlFree(issuerSerial);
+ xmlFree(issuerName);
+ return(0);
}
ret = xmlSecNssKeyDataX509AdoptCert(data, cert);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecNssKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CERT_DestroyCertificate(cert);
- xmlFree(issuerSerial);
- xmlFree(issuerName);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecNssKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CERT_DestroyCertificate(cert);
+ xmlFree(issuerSerial);
+ xmlFree(issuerName);
+ return(-1);
}
xmlFree(issuerSerial);
@@ -1349,58 +1349,58 @@ xmlSecNssX509IssuerSerialNodeWrite(CERTCertificate* cert, xmlNodePtr node, xmlSe
/* create xml nodes */
cur = xmlSecAddChild(node, xmlSecNodeX509IssuerSerial, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509IssuerSerial));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509IssuerSerial));
+ return(-1);
}
issuerNameNode = xmlSecAddChild(cur, xmlSecNodeX509IssuerName, xmlSecDSigNs);
if(issuerNameNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509IssuerName));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509IssuerName));
+ return(-1);
}
issuerNumberNode = xmlSecAddChild(cur, xmlSecNodeX509SerialNumber, xmlSecDSigNs);
if(issuerNumberNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber));
+ return(-1);
}
/* write data */
buf = xmlSecNssX509NameWrite(&(cert->issuer));
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssX509NameWrite(&(cert->issuer))",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssX509NameWrite(&(cert->issuer))",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
xmlSecNodeEncodeAndSetContent(issuerNameNode, buf);
xmlFree(buf);
buf = xmlSecNssASN1IntegerWrite(&(cert->serialNumber));
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssASN1IntegerWrite(&(cert->serialNumber))",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssASN1IntegerWrite(&(cert->serialNumber))",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
xmlNodeSetContent(issuerNumberNode, buf);
xmlFree(buf);
@@ -1422,57 +1422,57 @@ xmlSecNssX509SKINodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCt
x509Store = xmlSecKeysMngrGetDataStore(keyInfoCtx->keysMngr, xmlSecNssX509StoreId);
if(x509Store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeysMngrGetDataStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeysMngrGetDataStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ski = xmlNodeGetContent(node);
if((ski == NULL) || (xmlSecIsEmptyString(ski) == 1)) {
- if(ski != NULL) {
- xmlFree(ski);
- }
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509SKI));
- return(-1);
- }
- return(0);
+ if(ski != NULL) {
+ xmlFree(ski);
+ }
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509SKI));
+ return(-1);
+ }
+ return(0);
}
cert = xmlSecNssX509StoreFindCert(x509Store, NULL, NULL, NULL, ski, keyInfoCtx);
if(cert == NULL){
- xmlFree(ski);
+ xmlFree(ski);
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- NULL,
- XMLSEC_ERRORS_R_CERT_NOT_FOUND,
- "ski=%s",
- xmlSecErrorsSafeString(ski));
- return(-1);
- }
- return(0);
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ NULL,
+ XMLSEC_ERRORS_R_CERT_NOT_FOUND,
+ "ski=%s",
+ xmlSecErrorsSafeString(ski));
+ return(-1);
+ }
+ return(0);
}
ret = xmlSecNssKeyDataX509AdoptCert(data, cert);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecNssKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CERT_DestroyCertificate(cert);
- xmlFree(ski);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecNssKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CERT_DestroyCertificate(cert);
+ xmlFree(ski);
+ return(-1);
}
xmlFree(ski);
@@ -1489,24 +1489,24 @@ xmlSecNssX509SKINodeWrite(CERTCertificate* cert, xmlNodePtr node, xmlSecKeyInfoC
buf = xmlSecNssX509SKIWrite(cert);
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssX509SKIWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssX509SKIWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecAddChild(node, xmlSecNodeX509SKI, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "new_node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509SKI));
- xmlFree(buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "new_node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509SKI));
+ xmlFree(buf);
+ return(-1);
}
xmlSecNodeEncodeAndSetContent(cur, buf);
xmlFree(buf);
@@ -1525,29 +1525,29 @@ xmlSecNssX509CRLNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCt
content = xmlNodeGetContent(node);
if((content == NULL) || (xmlSecIsEmptyString(content) == 1)) {
- if(content != NULL) {
- xmlFree(content);
- }
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- return(0);
+ if(content != NULL) {
+ xmlFree(content);
+ }
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ return(0);
}
crl = xmlSecNssX509CrlBase64DerRead(content, keyInfoCtx);
if(crl == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecNssX509CrlBase64DerRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(content);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecNssX509CrlBase64DerRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(content);
+ return(-1);
}
SEC_DestroyCrl(crl);
@@ -1567,24 +1567,24 @@ xmlSecNssX509CRLNodeWrite(CERTSignedCrl* crl, xmlNodePtr node, xmlSecKeyInfoCtxP
/* set base64 lines size from context */
buf = xmlSecNssX509CrlBase64DerWrite(crl, keyInfoCtx->base64LineSize);
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssX509CrlBase64DerWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssX509CrlBase64DerWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecAddChild(node, xmlSecNodeX509CRL, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "new_node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509CRL));
- xmlFree(buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "new_node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509CRL));
+ xmlFree(buf);
+ return(-1);
}
/* todo: add \n around base64 data - from context */
/* todo: add errors check */
@@ -1598,7 +1598,7 @@ xmlSecNssX509CRLNodeWrite(CERTSignedCrl* crl, xmlNodePtr node, xmlSecKeyInfoCtxP
static int
xmlSecNssKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr key,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecNssX509DataCtxPtr ctx;
xmlSecKeyDataStorePtr x509Store;
int ret;
@@ -1615,94 +1615,94 @@ xmlSecNssKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr key,
x509Store = xmlSecKeysMngrGetDataStore(keyInfoCtx->keysMngr, xmlSecNssX509StoreId);
if(x509Store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeysMngrGetDataStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeysMngrGetDataStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((ctx->keyCert == NULL) && (ctx->certsList != NULL) && (xmlSecKeyGetValue(key) == NULL)) {
- CERTCertificate* cert;
-
- cert = xmlSecNssX509StoreVerify(x509Store, ctx->certsList, keyInfoCtx);
- if(cert != NULL) {
- xmlSecKeyDataPtr keyValue;
-
- ctx->keyCert = CERT_DupCertificate(cert);
- if(ctx->keyCert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "CERT_DupCertificate",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- keyValue = xmlSecNssX509CertGetKey(ctx->keyCert);
- if(keyValue == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecNssX509CertGetKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- /* verify that the key matches our expectations */
- if(xmlSecKeyReqMatchKeyValue(&(keyInfoCtx->keyReq), keyValue) != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeyReqMatchKeyValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(keyValue);
- return(-1);
- }
-
- ret = xmlSecKeySetValue(key, keyValue);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(keyValue);
- return(-1);
- }
-
- status = CERT_GetCertTimes(ctx->keyCert, ¬Before, ¬After);
- if (status == SECSuccess) {
- ret = xmlSecNssX509CertGetTime(¬Before, &(key->notValidBefore));
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecNssX509CertGetTime",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "notValidBefore");
- return(-1);
- }
- ret = xmlSecNssX509CertGetTime(¬After, &(key->notValidAfter));
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecNssX509CertGetTime",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "notValidAfter");
- return(-1);
- }
- } else {
- key->notValidBefore = key->notValidAfter = 0;
- }
- } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_INVALID_CERT) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- NULL,
- XMLSEC_ERRORS_R_CERT_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ CERTCertificate* cert;
+
+ cert = xmlSecNssX509StoreVerify(x509Store, ctx->certsList, keyInfoCtx);
+ if(cert != NULL) {
+ xmlSecKeyDataPtr keyValue;
+
+ ctx->keyCert = CERT_DupCertificate(cert);
+ if(ctx->keyCert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "CERT_DupCertificate",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ keyValue = xmlSecNssX509CertGetKey(ctx->keyCert);
+ if(keyValue == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecNssX509CertGetKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ /* verify that the key matches our expectations */
+ if(xmlSecKeyReqMatchKeyValue(&(keyInfoCtx->keyReq), keyValue) != 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeyReqMatchKeyValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(keyValue);
+ return(-1);
+ }
+
+ ret = xmlSecKeySetValue(key, keyValue);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(keyValue);
+ return(-1);
+ }
+
+ status = CERT_GetCertTimes(ctx->keyCert, ¬Before, ¬After);
+ if (status == SECSuccess) {
+ ret = xmlSecNssX509CertGetTime(¬Before, &(key->notValidBefore));
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecNssX509CertGetTime",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "notValidBefore");
+ return(-1);
+ }
+ ret = xmlSecNssX509CertGetTime(¬After, &(key->notValidAfter));
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecNssX509CertGetTime",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "notValidAfter");
+ return(-1);
+ }
+ } else {
+ key->notValidBefore = key->notValidAfter = 0;
+ }
+ } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_INVALID_CERT) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ NULL,
+ XMLSEC_ERRORS_R_CERT_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
return(0);
}
@@ -1731,13 +1731,13 @@ xmlSecNssX509CertGetTime(PRTime* t, time_t* res) {
/**
* xmlSecNssX509CertGetKey:
- * @cert: the certificate.
+ * @cert: the certificate.
*
* Extracts public key from the @cert.
*
* Returns: public key value or NULL if an error occurs.
*/
-xmlSecKeyDataPtr
+xmlSecKeyDataPtr
xmlSecNssX509CertGetKey(CERTCertificate* cert) {
xmlSecKeyDataPtr data;
SECKEYPublicKey *pubkey = NULL;
@@ -1746,23 +1746,23 @@ xmlSecNssX509CertGetKey(CERTCertificate* cert) {
pubkey = CERT_ExtractPublicKey(cert);
if(pubkey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CERT_ExtractPublicKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CERT_ExtractPublicKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(NULL);
}
data = xmlSecNssPKIAdoptKey(NULL, pubkey);
if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssPKIAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- SECKEY_DestroyPublicKey(pubkey);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssPKIAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ SECKEY_DestroyPublicKey(pubkey);
+ return(NULL);
}
return(data);
@@ -1777,12 +1777,12 @@ xmlSecNssX509CertBase64DerRead(xmlChar* buf) {
/* usual trick with base64 decoding "in-place" */
ret = xmlSecBase64Decode(buf, (xmlSecByte*)buf, xmlStrlen(buf));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64Decode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64Decode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(xmlSecNssX509CertDerRead((xmlSecByte*)buf, ret));
@@ -1804,12 +1804,12 @@ xmlSecNssX509CertDerRead(const xmlSecByte* buf, xmlSecSize size) {
cert = __CERT_NewTempCertificate(CERT_GetDefaultCertDB(), &derCert,
NULL, PR_FALSE, PR_TRUE);
if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "__CERT_NewTempCertificate",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "__CERT_NewTempCertificate",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(NULL);
}
@@ -1823,26 +1823,26 @@ xmlSecNssX509CertBase64DerWrite(CERTCertificate* cert, int base64LineWrap) {
long size;
xmlSecAssert2(cert != NULL, NULL);
-
+
p = cert->derCert.data;
size = cert->derCert.len;
if((size <= 0) || (p == NULL)){
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "cert->derCert",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "cert->derCert",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ return(NULL);
}
res = xmlSecBase64Encode(p, size, base64LineWrap);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64Encode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64Encode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(res);
@@ -1850,7 +1850,7 @@ xmlSecNssX509CertBase64DerWrite(CERTCertificate* cert, int base64LineWrap) {
static CERTSignedCrl*
xmlSecNssX509CrlBase64DerRead(xmlChar* buf,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
int ret;
xmlSecAssert2(buf != NULL, NULL);
@@ -1858,12 +1858,12 @@ xmlSecNssX509CrlBase64DerRead(xmlChar* buf,
/* usual trick with base64 decoding "in-place" */
ret = xmlSecBase64Decode(buf, (xmlSecByte*)buf, xmlStrlen(buf));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64Decode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64Decode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(xmlSecNssX509CrlDerRead((xmlSecByte*)buf, ret, keyInfoCtx));
@@ -1872,7 +1872,7 @@ xmlSecNssX509CrlBase64DerRead(xmlChar* buf,
static CERTSignedCrl*
xmlSecNssX509CrlDerRead(xmlSecByte* buf, xmlSecSize size,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
CERTSignedCrl *crl = NULL;
SECItem derCrl;
PK11SlotInfo *slot = NULL;
@@ -1894,24 +1894,24 @@ xmlSecNssX509CrlDerRead(xmlSecByte* buf, xmlSecSize size,
NULL,
"xmlSecNssGetInternalKeySlot",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return NULL;
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return NULL;
}
if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_SKIP_STRICT_CHECKS) != 0)
- importOptions |= CRL_IMPORT_BYPASS_CHECKS;
+ importOptions |= CRL_IMPORT_BYPASS_CHECKS;
crl = PK11_ImportCRL(slot, &derCrl, NULL, SEC_CRL_TYPE, NULL,
- importOptions, NULL, CRL_DECODE_DEFAULT_OPTIONS);
+ importOptions, NULL, CRL_DECODE_DEFAULT_OPTIONS);
if(crl == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PK11_ImportCRL",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
- PK11_FreeSlot(slot);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PK11_ImportCRL",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "error code=%d", PORT_GetError());
+ PK11_FreeSlot(slot);
+ return(NULL);
}
PK11_FreeSlot(slot);
@@ -1960,22 +1960,22 @@ xmlSecNssX509NameWrite(CERTName* nm) {
str = CERT_NameToAscii(nm);
if (str == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CERT_NameToAscii",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "CERT_NameToAscii",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(NULL);
}
res = xmlStrdup(BAD_CAST str);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlStrdup",
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- PORT_Free(str);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlStrdup",
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ PORT_Free(str);
+ return(NULL);
}
PORT_Free(str);
return(res);
@@ -2005,24 +2005,24 @@ xmlSecNssX509SKIWrite(CERTCertificate* cert) {
rv = CERT_FindSubjectKeyIDExtension(cert, &ski);
if (rv != SECSuccess) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CERT_FindSubjectKeyIDExtension",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- SECITEM_FreeItem(&ski, PR_FALSE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CERT_FindSubjectKeyIDExtension",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ SECITEM_FreeItem(&ski, PR_FALSE);
+ return(NULL);
}
res = xmlSecBase64Encode(ski.data, ski.len, 0);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64Encode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- SECITEM_FreeItem(&ski, PR_FALSE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64Encode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ SECITEM_FreeItem(&ski, PR_FALSE);
+ return(NULL);
}
SECITEM_FreeItem(&ski, PR_FALSE);
@@ -2043,11 +2043,11 @@ xmlSecNssX509CertDebugDump(CERTCertificate* cert, FILE* output) {
sn = &cert->serialNumber;
for (i = 0; i < sn->len; i++) {
- if (i != sn->len - 1) {
- fprintf(output, "%02x:", sn->data[i]);
- } else {
- fprintf(output, "%02x", sn->data[i]);
- }
+ if (i != sn->len - 1) {
+ fprintf(output, "%02x:", sn->data[i]);
+ } else {
+ fprintf(output, "%02x", sn->data[i]);
+ }
}
fprintf(output, "\n");
}
@@ -2072,11 +2072,11 @@ xmlSecNssX509CertDebugXmlDump(CERTCertificate* cert, FILE* output) {
fprintf(output, "<SerialNumber>");
sn = &cert->serialNumber;
for (i = 0; i < sn->len; i++) {
- if (i != sn->len - 1) {
- fprintf(output, "%02x:", sn->data[i]);
- } else {
- fprintf(output, "%02x", sn->data[i]);
- }
+ if (i != sn->len - 1) {
+ fprintf(output, "%02x:", sn->data[i]);
+ } else {
+ fprintf(output, "%02x", sn->data[i]);
+ }
}
fprintf(output, "</SerialNumber>\n");
}
@@ -2088,11 +2088,11 @@ xmlSecNssX509CertDebugXmlDump(CERTCertificate* cert, FILE* output) {
*
*
*************************************************************************/
-static int xmlSecNssKeyDataRawX509CertBinRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- const xmlSecByte* buf,
- xmlSecSize bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecNssKeyDataRawX509CertBinRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ const xmlSecByte* buf,
+ xmlSecSize bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
static xmlSecKeyDataKlass xmlSecNssKeyDataRawX509CertKlass = {
sizeof(xmlSecKeyDataKlass),
@@ -2101,35 +2101,35 @@ static xmlSecKeyDataKlass xmlSecNssKeyDataRawX509CertKlass = {
/* data */
xmlSecNameRawX509Cert,
xmlSecKeyDataUsageRetrievalMethodNodeBin,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefRawX509Cert, /* const xmlChar* href; */
- NULL, /* const xmlChar* dataNodeName; */
- xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefRawX509Cert, /* const xmlChar* href; */
+ NULL, /* const xmlChar* dataNodeName; */
+ xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- NULL, /* xmlSecKeyDataInitializeMethod initialize; */
- NULL, /* xmlSecKeyDataDuplicateMethod duplicate; */
- NULL, /* xmlSecKeyDataFinalizeMethod finalize; */
- NULL, /* xmlSecKeyDataGenerateMethod generate; */
+ NULL, /* xmlSecKeyDataInitializeMethod initialize; */
+ NULL, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ NULL, /* xmlSecKeyDataFinalizeMethod finalize; */
+ NULL, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- NULL, /* xmlSecKeyDataGetTypeMethod getType; */
- NULL, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ NULL, /* xmlSecKeyDataGetTypeMethod getType; */
+ NULL, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- NULL, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- NULL, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- xmlSecNssKeyDataRawX509CertBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
- NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ NULL, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ NULL, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ xmlSecNssKeyDataRawX509CertBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
+ NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- NULL, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- NULL, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ NULL, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ NULL, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -2146,8 +2146,8 @@ xmlSecNssKeyDataRawX509CertGetKlass(void) {
static int
xmlSecNssKeyDataRawX509CertBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- const xmlSecByte* buf, xmlSecSize bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ const xmlSecByte* buf, xmlSecSize bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyDataPtr data;
CERTCertificate* cert;
int ret;
@@ -2160,44 +2160,44 @@ xmlSecNssKeyDataRawX509CertBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
cert = xmlSecNssX509CertDerRead(buf, bufSize);
if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssX509CertDerRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssX509CertDerRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
data = xmlSecKeyEnsureData(key, xmlSecNssKeyDataX509Id);
if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyEnsureData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CERT_DestroyCertificate(cert);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyEnsureData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CERT_DestroyCertificate(cert);
+ return(-1);
}
ret = xmlSecNssKeyDataX509AdoptCert(data, cert);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- CERT_DestroyCertificate(cert);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ CERT_DestroyCertificate(cert);
+ return(-1);
}
ret = xmlSecNssKeyDataX509VerifyAndExtractKey(data, key, keyInfoCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecNssKeyDataX509VerifyAndExtractKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecNssKeyDataX509VerifyAndExtractKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
diff --git a/src/nss/x509vfy.c b/src/nss/x509vfy.c
index 25bf504..42cfddd 100644
--- a/src/nss/x509vfy.c
+++ b/src/nss/x509vfy.c
@@ -40,11 +40,11 @@
* Internal NSS X509 store CTX
*
*************************************************************************/
-typedef struct _xmlSecNssX509StoreCtx xmlSecNssX509StoreCtx,
- *xmlSecNssX509StoreCtxPtr;
+typedef struct _xmlSecNssX509StoreCtx xmlSecNssX509StoreCtx,
+ *xmlSecNssX509StoreCtxPtr;
struct _xmlSecNssX509StoreCtx {
CERTCertList* certsList; /* just keeping a reference to destroy later */
-};
+};
/****************************************************************************
*
@@ -55,22 +55,22 @@ struct _xmlSecNssX509StoreCtx {
***************************************************************************/
#define xmlSecNssX509StoreGetCtx(store) \
((xmlSecNssX509StoreCtxPtr)(((xmlSecByte*)(store)) + \
- sizeof(xmlSecKeyDataStoreKlass)))
-#define xmlSecNssX509StoreSize \
+ sizeof(xmlSecKeyDataStoreKlass)))
+#define xmlSecNssX509StoreSize \
(sizeof(xmlSecKeyDataStoreKlass) + sizeof(xmlSecNssX509StoreCtx))
-static int xmlSecNssX509StoreInitialize (xmlSecKeyDataStorePtr store);
-static void xmlSecNssX509StoreFinalize (xmlSecKeyDataStorePtr store);
-static int xmlSecNssX509NameStringRead (xmlSecByte **str,
- int *strLen,
- xmlSecByte *res,
- int resLen,
- xmlSecByte delim,
- int ingoreTrailingSpaces);
-static xmlSecByte * xmlSecNssX509NameRead (xmlSecByte *str,
- int len);
+static int xmlSecNssX509StoreInitialize (xmlSecKeyDataStorePtr store);
+static void xmlSecNssX509StoreFinalize (xmlSecKeyDataStorePtr store);
+static int xmlSecNssX509NameStringRead (xmlSecByte **str,
+ int *strLen,
+ xmlSecByte *res,
+ int resLen,
+ xmlSecByte delim,
+ int ingoreTrailingSpaces);
+static xmlSecByte * xmlSecNssX509NameRead (xmlSecByte *str,
+ int len);
-static void xmlSecNssNumToItem(SECItem *it, unsigned long num);
+static void xmlSecNssNumToItem(SECItem *it, unsigned long num);
static xmlSecKeyDataStoreKlass xmlSecNssX509StoreKlass = {
@@ -78,21 +78,21 @@ static xmlSecKeyDataStoreKlass xmlSecNssX509StoreKlass = {
xmlSecNssX509StoreSize,
/* data */
- xmlSecNameX509Store, /* const xmlChar* name; */
+ xmlSecNameX509Store, /* const xmlChar* name; */
/* constructors/destructor */
- xmlSecNssX509StoreInitialize, /* xmlSecKeyDataStoreInitializeMethod initialize; */
- xmlSecNssX509StoreFinalize, /* xmlSecKeyDataStoreFinalizeMethod finalize; */
+ xmlSecNssX509StoreInitialize, /* xmlSecKeyDataStoreInitializeMethod initialize; */
+ xmlSecNssX509StoreFinalize, /* xmlSecKeyDataStoreFinalizeMethod finalize; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
-static CERTCertificate* xmlSecNssX509FindCert(xmlChar *subjectName,
- xmlChar *issuerName,
- xmlChar *issuerSerial,
- xmlChar *ski);
+static CERTCertificate* xmlSecNssX509FindCert(xmlChar *subjectName,
+ xmlChar *issuerName,
+ xmlChar *issuerSerial,
+ xmlChar *ski);
/**
@@ -109,12 +109,12 @@ xmlSecNssX509StoreGetKlass(void) {
/**
* xmlSecNssX509StoreFindCert:
- * @store: the pointer to X509 key data store klass.
- * @subjectName: the desired certificate name.
- * @issuerName: the desired certificate issuer name.
- * @issuerSerial: the desired certificate issuer serial number.
- * @ski: the desired certificate SKI.
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
+ * @store: the pointer to X509 key data store klass.
+ * @subjectName: the desired certificate name.
+ * @issuerName: the desired certificate issuer name.
+ * @issuerSerial: the desired certificate issuer serial number.
+ * @ski: the desired certificate SKI.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
*
* Searches @store for a certificate that matches given criteria.
*
@@ -123,8 +123,8 @@ xmlSecNssX509StoreGetKlass(void) {
*/
CERTCertificate *
xmlSecNssX509StoreFindCert(xmlSecKeyDataStorePtr store, xmlChar *subjectName,
- xmlChar *issuerName, xmlChar *issuerSerial,
- xmlChar *ski, xmlSecKeyInfoCtx* keyInfoCtx) {
+ xmlChar *issuerName, xmlChar *issuerSerial,
+ xmlChar *ski, xmlSecKeyInfoCtx* keyInfoCtx) {
xmlSecNssX509StoreCtxPtr ctx;
xmlSecAssert2(xmlSecKeyDataStoreCheckId(store, xmlSecNssX509StoreId), NULL);
@@ -138,17 +138,17 @@ xmlSecNssX509StoreFindCert(xmlSecKeyDataStorePtr store, xmlChar *subjectName,
/**
* xmlSecNssX509StoreVerify:
- * @store: the pointer to X509 key data store klass.
- * @certs: the untrusted certificates stack.
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
+ * @store: the pointer to X509 key data store klass.
+ * @certs: the untrusted certificates stack.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
*
* Verifies @certs list.
*
* Returns: pointer to the first verified certificate from @certs.
*/
-CERTCertificate *
+CERTCertificate *
xmlSecNssX509StoreVerify(xmlSecKeyDataStorePtr store, CERTCertList* certs,
- xmlSecKeyInfoCtx* keyInfoCtx) {
+ xmlSecKeyInfoCtx* keyInfoCtx) {
xmlSecNssX509StoreCtxPtr ctx;
CERTCertListNode* head;
CERTCertificate* cert = NULL;
@@ -169,86 +169,86 @@ xmlSecNssX509StoreVerify(xmlSecKeyDataStorePtr store, CERTCertList* certs,
!CERT_LIST_END(head, certs);
head = CERT_LIST_NEXT(head)) {
cert = head->cert;
- if(keyInfoCtx->certsVerificationTime > 0) {
- /* convert the time since epoch in seconds to microseconds */
- LL_UI2L(timeboundary, keyInfoCtx->certsVerificationTime);
- tmp1 = (int64)PR_USEC_PER_SEC;
- tmp2 = timeboundary;
- LL_MUL(timeboundary, tmp1, tmp2);
- } else {
- timeboundary = PR_Now();
- }
-
- /* if cert is the issuer of any other cert in the list, then it is
- * to be skipped */
- for (head1 = CERT_LIST_HEAD(certs);
- !CERT_LIST_END(head1, certs);
- head1 = CERT_LIST_NEXT(head1)) {
-
- cert1 = head1->cert;
- if (cert1 == cert) {
- continue;
- }
-
- if (SECITEM_CompareItem(&cert1->derIssuer, &cert->derSubject)
- == SECEqual) {
- break;
- }
- }
-
- if (!CERT_LIST_END(head1, certs)) {
- continue;
- }
-
- status = CERT_VerifyCertificate(CERT_GetDefaultCertDB(),
- cert, PR_FALSE,
- (SECCertificateUsage)0,
- timeboundary , NULL, NULL, NULL);
- if (status == SECSuccess) {
- break;
- }
+ if(keyInfoCtx->certsVerificationTime > 0) {
+ /* convert the time since epoch in seconds to microseconds */
+ LL_UI2L(timeboundary, keyInfoCtx->certsVerificationTime);
+ tmp1 = (int64)PR_USEC_PER_SEC;
+ tmp2 = timeboundary;
+ LL_MUL(timeboundary, tmp1, tmp2);
+ } else {
+ timeboundary = PR_Now();
+ }
+
+ /* if cert is the issuer of any other cert in the list, then it is
+ * to be skipped */
+ for (head1 = CERT_LIST_HEAD(certs);
+ !CERT_LIST_END(head1, certs);
+ head1 = CERT_LIST_NEXT(head1)) {
+
+ cert1 = head1->cert;
+ if (cert1 == cert) {
+ continue;
+ }
+
+ if (SECITEM_CompareItem(&cert1->derIssuer, &cert->derSubject)
+ == SECEqual) {
+ break;
+ }
+ }
+
+ if (!CERT_LIST_END(head1, certs)) {
+ continue;
+ }
+
+ status = CERT_VerifyCertificate(CERT_GetDefaultCertDB(),
+ cert, PR_FALSE,
+ (SECCertificateUsage)0,
+ timeboundary , NULL, NULL, NULL);
+ if (status == SECSuccess) {
+ break;
+ }
}
if (status == SECSuccess) {
- return (cert);
+ return (cert);
}
switch(PORT_GetError()) {
- case SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE:
- case SEC_ERROR_CA_CERT_INVALID:
- case SEC_ERROR_UNKNOWN_SIGNER:
+ case SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE:
+ case SEC_ERROR_CA_CERT_INVALID:
+ case SEC_ERROR_UNKNOWN_SIGNER:
xmlSecError(XMLSEC_ERRORS_HERE,
xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
NULL,
XMLSEC_ERRORS_R_CERT_ISSUER_FAILED,
"cert with subject name %s could not be verified because the issuer's cert is expired/invalid or not found",
cert->subjectName);
- break;
- case SEC_ERROR_EXPIRED_CERTIFICATE:
+ break;
+ case SEC_ERROR_EXPIRED_CERTIFICATE:
xmlSecError(XMLSEC_ERRORS_HERE,
xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
NULL,
XMLSEC_ERRORS_R_CERT_HAS_EXPIRED,
"cert with subject name %s has expired",
cert->subjectName);
- break;
- case SEC_ERROR_REVOKED_CERTIFICATE:
+ break;
+ case SEC_ERROR_REVOKED_CERTIFICATE:
xmlSecError(XMLSEC_ERRORS_HERE,
xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
NULL,
XMLSEC_ERRORS_R_CERT_REVOKED,
"cert with subject name %s has been revoked",
cert->subjectName);
- break;
- default:
+ break;
+ default:
xmlSecError(XMLSEC_ERRORS_HERE,
xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
NULL,
XMLSEC_ERRORS_R_CERT_VERIFY_FAILED,
- "cert with subject name %s could not be verified, errcode %d",
- cert->subjectName,
- PORT_GetError());
- break;
+ "cert with subject name %s could not be verified, errcode %d",
+ cert->subjectName,
+ PORT_GetError());
+ break;
}
return (NULL);
@@ -282,7 +282,7 @@ xmlSecNssX509StoreAdoptCert(xmlSecKeyDataStorePtr store, CERTCertificate* cert,
xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
"CERT_NewCertList",
XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
+ "error code=%d", PORT_GetError());
return(-1);
}
}
@@ -293,7 +293,7 @@ xmlSecNssX509StoreAdoptCert(xmlSecKeyDataStorePtr store, CERTCertificate* cert,
xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
"CERT_AddCertToListTail",
XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "error code=%d", PORT_GetError());
+ "error code=%d", PORT_GetError());
return(-1);
}
@@ -322,8 +322,8 @@ xmlSecNssX509StoreFinalize(xmlSecKeyDataStorePtr store) {
xmlSecAssert(ctx != NULL);
if (ctx->certsList) {
- CERT_DestroyCertList(ctx->certsList);
- ctx->certsList = NULL;
+ CERT_DestroyCertList(ctx->certsList);
+ ctx->certsList = NULL;
}
memset(ctx, 0, sizeof(xmlSecNssX509StoreCtx));
@@ -335,9 +335,9 @@ xmlSecNssX509StoreFinalize(xmlSecKeyDataStorePtr store) {
* Low-level x509 functions
*
*****************************************************************************/
-static CERTCertificate*
+static CERTCertificate*
xmlSecNssX509FindCert(xmlChar *subjectName, xmlChar *issuerName,
- xmlChar *issuerSerial, xmlChar *ski) {
+ xmlChar *issuerSerial, xmlChar *ski) {
CERTCertificate *cert = NULL;
xmlChar *p = NULL;
CERTName *name = NULL;
@@ -345,116 +345,116 @@ xmlSecNssX509FindCert(xmlChar *subjectName, xmlChar *issuerName,
PRArenaPool *arena = NULL;
if (subjectName != NULL) {
- p = xmlSecNssX509NameRead(subjectName, xmlStrlen(subjectName));
- if (p == NULL) {
+ p = xmlSecNssX509NameRead(subjectName, xmlStrlen(subjectName));
+ if (p == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
"xmlSecNssX509NameRead",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
"subject=%s",
xmlSecErrorsSafeString(subjectName));
- goto done;
- }
+ goto done;
+ }
- arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
- if (arena == NULL) {
+ arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
+ if (arena == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
"PORT_NewArena",
XMLSEC_ERRORS_R_CRYPTO_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
+ goto done;
+ }
- name = CERT_AsciiToName((char*)p);
- if (name == NULL) {
+ name = CERT_AsciiToName((char*)p);
+ if (name == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
"CERT_AsciiToName",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
+ goto done;
+ }
- nameitem = SEC_ASN1EncodeItem(arena, NULL, (void *)name,
- SEC_ASN1_GET(CERT_NameTemplate));
- if (nameitem == NULL) {
+ nameitem = SEC_ASN1EncodeItem(arena, NULL, (void *)name,
+ SEC_ASN1_GET(CERT_NameTemplate));
+ if (nameitem == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
"SEC_ASN1EncodeItem",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "error code=%d", PORT_GetError());
- goto done;
- }
+ "error code=%d", PORT_GetError());
+ goto done;
+ }
- cert = CERT_FindCertByName(CERT_GetDefaultCertDB(), nameitem);
- goto done;
+ cert = CERT_FindCertByName(CERT_GetDefaultCertDB(), nameitem);
+ goto done;
}
if((issuerName != NULL) && (issuerSerial != NULL)) {
- CERTIssuerAndSN issuerAndSN;
+ CERTIssuerAndSN issuerAndSN;
- p = xmlSecNssX509NameRead(issuerName, xmlStrlen(issuerName));
- if (p == NULL) {
+ p = xmlSecNssX509NameRead(issuerName, xmlStrlen(issuerName));
+ if (p == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
"xmlSecNssX509NameRead",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
"issuer=%s",
xmlSecErrorsSafeString(issuerName));
- goto done;
- }
+ goto done;
+ }
- arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
- if (arena == NULL) {
+ arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
+ if (arena == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
"PORT_NewArena",
XMLSEC_ERRORS_R_CRYPTO_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
+ goto done;
+ }
- name = CERT_AsciiToName((char*)p);
- if (name == NULL) {
+ name = CERT_AsciiToName((char*)p);
+ if (name == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
"CERT_AsciiToName",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
+ goto done;
+ }
- nameitem = SEC_ASN1EncodeItem(arena, NULL, (void *)name,
- SEC_ASN1_GET(CERT_NameTemplate));
- if (nameitem == NULL) {
+ nameitem = SEC_ASN1EncodeItem(arena, NULL, (void *)name,
+ SEC_ASN1_GET(CERT_NameTemplate));
+ if (nameitem == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
"SEC_ASN1EncodeItem",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "error code=%d", PORT_GetError());
- goto done;
- }
+ "error code=%d", PORT_GetError());
+ goto done;
+ }
- memset(&issuerAndSN, 0, sizeof(issuerAndSN));
+ memset(&issuerAndSN, 0, sizeof(issuerAndSN));
- issuerAndSN.derIssuer.data = nameitem->data;
- issuerAndSN.derIssuer.len = nameitem->len;
+ issuerAndSN.derIssuer.data = nameitem->data;
+ issuerAndSN.derIssuer.len = nameitem->len;
- /* TBD: serial num can be arbitrarily long */
- xmlSecNssNumToItem(&issuerAndSN.serialNumber, PORT_Atoi((char *)issuerSerial));
+ /* TBD: serial num can be arbitrarily long */
+ xmlSecNssNumToItem(&issuerAndSN.serialNumber, PORT_Atoi((char *)issuerSerial));
- cert = CERT_FindCertByIssuerAndSN(CERT_GetDefaultCertDB(),
- &issuerAndSN);
- SECITEM_FreeItem(&issuerAndSN.serialNumber, PR_FALSE);
- goto done;
+ cert = CERT_FindCertByIssuerAndSN(CERT_GetDefaultCertDB(),
+ &issuerAndSN);
+ SECITEM_FreeItem(&issuerAndSN.serialNumber, PR_FALSE);
+ goto done;
}
if(ski != NULL) {
- SECItem subjKeyID;
- int len;
+ SECItem subjKeyID;
+ int len;
- len = xmlSecBase64Decode(ski, (xmlSecByte*)ski, xmlStrlen(ski));
+ len = xmlSecBase64Decode(ski, (xmlSecByte*)ski, xmlStrlen(ski));
if(len < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
@@ -462,25 +462,25 @@ xmlSecNssX509FindCert(xmlChar *subjectName, xmlChar *issuerName,
XMLSEC_ERRORS_R_XMLSEC_FAILED,
"ski=%s",
xmlSecErrorsSafeString(ski));
- goto done;
+ goto done;
}
- memset(&subjKeyID, 0, sizeof(subjKeyID));
- subjKeyID.data = ski;
- subjKeyID.len = xmlStrlen(ski);
+ memset(&subjKeyID, 0, sizeof(subjKeyID));
+ subjKeyID.data = ski;
+ subjKeyID.len = xmlStrlen(ski);
cert = CERT_FindCertBySubjectKeyID(CERT_GetDefaultCertDB(),
- &subjKeyID);
+ &subjKeyID);
}
done:
if (p != NULL) {
- PORT_Free(p);
+ PORT_Free(p);
}
if (arena != NULL) {
- PORT_FreeArena(arena, PR_FALSE);
+ PORT_FreeArena(arena, PR_FALSE);
}
if (name != NULL) {
- CERT_DestroyName(name);
+ CERT_DestroyName(name);
}
return(cert);
@@ -499,95 +499,95 @@ xmlSecNssX509NameRead(xmlSecByte *str, int len) {
/* return string should be no longer than input string */
retval = (xmlSecByte *)PORT_Alloc(len+1);
if(retval == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PORT_Alloc",
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PORT_Alloc",
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
p = retval;
while(len > 0) {
- /* skip spaces after comma or semicolon */
- while((len > 0) && isspace(*str)) {
- ++str; --len;
- }
-
- nameLen = xmlSecNssX509NameStringRead(&str, &len, name, sizeof(name), '=', 0);
- if(nameLen < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssX509NameStringRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
- memcpy(p, name, nameLen);
- p+=nameLen;
- *p++='=';
- if(len > 0) {
- ++str; --len;
- if((*str) == '\"') {
- valueLen = xmlSecNssX509NameStringRead(&str, &len,
- value, sizeof(value), '"', 1);
- if(valueLen < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssX509NameStringRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
- /* skip spaces before comma or semicolon */
- while((len > 0) && isspace(*str)) {
- ++str; --len;
- }
- if((len > 0) && ((*str) != ',')) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "comma is expected");
- goto done;
- }
- if(len > 0) {
- ++str; --len;
- }
- *p++='\"';
- memcpy(p, value, valueLen);
- p+=valueLen;
- *p++='\"';
- } else if((*str) == '#') {
- /* TODO: read octect values */
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "reading octect values is not implemented yet");
- goto done;
- } else {
- valueLen = xmlSecNssX509NameStringRead(&str, &len,
- value, sizeof(value), ',', 1);
- if(valueLen < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNssX509NameStringRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
- memcpy(p, value, valueLen);
- p+=valueLen;
- if (len > 0)
- *p++=',';
- }
- } else {
- valueLen = 0;
- }
- if(len > 0) {
- ++str; --len;
- }
+ /* skip spaces after comma or semicolon */
+ while((len > 0) && isspace(*str)) {
+ ++str; --len;
+ }
+
+ nameLen = xmlSecNssX509NameStringRead(&str, &len, name, sizeof(name), '=', 0);
+ if(nameLen < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssX509NameStringRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
+ memcpy(p, name, nameLen);
+ p+=nameLen;
+ *p++='=';
+ if(len > 0) {
+ ++str; --len;
+ if((*str) == '\"') {
+ valueLen = xmlSecNssX509NameStringRead(&str, &len,
+ value, sizeof(value), '"', 1);
+ if(valueLen < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssX509NameStringRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
+ /* skip spaces before comma or semicolon */
+ while((len > 0) && isspace(*str)) {
+ ++str; --len;
+ }
+ if((len > 0) && ((*str) != ',')) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "comma is expected");
+ goto done;
+ }
+ if(len > 0) {
+ ++str; --len;
+ }
+ *p++='\"';
+ memcpy(p, value, valueLen);
+ p+=valueLen;
+ *p++='\"';
+ } else if((*str) == '#') {
+ /* TODO: read octect values */
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "reading octect values is not implemented yet");
+ goto done;
+ } else {
+ valueLen = xmlSecNssX509NameStringRead(&str, &len,
+ value, sizeof(value), ',', 1);
+ if(valueLen < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNssX509NameStringRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
+ memcpy(p, value, valueLen);
+ p+=valueLen;
+ if (len > 0)
+ *p++=',';
+ }
+ } else {
+ valueLen = 0;
+ }
+ if(len > 0) {
+ ++str; --len;
+ }
}
*p = 0;
@@ -600,8 +600,8 @@ done:
static int
xmlSecNssX509NameStringRead(xmlSecByte **str, int *strLen,
- xmlSecByte *res, int resLen,
- xmlSecByte delim, int ingoreTrailingSpaces) {
+ xmlSecByte *res, int resLen,
+ xmlSecByte delim, int ingoreTrailingSpaces) {
xmlSecByte *p, *q, *nonSpace;
xmlSecAssert2(str != NULL, -1);
@@ -611,45 +611,45 @@ xmlSecNssX509NameStringRead(xmlSecByte **str, int *strLen,
p = (*str);
nonSpace = q = res;
while(((p - (*str)) < (*strLen)) && ((*p) != delim) && ((q - res) < resLen)) {
- if((*p) != '\\') {
- if(ingoreTrailingSpaces && !isspace(*p)) {
- nonSpace = q;
- }
- *(q++) = *(p++);
- } else {
- ++p;
- nonSpace = q;
- if(xmlSecIsHex((*p))) {
- if((p - (*str) + 1) >= (*strLen)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "two hex digits expected");
- return(-1);
- }
- *(q++) = xmlSecGetHex(p[0]) * 16 + xmlSecGetHex(p[1]);
- p += 2;
- } else {
- if(((++p) - (*str)) >= (*strLen)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "escaped symbol missed");
- return(-1);
- }
- *(q++) = *(p++);
- }
- }
+ if((*p) != '\\') {
+ if(ingoreTrailingSpaces && !isspace(*p)) {
+ nonSpace = q;
+ }
+ *(q++) = *(p++);
+ } else {
+ ++p;
+ nonSpace = q;
+ if(xmlSecIsHex((*p))) {
+ if((p - (*str) + 1) >= (*strLen)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "two hex digits expected");
+ return(-1);
+ }
+ *(q++) = xmlSecGetHex(p[0]) * 16 + xmlSecGetHex(p[1]);
+ p += 2;
+ } else {
+ if(((++p) - (*str)) >= (*strLen)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "escaped symbol missed");
+ return(-1);
+ }
+ *(q++) = *(p++);
+ }
+ }
}
if(((p - (*str)) < (*strLen)) && ((*p) != delim)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "buffer is too small");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "buffer is too small");
+ return(-1);
}
(*strLen) -= (p - (*str));
(*str) = p;
diff --git a/src/openssl/app.c b/src/openssl/app.c
index 64f8342..cc0ff18 100644
--- a/src/openssl/app.c
+++ b/src/openssl/app.c
@@ -32,14 +32,14 @@
#include <xmlsec/openssl/evp.h>
#include <xmlsec/openssl/x509.h>
-static int xmlSecOpenSSLAppLoadRANDFile (const char *file);
-static int xmlSecOpenSSLAppSaveRANDFile (const char *file);
-static int xmlSecOpenSSLDefaultPasswordCallback(char *buf, int bufsiz, int verify, void *userdata);
+static int xmlSecOpenSSLAppLoadRANDFile (const char *file);
+static int xmlSecOpenSSLAppSaveRANDFile (const char *file);
+static int xmlSecOpenSSLDefaultPasswordCallback(char *buf, int bufsiz, int verify, void *userdata);
static int xmlSecOpenSSLDummyPasswordCallback (char *buf, int bufsize, int verify, void *userdata);
/**
* xmlSecOpenSSLAppInit:
- * @config: the path to certs.
+ * @config: the path to certs.
*
* General crypto engine initialization. This function is used
* by XMLSec command line utility and called before
@@ -54,21 +54,21 @@ xmlSecOpenSSLAppInit(const char* config) {
OpenSSL_add_all_algorithms();
if((RAND_status() != 1) && (xmlSecOpenSSLAppLoadRANDFile(NULL) != 1)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLAppLoadRANDFile",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLAppLoadRANDFile",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((config != NULL) && (xmlSecOpenSSLSetDefaultTrustedCertsFolder(BAD_CAST config) < 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLSetDefaultTrustedCertsFolder",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLSetDefaultTrustedCertsFolder",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -106,11 +106,11 @@ xmlSecOpenSSLAppShutdown(void) {
/**
* xmlSecOpenSSLAppKeyLoad:
- * @filename: the key filename.
- * @format: the key file format.
- * @pwd: the key file password.
- * @pwdCallback: the key password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @filename: the key filename.
+ * @format: the key file format.
+ * @pwd: the key file password.
+ * @pwdCallback: the key password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key from the a file.
*
@@ -118,8 +118,8 @@ xmlSecOpenSSLAppShutdown(void) {
*/
xmlSecKeyPtr
xmlSecOpenSSLAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
- const char *pwd, void* pwdCallback,
- void* pwdCallbackCtx) {
+ const char *pwd, void* pwdCallback,
+ void* pwdCallbackCtx) {
BIO* bio;
xmlSecKeyPtr key;
@@ -128,27 +128,27 @@ xmlSecOpenSSLAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
bio = BIO_new_file(filename, "rb");
if(bio == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BIO_new_file",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "filename=%s;errno=%d",
- xmlSecErrorsSafeString(filename),
- errno);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BIO_new_file",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "filename=%s;errno=%d",
+ xmlSecErrorsSafeString(filename),
+ errno);
+ return(NULL);
}
key = xmlSecOpenSSLAppKeyLoadBIO (bio, format, pwd, pwdCallback, pwdCallbackCtx);
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLAppKeyLoadBIO",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "filename=%s;errno=%d",
- xmlSecErrorsSafeString(filename),
- errno);
- BIO_free(bio);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLAppKeyLoadBIO",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "filename=%s;errno=%d",
+ xmlSecErrorsSafeString(filename),
+ errno);
+ BIO_free(bio);
+ return(NULL);
}
BIO_free(bio);
@@ -157,12 +157,12 @@ xmlSecOpenSSLAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
/**
* xmlSecOpenSSLAppKeyLoadMemory:
- * @data: the binary key data.
- * @dataSize: the size of binary key.
- * @format: the key file format.
- * @pwd: the key file password.
- * @pwdCallback: the key password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @data: the binary key data.
+ * @dataSize: the size of binary key.
+ * @format: the key file format.
+ * @pwd: the key file password.
+ * @pwdCallback: the key password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key from the memory buffer.
*
@@ -170,8 +170,8 @@ xmlSecOpenSSLAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
*/
xmlSecKeyPtr
xmlSecOpenSSLAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
- xmlSecKeyDataFormat format, const char *pwd,
- void* pwdCallback, void* pwdCallbackCtx) {
+ xmlSecKeyDataFormat format, const char *pwd,
+ void* pwdCallback, void* pwdCallbackCtx) {
BIO* bio;
xmlSecKeyPtr key;
@@ -181,24 +181,24 @@ xmlSecOpenSSLAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
/* this would be a read only BIO, cast from const is ok */
bio = BIO_new_mem_buf((void*)data, dataSize);
if(bio == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BIO_new_mem_buf",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "errno=%d",
- errno);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BIO_new_mem_buf",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "errno=%d",
+ errno);
+ return(NULL);
}
key = xmlSecOpenSSLAppKeyLoadBIO (bio, format, pwd, pwdCallback, pwdCallbackCtx);
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLAppKeyLoadBIO",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- BIO_free(bio);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLAppKeyLoadBIO",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ BIO_free(bio);
+ return(NULL);
}
BIO_free(bio);
@@ -208,11 +208,11 @@ xmlSecOpenSSLAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
/**
* xmlSecOpenSSLAppKeyLoadBIO:
- * @bio: the key BIO.
- * @format: the key file format.
- * @pwd: the key file password.
- * @pwdCallback: the key password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @bio: the key BIO.
+ * @format: the key file format.
+ * @pwd: the key file password.
+ * @pwdCallback: the key password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key from the an OpenSSL BIO object.
*
@@ -220,8 +220,8 @@ xmlSecOpenSSLAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
*/
xmlSecKeyPtr
xmlSecOpenSSLAppKeyLoadBIO(BIO* bio, xmlSecKeyDataFormat format,
- const char *pwd, void* pwdCallback,
- void* pwdCallbackCtx) {
+ const char *pwd, void* pwdCallback,
+ void* pwdCallbackCtx) {
xmlSecKeyPtr key = NULL;
xmlSecKeyDataPtr data;
@@ -234,133 +234,133 @@ xmlSecOpenSSLAppKeyLoadBIO(BIO* bio, xmlSecKeyDataFormat format,
switch(format) {
case xmlSecKeyDataFormatPem:
/* try to read private key first */
- pKey = PEM_read_bio_PrivateKey(bio, NULL,
+ pKey = PEM_read_bio_PrivateKey(bio, NULL,
(pwd != NULL) ? xmlSecOpenSSLDummyPasswordCallback : (pem_password_cb*)pwdCallback,
(pwd != NULL) ? pwd : pwdCallbackCtx);
if(pKey == NULL) {
- /* go to start of the file and try to read public key */
- BIO_reset(bio);
- pKey = PEM_read_bio_PUBKEY(bio, NULL, (pem_password_cb*)pwdCallback, pwdCallbackCtx);
- if(pKey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PEM_read_bio_PrivateKey and PEM_read_bio_PUBKEY",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
- }
- break;
+ /* go to start of the file and try to read public key */
+ BIO_reset(bio);
+ pKey = PEM_read_bio_PUBKEY(bio, NULL, (pem_password_cb*)pwdCallback, pwdCallbackCtx);
+ if(pKey == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PEM_read_bio_PrivateKey and PEM_read_bio_PUBKEY",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+ }
+ break;
case xmlSecKeyDataFormatDer:
/* try to read private key first */
- pKey = d2i_PrivateKey_bio(bio, NULL);
+ pKey = d2i_PrivateKey_bio(bio, NULL);
if(pKey == NULL) {
- /* go to start of the file and try to read public key */
- BIO_reset(bio);
- pKey = d2i_PUBKEY_bio(bio, NULL);
- if(pKey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "d2i_PrivateKey_bio and d2i_PUBKEY_bio",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
- }
- break;
+ /* go to start of the file and try to read public key */
+ BIO_reset(bio);
+ pKey = d2i_PUBKEY_bio(bio, NULL);
+ if(pKey == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "d2i_PrivateKey_bio and d2i_PUBKEY_bio",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+ }
+ break;
case xmlSecKeyDataFormatPkcs8Pem:
/* try to read private key first */
- pKey = PEM_read_bio_PrivateKey(bio, NULL, (pem_password_cb*)pwdCallback, pwdCallbackCtx);
+ pKey = PEM_read_bio_PrivateKey(bio, NULL, (pem_password_cb*)pwdCallback, pwdCallbackCtx);
if(pKey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PEM_read_bio_PrivateKey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
- break;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PEM_read_bio_PrivateKey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+ break;
case xmlSecKeyDataFormatPkcs8Der:
/* try to read private key first */
- pKey = d2i_PKCS8PrivateKey_bio(bio, NULL, (pem_password_cb*)pwdCallback, pwdCallbackCtx);
+ pKey = d2i_PKCS8PrivateKey_bio(bio, NULL, (pem_password_cb*)pwdCallback, pwdCallbackCtx);
if(pKey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "d2i_PrivateKey_bio and d2i_PUBKEY_bio",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
- break;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "d2i_PrivateKey_bio and d2i_PUBKEY_bio",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+ break;
#ifndef XMLSEC_NO_X509
case xmlSecKeyDataFormatPkcs12:
- key = xmlSecOpenSSLAppPkcs12LoadBIO(bio, pwd, pwdCallback, pwdCallbackCtx);
+ key = xmlSecOpenSSLAppPkcs12LoadBIO(bio, pwd, pwdCallback, pwdCallbackCtx);
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLAppPkcs12LoadBIO",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
- return(key);
-
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLAppPkcs12LoadBIO",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+ return(key);
+
case xmlSecKeyDataFormatCertPem:
case xmlSecKeyDataFormatCertDer:
- key = xmlSecOpenSSLAppKeyFromCertLoadBIO(bio, format);
+ key = xmlSecOpenSSLAppKeyFromCertLoadBIO(bio, format);
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLAppKeyFromCertLoadBIO",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
- return(key);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLAppKeyFromCertLoadBIO",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+ return(key);
#endif /* XMLSEC_NO_X509 */
default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_FORMAT,
- "format=%d", format);
- return(NULL);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_FORMAT,
+ "format=%d", format);
+ return(NULL);
+ }
data = xmlSecOpenSSLEvpKeyAdopt(pKey);
if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLEvpKeyAdopt",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- EVP_PKEY_free(pKey);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLEvpKeyAdopt",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ EVP_PKEY_free(pKey);
+ return(NULL);
}
key = xmlSecKeyCreate();
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(data);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(data);
+ return(NULL);
}
ret = xmlSecKeySetValue(key, data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)));
- xmlSecKeyDestroy(key);
- xmlSecKeyDataDestroy(data);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)));
+ xmlSecKeyDestroy(key);
+ xmlSecKeyDataDestroy(data);
+ return(NULL);
}
return(key);
@@ -368,19 +368,19 @@ xmlSecOpenSSLAppKeyLoadBIO(BIO* bio, xmlSecKeyDataFormat format,
#ifndef XMLSEC_NO_X509
-static X509* xmlSecOpenSSLAppCertLoadBIO (BIO* bio,
- xmlSecKeyDataFormat format);
+static X509* xmlSecOpenSSLAppCertLoadBIO (BIO* bio,
+ xmlSecKeyDataFormat format);
/**
* xmlSecOpenSSLAppKeyCertLoad:
- * @key: the pointer to key.
- * @filename: the certificate filename.
- * @format: the certificate file format.
+ * @key: the pointer to key.
+ * @filename: the certificate filename.
+ * @format: the certificate file format.
*
* Reads the certificate from $ filename and adds it to key.
*
* Returns: 0 on success or a negative value otherwise.
*/
-int
+int
xmlSecOpenSSLAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, xmlSecKeyDataFormat format) {
BIO* bio;
int ret;
@@ -391,27 +391,27 @@ xmlSecOpenSSLAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, xmlSecKeyDat
bio = BIO_new_file(filename, "rb");
if(bio == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BIO_new_file",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "filename=%s;errno=%d",
- xmlSecErrorsSafeString(filename),
- errno);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BIO_new_file",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "filename=%s;errno=%d",
+ xmlSecErrorsSafeString(filename),
+ errno);
+ return(-1);
}
ret = xmlSecOpenSSLAppKeyCertLoadBIO (key, bio, format);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLAppKeyCertLoadBIO",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "filename=%s;errno=%d",
- xmlSecErrorsSafeString(filename),
- errno);
- BIO_free(bio);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLAppKeyCertLoadBIO",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "filename=%s;errno=%d",
+ xmlSecErrorsSafeString(filename),
+ errno);
+ BIO_free(bio);
+ return(-1);
}
BIO_free(bio);
@@ -420,18 +420,18 @@ xmlSecOpenSSLAppKeyCertLoad(xmlSecKeyPtr key, const char* filename, xmlSecKeyDat
/**
* xmlSecOpenSSLAppKeyCertLoadMemory:
- * @key: the pointer to key.
- * @data: the certificate binary data.
- * @dataSize: the certificate binary data size.
- * @format: the certificate file format.
+ * @key: the pointer to key.
+ * @data: the certificate binary data.
+ * @dataSize: the certificate binary data size.
+ * @format: the certificate file format.
*
* Reads the certificate from memory buffer and adds it to key.
*
* Returns: 0 on success or a negative value otherwise.
*/
-int
+int
xmlSecOpenSSLAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSize dataSize,
- xmlSecKeyDataFormat format) {
+ xmlSecKeyDataFormat format) {
BIO* bio;
int ret;
@@ -442,24 +442,24 @@ xmlSecOpenSSLAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlS
/* this would be a read only BIO, cast from const is ok */
bio = BIO_new_mem_buf((void*)data, dataSize);
if(bio == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BIO_new_mem_buf",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "errno=%d",
- errno);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BIO_new_mem_buf",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "errno=%d",
+ errno);
+ return(-1);
}
ret = xmlSecOpenSSLAppKeyCertLoadBIO (key, bio, format);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLAppKeyCertLoadBIO",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- BIO_free(bio);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLAppKeyCertLoadBIO",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ BIO_free(bio);
+ return(-1);
}
BIO_free(bio);
@@ -468,15 +468,15 @@ xmlSecOpenSSLAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlS
/**
* xmlSecOpenSSLAppKeyCertLoadBIO:
- * @key: the pointer to key.
- * @bio: the certificate bio.
- * @format: the certificate file format.
+ * @key: the pointer to key.
+ * @bio: the certificate bio.
+ * @format: the certificate file format.
*
* Reads the certificate from memory buffer and adds it to key.
*
* Returns: 0 on success or a negative value otherwise.
*/
-int
+int
xmlSecOpenSSLAppKeyCertLoadBIO(xmlSecKeyPtr key, BIO* bio, xmlSecKeyDataFormat format) {
xmlSecKeyDataFormat certFormat;
@@ -490,47 +490,47 @@ xmlSecOpenSSLAppKeyCertLoadBIO(xmlSecKeyPtr key, BIO* bio, xmlSecKeyDataFormat f
data = xmlSecKeyEnsureData(key, xmlSecOpenSSLKeyDataX509Id);
if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyEnsureData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecOpenSSLKeyDataX509Id)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyEnsureData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecOpenSSLKeyDataX509Id)));
+ return(-1);
}
/* adjust cert format */
switch(format) {
case xmlSecKeyDataFormatPkcs8Pem:
- certFormat = xmlSecKeyDataFormatPem;
- break;
+ certFormat = xmlSecKeyDataFormatPem;
+ break;
case xmlSecKeyDataFormatPkcs8Der:
- certFormat = xmlSecKeyDataFormatDer;
- break;
+ certFormat = xmlSecKeyDataFormatDer;
+ break;
default:
- certFormat = format;
+ certFormat = format;
}
cert = xmlSecOpenSSLAppCertLoadBIO(bio, certFormat);
if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLAppCertLoad",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLAppCertLoad",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
ret = xmlSecOpenSSLKeyDataX509AdoptCert(data, cert);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)));
- X509_free(cert);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)));
+ X509_free(cert);
+ return(-1);
}
return(0);
@@ -538,10 +538,10 @@ xmlSecOpenSSLAppKeyCertLoadBIO(xmlSecKeyPtr key, BIO* bio, xmlSecKeyDataFormat f
/**
* xmlSecOpenSSLAppPkcs12Load:
- * @filename: the PKCS12 key filename.
- * @pwd: the PKCS12 file password.
- * @pwdCallback: the password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @filename: the PKCS12 key filename.
+ * @pwd: the PKCS12 file password.
+ * @pwdCallback: the password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key and all associated certificates from the PKCS12 file.
* For uniformity, call xmlSecOpenSSLAppKeyLoad instead of this function. Pass
@@ -549,9 +549,9 @@ xmlSecOpenSSLAppKeyCertLoadBIO(xmlSecKeyPtr key, BIO* bio, xmlSecKeyDataFormat f
*
* Returns: pointer to the key or NULL if an error occurs.
*/
-xmlSecKeyPtr
+xmlSecKeyPtr
xmlSecOpenSSLAppPkcs12Load(const char *filename, const char *pwd,
- void* pwdCallback, void* pwdCallbackCtx) {
+ void* pwdCallback, void* pwdCallbackCtx) {
BIO* bio;
xmlSecKeyPtr key;
@@ -559,27 +559,27 @@ xmlSecOpenSSLAppPkcs12Load(const char *filename, const char *pwd,
bio = BIO_new_file(filename, "rb");
if(bio == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BIO_new_file",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "filename=%s;errno=%d",
- xmlSecErrorsSafeString(filename),
- errno);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BIO_new_file",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "filename=%s;errno=%d",
+ xmlSecErrorsSafeString(filename),
+ errno);
+ return(NULL);
}
key = xmlSecOpenSSLAppPkcs12LoadBIO (bio, pwd, pwdCallback, pwdCallbackCtx);
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLAppPkcs12LoadBIO",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "filename=%s;errno=%d",
- xmlSecErrorsSafeString(filename),
- errno);
- BIO_free(bio);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLAppPkcs12LoadBIO",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "filename=%s;errno=%d",
+ xmlSecErrorsSafeString(filename),
+ errno);
+ BIO_free(bio);
+ return(NULL);
}
BIO_free(bio);
@@ -588,11 +588,11 @@ xmlSecOpenSSLAppPkcs12Load(const char *filename, const char *pwd,
/**
* xmlSecOpenSSLAppPkcs12LoadMemory:
- * @data: the PKCS12 binary data.
- * @dataSize: the PKCS12 binary data size.
- * @pwd: the PKCS12 file password.
- * @pwdCallback: the password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @data: the PKCS12 binary data.
+ * @dataSize: the PKCS12 binary data size.
+ * @pwd: the PKCS12 file password.
+ * @pwdCallback: the password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key and all associated certificates from the PKCS12 data in memory buffer.
* For uniformity, call xmlSecOpenSSLAppKeyLoad instead of this function. Pass
@@ -600,10 +600,10 @@ xmlSecOpenSSLAppPkcs12Load(const char *filename, const char *pwd,
*
* Returns: pointer to the key or NULL if an error occurs.
*/
-xmlSecKeyPtr
+xmlSecKeyPtr
xmlSecOpenSSLAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
- const char *pwd, void* pwdCallback,
- void* pwdCallbackCtx) {
+ const char *pwd, void* pwdCallback,
+ void* pwdCallbackCtx) {
BIO* bio;
xmlSecKeyPtr key;
@@ -612,24 +612,24 @@ xmlSecOpenSSLAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
/* this would be a read only BIO, cast from const is ok */
bio = BIO_new_mem_buf((void*)data, dataSize);
if(bio == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BIO_new_mem_buf",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "errno=%d",
- errno);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BIO_new_mem_buf",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "errno=%d",
+ errno);
+ return(NULL);
}
key = xmlSecOpenSSLAppPkcs12LoadBIO (bio, pwd, pwdCallback, pwdCallbackCtx);
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLAppPkcs12LoadBIO",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- BIO_free(bio);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLAppPkcs12LoadBIO",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ BIO_free(bio);
+ return(NULL);
}
BIO_free(bio);
@@ -638,10 +638,10 @@ xmlSecOpenSSLAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
/**
* xmlSecOpenSSLAppPkcs12LoadBIO:
- * @bio: the PKCS12 key bio.
- * @pwd: the PKCS12 file password.
- * @pwdCallback: the password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @bio: the PKCS12 key bio.
+ * @pwd: the PKCS12 file password.
+ * @pwdCallback: the password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key and all associated certificates from the PKCS12 data in an OpenSSL BIO object.
* For uniformity, call xmlSecOpenSSLAppKeyLoad instead of this function. Pass
@@ -649,10 +649,10 @@ xmlSecOpenSSLAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize,
*
* Returns: pointer to the key or NULL if an error occurs.
*/
-xmlSecKeyPtr
+xmlSecKeyPtr
xmlSecOpenSSLAppPkcs12LoadBIO(BIO* bio, const char *pwd,
- void* pwdCallback ATTRIBUTE_UNUSED,
- void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
+ void* pwdCallback ATTRIBUTE_UNUSED,
+ void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
PKCS12 *p12 = NULL;
EVP_PKEY *pKey = NULL;
@@ -663,211 +663,211 @@ xmlSecOpenSSLAppPkcs12LoadBIO(BIO* bio, const char *pwd,
X509 *cert = NULL;
X509 *tmpcert = NULL;
int i;
- int has_cert;
+ int has_cert;
int ret;
xmlSecAssert2(bio != NULL, NULL);
p12 = d2i_PKCS12_bio(bio, NULL);
if(p12 == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "d2i_PKCS12_fp",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "d2i_PKCS12_fp",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
ret = PKCS12_verify_mac(p12, pwd, (pwd != NULL) ? strlen(pwd) : 0);
if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PKCS12_verify_mac",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PKCS12_verify_mac",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
ret = PKCS12_parse(p12, pwd, &pKey, &cert, &chain);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PKCS12_parse",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PKCS12_parse",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
data = xmlSecOpenSSLEvpKeyAdopt(pKey);
if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLEvpKeyAdopt",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- EVP_PKEY_free(pKey);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLEvpKeyAdopt",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ EVP_PKEY_free(pKey);
+ goto done;
}
x509Data = xmlSecKeyDataCreate(xmlSecOpenSSLKeyDataX509Id);
if(x509Data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecOpenSSLKeyDataX509Id)));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecOpenSSLKeyDataX509Id)));
+ goto done;
}
/* starting from openssl 1.0.0 the PKCS12_parse() call will not create certs
chain object if there is no certificates in the pkcs12 file and it will be null
*/
if(chain == NULL) {
- chain = sk_X509_new_null();
- if(chain == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "sk_X509_new_null",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
+ chain = sk_X509_new_null();
+ if(chain == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "sk_X509_new_null",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
}
- /*
- The documentation states (http://www.openssl.org/docs/crypto/PKCS12_parse.html):
+ /*
+ The documentation states (http://www.openssl.org/docs/crypto/PKCS12_parse.html):
- If successful the private key will be written to "*pkey", the
+ If successful the private key will be written to "*pkey", the
corresponding certificate to "*cert" and any additional certificates
to "*ca".
- In reality, the function sometime returns in the "ca" the certificates
+ In reality, the function sometime returns in the "ca" the certificates
including the one it is already returned in "cert".
- */
- has_cert = 0;
+ */
+ has_cert = 0;
for(i = 0; i < sk_X509_num(chain); ++i) {
- xmlSecAssert2(sk_X509_value(chain, i), NULL);
-
- if(X509_cmp(sk_X509_value(chain, i), cert) != 0) {
- has_cert = 1;
- break;
- }
- }
- if(has_cert != 0) {
- tmpcert = X509_dup(cert);
- if(tmpcert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "X509_dup",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
- }
-
- ret = sk_X509_push(chain, tmpcert);
- if(ret < 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "sk_X509_push",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- X509_free(tmpcert);
- goto done;
- }
- }
+ xmlSecAssert2(sk_X509_value(chain, i), NULL);
+
+ if(X509_cmp(sk_X509_value(chain, i), cert) != 0) {
+ has_cert = 1;
+ break;
+ }
+ }
+ if(has_cert != 0) {
+ tmpcert = X509_dup(cert);
+ if(tmpcert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "X509_dup",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
+ }
+
+ ret = sk_X509_push(chain, tmpcert);
+ if(ret < 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "sk_X509_push",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ X509_free(tmpcert);
+ goto done;
+ }
+ }
ret = xmlSecOpenSSLKeyDataX509AdoptKeyCert(x509Data, cert);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLKeyDataX509AdoptKeyCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLKeyDataX509AdoptKeyCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
}
cert = NULL;
for(i = 0; i < sk_X509_num(chain); ++i) {
- xmlSecAssert2(sk_X509_value(chain, i), NULL);
+ xmlSecAssert2(sk_X509_value(chain, i), NULL);
- tmpcert = X509_dup(sk_X509_value(chain, i));
+ tmpcert = X509_dup(sk_X509_value(chain, i));
if(tmpcert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "X509_dup",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- X509_free(tmpcert);
- goto done;
- }
-
- ret = xmlSecOpenSSLKeyDataX509AdoptCert(x509Data, tmpcert);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- goto done;
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "X509_dup",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ X509_free(tmpcert);
+ goto done;
+ }
+
+ ret = xmlSecOpenSSLKeyDataX509AdoptCert(x509Data, tmpcert);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ goto done;
+ }
}
key = xmlSecKeyCreate();
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
ret = xmlSecKeySetValue(key, data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- xmlSecKeyDestroy(key);
- key = NULL;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ xmlSecKeyDestroy(key);
+ key = NULL;
+ goto done;
}
data = NULL;
ret = xmlSecKeyAdoptData(key, x509Data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyAdoptData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "data=%s",
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
- xmlSecKeyDestroy(key);
- key = NULL;
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyAdoptData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "data=%s",
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(x509Data)));
+ xmlSecKeyDestroy(key);
+ key = NULL;
+ goto done;
}
x509Data = NULL;
done:
if(x509Data != NULL) {
- xmlSecKeyDataDestroy(x509Data);
+ xmlSecKeyDataDestroy(x509Data);
}
if(data != NULL) {
- xmlSecKeyDataDestroy(data);
+ xmlSecKeyDataDestroy(data);
}
if(chain != NULL) {
- sk_X509_pop_free(chain, X509_free);
+ sk_X509_pop_free(chain, X509_free);
}
if(cert != NULL) {
- X509_free(cert);
+ X509_free(cert);
}
if(p12 != NULL) {
PKCS12_free(p12);
@@ -877,8 +877,8 @@ done:
/**
* xmlSecOpenSSLAppKeyFromCertLoadBIO:
- * @bio: the BIO.
- * @format: the cert format.
+ * @bio: the BIO.
+ * @format: the cert format.
*
* Loads public key from cert.
*
@@ -899,76 +899,76 @@ xmlSecOpenSSLAppKeyFromCertLoadBIO(BIO* bio, xmlSecKeyDataFormat format) {
cert = xmlSecOpenSSLAppCertLoadBIO(bio, format);
if(cert == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLAppCertLoadBIO",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ NULL,
+ "xmlSecOpenSSLAppCertLoadBIO",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
/* get key value */
keyData = xmlSecOpenSSLX509CertGetKey(cert);
if(keyData == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLX509CertGetKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- X509_free(cert);
- return(NULL);
+ NULL,
+ "xmlSecOpenSSLX509CertGetKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ X509_free(cert);
+ return(NULL);
}
/* create key */
key = xmlSecKeyCreate();
if(key == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(keyData);
- X509_free(cert);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(keyData);
+ X509_free(cert);
+ return(NULL);
}
/* set key value */
ret = xmlSecKeySetValue(key, keyData);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(key);
- xmlSecKeyDataDestroy(keyData);
- X509_free(cert);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(key);
+ xmlSecKeyDataDestroy(keyData);
+ X509_free(cert);
+ return(NULL);
}
/* create cert data */
certData = xmlSecKeyEnsureData(key, xmlSecOpenSSLKeyDataX509Id);
if(certData == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyEnsureData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(key);
- X509_free(cert);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyEnsureData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(key);
+ X509_free(cert);
+ return(NULL);
}
/* put cert in the cert data */
ret = xmlSecOpenSSLKeyDataX509AdoptCert(certData, cert);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(key);
- X509_free(cert);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(key);
+ X509_free(cert);
+ return(NULL);
}
return(key);
@@ -977,11 +977,11 @@ xmlSecOpenSSLAppKeyFromCertLoadBIO(BIO* bio, xmlSecKeyDataFormat format) {
/**
* xmlSecOpenSSLAppKeysMngrCertLoad:
- * @mngr: the keys manager.
- * @filename: the certificate file.
- * @format: the certificate file format.
- * @type: the flag that indicates is the certificate in @filename
- * trusted or not.
+ * @mngr: the keys manager.
+ * @filename: the certificate file.
+ * @format: the certificate file format.
+ * @type: the flag that indicates is the certificate in @filename
+ * trusted or not.
*
* Reads cert from @filename and adds to the list of trusted or known
* untrusted certs in @store.
@@ -990,7 +990,7 @@ xmlSecOpenSSLAppKeyFromCertLoadBIO(BIO* bio, xmlSecKeyDataFormat format) {
*/
int
xmlSecOpenSSLAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
- xmlSecKeyDataFormat format, xmlSecKeyDataType type) {
+ xmlSecKeyDataFormat format, xmlSecKeyDataType type) {
BIO* bio;
int ret;
@@ -1000,27 +1000,27 @@ xmlSecOpenSSLAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
bio = BIO_new_file(filename, "rb");
if(bio == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BIO_new_file",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "filename=%s;errno=%d",
- xmlSecErrorsSafeString(filename),
- errno);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BIO_new_file",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "filename=%s;errno=%d",
+ xmlSecErrorsSafeString(filename),
+ errno);
+ return(-1);
}
ret = xmlSecOpenSSLAppKeysMngrCertLoadBIO(mngr, bio, format, type);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLAppKeysMngrCertLoadBIO",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "filename=%s;errno=%d",
- xmlSecErrorsSafeString(filename),
- errno);
- BIO_free(bio);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLAppKeysMngrCertLoadBIO",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "filename=%s;errno=%d",
+ xmlSecErrorsSafeString(filename),
+ errno);
+ BIO_free(bio);
+ return(-1);
}
BIO_free(bio);
@@ -1029,11 +1029,11 @@ xmlSecOpenSSLAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
/**
* xmlSecOpenSSLAppKeysMngrCertLoadMemory:
- * @mngr: the keys manager.
- * @data: the certificate binary data.
- * @dataSize: the certificate binary data size.
- * @format: the certificate file format.
- * @type: the flag that indicates is the certificate trusted or not.
+ * @mngr: the keys manager.
+ * @data: the certificate binary data.
+ * @dataSize: the certificate binary data size.
+ * @format: the certificate file format.
+ * @type: the flag that indicates is the certificate trusted or not.
*
* Reads cert from binary buffer @data and adds to the list of trusted or known
* untrusted certs in @store.
@@ -1042,8 +1042,8 @@ xmlSecOpenSSLAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
*/
int
xmlSecOpenSSLAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* data,
- xmlSecSize dataSize, xmlSecKeyDataFormat format,
- xmlSecKeyDataType type) {
+ xmlSecSize dataSize, xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type) {
BIO* bio;
int ret;
@@ -1054,24 +1054,24 @@ xmlSecOpenSSLAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte*
/* this would be a read only BIO, cast from const is ok */
bio = BIO_new_mem_buf((void*)data, dataSize);
if(bio == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BIO_new_mem_buf",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "errno=%d",
- errno);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BIO_new_mem_buf",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "errno=%d",
+ errno);
+ return(-1);
}
ret = xmlSecOpenSSLAppKeysMngrCertLoadBIO(mngr, bio, format, type);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLAppKeysMngrCertLoadBIO",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- BIO_free(bio);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLAppKeysMngrCertLoadBIO",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ BIO_free(bio);
+ return(-1);
}
BIO_free(bio);
@@ -1080,10 +1080,10 @@ xmlSecOpenSSLAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte*
/**
* xmlSecOpenSSLAppKeysMngrCertLoadBIO:
- * @mngr: the keys manager.
- * @bio: the certificate BIO.
- * @format: the certificate file format.
- * @type: the flag that indicates is the certificate trusted or not.
+ * @mngr: the keys manager.
+ * @bio: the certificate BIO.
+ * @format: the certificate file format.
+ * @type: the flag that indicates is the certificate trusted or not.
*
* Reads cert from an OpenSSL BIO object and adds to the list of trusted or known
* untrusted certs in @store.
@@ -1092,7 +1092,7 @@ xmlSecOpenSSLAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte*
*/
int
xmlSecOpenSSLAppKeysMngrCertLoadBIO(xmlSecKeysMngrPtr mngr, BIO* bio,
- xmlSecKeyDataFormat format, xmlSecKeyDataType type) {
+ xmlSecKeyDataFormat format, xmlSecKeyDataType type) {
xmlSecKeyDataStorePtr x509Store;
X509* cert;
int ret;
@@ -1103,33 +1103,33 @@ xmlSecOpenSSLAppKeysMngrCertLoadBIO(xmlSecKeysMngrPtr mngr, BIO* bio,
x509Store = xmlSecKeysMngrGetDataStore(mngr, xmlSecOpenSSLX509StoreId);
if(x509Store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrGetDataStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecOpenSSLX509StoreId");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrGetDataStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecOpenSSLX509StoreId");
+ return(-1);
}
cert = xmlSecOpenSSLAppCertLoadBIO(bio, format);
if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLAppCertLoadBIO",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLAppCertLoadBIO",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
ret = xmlSecOpenSSLX509StoreAdoptCert(x509Store, cert, type);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLX509StoreAdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- X509_free(cert);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLX509StoreAdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ X509_free(cert);
+ return(-1);
}
return(0);
@@ -1137,8 +1137,8 @@ xmlSecOpenSSLAppKeysMngrCertLoadBIO(xmlSecKeysMngrPtr mngr, BIO* bio,
/**
* xmlSecOpenSSLAppKeysMngrAddCertsPath:
- * @mngr: the keys manager.
- * @path: the path to trusted certificates.
+ * @mngr: the keys manager.
+ * @path: the path to trusted certificates.
*
* Reads cert from @path and adds to the list of trusted certificates.
*
@@ -1154,22 +1154,22 @@ xmlSecOpenSSLAppKeysMngrAddCertsPath(xmlSecKeysMngrPtr mngr, const char *path) {
x509Store = xmlSecKeysMngrGetDataStore(mngr, xmlSecOpenSSLX509StoreId);
if(x509Store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrGetDataStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecOpenSSLX509StoreId");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrGetDataStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecOpenSSLX509StoreId");
+ return(-1);
}
ret = xmlSecOpenSSLX509StoreAddCertsPath(x509Store, path);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLX509StoreAddCertsPath",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "path=%s", xmlSecErrorsSafeString(path));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLX509StoreAddCertsPath",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "path=%s", xmlSecErrorsSafeString(path));
+ return(-1);
}
return(0);
@@ -1216,7 +1216,7 @@ xmlSecOpenSSLAppKeysMngrAddCertsFile(xmlSecKeysMngrPtr mngr, const char *file) {
return(0);
}
-static X509*
+static X509*
xmlSecOpenSSLAppCertLoadBIO(BIO* bio, xmlSecKeyDataFormat format) {
X509 *cert;
@@ -1226,37 +1226,37 @@ xmlSecOpenSSLAppCertLoadBIO(BIO* bio, xmlSecKeyDataFormat format) {
switch(format) {
case xmlSecKeyDataFormatPem:
case xmlSecKeyDataFormatCertPem:
- cert = PEM_read_bio_X509_AUX(bio, NULL, NULL, NULL);
- if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "PEM_read_bio_X509_AUX",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
- break;
+ cert = PEM_read_bio_X509_AUX(bio, NULL, NULL, NULL);
+ if(cert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "PEM_read_bio_X509_AUX",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+ break;
case xmlSecKeyDataFormatDer:
case xmlSecKeyDataFormatCertDer:
- cert = d2i_X509_bio(bio, NULL);
- if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "d2i_X509_bio",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
- break;
+ cert = d2i_X509_bio(bio, NULL);
+ if(cert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "d2i_X509_bio",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+ break;
default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_FORMAT,
- "format=%d", format);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_FORMAT,
+ "format=%d", format);
+ return(NULL);
}
-
+
return(cert);
}
@@ -1264,7 +1264,7 @@ xmlSecOpenSSLAppCertLoadBIO(BIO* bio, xmlSecKeyDataFormat format) {
/**
* xmlSecOpenSSLAppDefaultKeysMngrInit:
- * @mngr: the pointer to keys manager.
+ * @mngr: the pointer to keys manager.
*
* Initializes @mngr with simple keys store #xmlSecSimpleKeysStoreId
* and a default OpenSSL crypto key data stores.
@@ -1279,38 +1279,38 @@ xmlSecOpenSSLAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
/* create simple keys store if needed */
if(xmlSecKeysMngrGetKeysStore(mngr) == NULL) {
- xmlSecKeyStorePtr keysStore;
-
- keysStore = xmlSecKeyStoreCreate(xmlSecSimpleKeysStoreId);
- if(keysStore == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyStoreCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecSimpleKeysStoreId");
- return(-1);
- }
-
- ret = xmlSecKeysMngrAdoptKeysStore(mngr, keysStore);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrAdoptKeysStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyStoreDestroy(keysStore);
- return(-1);
- }
+ xmlSecKeyStorePtr keysStore;
+
+ keysStore = xmlSecKeyStoreCreate(xmlSecSimpleKeysStoreId);
+ if(keysStore == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyStoreCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecSimpleKeysStoreId");
+ return(-1);
+ }
+
+ ret = xmlSecKeysMngrAdoptKeysStore(mngr, keysStore);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrAdoptKeysStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyStoreDestroy(keysStore);
+ return(-1);
+ }
}
ret = xmlSecOpenSSLKeysMngrInit(mngr);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLKeysMngrInit",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLKeysMngrInit",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* TODO */
@@ -1320,8 +1320,8 @@ xmlSecOpenSSLAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
/**
* xmlSecOpenSSLAppDefaultKeysMngrAdoptKey:
- * @mngr: the pointer to keys manager.
- * @key: the pointer to key.
+ * @mngr: the pointer to keys manager.
+ * @key: the pointer to key.
*
* Adds @key to the keys manager @mngr created with #xmlSecOpenSSLAppDefaultKeysMngrInit
* function.
@@ -1338,22 +1338,22 @@ xmlSecOpenSSLAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key
store = xmlSecKeysMngrGetKeysStore(mngr);
if(store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrGetKeysStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrGetKeysStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecSimpleKeysStoreAdoptKey(store, key);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSimpleKeysStoreAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSimpleKeysStoreAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -1361,8 +1361,8 @@ xmlSecOpenSSLAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr key
/**
* xmlSecOpenSSLAppDefaultKeysMngrLoad:
- * @mngr: the pointer to keys manager.
- * @uri: the uri.
+ * @mngr: the pointer to keys manager.
+ * @uri: the uri.
*
* Loads XML keys file from @uri to the keys manager @mngr created
* with #xmlSecOpenSSLAppDefaultKeysMngrInit function.
@@ -1379,22 +1379,22 @@ xmlSecOpenSSLAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
store = xmlSecKeysMngrGetKeysStore(mngr);
if(store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrGetKeysStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrGetKeysStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecSimpleKeysStoreLoad(store, uri, mngr);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSimpleKeysStoreLoad",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "uri=%s", xmlSecErrorsSafeString(uri));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSimpleKeysStoreLoad",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "uri=%s", xmlSecErrorsSafeString(uri));
+ return(-1);
}
return(0);
@@ -1402,9 +1402,9 @@ xmlSecOpenSSLAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
/**
* xmlSecOpenSSLAppDefaultKeysMngrSave:
- * @mngr: the pointer to keys manager.
- * @filename: the destination filename.
- * @type: the type of keys to save (public/private/symmetric).
+ * @mngr: the pointer to keys manager.
+ * @filename: the destination filename.
+ * @type: the type of keys to save (public/private/symmetric).
*
* Saves keys from @mngr to XML keys file.
*
@@ -1412,7 +1412,7 @@ xmlSecOpenSSLAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
*/
int
xmlSecOpenSSLAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename,
- xmlSecKeyDataType type) {
+ xmlSecKeyDataType type) {
xmlSecKeyStorePtr store;
int ret;
@@ -1421,22 +1421,22 @@ xmlSecOpenSSLAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filename
store = xmlSecKeysMngrGetKeysStore(mngr);
if(store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrGetKeysStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrGetKeysStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecSimpleKeysStoreSave(store, filename, type);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSimpleKeysStoreSave",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "filename%s", xmlSecErrorsSafeString(filename));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSimpleKeysStoreSave",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "filename%s", xmlSecErrorsSafeString(filename));
+ return(-1);
}
return(0);
@@ -1452,25 +1452,25 @@ static int egdsocket = 0;
static int
xmlSecOpenSSLAppLoadRANDFile(const char *file) {
char buffer[1024];
-
+
if(file == NULL) {
- file = RAND_file_name(buffer, sizeof(buffer));
+ file = RAND_file_name(buffer, sizeof(buffer));
}else if(RAND_egd(file) > 0) {
- /* we try if the given filename is an EGD socket.
- * if it is, we don't write anything back to the file. */
- egdsocket = 1;
- return 1;
+ /* we try if the given filename is an EGD socket.
+ * if it is, we don't write anything back to the file. */
+ egdsocket = 1;
+ return 1;
}
if((file == NULL) || !RAND_load_file(file, -1)) {
- if(RAND_status() == 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "RAND_load_file",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "file=%s", xmlSecErrorsSafeString(file));
- return 0;
- }
+ if(RAND_status() == 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "RAND_load_file",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "file=%s", xmlSecErrorsSafeString(file));
+ return 0;
+ }
}
seeded = 1;
return 1;
@@ -1479,26 +1479,26 @@ xmlSecOpenSSLAppLoadRANDFile(const char *file) {
static int
xmlSecOpenSSLAppSaveRANDFile(const char *file) {
char buffer[1024];
-
+
if(egdsocket || !seeded) {
- /* If we did not manage to read the seed file,
- * we should not write a low-entropy seed file back --
- * it would suppress a crucial warning the next time
- * we want to use it. */
- return 0;
+ /* If we did not manage to read the seed file,
+ * we should not write a low-entropy seed file back --
+ * it would suppress a crucial warning the next time
+ * we want to use it. */
+ return 0;
}
if(file == NULL) {
- file = RAND_file_name(buffer, sizeof(buffer));
+ file = RAND_file_name(buffer, sizeof(buffer));
}
if((file == NULL) || !RAND_write_file(file)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "RAND_write_file",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "file=%s",
- xmlSecErrorsSafeString(file));
- return 0;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "RAND_write_file",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "file=%s",
+ xmlSecErrorsSafeString(file));
+ return 0;
}
return 1;
@@ -1528,62 +1528,62 @@ xmlSecOpenSSLDefaultPasswordCallback(char *buf, int bufsize, int verify, void *u
/* try 3 times */
for(i = 0; i < 3; i++) {
if(filename != NULL) {
- xmlSecStrPrintf(prompt, sizeof(prompt), BAD_CAST "Enter password for \"%s\" file: ", filename);
- } else {
- xmlSecStrPrintf(prompt, sizeof(prompt), BAD_CAST "Enter password: ");
+ xmlSecStrPrintf(prompt, sizeof(prompt), BAD_CAST "Enter password for \"%s\" file: ", filename);
+ } else {
+ xmlSecStrPrintf(prompt, sizeof(prompt), BAD_CAST "Enter password: ");
}
- ret = EVP_read_pw_string(buf, bufsize, (char*)prompt, 0);
+ ret = EVP_read_pw_string(buf, bufsize, (char*)prompt, 0);
if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "EVP_read_pw_string",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "EVP_read_pw_string",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
- /* if we don't need to verify password then we are done */
+ /* if we don't need to verify password then we are done */
if(verify == 0) {
- return(strlen(buf));
+ return(strlen(buf));
+ }
+
+ if(filename != NULL) {
+ xmlSecStrPrintf(prompt, sizeof(prompt), BAD_CAST "Enter password for \"%s\" file again: ", filename);
+ } else {
+ xmlSecStrPrintf(prompt, sizeof(prompt), BAD_CAST "Enter password again: ");
}
- if(filename != NULL) {
- xmlSecStrPrintf(prompt, sizeof(prompt), BAD_CAST "Enter password for \"%s\" file again: ", filename);
- } else {
- xmlSecStrPrintf(prompt, sizeof(prompt), BAD_CAST "Enter password again: ");
- }
-
- buf2 = (char*)xmlMalloc(bufsize);
- if(buf2 == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "size=%d", bufsize);
- return(-1);
- }
- ret = EVP_read_pw_string(buf2, bufsize, (char*)prompt, 0);
- if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "EVP_read_pw_string",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- memset(buf2, 0, bufsize);
- xmlFree(buf2);
- return(-1);
- }
+ buf2 = (char*)xmlMalloc(bufsize);
+ if(buf2 == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "size=%d", bufsize);
+ return(-1);
+ }
+ ret = EVP_read_pw_string(buf2, bufsize, (char*)prompt, 0);
+ if(ret != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "EVP_read_pw_string",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ memset(buf2, 0, bufsize);
+ xmlFree(buf2);
+ return(-1);
+ }
- /* check if passwords match */
- if(strcmp(buf, buf2) == 0) {
- memset(buf2, 0, bufsize);
- xmlFree(buf2);
- return(strlen(buf));
- }
-
- /* try again */
- memset(buf2, 0, bufsize);
- xmlFree(buf2);
+ /* check if passwords match */
+ if(strcmp(buf, buf2) == 0) {
+ memset(buf2, 0, bufsize);
+ xmlFree(buf2);
+ return(strlen(buf));
+ }
+
+ /* try again */
+ memset(buf2, 0, bufsize);
+ xmlFree(buf2);
}
return(-1);
diff --git a/src/openssl/bn.c b/src/openssl/bn.c
index 28025d1..222aa27 100644
--- a/src/openssl/bn.c
+++ b/src/openssl/bn.c
@@ -45,34 +45,34 @@ xmlSecOpenSSLNodeGetBNValue(const xmlNodePtr cur, BIGNUM **a) {
ret = xmlSecBufferInitialize(&buf, 128);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
ret = xmlSecBufferBase64NodeContentRead(&buf, cur);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferBase64NodeContentRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBufferFinalize(&buf);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferBase64NodeContentRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBufferFinalize(&buf);
+ return(NULL);
}
(*a) = BN_bin2bn(xmlSecBufferGetData(&buf), xmlSecBufferGetSize(&buf), (*a));
- if( (*a) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BN_bin2bn",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBufferFinalize(&buf);
- return(NULL);
+ if( (*a) == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BN_bin2bn",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBufferFinalize(&buf);
+ return(NULL);
}
xmlSecBufferFinalize(&buf);
return(*a);
@@ -83,8 +83,8 @@ xmlSecOpenSSLNodeGetBNValue(const xmlNodePtr cur, BIGNUM **a) {
* @cur: the pointer to an XML node.
* @a: the BIGNUM.
* @addLineBreaks: if the flag is equal to 1 then
- * linebreaks will be added before and after
- * new buffer content.
+ * linebreaks will be added before and after
+ * new buffer content.
*
* Converts BIGNUM to CryptoBinary string
* (http://www.w3.org/TR/xmldsig-core/#sec-CryptoBinary)
@@ -105,56 +105,56 @@ xmlSecOpenSSLNodeSetBNValue(xmlNodePtr cur, const BIGNUM *a, int addLineBreaks)
ret = xmlSecBufferInitialize(&buf, BN_num_bytes(a) + 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", BN_num_bytes(a) + 1);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", BN_num_bytes(a) + 1);
+ return(-1);
}
ret = BN_bn2bin(a, xmlSecBufferGetData(&buf));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BN_bn2bin",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BN_bn2bin",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
size = ret;
ret = xmlSecBufferSetSize(&buf, size);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", size);
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", size);
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
if(addLineBreaks) {
- xmlNodeSetContent(cur, xmlSecStringCR);
+ xmlNodeSetContent(cur, xmlSecStringCR);
} else {
- xmlNodeSetContent(cur, xmlSecStringEmpty);
+ 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);
- xmlSecBufferFinalize(&buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferBase64NodeContentWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBufferFinalize(&buf);
+ return(-1);
}
if(addLineBreaks) {
- xmlNodeAddContent(cur, xmlSecStringCR);
+ xmlNodeAddContent(cur, xmlSecStringCR);
}
xmlSecBufferFinalize(&buf);
diff --git a/src/openssl/ciphers.c b/src/openssl/ciphers.c
index 4799cb5..1a70c97 100644
--- a/src/openssl/ciphers.c
+++ b/src/openssl/ciphers.c
@@ -23,7 +23,7 @@
/* this is not defined in OpenSSL 0.9.6 */
#ifndef EVP_MAX_BLOCK_LENGTH
-#define EVP_MAX_BLOCK_LENGTH 32
+#define EVP_MAX_BLOCK_LENGTH 32
#endif /* EVP_MAX_BLOCK_LENGTH */
/**************************************************************************
@@ -31,39 +31,39 @@
* Internal OpenSSL Block cipher CTX
*
*****************************************************************************/
-typedef struct _xmlSecOpenSSLEvpBlockCipherCtx xmlSecOpenSSLEvpBlockCipherCtx,
- *xmlSecOpenSSLEvpBlockCipherCtxPtr;
+typedef struct _xmlSecOpenSSLEvpBlockCipherCtx xmlSecOpenSSLEvpBlockCipherCtx,
+ *xmlSecOpenSSLEvpBlockCipherCtxPtr;
struct _xmlSecOpenSSLEvpBlockCipherCtx {
- const EVP_CIPHER* cipher;
- xmlSecKeyDataId keyId;
- EVP_CIPHER_CTX cipherCtx;
- int keyInitialized;
- int ctxInitialized;
- xmlSecByte key[EVP_MAX_KEY_LENGTH];
- xmlSecByte iv[EVP_MAX_IV_LENGTH];
- xmlSecByte pad[EVP_MAX_BLOCK_LENGTH];
+ const EVP_CIPHER* cipher;
+ xmlSecKeyDataId keyId;
+ EVP_CIPHER_CTX cipherCtx;
+ int keyInitialized;
+ int ctxInitialized;
+ xmlSecByte key[EVP_MAX_KEY_LENGTH];
+ xmlSecByte iv[EVP_MAX_IV_LENGTH];
+ xmlSecByte pad[EVP_MAX_BLOCK_LENGTH];
};
-static int xmlSecOpenSSLEvpBlockCipherCtxInit (xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
- xmlSecBufferPtr in,
- xmlSecBufferPtr out,
- int encrypt,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecOpenSSLEvpBlockCipherCtxUpdate (xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
- xmlSecBufferPtr in,
- xmlSecBufferPtr out,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecOpenSSLEvpBlockCipherCtxFinal (xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
- xmlSecBufferPtr out,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecOpenSSLEvpBlockCipherCtxInit (xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
+ xmlSecBufferPtr in,
+ xmlSecBufferPtr out,
+ int encrypt,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecOpenSSLEvpBlockCipherCtxUpdate (xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
+ xmlSecBufferPtr in,
+ xmlSecBufferPtr out,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecOpenSSLEvpBlockCipherCtxFinal (xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
+ xmlSecBufferPtr out,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx);
static int
xmlSecOpenSSLEvpBlockCipherCtxInit(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
- xmlSecBufferPtr in, xmlSecBufferPtr out,
- int encrypt,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecBufferPtr in, xmlSecBufferPtr out,
+ int encrypt,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx) {
int ivLen;
int ret;
@@ -82,58 +82,58 @@ xmlSecOpenSSLEvpBlockCipherCtxInit(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
if(encrypt) {
/* generate random iv */
ret = RAND_bytes(ctx->iv, ivLen);
- if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "RAND_bytes",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "size=%d", ivLen);
- return(-1);
- }
-
- /* write iv to the output */
- ret = xmlSecBufferAppend(out, ctx->iv, ivLen);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", ivLen);
- return(-1);
- }
-
+ if(ret != 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "RAND_bytes",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "size=%d", ivLen);
+ return(-1);
+ }
+
+ /* write iv to the output */
+ ret = xmlSecBufferAppend(out, ctx->iv, ivLen);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", ivLen);
+ return(-1);
+ }
+
} else {
- /* if we don't have enough data, exit and hope that
- * we'll have iv next time */
- if(xmlSecBufferGetSize(in) < (xmlSecSize)ivLen) {
- return(0);
- }
-
- /* copy iv to our buffer*/
- xmlSecAssert2(xmlSecBufferGetData(in) != NULL, -1);
- memcpy(ctx->iv, xmlSecBufferGetData(in), ivLen);
-
- /* and remove from input */
- ret = xmlSecBufferRemoveHead(in, ivLen);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", ivLen);
- return(-1);
- }
+ /* if we don't have enough data, exit and hope that
+ * we'll have iv next time */
+ if(xmlSecBufferGetSize(in) < (xmlSecSize)ivLen) {
+ return(0);
+ }
+
+ /* copy iv to our buffer*/
+ xmlSecAssert2(xmlSecBufferGetData(in) != NULL, -1);
+ memcpy(ctx->iv, xmlSecBufferGetData(in), ivLen);
+
+ /* and remove from input */
+ ret = xmlSecBufferRemoveHead(in, ivLen);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", ivLen);
+ return(-1);
+ }
}
/* set iv */
ret = EVP_CipherInit(&(ctx->cipherCtx), ctx->cipher, ctx->key, ctx->iv, encrypt);
if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "EVP_CipherInit",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "EVP_CipherInit",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ctx->ctxInitialized = 1;
@@ -144,17 +144,17 @@ xmlSecOpenSSLEvpBlockCipherCtxInit(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
* it is possible to disable padding and do it by yourself
* For OpenSSL 0.9.6 you have interop problems
*/
-#ifndef XMLSEC_OPENSSL_096
+#ifndef XMLSEC_OPENSSL_096
EVP_CIPHER_CTX_set_padding(&(ctx->cipherCtx), 0);
-#endif /* XMLSEC_OPENSSL_096 */
+#endif /* XMLSEC_OPENSSL_096 */
return(0);
}
static int
xmlSecOpenSSLEvpBlockCipherCtxUpdate(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
- xmlSecBufferPtr in, xmlSecBufferPtr out,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecBufferPtr in, xmlSecBufferPtr out,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx) {
int blockLen, fixLength = 0, outLen = 0;
xmlSecSize inSize, outSize;
xmlSecByte* outBuf;
@@ -174,8 +174,8 @@ xmlSecOpenSSLEvpBlockCipherCtxUpdate(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
outSize = xmlSecBufferGetSize(out);
if(inSize == 0) {
- /* wait for more data */
- return(0);
+ /* wait for more data */
+ return(0);
}
/* OpenSSL docs: The amount of data written depends on the block
@@ -184,12 +184,12 @@ xmlSecOpenSSLEvpBlockCipherCtxUpdate(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
*/
ret = xmlSecBufferSetMaxSize(out, outSize + inSize + blockLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + inSize + blockLen);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + inSize + blockLen);
+ return(-1);
}
outBuf = xmlSecBufferGetData(out) + outSize;
@@ -206,77 +206,77 @@ xmlSecOpenSSLEvpBlockCipherCtxUpdate(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
*/
#ifndef XMLSEC_OPENSSL_096
if(!ctx->cipherCtx.encrypt) {
- if(ctx->cipherCtx.final_used) {
- memcpy(outBuf, ctx->cipherCtx.final, blockLen);
- outBuf += blockLen;
- fixLength = 1;
- } else {
- fixLength = 0;
- }
+ if(ctx->cipherCtx.final_used) {
+ memcpy(outBuf, ctx->cipherCtx.final, blockLen);
+ outBuf += blockLen;
+ fixLength = 1;
+ } else {
+ fixLength = 0;
+ }
}
#endif /* XMLSEC_OPENSSL_096 */
/* encrypt/decrypt */
ret = EVP_CipherUpdate(&(ctx->cipherCtx), outBuf, &outLen, xmlSecBufferGetData(in), inSize);
if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "EVP_CipherUpdate",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "EVP_CipherUpdate",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
#ifndef XMLSEC_OPENSSL_096
if(!ctx->cipherCtx.encrypt) {
- /*
- * The logic below is copied from EVP_DecryptUpdate() function.
- * This is a hack but it's the only way I can provide binary
- * compatibility with previous versions of xmlsec.
- * This needs to be fixed in the next XMLSEC API refresh.
- */
- if (blockLen > 1 && !ctx->cipherCtx.buf_len) {
- outLen -= blockLen;
- ctx->cipherCtx.final_used = 1;
- memcpy(ctx->cipherCtx.final, &outBuf[outLen], blockLen);
- } else {
- ctx->cipherCtx.final_used = 0;
- }
- if (fixLength) {
- outLen += blockLen;
- }
+ /*
+ * The logic below is copied from EVP_DecryptUpdate() function.
+ * This is a hack but it's the only way I can provide binary
+ * compatibility with previous versions of xmlsec.
+ * This needs to be fixed in the next XMLSEC API refresh.
+ */
+ if (blockLen > 1 && !ctx->cipherCtx.buf_len) {
+ outLen -= blockLen;
+ ctx->cipherCtx.final_used = 1;
+ memcpy(ctx->cipherCtx.final, &outBuf[outLen], blockLen);
+ } else {
+ ctx->cipherCtx.final_used = 0;
+ }
+ if (fixLength) {
+ outLen += blockLen;
+ }
}
#endif /* XMLSEC_OPENSSL_096 */
/* set correct output buffer size */
ret = xmlSecBufferSetSize(out, outSize + outLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + outLen);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + outLen);
+ return(-1);
}
/* remove the processed block from input */
ret = xmlSecBufferRemoveHead(in, inSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
}
return(0);
}
static int
xmlSecOpenSSLEvpBlockCipherCtxFinal(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
- xmlSecBufferPtr out,
- const xmlChar* cipherName,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecBufferPtr out,
+ const xmlChar* cipherName,
+ xmlSecTransformCtxPtr transformCtx) {
int blockLen, outLen = 0, outLen2 = 0;
xmlSecSize outSize;
xmlSecByte* outBuf;
@@ -299,12 +299,12 @@ xmlSecOpenSSLEvpBlockCipherCtxFinal(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
*/
ret = xmlSecBufferSetMaxSize(out, outSize + 2 * blockLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + 2 * blockLen);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + 2 * blockLen);
+ return(-1);
}
outBuf = xmlSecBufferGetData(out) + outSize;
@@ -321,50 +321,50 @@ xmlSecOpenSSLEvpBlockCipherCtxFinal(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
*/
#ifndef XMLSEC_OPENSSL_096
if(ctx->cipherCtx.encrypt) {
- int padLen;
-
+ int padLen;
+
xmlSecAssert2(blockLen <= EVP_MAX_BLOCK_LENGTH, -1);
- padLen = blockLen - ctx->cipherCtx.buf_len;
- xmlSecAssert2(padLen > 0, -1);
+ padLen = blockLen - ctx->cipherCtx.buf_len;
+ xmlSecAssert2(padLen > 0, -1);
- /* generate random padding */
- if(padLen > 1) {
- ret = RAND_bytes(ctx->pad, padLen - 1);
- if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "RAND_bytes",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "size=%d", padLen - 1);
- return(-1);
- }
- }
- ctx->pad[padLen - 1] = padLen;
+ /* generate random padding */
+ if(padLen > 1) {
+ ret = RAND_bytes(ctx->pad, padLen - 1);
+ if(ret != 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "RAND_bytes",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "size=%d", padLen - 1);
+ return(-1);
+ }
+ }
+ ctx->pad[padLen - 1] = padLen;
/* write padding */
- ret = EVP_CipherUpdate(&(ctx->cipherCtx), outBuf, &outLen, ctx->pad, padLen);
- if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "EVP_CipherUpdate",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- outBuf += outLen;
+ ret = EVP_CipherUpdate(&(ctx->cipherCtx), outBuf, &outLen, ctx->pad, padLen);
+ if(ret != 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "EVP_CipherUpdate",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ outBuf += outLen;
}
-#endif /* XMLSEC_OPENSSL_096 */
+#endif /* XMLSEC_OPENSSL_096 */
/* finalize transform */
ret = EVP_CipherFinal(&(ctx->cipherCtx), outBuf, &outLen2);
if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "EVP_CipherFinal",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "EVP_CipherFinal",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/*
@@ -380,39 +380,39 @@ xmlSecOpenSSLEvpBlockCipherCtxFinal(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
*/
#ifndef XMLSEC_OPENSSL_096
if(!ctx->cipherCtx.encrypt) {
- /* we instructed openssl to do not use padding so there
- * should be no final block
- */
- xmlSecAssert2(outLen2 == 0, -1);
- xmlSecAssert2(ctx->cipherCtx.buf_len == 0, -1);
- xmlSecAssert2(ctx->cipherCtx.final_used, -1);
-
+ /* we instructed openssl to do not use padding so there
+ * should be no final block
+ */
+ xmlSecAssert2(outLen2 == 0, -1);
+ xmlSecAssert2(ctx->cipherCtx.buf_len == 0, -1);
+ xmlSecAssert2(ctx->cipherCtx.final_used, -1);
+
if(blockLen > 1) {
- outLen2 = blockLen - ctx->cipherCtx.final[blockLen - 1];
- if(outLen2 > 0) {
- memcpy(outBuf, ctx->cipherCtx.final, outLen2);
- } else if(outLen2 < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "padding=%d;buffer=%d",
- ctx->cipherCtx.final[blockLen - 1], blockLen);
- return(-1);
- }
- }
+ outLen2 = blockLen - ctx->cipherCtx.final[blockLen - 1];
+ if(outLen2 > 0) {
+ memcpy(outBuf, ctx->cipherCtx.final, outLen2);
+ } else if(outLen2 < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "padding=%d;buffer=%d",
+ ctx->cipherCtx.final[blockLen - 1], blockLen);
+ return(-1);
+ }
+ }
}
-#endif /* XMLSEC_OPENSSL_096 */
+#endif /* XMLSEC_OPENSSL_096 */
/* set correct output buffer size */
ret = xmlSecBufferSetSize(out, outSize + outLen + outLen2);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(cipherName),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize + outLen + outLen2);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(cipherName),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize + outLen + outLen2);
+ return(-1);
}
return(0);
@@ -426,29 +426,29 @@ xmlSecOpenSSLEvpBlockCipherCtxFinal(xmlSecOpenSSLEvpBlockCipherCtxPtr ctx,
* xmlSecOpenSSLEvpBlockCipherCtx block is located after xmlSecTransform structure
*
*****************************************************************************/
-#define xmlSecOpenSSLEvpBlockCipherSize \
+#define xmlSecOpenSSLEvpBlockCipherSize \
(sizeof(xmlSecTransform) + sizeof(xmlSecOpenSSLEvpBlockCipherCtx))
#define xmlSecOpenSSLEvpBlockCipherGetCtx(transform) \
((xmlSecOpenSSLEvpBlockCipherCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-static int xmlSecOpenSSLEvpBlockCipherInitialize (xmlSecTransformPtr transform);
-static void xmlSecOpenSSLEvpBlockCipherFinalize (xmlSecTransformPtr transform);
-static int xmlSecOpenSSLEvpBlockCipherSetKeyReq (xmlSecTransformPtr transform,
- xmlSecKeyReqPtr keyReq);
-static int xmlSecOpenSSLEvpBlockCipherSetKey (xmlSecTransformPtr transform,
- xmlSecKeyPtr key);
-static int xmlSecOpenSSLEvpBlockCipherExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecOpenSSLEvpBlockCipherCheckId (xmlSecTransformPtr transform);
-
+static int xmlSecOpenSSLEvpBlockCipherInitialize (xmlSecTransformPtr transform);
+static void xmlSecOpenSSLEvpBlockCipherFinalize (xmlSecTransformPtr transform);
+static int xmlSecOpenSSLEvpBlockCipherSetKeyReq (xmlSecTransformPtr transform,
+ xmlSecKeyReqPtr keyReq);
+static int xmlSecOpenSSLEvpBlockCipherSetKey (xmlSecTransformPtr transform,
+ xmlSecKeyPtr key);
+static int xmlSecOpenSSLEvpBlockCipherExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecOpenSSLEvpBlockCipherCheckId (xmlSecTransformPtr transform);
+
static int
xmlSecOpenSSLEvpBlockCipherCheckId(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_DES
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformDes3CbcId)) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_DES */
@@ -478,31 +478,31 @@ xmlSecOpenSSLEvpBlockCipherInitialize(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_DES
if(transform->id == xmlSecOpenSSLTransformDes3CbcId) {
- ctx->cipher = EVP_des_ede3_cbc();
- ctx->keyId = xmlSecOpenSSLKeyDataDesId;
+ ctx->cipher = EVP_des_ede3_cbc();
+ ctx->keyId = xmlSecOpenSSLKeyDataDesId;
} else
#endif /* XMLSEC_NO_DES */
#ifndef XMLSEC_NO_AES
if(transform->id == xmlSecOpenSSLTransformAes128CbcId) {
- ctx->cipher = EVP_aes_128_cbc();
- ctx->keyId = xmlSecOpenSSLKeyDataAesId;
+ ctx->cipher = EVP_aes_128_cbc();
+ ctx->keyId = xmlSecOpenSSLKeyDataAesId;
} else if(transform->id == xmlSecOpenSSLTransformAes192CbcId) {
- ctx->cipher = EVP_aes_192_cbc();
- ctx->keyId = xmlSecOpenSSLKeyDataAesId;
+ ctx->cipher = EVP_aes_192_cbc();
+ ctx->keyId = xmlSecOpenSSLKeyDataAesId;
} else if(transform->id == xmlSecOpenSSLTransformAes256CbcId) {
- ctx->cipher = EVP_aes_256_cbc();
- ctx->keyId = xmlSecOpenSSLKeyDataAesId;
+ ctx->cipher = EVP_aes_256_cbc();
+ ctx->keyId = xmlSecOpenSSLKeyDataAesId;
} else
#endif /* XMLSEC_NO_AES */
if(1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
EVP_CIPHER_CTX_init(&(ctx->cipherCtx));
@@ -538,12 +538,12 @@ xmlSecOpenSSLEvpBlockCipherSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReq
xmlSecAssert2(ctx->cipher != NULL, -1);
xmlSecAssert2(ctx->keyId != NULL, -1);
- keyReq->keyId = ctx->keyId;
+ keyReq->keyId = ctx->keyId;
keyReq->keyType = xmlSecKeyDataTypeSymmetric;
if(transform->operation == xmlSecTransformOperationEncrypt) {
- keyReq->keyUsage = xmlSecKeyUsageEncrypt;
+ keyReq->keyUsage = xmlSecKeyUsageEncrypt;
} else {
- keyReq->keyUsage = xmlSecKeyUsageDecrypt;
+ keyReq->keyUsage = xmlSecKeyUsageDecrypt;
}
cipherKeyLen = EVP_CIPHER_key_length(ctx->cipher);
@@ -579,13 +579,13 @@ xmlSecOpenSSLEvpBlockCipherSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key
xmlSecAssert2(buffer != NULL, -1);
if(xmlSecBufferGetSize(buffer) < (xmlSecSize)cipherKeyLen) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
- "keySize=%d;expected=%d",
- xmlSecBufferGetSize(buffer), cipherKeyLen);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
+ "keySize=%d;expected=%d",
+ xmlSecBufferGetSize(buffer), cipherKeyLen);
+ return(-1);
}
xmlSecAssert2(xmlSecBufferGetData(buffer) != NULL, -1);
@@ -613,75 +613,75 @@ xmlSecOpenSSLEvpBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSe
xmlSecAssert2(ctx != NULL, -1);
if(transform->status == xmlSecTransformStatusNone) {
- transform->status = xmlSecTransformStatusWorking;
+ transform->status = xmlSecTransformStatusWorking;
}
if(transform->status == xmlSecTransformStatusWorking) {
- if(ctx->ctxInitialized == 0) {
- ret = xmlSecOpenSSLEvpBlockCipherCtxInit(ctx, in, out,
- (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
- xmlSecTransformGetName(transform), transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecOpenSSLEvpBlockCipherCtxInit",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- }
- if((ctx->ctxInitialized == 0) && (last != 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "not enough data to initialize transform");
- return(-1);
- }
-
- if(ctx->ctxInitialized != 0) {
- ret = xmlSecOpenSSLEvpBlockCipherCtxUpdate(ctx, in, out,
- xmlSecTransformGetName(transform),
- transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecOpenSSLEvpBlockCipherCtxUpdate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- }
-
- if(last != 0) {
- /* by now there should be no input */
- xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
- ret = xmlSecOpenSSLEvpBlockCipherCtxFinal(ctx, out,
- xmlSecTransformGetName(transform),
- transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecOpenSSLEvpBlockCipherCtxFinal",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- transform->status = xmlSecTransformStatusFinished;
- }
+ if(ctx->ctxInitialized == 0) {
+ ret = xmlSecOpenSSLEvpBlockCipherCtxInit(ctx, in, out,
+ (transform->operation == xmlSecTransformOperationEncrypt) ? 1 : 0,
+ xmlSecTransformGetName(transform), transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecOpenSSLEvpBlockCipherCtxInit",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ }
+ if((ctx->ctxInitialized == 0) && (last != 0)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "not enough data to initialize transform");
+ return(-1);
+ }
+
+ if(ctx->ctxInitialized != 0) {
+ ret = xmlSecOpenSSLEvpBlockCipherCtxUpdate(ctx, in, out,
+ xmlSecTransformGetName(transform),
+ transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecOpenSSLEvpBlockCipherCtxUpdate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ }
+
+ if(last != 0) {
+ /* by now there should be no input */
+ xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
+ ret = xmlSecOpenSSLEvpBlockCipherCtxFinal(ctx, out,
+ xmlSecTransformGetName(transform),
+ transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecOpenSSLEvpBlockCipherCtxFinal",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ transform->status = xmlSecTransformStatusFinished;
+ }
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
} else if(transform->status == xmlSecTransformStatusNone) {
- /* the only way we can get here is if there is no enough data in the input */
- xmlSecAssert2(last == 0, -1);
+ /* the only way we can get here is if there is no enough data in the input */
+ xmlSecAssert2(last == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
@@ -696,29 +696,29 @@ xmlSecOpenSSLEvpBlockCipherExecute(xmlSecTransformPtr transform, int last, xmlSe
********************************************************************/
static xmlSecTransformKlass xmlSecOpenSSLAes128CbcKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLEvpBlockCipherSize, /* xmlSecSize objSize */
-
- xmlSecNameAes128Cbc, /* const xmlChar* name; */
- xmlSecHrefAes128Cbc, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecOpenSSLEvpBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLEvpBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLEvpBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecOpenSSLEvpBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLEvpBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
-
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLEvpBlockCipherSize, /* xmlSecSize objSize */
+
+ xmlSecNameAes128Cbc, /* const xmlChar* name; */
+ xmlSecHrefAes128Cbc, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecOpenSSLEvpBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLEvpBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLEvpBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecOpenSSLEvpBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLEvpBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
+
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -735,29 +735,29 @@ xmlSecOpenSSLTransformAes128CbcGetKlass(void) {
static xmlSecTransformKlass xmlSecOpenSSLAes192CbcKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLEvpBlockCipherSize, /* xmlSecSize objSize */
-
- xmlSecNameAes192Cbc, /* const xmlChar* name; */
- xmlSecHrefAes192Cbc, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecOpenSSLEvpBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLEvpBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLEvpBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecOpenSSLEvpBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLEvpBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLEvpBlockCipherSize, /* xmlSecSize objSize */
+
+ xmlSecNameAes192Cbc, /* const xmlChar* name; */
+ xmlSecHrefAes192Cbc, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecOpenSSLEvpBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLEvpBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLEvpBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecOpenSSLEvpBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLEvpBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -774,29 +774,29 @@ xmlSecOpenSSLTransformAes192CbcGetKlass(void) {
static xmlSecTransformKlass xmlSecOpenSSLAes256CbcKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLEvpBlockCipherSize, /* xmlSecSize objSize */
-
- xmlSecNameAes256Cbc, /* const xmlChar* name; */
- xmlSecHrefAes256Cbc, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecOpenSSLEvpBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLEvpBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLEvpBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecOpenSSLEvpBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLEvpBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLEvpBlockCipherSize, /* xmlSecSize objSize */
+
+ xmlSecNameAes256Cbc, /* const xmlChar* name; */
+ xmlSecHrefAes256Cbc, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecOpenSSLEvpBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLEvpBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLEvpBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecOpenSSLEvpBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLEvpBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -816,29 +816,29 @@ xmlSecOpenSSLTransformAes256CbcGetKlass(void) {
#ifndef XMLSEC_NO_DES
static xmlSecTransformKlass xmlSecOpenSSLDes3CbcKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLEvpBlockCipherSize, /* xmlSecSize objSize */
-
- xmlSecNameDes3Cbc, /* const xmlChar* name; */
- xmlSecHrefDes3Cbc, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecOpenSSLEvpBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLEvpBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLEvpBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecOpenSSLEvpBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLEvpBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLEvpBlockCipherSize, /* xmlSecSize objSize */
+
+ xmlSecNameDes3Cbc, /* const xmlChar* name; */
+ xmlSecHrefDes3Cbc, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecOpenSSLEvpBlockCipherInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLEvpBlockCipherFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLEvpBlockCipherSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecOpenSSLEvpBlockCipherSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLEvpBlockCipherExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
diff --git a/src/openssl/crypto.c b/src/openssl/crypto.c
index fa22662..7e81a8e 100644
--- a/src/openssl/crypto.c
+++ b/src/openssl/crypto.c
@@ -25,7 +25,7 @@
#include <xmlsec/openssl/crypto.h>
#include <xmlsec/openssl/x509.h>
-static int xmlSecOpenSSLErrorsInit (void);
+static int xmlSecOpenSSLErrorsInit (void);
static xmlSecCryptoDLFunctionsPtr gXmlSecOpenSSLFunctions = NULL;
static xmlChar* gXmlSecOpenSSLTrustedCertsFolder = NULL;
@@ -42,7 +42,7 @@ xmlSecCryptoGetFunctions_openssl(void) {
static xmlSecCryptoDLFunctions functions;
if(gXmlSecOpenSSLFunctions != NULL) {
- return(gXmlSecOpenSSLFunctions);
+ return(gXmlSecOpenSSLFunctions);
}
memset(&functions, 0, sizeof(functions));
@@ -51,35 +51,35 @@ xmlSecCryptoGetFunctions_openssl(void) {
/**
* Crypto Init/shutdown
*/
- gXmlSecOpenSSLFunctions->cryptoInit = xmlSecOpenSSLInit;
- gXmlSecOpenSSLFunctions->cryptoShutdown = xmlSecOpenSSLShutdown;
- gXmlSecOpenSSLFunctions->cryptoKeysMngrInit = xmlSecOpenSSLKeysMngrInit;
+ gXmlSecOpenSSLFunctions->cryptoInit = xmlSecOpenSSLInit;
+ gXmlSecOpenSSLFunctions->cryptoShutdown = xmlSecOpenSSLShutdown;
+ gXmlSecOpenSSLFunctions->cryptoKeysMngrInit = xmlSecOpenSSLKeysMngrInit;
/**
* Key data ids
*/
#ifndef XMLSEC_NO_AES
- gXmlSecOpenSSLFunctions->keyDataAesGetKlass = xmlSecOpenSSLKeyDataAesGetKlass;
+ gXmlSecOpenSSLFunctions->keyDataAesGetKlass = xmlSecOpenSSLKeyDataAesGetKlass;
#endif /* XMLSEC_NO_AES */
#ifndef XMLSEC_NO_DES
- gXmlSecOpenSSLFunctions->keyDataDesGetKlass = xmlSecOpenSSLKeyDataDesGetKlass;
+ gXmlSecOpenSSLFunctions->keyDataDesGetKlass = xmlSecOpenSSLKeyDataDesGetKlass;
#endif /* XMLSEC_NO_DES */
#ifndef XMLSEC_NO_DSA
- gXmlSecOpenSSLFunctions->keyDataDsaGetKlass = xmlSecOpenSSLKeyDataDsaGetKlass;
+ gXmlSecOpenSSLFunctions->keyDataDsaGetKlass = xmlSecOpenSSLKeyDataDsaGetKlass;
#endif /* XMLSEC_NO_DSA */
#ifndef XMLSEC_NO_HMAC
- gXmlSecOpenSSLFunctions->keyDataHmacGetKlass = xmlSecOpenSSLKeyDataHmacGetKlass;
+ gXmlSecOpenSSLFunctions->keyDataHmacGetKlass = xmlSecOpenSSLKeyDataHmacGetKlass;
#endif /* XMLSEC_NO_HMAC */
#ifndef XMLSEC_NO_RSA
- gXmlSecOpenSSLFunctions->keyDataRsaGetKlass = xmlSecOpenSSLKeyDataRsaGetKlass;
+ gXmlSecOpenSSLFunctions->keyDataRsaGetKlass = xmlSecOpenSSLKeyDataRsaGetKlass;
#endif /* XMLSEC_NO_RSA */
#ifndef XMLSEC_NO_X509
- gXmlSecOpenSSLFunctions->keyDataX509GetKlass = xmlSecOpenSSLKeyDataX509GetKlass;
+ gXmlSecOpenSSLFunctions->keyDataX509GetKlass = xmlSecOpenSSLKeyDataX509GetKlass;
gXmlSecOpenSSLFunctions->keyDataRawX509CertGetKlass = xmlSecOpenSSLKeyDataRawX509CertGetKlass;
#endif /* XMLSEC_NO_X509 */
@@ -87,7 +87,7 @@ xmlSecCryptoGetFunctions_openssl(void) {
* Key data store ids
*/
#ifndef XMLSEC_NO_X509
- gXmlSecOpenSSLFunctions->x509StoreGetKlass = xmlSecOpenSSLX509StoreGetKlass;
+ gXmlSecOpenSSLFunctions->x509StoreGetKlass = xmlSecOpenSSLX509StoreGetKlass;
#endif /* XMLSEC_NO_X509 */
/**
@@ -95,56 +95,56 @@ xmlSecCryptoGetFunctions_openssl(void) {
*/
/******************************* AES ********************************/
#ifndef XMLSEC_NO_AES
- gXmlSecOpenSSLFunctions->transformAes128CbcGetKlass = xmlSecOpenSSLTransformAes128CbcGetKlass;
- gXmlSecOpenSSLFunctions->transformAes192CbcGetKlass = xmlSecOpenSSLTransformAes192CbcGetKlass;
- gXmlSecOpenSSLFunctions->transformAes256CbcGetKlass = xmlSecOpenSSLTransformAes256CbcGetKlass;
- gXmlSecOpenSSLFunctions->transformKWAes128GetKlass = xmlSecOpenSSLTransformKWAes128GetKlass;
- gXmlSecOpenSSLFunctions->transformKWAes192GetKlass = xmlSecOpenSSLTransformKWAes192GetKlass;
- gXmlSecOpenSSLFunctions->transformKWAes256GetKlass = xmlSecOpenSSLTransformKWAes256GetKlass;
+ gXmlSecOpenSSLFunctions->transformAes128CbcGetKlass = xmlSecOpenSSLTransformAes128CbcGetKlass;
+ gXmlSecOpenSSLFunctions->transformAes192CbcGetKlass = xmlSecOpenSSLTransformAes192CbcGetKlass;
+ gXmlSecOpenSSLFunctions->transformAes256CbcGetKlass = xmlSecOpenSSLTransformAes256CbcGetKlass;
+ gXmlSecOpenSSLFunctions->transformKWAes128GetKlass = xmlSecOpenSSLTransformKWAes128GetKlass;
+ gXmlSecOpenSSLFunctions->transformKWAes192GetKlass = xmlSecOpenSSLTransformKWAes192GetKlass;
+ gXmlSecOpenSSLFunctions->transformKWAes256GetKlass = xmlSecOpenSSLTransformKWAes256GetKlass;
#endif /* XMLSEC_NO_AES */
/******************************* DES ********************************/
#ifndef XMLSEC_NO_DES
- gXmlSecOpenSSLFunctions->transformDes3CbcGetKlass = xmlSecOpenSSLTransformDes3CbcGetKlass;
- gXmlSecOpenSSLFunctions->transformKWDes3GetKlass = xmlSecOpenSSLTransformKWDes3GetKlass;
+ gXmlSecOpenSSLFunctions->transformDes3CbcGetKlass = xmlSecOpenSSLTransformDes3CbcGetKlass;
+ gXmlSecOpenSSLFunctions->transformKWDes3GetKlass = xmlSecOpenSSLTransformKWDes3GetKlass;
#endif /* XMLSEC_NO_DES */
/******************************* DSA ********************************/
#ifndef XMLSEC_NO_DSA
#ifndef XMLSEC_NO_SHA1
- gXmlSecOpenSSLFunctions->transformDsaSha1GetKlass = xmlSecOpenSSLTransformDsaSha1GetKlass;
+ gXmlSecOpenSSLFunctions->transformDsaSha1GetKlass = xmlSecOpenSSLTransformDsaSha1GetKlass;
#endif /* XMLSEC_NO_SHA1 */
#endif /* XMLSEC_NO_DSA */
/******************************* HMAC ********************************/
#ifndef XMLSEC_NO_HMAC
#ifndef XMLSEC_NO_MD5
- gXmlSecOpenSSLFunctions->transformHmacMd5GetKlass = xmlSecOpenSSLTransformHmacMd5GetKlass;
+ gXmlSecOpenSSLFunctions->transformHmacMd5GetKlass = xmlSecOpenSSLTransformHmacMd5GetKlass;
#endif /* XMLSEC_NO_MD5 */
#ifndef XMLSEC_NO_RIPEMD160
- gXmlSecOpenSSLFunctions->transformHmacRipemd160GetKlass = xmlSecOpenSSLTransformHmacRipemd160GetKlass;
+ gXmlSecOpenSSLFunctions->transformHmacRipemd160GetKlass = xmlSecOpenSSLTransformHmacRipemd160GetKlass;
#endif /* XMLSEC_NO_RIPEMD160 */
#ifndef XMLSEC_NO_SHA1
- gXmlSecOpenSSLFunctions->transformHmacSha1GetKlass = xmlSecOpenSSLTransformHmacSha1GetKlass;
+ gXmlSecOpenSSLFunctions->transformHmacSha1GetKlass = xmlSecOpenSSLTransformHmacSha1GetKlass;
#endif /* XMLSEC_NO_SHA1 */
#ifndef XMLSEC_NO_SHA224
- gXmlSecOpenSSLFunctions->transformHmacSha224GetKlass = xmlSecOpenSSLTransformHmacSha224GetKlass;
+ gXmlSecOpenSSLFunctions->transformHmacSha224GetKlass = xmlSecOpenSSLTransformHmacSha224GetKlass;
#endif /* XMLSEC_NO_SHA224 */
#ifndef XMLSEC_NO_SHA256
- gXmlSecOpenSSLFunctions->transformHmacSha256GetKlass = xmlSecOpenSSLTransformHmacSha256GetKlass;
+ gXmlSecOpenSSLFunctions->transformHmacSha256GetKlass = xmlSecOpenSSLTransformHmacSha256GetKlass;
#endif /* XMLSEC_NO_SHA256 */
#ifndef XMLSEC_NO_SHA384
- gXmlSecOpenSSLFunctions->transformHmacSha384GetKlass = xmlSecOpenSSLTransformHmacSha384GetKlass;
+ gXmlSecOpenSSLFunctions->transformHmacSha384GetKlass = xmlSecOpenSSLTransformHmacSha384GetKlass;
#endif /* XMLSEC_NO_SHA384 */
#ifndef XMLSEC_NO_SHA512
- gXmlSecOpenSSLFunctions->transformHmacSha512GetKlass = xmlSecOpenSSLTransformHmacSha512GetKlass;
+ gXmlSecOpenSSLFunctions->transformHmacSha512GetKlass = xmlSecOpenSSLTransformHmacSha512GetKlass;
#endif /* XMLSEC_NO_SHA512 */
@@ -152,85 +152,85 @@ xmlSecCryptoGetFunctions_openssl(void) {
/******************************* MD5 ********************************/
#ifndef XMLSEC_NO_MD5
- gXmlSecOpenSSLFunctions->transformMd5GetKlass = xmlSecOpenSSLTransformMd5GetKlass;
+ gXmlSecOpenSSLFunctions->transformMd5GetKlass = xmlSecOpenSSLTransformMd5GetKlass;
#endif /* XMLSEC_NO_MD5 */
/******************************* RIPEMD160 ********************************/
#ifndef XMLSEC_NO_RIPEMD160
- gXmlSecOpenSSLFunctions->transformRipemd160GetKlass = xmlSecOpenSSLTransformRipemd160GetKlass;
+ gXmlSecOpenSSLFunctions->transformRipemd160GetKlass = xmlSecOpenSSLTransformRipemd160GetKlass;
#endif /* XMLSEC_NO_RIPEMD160 */
/******************************* RSA ********************************/
#ifndef XMLSEC_NO_RSA
#ifndef XMLSEC_NO_MD5
- gXmlSecOpenSSLFunctions->transformRsaMd5GetKlass = xmlSecOpenSSLTransformRsaMd5GetKlass;
+ gXmlSecOpenSSLFunctions->transformRsaMd5GetKlass = xmlSecOpenSSLTransformRsaMd5GetKlass;
#endif /* XMLSEC_NO_MD5 */
#ifndef XMLSEC_NO_RIPEMD160
- gXmlSecOpenSSLFunctions->transformRsaRipemd160GetKlass = xmlSecOpenSSLTransformRsaRipemd160GetKlass;
+ gXmlSecOpenSSLFunctions->transformRsaRipemd160GetKlass = xmlSecOpenSSLTransformRsaRipemd160GetKlass;
#endif /* XMLSEC_NO_RIPEMD160 */
#ifndef XMLSEC_NO_SHA1
- gXmlSecOpenSSLFunctions->transformRsaSha1GetKlass = xmlSecOpenSSLTransformRsaSha1GetKlass;
+ gXmlSecOpenSSLFunctions->transformRsaSha1GetKlass = xmlSecOpenSSLTransformRsaSha1GetKlass;
#endif /* XMLSEC_NO_SHA1 */
#ifndef XMLSEC_NO_SHA224
- gXmlSecOpenSSLFunctions->transformRsaSha224GetKlass = xmlSecOpenSSLTransformRsaSha224GetKlass;
+ gXmlSecOpenSSLFunctions->transformRsaSha224GetKlass = xmlSecOpenSSLTransformRsaSha224GetKlass;
#endif /* XMLSEC_NO_SHA224 */
#ifndef XMLSEC_NO_SHA256
- gXmlSecOpenSSLFunctions->transformRsaSha256GetKlass = xmlSecOpenSSLTransformRsaSha256GetKlass;
+ gXmlSecOpenSSLFunctions->transformRsaSha256GetKlass = xmlSecOpenSSLTransformRsaSha256GetKlass;
#endif /* XMLSEC_NO_SHA256 */
#ifndef XMLSEC_NO_SHA384
- gXmlSecOpenSSLFunctions->transformRsaSha384GetKlass = xmlSecOpenSSLTransformRsaSha384GetKlass;
+ gXmlSecOpenSSLFunctions->transformRsaSha384GetKlass = xmlSecOpenSSLTransformRsaSha384GetKlass;
#endif /* XMLSEC_NO_SHA384 */
#ifndef XMLSEC_NO_SHA512
- gXmlSecOpenSSLFunctions->transformRsaSha512GetKlass = xmlSecOpenSSLTransformRsaSha512GetKlass;
+ gXmlSecOpenSSLFunctions->transformRsaSha512GetKlass = xmlSecOpenSSLTransformRsaSha512GetKlass;
#endif /* XMLSEC_NO_SHA512 */
- gXmlSecOpenSSLFunctions->transformRsaPkcs1GetKlass = xmlSecOpenSSLTransformRsaPkcs1GetKlass;
- gXmlSecOpenSSLFunctions->transformRsaOaepGetKlass = xmlSecOpenSSLTransformRsaOaepGetKlass;
+ gXmlSecOpenSSLFunctions->transformRsaPkcs1GetKlass = xmlSecOpenSSLTransformRsaPkcs1GetKlass;
+ gXmlSecOpenSSLFunctions->transformRsaOaepGetKlass = xmlSecOpenSSLTransformRsaOaepGetKlass;
#endif /* XMLSEC_NO_RSA */
/******************************* SHA ********************************/
#ifndef XMLSEC_NO_SHA1
- gXmlSecOpenSSLFunctions->transformSha1GetKlass = xmlSecOpenSSLTransformSha1GetKlass;
+ gXmlSecOpenSSLFunctions->transformSha1GetKlass = xmlSecOpenSSLTransformSha1GetKlass;
#endif /* XMLSEC_NO_SHA1 */
#ifndef XMLSEC_NO_SHA224
- gXmlSecOpenSSLFunctions->transformSha224GetKlass = xmlSecOpenSSLTransformSha224GetKlass;
+ gXmlSecOpenSSLFunctions->transformSha224GetKlass = xmlSecOpenSSLTransformSha224GetKlass;
#endif /* XMLSEC_NO_SHA224 */
#ifndef XMLSEC_NO_SHA256
- gXmlSecOpenSSLFunctions->transformSha256GetKlass = xmlSecOpenSSLTransformSha256GetKlass;
+ gXmlSecOpenSSLFunctions->transformSha256GetKlass = xmlSecOpenSSLTransformSha256GetKlass;
#endif /* XMLSEC_NO_SHA256 */
#ifndef XMLSEC_NO_SHA384
- gXmlSecOpenSSLFunctions->transformSha384GetKlass = xmlSecOpenSSLTransformSha384GetKlass;
+ gXmlSecOpenSSLFunctions->transformSha384GetKlass = xmlSecOpenSSLTransformSha384GetKlass;
#endif /* XMLSEC_NO_SHA384 */
#ifndef XMLSEC_NO_SHA512
- gXmlSecOpenSSLFunctions->transformSha512GetKlass = xmlSecOpenSSLTransformSha512GetKlass;
+ gXmlSecOpenSSLFunctions->transformSha512GetKlass = xmlSecOpenSSLTransformSha512GetKlass;
#endif /* XMLSEC_NO_SHA512 */
/**
* High level routines form xmlsec command line utility
*/
- gXmlSecOpenSSLFunctions->cryptoAppInit = xmlSecOpenSSLAppInit;
- gXmlSecOpenSSLFunctions->cryptoAppShutdown = xmlSecOpenSSLAppShutdown;
- gXmlSecOpenSSLFunctions->cryptoAppDefaultKeysMngrInit = xmlSecOpenSSLAppDefaultKeysMngrInit;
- gXmlSecOpenSSLFunctions->cryptoAppDefaultKeysMngrAdoptKey = xmlSecOpenSSLAppDefaultKeysMngrAdoptKey;
- gXmlSecOpenSSLFunctions->cryptoAppDefaultKeysMngrLoad = xmlSecOpenSSLAppDefaultKeysMngrLoad;
- gXmlSecOpenSSLFunctions->cryptoAppDefaultKeysMngrSave = xmlSecOpenSSLAppDefaultKeysMngrSave;
+ gXmlSecOpenSSLFunctions->cryptoAppInit = xmlSecOpenSSLAppInit;
+ gXmlSecOpenSSLFunctions->cryptoAppShutdown = xmlSecOpenSSLAppShutdown;
+ gXmlSecOpenSSLFunctions->cryptoAppDefaultKeysMngrInit = xmlSecOpenSSLAppDefaultKeysMngrInit;
+ gXmlSecOpenSSLFunctions->cryptoAppDefaultKeysMngrAdoptKey = xmlSecOpenSSLAppDefaultKeysMngrAdoptKey;
+ gXmlSecOpenSSLFunctions->cryptoAppDefaultKeysMngrLoad = xmlSecOpenSSLAppDefaultKeysMngrLoad;
+ gXmlSecOpenSSLFunctions->cryptoAppDefaultKeysMngrSave = xmlSecOpenSSLAppDefaultKeysMngrSave;
#ifndef XMLSEC_NO_X509
- gXmlSecOpenSSLFunctions->cryptoAppKeysMngrCertLoad = xmlSecOpenSSLAppKeysMngrCertLoad;
- gXmlSecOpenSSLFunctions->cryptoAppKeysMngrCertLoadMemory = xmlSecOpenSSLAppKeysMngrCertLoadMemory;
- gXmlSecOpenSSLFunctions->cryptoAppPkcs12Load = xmlSecOpenSSLAppPkcs12Load;
- gXmlSecOpenSSLFunctions->cryptoAppPkcs12LoadMemory = xmlSecOpenSSLAppPkcs12LoadMemory;
- gXmlSecOpenSSLFunctions->cryptoAppKeyCertLoad = xmlSecOpenSSLAppKeyCertLoad;
- gXmlSecOpenSSLFunctions->cryptoAppKeyCertLoadMemory = xmlSecOpenSSLAppKeyCertLoadMemory;
+ gXmlSecOpenSSLFunctions->cryptoAppKeysMngrCertLoad = xmlSecOpenSSLAppKeysMngrCertLoad;
+ gXmlSecOpenSSLFunctions->cryptoAppKeysMngrCertLoadMemory = xmlSecOpenSSLAppKeysMngrCertLoadMemory;
+ gXmlSecOpenSSLFunctions->cryptoAppPkcs12Load = xmlSecOpenSSLAppPkcs12Load;
+ gXmlSecOpenSSLFunctions->cryptoAppPkcs12LoadMemory = xmlSecOpenSSLAppPkcs12LoadMemory;
+ gXmlSecOpenSSLFunctions->cryptoAppKeyCertLoad = xmlSecOpenSSLAppKeyCertLoad;
+ gXmlSecOpenSSLFunctions->cryptoAppKeyCertLoadMemory = xmlSecOpenSSLAppKeyCertLoadMemory;
#endif /* XMLSEC_NO_X509 */
- gXmlSecOpenSSLFunctions->cryptoAppKeyLoad = xmlSecOpenSSLAppKeyLoad;
- gXmlSecOpenSSLFunctions->cryptoAppKeyLoadMemory = xmlSecOpenSSLAppKeyLoadMemory;
- gXmlSecOpenSSLFunctions->cryptoAppDefaultPwdCallback = (void*)xmlSecOpenSSLAppGetDefaultPwdCallback();
+ gXmlSecOpenSSLFunctions->cryptoAppKeyLoad = xmlSecOpenSSLAppKeyLoad;
+ gXmlSecOpenSSLFunctions->cryptoAppKeyLoadMemory = xmlSecOpenSSLAppKeyLoadMemory;
+ gXmlSecOpenSSLFunctions->cryptoAppDefaultPwdCallback = (void*)xmlSecOpenSSLAppGetDefaultPwdCallback();
return(gXmlSecOpenSSLFunctions);
}
@@ -246,31 +246,31 @@ int
xmlSecOpenSSLInit (void) {
/* Check loaded xmlsec library version */
if(xmlSecCheckVersionExact() != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCheckVersionExact",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCheckVersionExact",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if(xmlSecOpenSSLErrorsInit() < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLErrorsInit",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLErrorsInit",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* register our klasses */
if(xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(xmlSecCryptoGetFunctions_openssl()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -291,7 +291,7 @@ xmlSecOpenSSLShutdown(void) {
/**
* xmlSecOpenSSLKeysMngrInit:
- * @mngr: the pointer to keys manager.
+ * @mngr: the pointer to keys manager.
*
* Adds OpenSSL specific key data stores in keys manager.
*
@@ -306,28 +306,28 @@ xmlSecOpenSSLKeysMngrInit(xmlSecKeysMngrPtr mngr) {
#ifndef XMLSEC_NO_X509
/* create x509 store if needed */
if(xmlSecKeysMngrGetDataStore(mngr, xmlSecOpenSSLX509StoreId) == NULL) {
- xmlSecKeyDataStorePtr x509Store;
+ xmlSecKeyDataStorePtr x509Store;
x509Store = xmlSecKeyDataStoreCreate(xmlSecOpenSSLX509StoreId);
- if(x509Store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataStoreCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecOpenSSLX509StoreId");
- return(-1);
- }
+ if(x509Store == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataStoreCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecOpenSSLX509StoreId");
+ return(-1);
+ }
ret = xmlSecKeysMngrAdoptDataStore(mngr, x509Store);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrAdoptDataStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataStoreDestroy(x509Store);
- return(-1);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrAdoptDataStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataStoreDestroy(x509Store);
+ return(-1);
+ }
}
#endif /* XMLSEC_NO_X509 */
return(0);
@@ -335,15 +335,15 @@ xmlSecOpenSSLKeysMngrInit(xmlSecKeysMngrPtr mngr) {
/**
* xmlSecOpenSSLGenerateRandom:
- * @buffer: the destination buffer.
- * @size: the numer of bytes to generate.
+ * @buffer: the destination buffer.
+ * @size: the numer of bytes to generate.
*
* Generates @size random bytes and puts result in @buffer.
*
* Returns: 0 on success or a negative value otherwise.
*/
int
-xmlSecOpenSSLGenerateRandom(xmlSecBufferPtr buffer, xmlSecSize size) {
+xmlSecOpenSSLGenerateRandom(xmlSecBufferPtr buffer, xmlSecSize size) {
int ret;
xmlSecAssert2(buffer != NULL, -1);
@@ -351,70 +351,70 @@ xmlSecOpenSSLGenerateRandom(xmlSecBufferPtr buffer, xmlSecSize size) {
ret = xmlSecBufferSetSize(buffer, size);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", size);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", size);
+ return(-1);
}
/* get random data */
ret = RAND_bytes((xmlSecByte*)xmlSecBufferGetData(buffer), size);
if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "RAND_bytes",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "size=%d", size);
- return(-1);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "RAND_bytes",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "size=%d", size);
+ return(-1);
+ }
return(0);
}
/**
* xmlSecOpenSSLErrorsDefaultCallback:
- * @file: the error location file name (__FILE__ macro).
- * @line: the error location line number (__LINE__ macro).
- * @func: the error location function name (__FUNCTION__ macro).
- * @errorObject: the error specific error object
- * @errorSubject: the error specific error subject.
- * @reason: the error code.
- * @msg: the additional error message.
+ * @file: the error location file name (__FILE__ macro).
+ * @line: the error location line number (__LINE__ macro).
+ * @func: the error location function name (__FUNCTION__ macro).
+ * @errorObject: the error specific error object
+ * @errorSubject: the error specific error subject.
+ * @reason: the error code.
+ * @msg: the additional error message.
*
* The default OpenSSL errors reporting callback function.
*/
void
xmlSecOpenSSLErrorsDefaultCallback(const char* file, int line, const char* func,
- const char* errorObject, const char* errorSubject,
- int reason, const char* msg) {
+ const char* errorObject, const char* errorSubject,
+ int reason, const char* msg) {
ERR_put_error(XMLSEC_OPENSSL_ERRORS_LIB,
- XMLSEC_OPENSSL_ERRORS_FUNCTION,
- reason, file, line);
+ XMLSEC_OPENSSL_ERRORS_FUNCTION,
+ reason, file, line);
xmlSecErrorsDefaultCallback(file, line, func,
- errorObject, errorSubject,
- reason, msg);
+ errorObject, errorSubject,
+ reason, msg);
}
static int
xmlSecOpenSSLErrorsInit(void) {
static ERR_STRING_DATA xmlSecOpenSSLStrReasons[XMLSEC_ERRORS_MAX_NUMBER + 1];
static ERR_STRING_DATA xmlSecOpenSSLStrLib[]= {
- { ERR_PACK(XMLSEC_OPENSSL_ERRORS_LIB,0,0), "xmlsec routines"},
- { 0, NULL}
+ { ERR_PACK(XMLSEC_OPENSSL_ERRORS_LIB,0,0), "xmlsec routines"},
+ { 0, NULL}
};
static ERR_STRING_DATA xmlSecOpenSSLStrDefReason[]= {
- { XMLSEC_OPENSSL_ERRORS_LIB, "xmlsec lib"},
- { 0, NULL}
+ { XMLSEC_OPENSSL_ERRORS_LIB, "xmlsec lib"},
+ { 0, NULL}
};
xmlSecSize pos;
/* initialize reasons array */
memset(xmlSecOpenSSLStrReasons, 0, sizeof(xmlSecOpenSSLStrReasons));
for(pos = 0; (pos < XMLSEC_ERRORS_MAX_NUMBER) && (xmlSecErrorsGetMsg(pos) != NULL); ++pos) {
- xmlSecOpenSSLStrReasons[pos].error = xmlSecErrorsGetCode(pos);
- xmlSecOpenSSLStrReasons[pos].string = xmlSecErrorsGetMsg(pos);
+ xmlSecOpenSSLStrReasons[pos].error = xmlSecErrorsGetCode(pos);
+ xmlSecOpenSSLStrReasons[pos].string = xmlSecErrorsGetMsg(pos);
}
/* finally load xmlsec strings in OpenSSL */
@@ -430,7 +430,7 @@ xmlSecOpenSSLErrorsInit(void) {
/**
* xmlSecOpenSSLSetDefaultTrustedCertsFolder:
- * @path: the default trusted certs path.
+ * @path: the default trusted certs path.
*
* Sets the default trusted certs folder.
*
@@ -439,20 +439,20 @@ xmlSecOpenSSLErrorsInit(void) {
int
xmlSecOpenSSLSetDefaultTrustedCertsFolder(const xmlChar* path) {
if(gXmlSecOpenSSLTrustedCertsFolder != NULL) {
- xmlFree(gXmlSecOpenSSLTrustedCertsFolder);
- gXmlSecOpenSSLTrustedCertsFolder = NULL;
+ xmlFree(gXmlSecOpenSSLTrustedCertsFolder);
+ gXmlSecOpenSSLTrustedCertsFolder = NULL;
}
if(path != NULL) {
- gXmlSecOpenSSLTrustedCertsFolder = xmlStrdup(BAD_CAST path);
- if(gXmlSecOpenSSLTrustedCertsFolder == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlStrdup",
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ gXmlSecOpenSSLTrustedCertsFolder = xmlStrdup(BAD_CAST path);
+ if(gXmlSecOpenSSLTrustedCertsFolder == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlStrdup",
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
return(0);
@@ -465,7 +465,7 @@ xmlSecOpenSSLSetDefaultTrustedCertsFolder(const xmlChar* path) {
*
* Returns: the default trusted cert folder.
*/
-const xmlChar*
+const xmlChar*
xmlSecOpenSSLGetDefaultTrustedCertsFolder(void) {
return(gXmlSecOpenSSLTrustedCertsFolder);
}
diff --git a/src/openssl/digests.c b/src/openssl/digests.c
index c681e85..a755ce6 100644
--- a/src/openssl/digests.c
+++ b/src/openssl/digests.c
@@ -25,13 +25,13 @@
* Internal OpenSSL Digest CTX
*
*****************************************************************************/
-typedef struct _xmlSecOpenSSLDigestCtx xmlSecOpenSSLDigestCtx, *xmlSecOpenSSLDigestCtxPtr;
+typedef struct _xmlSecOpenSSLDigestCtx xmlSecOpenSSLDigestCtx, *xmlSecOpenSSLDigestCtxPtr;
struct _xmlSecOpenSSLDigestCtx {
- const EVP_MD* digest;
- EVP_MD_CTX digestCtx;
- xmlSecByte dgst[EVP_MAX_MD_SIZE];
- xmlSecSize dgstSize; /* dgst size in bytes */
-};
+ const EVP_MD* digest;
+ EVP_MD_CTX digestCtx;
+ xmlSecByte dgst[EVP_MAX_MD_SIZE];
+ xmlSecSize dgstSize; /* dgst size in bytes */
+};
/******************************************************************************
*
@@ -40,71 +40,71 @@ struct _xmlSecOpenSSLDigestCtx {
* xmlSecOpenSSLDigestCtx is located after xmlSecTransform
*
*****************************************************************************/
-#define xmlSecOpenSSLEvpDigestSize \
- (sizeof(xmlSecTransform) + sizeof(xmlSecOpenSSLDigestCtx))
+#define xmlSecOpenSSLEvpDigestSize \
+ (sizeof(xmlSecTransform) + sizeof(xmlSecOpenSSLDigestCtx))
#define xmlSecOpenSSLEvpDigestGetCtx(transform) \
((xmlSecOpenSSLDigestCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-static int xmlSecOpenSSLEvpDigestInitialize (xmlSecTransformPtr transform);
-static void xmlSecOpenSSLEvpDigestFinalize (xmlSecTransformPtr transform);
-static int xmlSecOpenSSLEvpDigestVerify (xmlSecTransformPtr transform,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecOpenSSLEvpDigestExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecOpenSSLEvpDigestCheckId (xmlSecTransformPtr transform);
+static int xmlSecOpenSSLEvpDigestInitialize (xmlSecTransformPtr transform);
+static void xmlSecOpenSSLEvpDigestFinalize (xmlSecTransformPtr transform);
+static int xmlSecOpenSSLEvpDigestVerify (xmlSecTransformPtr transform,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecOpenSSLEvpDigestExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecOpenSSLEvpDigestCheckId (xmlSecTransformPtr transform);
static int
xmlSecOpenSSLEvpDigestCheckId(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_MD5
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformMd5Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_MD5 */
#ifndef XMLSEC_NO_RIPEMD160
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRipemd160Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_RIPEMD160 */
#ifndef XMLSEC_NO_SHA1
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformSha1Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_SHA1 */
#ifndef XMLSEC_NO_SHA224
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformSha224Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_SHA224 */
#ifndef XMLSEC_NO_SHA256
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformSha256Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_SHA256 */
#ifndef XMLSEC_NO_SHA384
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformSha384Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_SHA384 */
#ifndef XMLSEC_NO_SHA512
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformSha512Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_SHA512 */
{
- return(0);
+ return(0);
}
return(0);
@@ -166,12 +166,12 @@ xmlSecOpenSSLEvpDigestInitialize(xmlSecTransformPtr transform) {
#endif /* XMLSEC_NO_SHA512 */
{
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
#ifndef XMLSEC_OPENSSL_096
@@ -199,8 +199,8 @@ xmlSecOpenSSLEvpDigestFinalize(xmlSecTransformPtr transform) {
static int
xmlSecOpenSSLEvpDigestVerify(xmlSecTransformPtr transform,
- const xmlSecByte* data, xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx) {
+ const xmlSecByte* data, xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecOpenSSLDigestCtxPtr ctx;
xmlSecAssert2(xmlSecOpenSSLEvpDigestCheckId(transform), -1);
@@ -215,24 +215,24 @@ xmlSecOpenSSLEvpDigestVerify(xmlSecTransformPtr transform,
xmlSecAssert2(ctx->dgstSize > 0, -1);
if(dataSize != ctx->dgstSize) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "data_size=%d;dgst_size=%d",
- dataSize, ctx->dgstSize);
- transform->status = xmlSecTransformStatusFail;
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "data_size=%d;dgst_size=%d",
+ dataSize, ctx->dgstSize);
+ transform->status = xmlSecTransformStatusFail;
+ return(0);
}
if(memcmp(ctx->dgst, data, ctx->dgstSize) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "data and digest do not match");
- transform->status = xmlSecTransformStatusFail;
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "data and digest do not match");
+ transform->status = xmlSecTransformStatusFail;
+ return(0);
}
transform->status = xmlSecTransformStatusOk;
@@ -262,92 +262,92 @@ xmlSecOpenSSLEvpDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTran
if(transform->status == xmlSecTransformStatusNone) {
#ifndef XMLSEC_OPENSSL_096
- ret = EVP_DigestInit(&(ctx->digestCtx), ctx->digest);
- if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "EVP_DigestInit",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ret = EVP_DigestInit(&(ctx->digestCtx), ctx->digest);
+ if(ret != 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "EVP_DigestInit",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
#else /* XMLSEC_OPENSSL_096 */
- EVP_DigestInit(&(ctx->digestCtx), ctx->digest);
+ EVP_DigestInit(&(ctx->digestCtx), ctx->digest);
#endif /* XMLSEC_OPENSSL_096 */
- transform->status = xmlSecTransformStatusWorking;
+ transform->status = xmlSecTransformStatusWorking;
}
if(transform->status == xmlSecTransformStatusWorking) {
- xmlSecSize inSize;
-
- inSize = xmlSecBufferGetSize(in);
- if(inSize > 0) {
+ xmlSecSize inSize;
+
+ inSize = xmlSecBufferGetSize(in);
+ if(inSize > 0) {
#ifndef XMLSEC_OPENSSL_096
- ret = EVP_DigestUpdate(&(ctx->digestCtx), xmlSecBufferGetData(in), inSize);
- if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "EVP_DigestUpdate",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "size=%d", inSize);
- return(-1);
- }
+ ret = EVP_DigestUpdate(&(ctx->digestCtx), xmlSecBufferGetData(in), inSize);
+ if(ret != 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "EVP_DigestUpdate",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "size=%d", inSize);
+ return(-1);
+ }
#else /* XMLSEC_OPENSSL_096 */
- EVP_DigestUpdate(&(ctx->digestCtx), xmlSecBufferGetData(in), inSize);
+ EVP_DigestUpdate(&(ctx->digestCtx), xmlSecBufferGetData(in), inSize);
#endif /* XMLSEC_OPENSSL_096 */
-
- ret = xmlSecBufferRemoveHead(in, inSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
- }
- }
- if(last) {
- xmlSecAssert2((xmlSecSize)EVP_MD_size(ctx->digest) <= sizeof(ctx->dgst), -1);
-
+
+ ret = xmlSecBufferRemoveHead(in, inSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
+ }
+ }
+ if(last) {
+ xmlSecAssert2((xmlSecSize)EVP_MD_size(ctx->digest) <= sizeof(ctx->dgst), -1);
+
#ifndef XMLSEC_OPENSSL_096
- ret = EVP_DigestFinal(&(ctx->digestCtx), ctx->dgst, &ctx->dgstSize);
- if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "EVP_DigestFinal",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ret = EVP_DigestFinal(&(ctx->digestCtx), ctx->dgst, &ctx->dgstSize);
+ if(ret != 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "EVP_DigestFinal",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
#else /* XMLSEC_OPENSSL_096 */
- EVP_DigestFinal(&(ctx->digestCtx), ctx->dgst, &ctx->dgstSize);
+ EVP_DigestFinal(&(ctx->digestCtx), ctx->dgst, &ctx->dgstSize);
#endif /* XMLSEC_OPENSSL_096 */
- xmlSecAssert2(ctx->dgstSize > 0, -1);
-
- /* copy result to output */
- if(transform->operation == xmlSecTransformOperationSign) {
- ret = xmlSecBufferAppend(out, ctx->dgst, ctx->dgstSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", ctx->dgstSize);
- return(-1);
- }
- }
- transform->status = xmlSecTransformStatusFinished;
- }
+ xmlSecAssert2(ctx->dgstSize > 0, -1);
+
+ /* copy result to output */
+ if(transform->operation == xmlSecTransformOperationSign) {
+ ret = xmlSecBufferAppend(out, ctx->dgst, ctx->dgstSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", ctx->dgstSize);
+ return(-1);
+ }
+ }
+ transform->status = xmlSecTransformStatusFinished;
+ }
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
@@ -362,29 +362,29 @@ xmlSecOpenSSLEvpDigestExecute(xmlSecTransformPtr transform, int last, xmlSecTran
*****************************************************************************/
static xmlSecTransformKlass xmlSecOpenSSLMd5Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLEvpDigestSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLEvpDigestSize, /* xmlSecSize objSize */
- xmlSecNameMd5, /* const xmlChar* name; */
- xmlSecHrefMd5, /* const xmlChar* href; */
- xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameMd5, /* const xmlChar* name; */
+ xmlSecHrefMd5, /* const xmlChar* href; */
+ xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLEvpDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLEvpDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLEvpDigestVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLEvpDigestExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLEvpDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLEvpDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLEvpDigestVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLEvpDigestExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -408,29 +408,29 @@ xmlSecOpenSSLTransformMd5GetKlass(void) {
*****************************************************************************/
static xmlSecTransformKlass xmlSecOpenSSLRipemd160Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLEvpDigestSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLEvpDigestSize, /* xmlSecSize objSize */
- xmlSecNameRipemd160, /* const xmlChar* name; */
- xmlSecHrefRipemd160, /* const xmlChar* href; */
- xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameRipemd160, /* const xmlChar* name; */
+ xmlSecHrefRipemd160, /* const xmlChar* href; */
+ xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLEvpDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLEvpDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLEvpDigestVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLEvpDigestExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLEvpDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLEvpDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLEvpDigestVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLEvpDigestExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -455,29 +455,29 @@ xmlSecOpenSSLTransformRipemd160GetKlass(void) {
*****************************************************************************/
static xmlSecTransformKlass xmlSecOpenSSLSha1Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLEvpDigestSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLEvpDigestSize, /* xmlSecSize objSize */
- xmlSecNameSha1, /* const xmlChar* name; */
- xmlSecHrefSha1, /* const xmlChar* href; */
- xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameSha1, /* const xmlChar* name; */
+ xmlSecHrefSha1, /* const xmlChar* href; */
+ xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLEvpDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLEvpDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLEvpDigestVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLEvpDigestExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLEvpDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLEvpDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLEvpDigestVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLEvpDigestExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -501,29 +501,29 @@ xmlSecOpenSSLTransformSha1GetKlass(void) {
*****************************************************************************/
static xmlSecTransformKlass xmlSecOpenSSLSha224Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLEvpDigestSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLEvpDigestSize, /* xmlSecSize objSize */
- xmlSecNameSha224, /* const xmlChar* name; */
- xmlSecHrefSha224, /* const xmlChar* href; */
- xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameSha224, /* const xmlChar* name; */
+ xmlSecHrefSha224, /* const xmlChar* href; */
+ xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLEvpDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLEvpDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLEvpDigestVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLEvpDigestExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLEvpDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLEvpDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLEvpDigestVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLEvpDigestExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -547,29 +547,29 @@ xmlSecOpenSSLTransformSha224GetKlass(void) {
*****************************************************************************/
static xmlSecTransformKlass xmlSecOpenSSLSha256Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLEvpDigestSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLEvpDigestSize, /* xmlSecSize objSize */
- xmlSecNameSha256, /* const xmlChar* name; */
- xmlSecHrefSha256, /* const xmlChar* href; */
- xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameSha256, /* const xmlChar* name; */
+ xmlSecHrefSha256, /* const xmlChar* href; */
+ xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLEvpDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLEvpDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLEvpDigestVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLEvpDigestExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLEvpDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLEvpDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLEvpDigestVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLEvpDigestExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -593,29 +593,29 @@ xmlSecOpenSSLTransformSha256GetKlass(void) {
*****************************************************************************/
static xmlSecTransformKlass xmlSecOpenSSLSha384Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLEvpDigestSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLEvpDigestSize, /* xmlSecSize objSize */
- xmlSecNameSha384, /* const xmlChar* name; */
- xmlSecHrefSha384, /* const xmlChar* href; */
- xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameSha384, /* const xmlChar* name; */
+ xmlSecHrefSha384, /* const xmlChar* href; */
+ xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLEvpDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLEvpDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLEvpDigestVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLEvpDigestExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLEvpDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLEvpDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLEvpDigestVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLEvpDigestExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -639,29 +639,29 @@ xmlSecOpenSSLTransformSha384GetKlass(void) {
*****************************************************************************/
static xmlSecTransformKlass xmlSecOpenSSLSha512Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLEvpDigestSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLEvpDigestSize, /* xmlSecSize objSize */
- xmlSecNameSha512, /* const xmlChar* name; */
- xmlSecHrefSha512, /* const xmlChar* href; */
- xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameSha512, /* const xmlChar* name; */
+ xmlSecHrefSha512, /* const xmlChar* href; */
+ xmlSecTransformUsageDigestMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLEvpDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLEvpDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLEvpDigestVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLEvpDigestExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLEvpDigestInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLEvpDigestFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLEvpDigestVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLEvpDigestExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
diff --git a/src/openssl/evp.c b/src/openssl/evp.c
index e9d8729..60b4685 100644
--- a/src/openssl/evp.c
+++ b/src/openssl/evp.c
@@ -29,11 +29,11 @@
* Internal OpenSSL EVP key CTX
*
*************************************************************************/
-typedef struct _xmlSecOpenSSLEvpKeyDataCtx xmlSecOpenSSLEvpKeyDataCtx,
- *xmlSecOpenSSLEvpKeyDataCtxPtr;
+typedef struct _xmlSecOpenSSLEvpKeyDataCtx xmlSecOpenSSLEvpKeyDataCtx,
+ *xmlSecOpenSSLEvpKeyDataCtxPtr;
struct _xmlSecOpenSSLEvpKeyDataCtx {
- EVP_PKEY* pKey;
-};
+ EVP_PKEY* pKey;
+};
/******************************************************************************
*
@@ -42,20 +42,20 @@ struct _xmlSecOpenSSLEvpKeyDataCtx {
* xmlSecOpenSSLEvpKeyDataCtx is located after xmlSecTransform
*
*****************************************************************************/
-#define xmlSecOpenSSLEvpKeyDataSize \
- (sizeof(xmlSecKeyData) + sizeof(xmlSecOpenSSLEvpKeyDataCtx))
+#define xmlSecOpenSSLEvpKeyDataSize \
+ (sizeof(xmlSecKeyData) + sizeof(xmlSecOpenSSLEvpKeyDataCtx))
#define xmlSecOpenSSLEvpKeyDataGetCtx(data) \
((xmlSecOpenSSLEvpKeyDataCtxPtr)(((xmlSecByte*)(data)) + sizeof(xmlSecKeyData)))
-static int xmlSecOpenSSLEvpKeyDataInitialize (xmlSecKeyDataPtr data);
-static int xmlSecOpenSSLEvpKeyDataDuplicate (xmlSecKeyDataPtr dst,
- xmlSecKeyDataPtr src);
-static void xmlSecOpenSSLEvpKeyDataFinalize (xmlSecKeyDataPtr data);
+static int xmlSecOpenSSLEvpKeyDataInitialize (xmlSecKeyDataPtr data);
+static int xmlSecOpenSSLEvpKeyDataDuplicate (xmlSecKeyDataPtr dst,
+ xmlSecKeyDataPtr src);
+static void xmlSecOpenSSLEvpKeyDataFinalize (xmlSecKeyDataPtr data);
/**
* xmlSecOpenSSLEvpKeyDataAdoptEvp:
- * @data: the pointer to OpenSSL EVP key data.
- * @pKey: the pointer to EVP key.
+ * @data: the pointer to OpenSSL EVP key data.
+ * @pKey: the pointer to EVP key.
*
* Sets the value of key data.
*
@@ -73,7 +73,7 @@ xmlSecOpenSSLEvpKeyDataAdoptEvp(xmlSecKeyDataPtr data, EVP_PKEY* pKey) {
xmlSecAssert2(ctx != NULL, -1);
if(ctx->pKey != NULL) {
- EVP_PKEY_free(ctx->pKey);
+ EVP_PKEY_free(ctx->pKey);
}
ctx->pKey = pKey;
return(0);
@@ -81,7 +81,7 @@ xmlSecOpenSSLEvpKeyDataAdoptEvp(xmlSecKeyDataPtr data, EVP_PKEY* pKey) {
/**
* xmlSecOpenSSLEvpKeyDataGetEvp:
- * @data: the pointer to OpenSSL EVP data.
+ * @data: the pointer to OpenSSL EVP data.
*
* Gets the EVP_PKEY from the key data.
*
@@ -133,15 +133,15 @@ xmlSecOpenSSLEvpKeyDataDuplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
xmlSecAssert2(ctxSrc != NULL, -1);
if(ctxSrc->pKey != NULL) {
- ctxDst->pKey = xmlSecOpenSSLEvpKeyDup(ctxSrc->pKey);
- if(ctxDst->pKey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "xmlSecOpenSSLEvpKeyDup",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ctxDst->pKey = xmlSecOpenSSLEvpKeyDup(ctxSrc->pKey);
+ if(ctxDst->pKey == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "xmlSecOpenSSLEvpKeyDup",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
return(0);
@@ -158,7 +158,7 @@ xmlSecOpenSSLEvpKeyDataFinalize(xmlSecKeyDataPtr data) {
xmlSecAssert(ctx != NULL);
if(ctx->pKey != NULL) {
- EVP_PKEY_free(ctx->pKey);
+ EVP_PKEY_free(ctx->pKey);
}
memset(ctx, 0, sizeof(xmlSecOpenSSLEvpKeyDataCtx));
}
@@ -170,7 +170,7 @@ xmlSecOpenSSLEvpKeyDataFinalize(xmlSecKeyDataPtr data) {
*****************************************************************************/
/**
* xmlSecOpenSSLEvpKeyDup:
- * @pKey: the pointer to EVP_PKEY.
+ * @pKey: the pointer to EVP_PKEY.
*
* Duplicates @pKey.
*
@@ -184,12 +184,12 @@ xmlSecOpenSSLEvpKeyDup(EVP_PKEY* pKey) {
ret = CRYPTO_add(&pKey->references,1,CRYPTO_LOCK_EVP_PKEY);
if(ret <= 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CRYPTO_add",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CRYPTO_add",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(pKey);
@@ -197,7 +197,7 @@ xmlSecOpenSSLEvpKeyDup(EVP_PKEY* pKey) {
/**
* xmlSecOpenSSLEvpKeyAdopt:
- * @pKey: the pointer to EVP_PKEY.
+ * @pKey: the pointer to EVP_PKEY.
*
* Creates xmlsec key object from OpenSSL key object.
*
@@ -210,52 +210,52 @@ xmlSecOpenSSLEvpKeyAdopt(EVP_PKEY *pKey) {
xmlSecAssert2(pKey != NULL, NULL);
- switch(pKey->type) {
+ switch(pKey->type) {
#ifndef XMLSEC_NO_RSA
case EVP_PKEY_RSA:
- data = xmlSecKeyDataCreate(xmlSecOpenSSLKeyDataRsaId);
- if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecOpenSSLKeyDataRsaId");
- return(NULL);
- }
- break;
-#endif /* XMLSEC_NO_RSA */
-#ifndef XMLSEC_NO_DSA
+ data = xmlSecKeyDataCreate(xmlSecOpenSSLKeyDataRsaId);
+ if(data == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecOpenSSLKeyDataRsaId");
+ return(NULL);
+ }
+ break;
+#endif /* XMLSEC_NO_RSA */
+#ifndef XMLSEC_NO_DSA
case EVP_PKEY_DSA:
- data = xmlSecKeyDataCreate(xmlSecOpenSSLKeyDataDsaId);
- if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecOpenSSLKeyDataDsaId");
- return(NULL);
- }
- break;
-#endif /* XMLSEC_NO_DSA */
- default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_TYPE,
- "evp key type %d not supported", pKey->type);
- return(NULL);
+ data = xmlSecKeyDataCreate(xmlSecOpenSSLKeyDataDsaId);
+ if(data == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecOpenSSLKeyDataDsaId");
+ return(NULL);
+ }
+ break;
+#endif /* XMLSEC_NO_DSA */
+ default:
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TYPE,
+ "evp key type %d not supported", pKey->type);
+ return(NULL);
}
xmlSecAssert2(data != NULL, NULL);
ret = xmlSecOpenSSLEvpKeyDataAdoptEvp(data, pKey);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLEvpKeyDataAdoptEvp",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(data);
- return(NULL);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLEvpKeyDataAdoptEvp",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(data);
+ return(NULL);
}
return(data);
}
@@ -276,7 +276,7 @@ xmlSecOpenSSLEvpKeyAdopt(EVP_PKEY *pKey) {
* divisor of P-1
* * G - an integer with certain properties with respect to P and Q
* * Y - G**X mod P (where X is part of the private key and not made
- * public)
+ * public)
* * J - (P - 1) / Q
* * seed - a DSA prime generation seed
* * pgenCounter - a DSA prime generation counter
@@ -334,28 +334,28 @@ xmlSecOpenSSLEvpKeyAdopt(EVP_PKEY *pKey) {
* by this the P, Q and G are *required*!
*
*************************************************************************/
-static int xmlSecOpenSSLKeyDataDsaInitialize (xmlSecKeyDataPtr data);
-static int xmlSecOpenSSLKeyDataDsaDuplicate (xmlSecKeyDataPtr dst,
- xmlSecKeyDataPtr src);
-static void xmlSecOpenSSLKeyDataDsaFinalize (xmlSecKeyDataPtr data);
-static int xmlSecOpenSSLKeyDataDsaXmlRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecOpenSSLKeyDataDsaXmlWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecOpenSSLKeyDataDsaGenerate (xmlSecKeyDataPtr data,
- xmlSecSize sizeBits,
- xmlSecKeyDataType type);
-
-static xmlSecKeyDataType xmlSecOpenSSLKeyDataDsaGetType (xmlSecKeyDataPtr data);
-static xmlSecSize xmlSecOpenSSLKeyDataDsaGetSize (xmlSecKeyDataPtr data);
-static void xmlSecOpenSSLKeyDataDsaDebugDump (xmlSecKeyDataPtr data,
- FILE* output);
-static void xmlSecOpenSSLKeyDataDsaDebugXmlDump (xmlSecKeyDataPtr data,
- FILE* output);
+static int xmlSecOpenSSLKeyDataDsaInitialize (xmlSecKeyDataPtr data);
+static int xmlSecOpenSSLKeyDataDsaDuplicate (xmlSecKeyDataPtr dst,
+ xmlSecKeyDataPtr src);
+static void xmlSecOpenSSLKeyDataDsaFinalize (xmlSecKeyDataPtr data);
+static int xmlSecOpenSSLKeyDataDsaXmlRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLKeyDataDsaXmlWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLKeyDataDsaGenerate (xmlSecKeyDataPtr data,
+ xmlSecSize sizeBits,
+ xmlSecKeyDataType type);
+
+static xmlSecKeyDataType xmlSecOpenSSLKeyDataDsaGetType (xmlSecKeyDataPtr data);
+static xmlSecSize xmlSecOpenSSLKeyDataDsaGetSize (xmlSecKeyDataPtr data);
+static void xmlSecOpenSSLKeyDataDsaDebugDump (xmlSecKeyDataPtr data,
+ FILE* output);
+static void xmlSecOpenSSLKeyDataDsaDebugXmlDump (xmlSecKeyDataPtr data,
+ FILE* output);
static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataDsaKlass = {
sizeof(xmlSecKeyDataKlass),
@@ -364,35 +364,35 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataDsaKlass = {
/* data */
xmlSecNameDSAKeyValue,
xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefDSAKeyValue, /* const xmlChar* href; */
- xmlSecNodeDSAKeyValue, /* const xmlChar* dataNodeName; */
- xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefDSAKeyValue, /* const xmlChar* href; */
+ xmlSecNodeDSAKeyValue, /* const xmlChar* dataNodeName; */
+ xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecOpenSSLKeyDataDsaInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecOpenSSLKeyDataDsaDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecOpenSSLKeyDataDsaFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- xmlSecOpenSSLKeyDataDsaGenerate, /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecOpenSSLKeyDataDsaInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecOpenSSLKeyDataDsaDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecOpenSSLKeyDataDsaFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ xmlSecOpenSSLKeyDataDsaGenerate, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecOpenSSLKeyDataDsaGetType, /* xmlSecKeyDataGetTypeMethod getType; */
- xmlSecOpenSSLKeyDataDsaGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecOpenSSLKeyDataDsaGetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ xmlSecOpenSSLKeyDataDsaGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecOpenSSLKeyDataDsaXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecOpenSSLKeyDataDsaXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- NULL, /* xmlSecKeyDataBinReadMethod binRead; */
- NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecOpenSSLKeyDataDsaXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecOpenSSLKeyDataDsaXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ NULL, /* xmlSecKeyDataBinReadMethod binRead; */
+ NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecOpenSSLKeyDataDsaDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- xmlSecOpenSSLKeyDataDsaDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ xmlSecOpenSSLKeyDataDsaDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecOpenSSLKeyDataDsaDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -409,8 +409,8 @@ xmlSecOpenSSLKeyDataDsaGetKlass(void) {
/**
* xmlSecOpenSSLKeyDataDsaAdoptDsa:
- * @data: the pointer to DSA key data.
- * @dsa: the pointer to OpenSSL DSA key.
+ * @data: the pointer to DSA key data.
+ * @dsa: the pointer to OpenSSL DSA key.
*
* Sets the value of DSA key data.
*
@@ -425,45 +425,45 @@ xmlSecOpenSSLKeyDataDsaAdoptDsa(xmlSecKeyDataPtr data, DSA* dsa) {
/* construct new EVP_PKEY */
if(dsa != NULL) {
- pKey = EVP_PKEY_new();
- if(pKey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "EVP_PKEY_new",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- ret = EVP_PKEY_assign_DSA(pKey, dsa);
- if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "EVP_PKEY_assign_DSA",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ pKey = EVP_PKEY_new();
+ if(pKey == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "EVP_PKEY_new",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ ret = EVP_PKEY_assign_DSA(pKey, dsa);
+ if(ret != 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "EVP_PKEY_assign_DSA",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
ret = xmlSecOpenSSLKeyDataDsaAdoptEvp(data, pKey);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecOpenSSLKeyDataDsaAdoptEvp",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- if(pKey != NULL) {
- EVP_PKEY_free(pKey);
- }
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecOpenSSLKeyDataDsaAdoptEvp",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ if(pKey != NULL) {
+ EVP_PKEY_free(pKey);
+ }
+ return(-1);
}
return(0);
}
/**
* xmlSecOpenSSLKeyDataDsaGetDsa:
- * @data: the pointer to DSA key data.
+ * @data: the pointer to DSA key data.
*
* Gets the OpenSSL DSA key from DSA key data.
*
@@ -483,8 +483,8 @@ xmlSecOpenSSLKeyDataDsaGetDsa(xmlSecKeyDataPtr data) {
/**
* xmlSecOpenSSLKeyDataDsaAdoptEvp:
- * @data: the pointer to DSA key data.
- * @pKey: the pointer to OpenSSL EVP key.
+ * @data: the pointer to DSA key data.
+ * @pKey: the pointer to OpenSSL EVP key.
*
* Sets the DSA key data value to OpenSSL EVP key.
*
@@ -501,7 +501,7 @@ xmlSecOpenSSLKeyDataDsaAdoptEvp(xmlSecKeyDataPtr data, EVP_PKEY* pKey) {
/**
* xmlSecOpenSSLKeyDataDsaGetEvp:
- * @data: the pointer to DSA key data.
+ * @data: the pointer to DSA key data.
*
* Gets the OpenSSL EVP key from DSA key data.
*
@@ -538,7 +538,7 @@ xmlSecOpenSSLKeyDataDsaFinalize(xmlSecKeyDataPtr data) {
static int
xmlSecOpenSSLKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyDataPtr data;
xmlNodePtr cur;
DSA *dsa;
@@ -550,190 +550,190 @@ xmlSecOpenSSLKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
xmlSecAssert2(keyInfoCtx != NULL, -1);
if(xmlSecKeyGetValue(key) != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_KEY_DATA,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_KEY_DATA,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
dsa = DSA_new();
if(dsa == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "DSA_new",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "DSA_new",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecGetNextElementNode(node->children);
/* first is P node. It is REQUIRED because we do not support Seed and PgenCounter*/
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeDSAP, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAP));
- DSA_free(dsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAP));
+ DSA_free(dsa);
+ return(-1);
}
if(xmlSecOpenSSLNodeGetBNValue(cur, &(dsa->p)) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLNodeGetBNValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAP));
- DSA_free(dsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLNodeGetBNValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAP));
+ DSA_free(dsa);
+ return(-1);
}
cur = xmlSecGetNextElementNode(cur->next);
/* next is Q node. It is REQUIRED because we do not support Seed and PgenCounter*/
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeDSAQ, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAQ));
- DSA_free(dsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAQ));
+ DSA_free(dsa);
+ return(-1);
}
if(xmlSecOpenSSLNodeGetBNValue(cur, &(dsa->q)) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLNodeGetBNValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAQ));
- DSA_free(dsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLNodeGetBNValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAQ));
+ DSA_free(dsa);
+ return(-1);
}
cur = xmlSecGetNextElementNode(cur->next);
/* next is G node. It is REQUIRED because we do not support Seed and PgenCounter*/
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeDSAG, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAG));
- DSA_free(dsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAG));
+ DSA_free(dsa);
+ return(-1);
}
if(xmlSecOpenSSLNodeGetBNValue(cur, &(dsa->g)) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLNodeGetBNValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAG));
- DSA_free(dsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLNodeGetBNValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAG));
+ DSA_free(dsa);
+ return(-1);
}
cur = xmlSecGetNextElementNode(cur->next);
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSAX, xmlSecNs))) {
/* next is X node. It is REQUIRED for private key but
- * we are not sure exactly what do we read */
- if(xmlSecOpenSSLNodeGetBNValue(cur, &(dsa->priv_key)) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLNodeGetBNValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAX));
- DSA_free(dsa);
- return(-1);
- }
- cur = xmlSecGetNextElementNode(cur->next);
+ * we are not sure exactly what do we read */
+ if(xmlSecOpenSSLNodeGetBNValue(cur, &(dsa->priv_key)) == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLNodeGetBNValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAX));
+ DSA_free(dsa);
+ return(-1);
+ }
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* next is Y node. */
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeDSAY, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAY));
- DSA_free(dsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAY));
+ DSA_free(dsa);
+ return(-1);
}
if(xmlSecOpenSSLNodeGetBNValue(cur, &(dsa->pub_key)) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLNodeGetBNValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s", xmlSecErrorsSafeString(xmlSecNodeDSAY));
- DSA_free(dsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLNodeGetBNValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s", xmlSecErrorsSafeString(xmlSecNodeDSAY));
+ DSA_free(dsa);
+ return(-1);
}
cur = xmlSecGetNextElementNode(cur->next);
/* todo: add support for J */
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSAJ, xmlSecDSigNs))) {
- cur = xmlSecGetNextElementNode(cur->next);
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* todo: add support for seed */
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSASeed, xmlSecDSigNs))) {
- cur = xmlSecGetNextElementNode(cur->next);
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* todo: add support for pgencounter */
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDSAPgenCounter, xmlSecDSigNs))) {
- cur = xmlSecGetNextElementNode(cur->next);
+ cur = xmlSecGetNextElementNode(cur->next);
}
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- DSA_free(dsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ DSA_free(dsa);
+ return(-1);
}
data = xmlSecKeyDataCreate(id);
if(data == NULL ) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- DSA_free(dsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ DSA_free(dsa);
+ return(-1);
}
ret = xmlSecOpenSSLKeyDataDsaAdoptDsa(data, dsa);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecOpenSSLKeyDataDsaAdoptDsa",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(data);
- DSA_free(dsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecOpenSSLKeyDataDsaAdoptDsa",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(data);
+ DSA_free(dsa);
+ return(-1);
}
ret = xmlSecKeySetValue(key, data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(data);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(data);
+ return(-1);
}
return(0);
@@ -741,7 +741,7 @@ xmlSecOpenSSLKeyDataDsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
static int
xmlSecOpenSSLKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlNodePtr cur;
DSA* dsa;
int ret;
@@ -756,124 +756,124 @@ xmlSecOpenSSLKeyDataDsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
xmlSecAssert2(dsa != NULL, -1);
if(((xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate) & keyInfoCtx->keyReq.keyType) == 0) {
- /* we can have only private key or public key */
- return(0);
+ /* we can have only private key or public key */
+ return(0);
}
/* first is P node */
xmlSecAssert2(dsa->p != NULL, -1);
cur = xmlSecAddChild(node, xmlSecNodeDSAP, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAP));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAP));
+ return(-1);
}
ret = xmlSecOpenSSLNodeSetBNValue(cur, dsa->p, 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLNodeSetBNValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAP));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLNodeSetBNValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAP));
+ return(-1);
}
/* next is Q node. */
xmlSecAssert2(dsa->q != NULL, -1);
cur = xmlSecAddChild(node, xmlSecNodeDSAQ, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAQ));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAQ));
+ return(-1);
}
ret = xmlSecOpenSSLNodeSetBNValue(cur, dsa->q, 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLNodeSetBNValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAQ));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLNodeSetBNValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAQ));
+ return(-1);
}
/* next is G node. */
xmlSecAssert2(dsa->g != NULL, -1);
cur = xmlSecAddChild(node, xmlSecNodeDSAG, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAG));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAG));
+ return(-1);
}
ret = xmlSecOpenSSLNodeSetBNValue(cur, dsa->g, 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLNodeSetBNValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAG));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLNodeSetBNValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAG));
+ return(-1);
}
/* next is X node: write it ONLY for private keys and ONLY if it is requested */
if(((keyInfoCtx->keyReq.keyType & xmlSecKeyDataTypePrivate) != 0) && (dsa->priv_key != NULL)) {
- cur = xmlSecAddChild(node, xmlSecNodeDSAX, xmlSecNs);
- if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAX));
- return(-1);
- }
- ret = xmlSecOpenSSLNodeSetBNValue(cur, dsa->priv_key, 1);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLNodeSetBNValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAX));
- return(-1);
- }
+ cur = xmlSecAddChild(node, xmlSecNodeDSAX, xmlSecNs);
+ if(cur == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAX));
+ return(-1);
+ }
+ ret = xmlSecOpenSSLNodeSetBNValue(cur, dsa->priv_key, 1);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLNodeSetBNValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAX));
+ return(-1);
+ }
}
/* next is Y node. */
xmlSecAssert2(dsa->pub_key != NULL, -1);
cur = xmlSecAddChild(node, xmlSecNodeDSAY, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAY));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAY));
+ return(-1);
}
ret = xmlSecOpenSSLNodeSetBNValue(cur, dsa->pub_key, 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLNodeSetBNValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDSAY));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLNodeSetBNValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDSAY));
+ return(-1);
}
return(0);
}
@@ -890,34 +890,34 @@ xmlSecOpenSSLKeyDataDsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, xmlS
dsa = DSA_generate_parameters(sizeBits, NULL, 0, &counter_ret, &h_ret, NULL, NULL);
if(dsa == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "DSA_generate_parameters",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "size=%d", sizeBits);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "DSA_generate_parameters",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "size=%d", sizeBits);
+ return(-1);
}
ret = DSA_generate_key(dsa);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "DSA_generate_key",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- DSA_free(dsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "DSA_generate_key",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ DSA_free(dsa);
+ return(-1);
}
ret = xmlSecOpenSSLKeyDataDsaAdoptDsa(data, dsa);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecOpenSSLKeyDataDsaAdoptDsa",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- DSA_free(dsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecOpenSSLKeyDataDsaAdoptDsa",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ DSA_free(dsa);
+ return(-1);
}
return(0);
@@ -934,18 +934,18 @@ xmlSecOpenSSLKeyDataDsaGetType(xmlSecKeyDataPtr data) {
(dsa->g != NULL) && (dsa->pub_key != NULL)) {
if(dsa->priv_key != NULL) {
- return(xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic);
- } else if(dsa->engine != NULL) {
- /*
- * !!! HACK !!! Also see RSA key
- * We assume here that engine *always* has private key.
- * This might be incorrect but it seems that there is no
- * way to ask engine if given key is private or not.
- */
- return(xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic);
- } else {
- return(xmlSecKeyDataTypePublic);
- }
+ return(xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic);
+ } else if(dsa->engine != NULL) {
+ /*
+ * !!! HACK !!! Also see RSA key
+ * We assume here that engine *always* has private key.
+ * This might be incorrect but it seems that there is no
+ * way to ask engine if given key is private or not.
+ */
+ return(xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic);
+ } else {
+ return(xmlSecKeyDataTypePublic);
+ }
}
return(xmlSecKeyDataTypeUnknown);
@@ -959,7 +959,7 @@ xmlSecOpenSSLKeyDataDsaGetSize(xmlSecKeyDataPtr data) {
dsa = xmlSecOpenSSLKeyDataDsaGetDsa(data);
if((dsa != NULL) && (dsa->p != NULL)) {
- return(BN_num_bits(dsa->p));
+ return(BN_num_bits(dsa->p));
}
return(0);
}
@@ -970,7 +970,7 @@ xmlSecOpenSSLKeyDataDsaDebugDump(xmlSecKeyDataPtr data, FILE* output) {
xmlSecAssert(output != NULL);
fprintf(output, "=== dsa key: size = %d\n",
- xmlSecOpenSSLKeyDataDsaGetSize(data));
+ xmlSecOpenSSLKeyDataDsaGetSize(data));
}
static void
@@ -979,7 +979,7 @@ xmlSecOpenSSLKeyDataDsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
xmlSecAssert(output != NULL);
fprintf(output, "<DSAKeyValue size=\"%d\" />\n",
- xmlSecOpenSSLKeyDataDsaGetSize(data));
+ xmlSecOpenSSLKeyDataDsaGetSize(data));
}
#endif /* XMLSEC_NO_DSA */
@@ -997,7 +997,7 @@ xmlSecOpenSSLKeyDataDsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
* <RSAKeyValue>
* <Modulus>xA7SEU+e0yQH5rm9kbCDN9o3aPIo7HbP7tX6WOocLZAtNfyxSZDU16ksL6W
* jubafOqNEpcwR3RdFsT7bCqnXPBe5ELh5u4VEy19MzxkXRgrMvavzyBpVRgBUwUlV
- * 5foK5hhmbktQhyNdy/6LpQRhDUDsTvK+g9Ucj47es9AQJ3U=
+ * 5foK5hhmbktQhyNdy/6LpQRhDUDsTvK+g9Ucj47es9AQJ3U=
* </Modulus>
* <Exponent>AQAB</Exponent>
* </RSAKeyValue>
@@ -1028,28 +1028,28 @@ xmlSecOpenSSLKeyDataDsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
*
*************************************************************************/
-static int xmlSecOpenSSLKeyDataRsaInitialize (xmlSecKeyDataPtr data);
-static int xmlSecOpenSSLKeyDataRsaDuplicate (xmlSecKeyDataPtr dst,
- xmlSecKeyDataPtr src);
-static void xmlSecOpenSSLKeyDataRsaFinalize (xmlSecKeyDataPtr data);
-static int xmlSecOpenSSLKeyDataRsaXmlRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecOpenSSLKeyDataRsaXmlWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecOpenSSLKeyDataRsaGenerate (xmlSecKeyDataPtr data,
- xmlSecSize sizeBits,
- xmlSecKeyDataType type);
-
-static xmlSecKeyDataType xmlSecOpenSSLKeyDataRsaGetType (xmlSecKeyDataPtr data);
-static xmlSecSize xmlSecOpenSSLKeyDataRsaGetSize (xmlSecKeyDataPtr data);
-static void xmlSecOpenSSLKeyDataRsaDebugDump (xmlSecKeyDataPtr data,
- FILE* output);
-static void xmlSecOpenSSLKeyDataRsaDebugXmlDump (xmlSecKeyDataPtr data,
- FILE* output);
+static int xmlSecOpenSSLKeyDataRsaInitialize (xmlSecKeyDataPtr data);
+static int xmlSecOpenSSLKeyDataRsaDuplicate (xmlSecKeyDataPtr dst,
+ xmlSecKeyDataPtr src);
+static void xmlSecOpenSSLKeyDataRsaFinalize (xmlSecKeyDataPtr data);
+static int xmlSecOpenSSLKeyDataRsaXmlRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLKeyDataRsaXmlWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLKeyDataRsaGenerate (xmlSecKeyDataPtr data,
+ xmlSecSize sizeBits,
+ xmlSecKeyDataType type);
+
+static xmlSecKeyDataType xmlSecOpenSSLKeyDataRsaGetType (xmlSecKeyDataPtr data);
+static xmlSecSize xmlSecOpenSSLKeyDataRsaGetSize (xmlSecKeyDataPtr data);
+static void xmlSecOpenSSLKeyDataRsaDebugDump (xmlSecKeyDataPtr data,
+ FILE* output);
+static void xmlSecOpenSSLKeyDataRsaDebugXmlDump (xmlSecKeyDataPtr data,
+ FILE* output);
static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataRsaKlass = {
sizeof(xmlSecKeyDataKlass),
xmlSecOpenSSLEvpKeyDataSize,
@@ -1057,35 +1057,35 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataRsaKlass = {
/* data */
xmlSecNameRSAKeyValue,
xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefRSAKeyValue, /* const xmlChar* href; */
- xmlSecNodeRSAKeyValue, /* const xmlChar* dataNodeName; */
- xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefRSAKeyValue, /* const xmlChar* href; */
+ xmlSecNodeRSAKeyValue, /* const xmlChar* dataNodeName; */
+ xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecOpenSSLKeyDataRsaInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecOpenSSLKeyDataRsaDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecOpenSSLKeyDataRsaFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- xmlSecOpenSSLKeyDataRsaGenerate, /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecOpenSSLKeyDataRsaInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecOpenSSLKeyDataRsaDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecOpenSSLKeyDataRsaFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ xmlSecOpenSSLKeyDataRsaGenerate, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecOpenSSLKeyDataRsaGetType, /* xmlSecKeyDataGetTypeMethod getType; */
- xmlSecOpenSSLKeyDataRsaGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecOpenSSLKeyDataRsaGetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ xmlSecOpenSSLKeyDataRsaGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecOpenSSLKeyDataRsaXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecOpenSSLKeyDataRsaXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- NULL, /* xmlSecKeyDataBinReadMethod binRead; */
- NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecOpenSSLKeyDataRsaXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecOpenSSLKeyDataRsaXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ NULL, /* xmlSecKeyDataBinReadMethod binRead; */
+ NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecOpenSSLKeyDataRsaDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- xmlSecOpenSSLKeyDataRsaDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ xmlSecOpenSSLKeyDataRsaDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecOpenSSLKeyDataRsaDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -1102,8 +1102,8 @@ xmlSecOpenSSLKeyDataRsaGetKlass(void) {
/**
* xmlSecOpenSSLKeyDataRsaAdoptRsa:
- * @data: the pointer to RSA key data.
- * @rsa: the pointer to OpenSSL RSA key.
+ * @data: the pointer to RSA key data.
+ * @rsa: the pointer to OpenSSL RSA key.
*
* Sets the value of RSA key data.
*
@@ -1118,45 +1118,45 @@ xmlSecOpenSSLKeyDataRsaAdoptRsa(xmlSecKeyDataPtr data, RSA* rsa) {
/* construct new EVP_PKEY */
if(rsa != NULL) {
- pKey = EVP_PKEY_new();
- if(pKey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "EVP_PKEY_new",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- ret = EVP_PKEY_assign_RSA(pKey, rsa);
- if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "EVP_PKEY_assign_RSA",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ pKey = EVP_PKEY_new();
+ if(pKey == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "EVP_PKEY_new",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ ret = EVP_PKEY_assign_RSA(pKey, rsa);
+ if(ret != 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "EVP_PKEY_assign_RSA",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
ret = xmlSecOpenSSLKeyDataRsaAdoptEvp(data, pKey);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecOpenSSLKeyDataRsaAdoptEvp",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- if(pKey != NULL) {
- EVP_PKEY_free(pKey);
- }
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecOpenSSLKeyDataRsaAdoptEvp",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ if(pKey != NULL) {
+ EVP_PKEY_free(pKey);
+ }
+ return(-1);
}
return(0);
}
/**
* xmlSecOpenSSLKeyDataRsaGetRsa:
- * @data: the pointer to RSA key data.
+ * @data: the pointer to RSA key data.
*
* Gets the OpenSSL RSA key from RSA key data.
*
@@ -1176,8 +1176,8 @@ xmlSecOpenSSLKeyDataRsaGetRsa(xmlSecKeyDataPtr data) {
/**
* xmlSecOpenSSLKeyDataRsaAdoptEvp:
- * @data: the pointer to RSA key data.
- * @pKey: the pointer to OpenSSL EVP key.
+ * @data: the pointer to RSA key data.
+ * @pKey: the pointer to OpenSSL EVP key.
*
* Sets the RSA key data value to OpenSSL EVP key.
*
@@ -1194,7 +1194,7 @@ xmlSecOpenSSLKeyDataRsaAdoptEvp(xmlSecKeyDataPtr data, EVP_PKEY* pKey) {
/**
* xmlSecOpenSSLKeyDataRsaGetEvp:
- * @data: the pointer to RSA key data.
+ * @data: the pointer to RSA key data.
*
* Gets the OpenSSL EVP key from RSA key data.
*
@@ -1231,7 +1231,7 @@ xmlSecOpenSSLKeyDataRsaFinalize(xmlSecKeyDataPtr data) {
static int
xmlSecOpenSSLKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyDataPtr data;
xmlNodePtr cur;
RSA *rsa;
@@ -1243,130 +1243,130 @@ xmlSecOpenSSLKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
xmlSecAssert2(keyInfoCtx != NULL, -1);
if(xmlSecKeyGetValue(key) != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_KEY_DATA,
- "key already has a value");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_KEY_DATA,
+ "key already has a value");
+ return(-1);
}
rsa = RSA_new();
if(rsa == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "RSA_new",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "RSA_new",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecGetNextElementNode(node->children);
/* first is Modulus node. It is REQUIRED because we do not support Seed and PgenCounter*/
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeRSAModulus, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
- RSA_free(rsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
+ RSA_free(rsa);
+ return(-1);
}
if(xmlSecOpenSSLNodeGetBNValue(cur, &(rsa->n)) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLNodeGetBNValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
- RSA_free(rsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLNodeGetBNValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
+ RSA_free(rsa);
+ return(-1);
}
cur = xmlSecGetNextElementNode(cur->next);
/* next is Exponent node. It is REQUIRED because we do not support Seed and PgenCounter*/
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeRSAExponent, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
- RSA_free(rsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
+ RSA_free(rsa);
+ return(-1);
}
if(xmlSecOpenSSLNodeGetBNValue(cur, &(rsa->e)) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLNodeGetBNValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
- RSA_free(rsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLNodeGetBNValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
+ RSA_free(rsa);
+ return(-1);
}
cur = xmlSecGetNextElementNode(cur->next);
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeRSAPrivateExponent, xmlSecNs))) {
/* next is X node. It is REQUIRED for private key but
- * we are not sure exactly what do we read */
- if(xmlSecOpenSSLNodeGetBNValue(cur, &(rsa->d)) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLNodeGetBNValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAPrivateExponent));
- RSA_free(rsa);
- return(-1);
- }
- cur = xmlSecGetNextElementNode(cur->next);
+ * we are not sure exactly what do we read */
+ if(xmlSecOpenSSLNodeGetBNValue(cur, &(rsa->d)) == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLNodeGetBNValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAPrivateExponent));
+ RSA_free(rsa);
+ return(-1);
+ }
+ cur = xmlSecGetNextElementNode(cur->next);
}
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "no nodes expected");
- RSA_free(rsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "no nodes expected");
+ RSA_free(rsa);
+ return(-1);
}
data = xmlSecKeyDataCreate(id);
if(data == NULL ) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- RSA_free(rsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ RSA_free(rsa);
+ return(-1);
}
ret = xmlSecOpenSSLKeyDataRsaAdoptRsa(data, rsa);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLKeyDataRsaAdoptRsa",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(data);
- RSA_free(rsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLKeyDataRsaAdoptRsa",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(data);
+ RSA_free(rsa);
+ return(-1);
}
ret = xmlSecKeySetValue(key, data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(data);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(data);
+ return(-1);
}
return(0);
@@ -1374,7 +1374,7 @@ xmlSecOpenSSLKeyDataRsaXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
static int
xmlSecOpenSSLKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlNodePtr cur;
RSA* rsa;
int ret;
@@ -1389,76 +1389,76 @@ xmlSecOpenSSLKeyDataRsaXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
xmlSecAssert2(rsa != NULL, -1);
if(((xmlSecKeyDataTypePublic | xmlSecKeyDataTypePrivate) & keyInfoCtx->keyReq.keyType) == 0) {
- /* we can have only private key or public key */
- return(0);
+ /* we can have only private key or public key */
+ return(0);
}
/* first is Modulus node */
cur = xmlSecAddChild(node, xmlSecNodeRSAModulus, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
+ return(-1);
}
ret = xmlSecOpenSSLNodeSetBNValue(cur, rsa->n, 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLNodeSetBNValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLNodeSetBNValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAModulus));
+ return(-1);
}
/* next is Exponent node. */
cur = xmlSecAddChild(node, xmlSecNodeRSAExponent, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
+ return(-1);
}
ret = xmlSecOpenSSLNodeSetBNValue(cur, rsa->e, 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLNodeSetBNValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLNodeSetBNValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAExponent));
+ return(-1);
}
/* next is PrivateExponent node: write it ONLY for private keys and ONLY if it is requested */
if(((keyInfoCtx->keyReq.keyType & xmlSecKeyDataTypePrivate) != 0) && (rsa->d != NULL)) {
- cur = xmlSecAddChild(node, xmlSecNodeRSAPrivateExponent, xmlSecNs);
- if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAPrivateExponent));
- return(-1);
- }
- ret = xmlSecOpenSSLNodeSetBNValue(cur, rsa->d, 1);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLNodeSetBNValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRSAPrivateExponent));
- return(-1);
- }
+ cur = xmlSecAddChild(node, xmlSecNodeRSAPrivateExponent, xmlSecNs);
+ if(cur == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAPrivateExponent));
+ return(-1);
+ }
+ ret = xmlSecOpenSSLNodeSetBNValue(cur, rsa->d, 1);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLNodeSetBNValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRSAPrivateExponent));
+ return(-1);
+ }
}
return(0);
@@ -1474,23 +1474,23 @@ xmlSecOpenSSLKeyDataRsaGenerate(xmlSecKeyDataPtr data, xmlSecSize sizeBits, xmlS
rsa = RSA_generate_key(sizeBits, 3, NULL, NULL);
if(rsa == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "RSA_generate_key",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "sizeBits=%d", sizeBits);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "RSA_generate_key",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "sizeBits=%d", sizeBits);
+ return(-1);
}
ret = xmlSecOpenSSLKeyDataRsaAdoptRsa(data, rsa);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecOpenSSLKeyDataRsaAdoptRsa",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- RSA_free(rsa);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecOpenSSLKeyDataRsaAdoptRsa",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ RSA_free(rsa);
+ return(-1);
}
return(0);
@@ -1504,19 +1504,19 @@ xmlSecOpenSSLKeyDataRsaGetType(xmlSecKeyDataPtr data) {
rsa = xmlSecOpenSSLKeyDataRsaGetRsa(data);
if((rsa != NULL) && (rsa->n != NULL) && (rsa->e != NULL)) {
- if(rsa->d != NULL) {
- return(xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic);
- } else if(rsa->engine != NULL) {
- /*
- * !!! HACK !!! Also see DSA key
- * We assume here that engine *always* has private key.
- * This might be incorrect but it seems that there is no
- * way to ask engine if given key is private or not.
- */
- return(xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic);
- } else {
- return(xmlSecKeyDataTypePublic);
- }
+ if(rsa->d != NULL) {
+ return(xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic);
+ } else if(rsa->engine != NULL) {
+ /*
+ * !!! HACK !!! Also see DSA key
+ * We assume here that engine *always* has private key.
+ * This might be incorrect but it seems that there is no
+ * way to ask engine if given key is private or not.
+ */
+ return(xmlSecKeyDataTypePrivate | xmlSecKeyDataTypePublic);
+ } else {
+ return(xmlSecKeyDataTypePublic);
+ }
}
return(xmlSecKeyDataTypeUnknown);
@@ -1530,7 +1530,7 @@ xmlSecOpenSSLKeyDataRsaGetSize(xmlSecKeyDataPtr data) {
rsa = xmlSecOpenSSLKeyDataRsaGetRsa(data);
if((rsa != NULL) && (rsa->n != NULL)) {
- return(BN_num_bits(rsa->n));
+ return(BN_num_bits(rsa->n));
}
return(0);
}
@@ -1541,7 +1541,7 @@ xmlSecOpenSSLKeyDataRsaDebugDump(xmlSecKeyDataPtr data, FILE* output) {
xmlSecAssert(output != NULL);
fprintf(output, "=== rsa key: size = %d\n",
- xmlSecOpenSSLKeyDataRsaGetSize(data));
+ xmlSecOpenSSLKeyDataRsaGetSize(data));
}
static void
@@ -1550,7 +1550,7 @@ xmlSecOpenSSLKeyDataRsaDebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
xmlSecAssert(output != NULL);
fprintf(output, "<RSAKeyValue size=\"%d\" />\n",
- xmlSecOpenSSLKeyDataRsaGetSize(data));
+ xmlSecOpenSSLKeyDataRsaGetSize(data));
}
#endif /* XMLSEC_NO_RSA */
diff --git a/src/openssl/hmac.c b/src/openssl/hmac.c
index 0b6605b..cfaa6af 100644
--- a/src/openssl/hmac.c
+++ b/src/openssl/hmac.c
@@ -34,8 +34,8 @@
#include <xmlsec/openssl/crypto.h>
/* sizes in bits */
-#define XMLSEC_OPENSSL_MIN_HMAC_SIZE 80
-#define XMLSEC_OPENSSL_MAX_HMAC_SIZE (EVP_MAX_MD_SIZE * 8)
+#define XMLSEC_OPENSSL_MIN_HMAC_SIZE 80
+#define XMLSEC_OPENSSL_MAX_HMAC_SIZE (EVP_MAX_MD_SIZE * 8)
/**************************************************************************
*
@@ -72,14 +72,14 @@ void xmlSecOpenSSLHmacSetMinOutputLength(int min_length)
* Internal OpenSSL HMAC CTX
*
*****************************************************************************/
-typedef struct _xmlSecOpenSSLHmacCtx xmlSecOpenSSLHmacCtx, *xmlSecOpenSSLHmacCtxPtr;
+typedef struct _xmlSecOpenSSLHmacCtx xmlSecOpenSSLHmacCtx, *xmlSecOpenSSLHmacCtxPtr;
struct _xmlSecOpenSSLHmacCtx {
- const EVP_MD* hmacDgst;
- HMAC_CTX hmacCtx;
- int ctxInitialized;
- xmlSecByte dgst[XMLSEC_OPENSSL_MAX_HMAC_SIZE];
- xmlSecSize dgstSize; /* dgst size in bits */
-};
+ const EVP_MD* hmacDgst;
+ HMAC_CTX hmacCtx;
+ int ctxInitialized;
+ xmlSecByte dgst[XMLSEC_OPENSSL_MAX_HMAC_SIZE];
+ xmlSecSize dgstSize; /* dgst size in bits */
+};
/**************************************************************************
*
@@ -90,26 +90,26 @@ struct _xmlSecOpenSSLHmacCtx {
*****************************************************************************/
#define xmlSecOpenSSLHmacGetCtx(transform) \
((xmlSecOpenSSLHmacCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-#define xmlSecOpenSSLHmacSize \
+#define xmlSecOpenSSLHmacSize \
(sizeof(xmlSecTransform) + sizeof(xmlSecOpenSSLHmacCtx))
-static int xmlSecOpenSSLHmacCheckId (xmlSecTransformPtr transform);
-static int xmlSecOpenSSLHmacInitialize (xmlSecTransformPtr transform);
-static void xmlSecOpenSSLHmacFinalize (xmlSecTransformPtr transform);
-static int xmlSecOpenSSLHmacNodeRead (xmlSecTransformPtr transform,
- xmlNodePtr node,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecOpenSSLHmacSetKeyReq (xmlSecTransformPtr transform,
- xmlSecKeyReqPtr keyReq);
-static int xmlSecOpenSSLHmacSetKey (xmlSecTransformPtr transform,
- xmlSecKeyPtr key);
-static int xmlSecOpenSSLHmacVerify (xmlSecTransformPtr transform,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecOpenSSLHmacExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecOpenSSLHmacCheckId (xmlSecTransformPtr transform);
+static int xmlSecOpenSSLHmacInitialize (xmlSecTransformPtr transform);
+static void xmlSecOpenSSLHmacFinalize (xmlSecTransformPtr transform);
+static int xmlSecOpenSSLHmacNodeRead (xmlSecTransformPtr transform,
+ xmlNodePtr node,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecOpenSSLHmacSetKeyReq (xmlSecTransformPtr transform,
+ xmlSecKeyReqPtr keyReq);
+static int xmlSecOpenSSLHmacSetKey (xmlSecTransformPtr transform,
+ xmlSecKeyPtr key);
+static int xmlSecOpenSSLHmacVerify (xmlSecTransformPtr transform,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecOpenSSLHmacExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
static int
@@ -117,48 +117,48 @@ xmlSecOpenSSLHmacCheckId(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_SHA1
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacSha1Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_SHA1 */
#ifndef XMLSEC_NO_SHA224
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacSha224Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_SHA224 */
#ifndef XMLSEC_NO_SHA256
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacSha256Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_SHA256 */
#ifndef XMLSEC_NO_SHA384
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacSha384Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_SHA384 */
#ifndef XMLSEC_NO_SHA512
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacSha512Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_SHA512 */
#ifndef XMLSEC_NO_RIPEMD160
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacRipemd160Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_RIPEMD160 */
#ifndef XMLSEC_NO_MD5
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformHmacMd5Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_MD5 */
{
- return(0);
+ return(0);
}
return(0);
@@ -222,12 +222,12 @@ xmlSecOpenSSLHmacInitialize(xmlSecTransformPtr transform) {
#endif /* XMLSEC_NO_MD5 */
{
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
#ifndef XMLSEC_OPENSSL_096
@@ -267,37 +267,37 @@ xmlSecOpenSSLHmacNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecT
cur = xmlSecGetNextElementNode(node->children);
if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeHMACOutputLength, xmlSecDSigNs)) {
- xmlChar *content;
-
- content = xmlNodeGetContent(cur);
- if(content != NULL) {
- ctx->dgstSize = atoi((char*)content);
- xmlFree(content);
- }
-
- /* Ensure that HMAC length is greater than min specified.
- Otherwise, an attacker can set this lenght to 0 or very
- small value
- */
- if((int)ctx->dgstSize < xmlSecOpenSSLHmacGetMinOutputLength()) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
- "HMAC output length is too small");
- return(-1);
- }
-
- cur = xmlSecGetNextElementNode(cur->next);
+ xmlChar *content;
+
+ content = xmlNodeGetContent(cur);
+ if(content != NULL) {
+ ctx->dgstSize = atoi((char*)content);
+ xmlFree(content);
+ }
+
+ /* Ensure that HMAC length is greater than min specified.
+ Otherwise, an attacker can set this lenght to 0 or very
+ small value
+ */
+ if((int)ctx->dgstSize < xmlSecOpenSSLHmacGetMinOutputLength()) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
+ "HMAC output length is too small");
+ return(-1);
+ }
+
+ cur = xmlSecGetNextElementNode(cur->next);
}
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
@@ -312,9 +312,9 @@ xmlSecOpenSSLHmacSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr keyReq
keyReq->keyId = xmlSecOpenSSLKeyDataHmacId;
keyReq->keyType = xmlSecKeyDataTypeSymmetric;
if(transform->operation == xmlSecTransformOperationSign) {
- keyReq->keyUsage = xmlSecKeyUsageSign;
+ keyReq->keyUsage = xmlSecKeyUsageSign;
} else {
- keyReq->keyUsage = xmlSecKeyUsageVerify;
+ keyReq->keyUsage = xmlSecKeyUsageVerify;
}
return(0);
@@ -343,29 +343,29 @@ xmlSecOpenSSLHmacSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
xmlSecAssert2(buffer != NULL, -1);
if(xmlSecBufferGetSize(buffer) == 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
- "keySize=0");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
+ "keySize=0");
+ return(-1);
}
xmlSecAssert2(xmlSecBufferGetData(buffer) != NULL, -1);
HMAC_Init(&(ctx->hmacCtx),
- xmlSecBufferGetData(buffer),
- xmlSecBufferGetSize(buffer),
- ctx->hmacDgst);
+ xmlSecBufferGetData(buffer),
+ xmlSecBufferGetSize(buffer),
+ ctx->hmacDgst);
ctx->ctxInitialized = 1;
return(0);
}
static int
xmlSecOpenSSLHmacVerify(xmlSecTransformPtr transform,
- const xmlSecByte* data, xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx) {
- static xmlSecByte last_byte_masks[] =
- { 0xFF, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE };
+ const xmlSecByte* data, xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx) {
+ static xmlSecByte last_byte_masks[] =
+ { 0xFF, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE };
xmlSecOpenSSLHmacCtxPtr ctx;
xmlSecByte mask;
@@ -383,46 +383,46 @@ xmlSecOpenSSLHmacVerify(xmlSecTransformPtr transform,
/* compare the digest size in bytes */
if(dataSize != ((ctx->dgstSize + 7) / 8)){
- /* NO COMMIT */
- xmlChar* a;
- mask = last_byte_masks[ctx->dgstSize % 8];
- ctx->dgst[dataSize - 1] &= mask;
- a = xmlSecBase64Encode(ctx->dgst, (ctx->dgstSize + 7) / 8, -1);
- fprintf(stderr, "%s\n", a);
- xmlFree(a);
-
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "data=%d;dgst=%d",
- dataSize, ((ctx->dgstSize + 7) / 8));
- transform->status = xmlSecTransformStatusFail;
- return(0);
+ /* NO COMMIT */
+ xmlChar* a;
+ mask = last_byte_masks[ctx->dgstSize % 8];
+ ctx->dgst[dataSize - 1] &= mask;
+ a = xmlSecBase64Encode(ctx->dgst, (ctx->dgstSize + 7) / 8, -1);
+ fprintf(stderr, "%s\n", a);
+ xmlFree(a);
+
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "data=%d;dgst=%d",
+ dataSize, ((ctx->dgstSize + 7) / 8));
+ transform->status = xmlSecTransformStatusFail;
+ return(0);
}
/* we check the last byte separatelly */
xmlSecAssert2(dataSize > 0, -1);
mask = last_byte_masks[ctx->dgstSize % 8];
if((ctx->dgst[dataSize - 1] & mask) != (data[dataSize - 1] & mask)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_DATA_NOT_MATCH,
- "data and digest do not match (last byte)");
- transform->status = xmlSecTransformStatusFail;
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_DATA_NOT_MATCH,
+ "data and digest do not match (last byte)");
+ transform->status = xmlSecTransformStatusFail;
+ return(0);
}
/* now check the rest of the digest */
if((dataSize > 1) && (memcmp(ctx->dgst, data, dataSize - 1) != 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_DATA_NOT_MATCH,
- "data and digest do not match");
- transform->status = xmlSecTransformStatusFail;
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_DATA_NOT_MATCH,
+ "data and digest do not match");
+ transform->status = xmlSecTransformStatusFail;
+ return(0);
}
transform->status = xmlSecTransformStatusOk;
@@ -448,73 +448,73 @@ xmlSecOpenSSLHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransform
xmlSecAssert2(ctx->ctxInitialized != 0, -1);
if(transform->status == xmlSecTransformStatusNone) {
- /* we should be already initialized when we set key */
- transform->status = xmlSecTransformStatusWorking;
+ /* we should be already initialized when we set key */
+ transform->status = xmlSecTransformStatusWorking;
}
if(transform->status == xmlSecTransformStatusWorking) {
- xmlSecSize inSize;
-
- inSize = xmlSecBufferGetSize(in);
- if(inSize > 0) {
- HMAC_Update(&(ctx->hmacCtx), xmlSecBufferGetData(in), inSize);
-
- ret = xmlSecBufferRemoveHead(in, inSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
- }
- }
-
- if(last) {
- xmlSecSize dgstSize;
-
- HMAC_Final(&(ctx->hmacCtx), ctx->dgst, &dgstSize);
- xmlSecAssert2(dgstSize > 0, -1);
-
- /* check/set the result digest size */
- if(ctx->dgstSize == 0) {
- ctx->dgstSize = dgstSize * 8; /* no dgst size specified, use all we have */
- } else if(ctx->dgstSize <= 8 * dgstSize) {
- dgstSize = ((ctx->dgstSize + 7) / 8); /* we need to truncate result digest */
- } else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "result-bits=%d;required-bits=%d",
- 8 * dgstSize, ctx->dgstSize);
- return(-1);
- }
-
- /* finally write result to output */
- if(transform->operation == xmlSecTransformOperationSign) {
- ret = xmlSecBufferAppend(out, ctx->dgst, dgstSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", dgstSize);
- return(-1);
- }
- }
- transform->status = xmlSecTransformStatusFinished;
- }
+ xmlSecSize inSize;
+
+ inSize = xmlSecBufferGetSize(in);
+ if(inSize > 0) {
+ HMAC_Update(&(ctx->hmacCtx), xmlSecBufferGetData(in), inSize);
+
+ ret = xmlSecBufferRemoveHead(in, inSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
+ }
+ }
+
+ if(last) {
+ xmlSecSize dgstSize;
+
+ HMAC_Final(&(ctx->hmacCtx), ctx->dgst, &dgstSize);
+ xmlSecAssert2(dgstSize > 0, -1);
+
+ /* check/set the result digest size */
+ if(ctx->dgstSize == 0) {
+ ctx->dgstSize = dgstSize * 8; /* no dgst size specified, use all we have */
+ } else if(ctx->dgstSize <= 8 * dgstSize) {
+ dgstSize = ((ctx->dgstSize + 7) / 8); /* we need to truncate result digest */
+ } else {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "result-bits=%d;required-bits=%d",
+ 8 * dgstSize, ctx->dgstSize);
+ return(-1);
+ }
+
+ /* finally write result to output */
+ if(transform->operation == xmlSecTransformOperationSign) {
+ ret = xmlSecBufferAppend(out, ctx->dgst, dgstSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", dgstSize);
+ return(-1);
+ }
+ }
+ transform->status = xmlSecTransformStatusFinished;
+ }
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(in) == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
@@ -527,29 +527,29 @@ xmlSecOpenSSLHmacExecute(xmlSecTransformPtr transform, int last, xmlSecTransform
*/
static xmlSecTransformKlass xmlSecOpenSSLHmacMd5Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLHmacSize, /* xmlSecSize objSize */
-
- xmlSecNameHmacMd5, /* const xmlChar* name; */
- xmlSecHrefHmacMd5, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
-
- xmlSecOpenSSLHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- xmlSecOpenSSLHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecOpenSSLHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLHmacVerify, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLHmacExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLHmacSize, /* xmlSecSize objSize */
+
+ xmlSecNameHmacMd5, /* const xmlChar* name; */
+ xmlSecHrefHmacMd5, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+
+ xmlSecOpenSSLHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ xmlSecOpenSSLHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecOpenSSLHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLHmacVerify, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLHmacExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -573,29 +573,29 @@ xmlSecOpenSSLTransformHmacMd5GetKlass(void) {
*/
static xmlSecTransformKlass xmlSecOpenSSLHmacRipemd160Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLHmacSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLHmacSize, /* xmlSecSize objSize */
- xmlSecNameHmacRipemd160, /* const xmlChar* name; */
- xmlSecHrefHmacRipemd160, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameHmacRipemd160, /* const xmlChar* name; */
+ xmlSecHrefHmacRipemd160, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- xmlSecOpenSSLHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecOpenSSLHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLHmacVerify, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLHmacExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ xmlSecOpenSSLHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecOpenSSLHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLHmacVerify, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLHmacExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -617,29 +617,29 @@ xmlSecOpenSSLTransformHmacRipemd160GetKlass(void) {
*/
static xmlSecTransformKlass xmlSecOpenSSLHmacSha1Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLHmacSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLHmacSize, /* xmlSecSize objSize */
- xmlSecNameHmacSha1, /* const xmlChar* name; */
- xmlSecHrefHmacSha1, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameHmacSha1, /* const xmlChar* name; */
+ xmlSecHrefHmacSha1, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- xmlSecOpenSSLHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecOpenSSLHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLHmacVerify, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLHmacExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ xmlSecOpenSSLHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecOpenSSLHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLHmacVerify, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLHmacExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -662,29 +662,29 @@ xmlSecOpenSSLTransformHmacSha1GetKlass(void) {
*/
static xmlSecTransformKlass xmlSecOpenSSLHmacSha224Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLHmacSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLHmacSize, /* xmlSecSize objSize */
- xmlSecNameHmacSha224, /* const xmlChar* name; */
- xmlSecHrefHmacSha224, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameHmacSha224, /* const xmlChar* name; */
+ xmlSecHrefHmacSha224, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- xmlSecOpenSSLHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecOpenSSLHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLHmacVerify, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLHmacExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ xmlSecOpenSSLHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecOpenSSLHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLHmacVerify, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLHmacExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -707,29 +707,29 @@ xmlSecOpenSSLTransformHmacSha224GetKlass(void) {
*/
static xmlSecTransformKlass xmlSecOpenSSLHmacSha256Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLHmacSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLHmacSize, /* xmlSecSize objSize */
- xmlSecNameHmacSha256, /* const xmlChar* name; */
- xmlSecHrefHmacSha256, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameHmacSha256, /* const xmlChar* name; */
+ xmlSecHrefHmacSha256, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- xmlSecOpenSSLHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecOpenSSLHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLHmacVerify, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLHmacExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ xmlSecOpenSSLHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecOpenSSLHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLHmacVerify, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLHmacExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -752,29 +752,29 @@ xmlSecOpenSSLTransformHmacSha256GetKlass(void) {
*/
static xmlSecTransformKlass xmlSecOpenSSLHmacSha384Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLHmacSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLHmacSize, /* xmlSecSize objSize */
- xmlSecNameHmacSha384, /* const xmlChar* name; */
- xmlSecHrefHmacSha384, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameHmacSha384, /* const xmlChar* name; */
+ xmlSecHrefHmacSha384, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- xmlSecOpenSSLHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecOpenSSLHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLHmacVerify, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLHmacExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ xmlSecOpenSSLHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecOpenSSLHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLHmacVerify, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLHmacExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -797,29 +797,29 @@ xmlSecOpenSSLTransformHmacSha384GetKlass(void) {
*/
static xmlSecTransformKlass xmlSecOpenSSLHmacSha512Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLHmacSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLHmacSize, /* xmlSecSize objSize */
- xmlSecNameHmacSha512, /* const xmlChar* name; */
- xmlSecHrefHmacSha512, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameHmacSha512, /* const xmlChar* name; */
+ xmlSecHrefHmacSha512, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- xmlSecOpenSSLHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecOpenSSLHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLHmacVerify, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLHmacExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLHmacInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLHmacFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ xmlSecOpenSSLHmacNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLHmacSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecOpenSSLHmacSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLHmacVerify, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLHmacExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
diff --git a/src/openssl/kt_rsa.c b/src/openssl/kt_rsa.c
index 1ed3685..9c9dd8b 100644
--- a/src/openssl/kt_rsa.c
+++ b/src/openssl/kt_rsa.c
@@ -40,11 +40,11 @@
* Internal OpenSSL RSA PKCS1 CTX
*
*************************************************************************/
-typedef struct _xmlSecOpenSSLRsaPkcs1Ctx xmlSecOpenSSLRsaPkcs1Ctx,
- *xmlSecOpenSSLRsaPkcs1CtxPtr;
+typedef struct _xmlSecOpenSSLRsaPkcs1Ctx xmlSecOpenSSLRsaPkcs1Ctx,
+ *xmlSecOpenSSLRsaPkcs1CtxPtr;
struct _xmlSecOpenSSLRsaPkcs1Ctx {
- EVP_PKEY* pKey;
-};
+ EVP_PKEY* pKey;
+};
/*********************************************************************
*
@@ -53,48 +53,48 @@ struct _xmlSecOpenSSLRsaPkcs1Ctx {
* xmlSecOpenSSLRsaPkcs1Ctx is located after xmlSecTransform
*
********************************************************************/
-#define xmlSecOpenSSLRsaPkcs1Size \
- (sizeof(xmlSecTransform) + sizeof(xmlSecOpenSSLRsaPkcs1Ctx))
+#define xmlSecOpenSSLRsaPkcs1Size \
+ (sizeof(xmlSecTransform) + sizeof(xmlSecOpenSSLRsaPkcs1Ctx))
#define xmlSecOpenSSLRsaPkcs1GetCtx(transform) \
((xmlSecOpenSSLRsaPkcs1CtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-static int xmlSecOpenSSLRsaPkcs1Initialize (xmlSecTransformPtr transform);
-static void xmlSecOpenSSLRsaPkcs1Finalize (xmlSecTransformPtr transform);
-static int xmlSecOpenSSLRsaPkcs1SetKeyReq (xmlSecTransformPtr transform,
- xmlSecKeyReqPtr keyReq);
-static int xmlSecOpenSSLRsaPkcs1SetKey (xmlSecTransformPtr transform,
- xmlSecKeyPtr key);
-static int xmlSecOpenSSLRsaPkcs1Execute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecOpenSSLRsaPkcs1Process (xmlSecTransformPtr transform,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecOpenSSLRsaPkcs1Initialize (xmlSecTransformPtr transform);
+static void xmlSecOpenSSLRsaPkcs1Finalize (xmlSecTransformPtr transform);
+static int xmlSecOpenSSLRsaPkcs1SetKeyReq (xmlSecTransformPtr transform,
+ xmlSecKeyReqPtr keyReq);
+static int xmlSecOpenSSLRsaPkcs1SetKey (xmlSecTransformPtr transform,
+ xmlSecKeyPtr key);
+static int xmlSecOpenSSLRsaPkcs1Execute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecOpenSSLRsaPkcs1Process (xmlSecTransformPtr transform,
+ xmlSecTransformCtxPtr transformCtx);
static xmlSecTransformKlass xmlSecOpenSSLRsaPkcs1Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLRsaPkcs1Size, /* xmlSecSize objSize */
-
- xmlSecNameRsaPkcs1, /* const xmlChar* name; */
- xmlSecHrefRsaPkcs1, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecOpenSSLRsaPkcs1Initialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLRsaPkcs1Finalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLRsaPkcs1SetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecOpenSSLRsaPkcs1SetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLRsaPkcs1Execute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLRsaPkcs1Size, /* xmlSecSize objSize */
+
+ xmlSecNameRsaPkcs1, /* const xmlChar* name; */
+ xmlSecHrefRsaPkcs1, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecOpenSSLRsaPkcs1Initialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLRsaPkcs1Finalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLRsaPkcs1SetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecOpenSSLRsaPkcs1SetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLRsaPkcs1Execute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -134,7 +134,7 @@ xmlSecOpenSSLRsaPkcs1Finalize(xmlSecTransformPtr transform) {
xmlSecAssert(ctx != NULL);
if(ctx->pKey != NULL) {
- EVP_PKEY_free(ctx->pKey);
+ EVP_PKEY_free(ctx->pKey);
}
memset(ctx, 0, sizeof(xmlSecOpenSSLRsaPkcs1Ctx));
}
@@ -151,18 +151,18 @@ xmlSecOpenSSLRsaPkcs1SetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr ke
ctx = xmlSecOpenSSLRsaPkcs1GetCtx(transform);
xmlSecAssert2(ctx != NULL, -1);
- keyReq->keyId = xmlSecOpenSSLKeyDataRsaId;
+ keyReq->keyId = xmlSecOpenSSLKeyDataRsaId;
if(transform->operation == xmlSecTransformOperationEncrypt) {
keyReq->keyType = xmlSecKeyDataTypePublic;
- keyReq->keyUsage = xmlSecKeyUsageEncrypt;
+ keyReq->keyUsage = xmlSecKeyUsageEncrypt;
} else {
keyReq->keyType = xmlSecKeyDataTypePrivate;
- keyReq->keyUsage = xmlSecKeyUsageDecrypt;
+ keyReq->keyUsage = xmlSecKeyUsageDecrypt;
}
return(0);
}
-static int
+static int
xmlSecOpenSSLRsaPkcs1SetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
xmlSecOpenSSLRsaPkcs1CtxPtr ctx;
EVP_PKEY* pKey;
@@ -179,24 +179,24 @@ xmlSecOpenSSLRsaPkcs1SetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
pKey = xmlSecOpenSSLKeyDataRsaGetEvp(xmlSecKeyGetValue(key));
if(pKey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecOpenSSLKeyDataRsaGetEvp",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecOpenSSLKeyDataRsaGetEvp",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
xmlSecAssert2(pKey->type == EVP_PKEY_RSA, -1);
xmlSecAssert2(pKey->pkey.rsa != NULL, -1);
ctx->pKey = xmlSecOpenSSLEvpKeyDup(pKey);
if(ctx->pKey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecOpenSSLEvpKeyDup",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecOpenSSLEvpKeyDup",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -217,32 +217,32 @@ xmlSecOpenSSLRsaPkcs1Execute(xmlSecTransformPtr transform, int last, xmlSecTrans
xmlSecAssert2(ctx->pKey != NULL, -1);
if(transform->status == xmlSecTransformStatusNone) {
- transform->status = xmlSecTransformStatusWorking;
+ transform->status = xmlSecTransformStatusWorking;
}
if((transform->status == xmlSecTransformStatusWorking) && (last == 0)) {
- /* just do nothing */
+ /* just do nothing */
} else if((transform->status == xmlSecTransformStatusWorking) && (last != 0)) {
- ret = xmlSecOpenSSLRsaPkcs1Process(transform, transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecOpenSSLRsaPkcs1Process",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- transform->status = xmlSecTransformStatusFinished;
+ ret = xmlSecOpenSSLRsaPkcs1Process(transform, transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecOpenSSLRsaPkcs1Process",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ transform->status = xmlSecTransformStatusFinished;
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
}
@@ -271,7 +271,7 @@ xmlSecOpenSSLRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
in = &(transform->inBuf);
out = &(transform->outBuf);
-
+
inSize = xmlSecBufferGetSize(in);
outSize = xmlSecBufferGetSize(out);
xmlSecAssert2(outSize == 0, -1);
@@ -279,78 +279,78 @@ xmlSecOpenSSLRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
/* the encoded size is equal to the keys size so we could not
* process more than that */
if((transform->operation == xmlSecTransformOperationEncrypt) && (inSize >= keySize)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "%d when expected less than %d", inSize, keySize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "%d when expected less than %d", inSize, keySize);
+ return(-1);
} else if((transform->operation == xmlSecTransformOperationDecrypt) && (inSize != keySize)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "%d when expected %d", inSize, keySize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "%d when expected %d", inSize, keySize);
+ return(-1);
}
-
+
outSize = keySize;
ret = xmlSecBufferSetMaxSize(out, outSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize);
+ return(-1);
}
if(transform->operation == xmlSecTransformOperationEncrypt) {
- ret = RSA_public_encrypt(inSize, xmlSecBufferGetData(in),
- xmlSecBufferGetData(out),
- ctx->pKey->pkey.rsa, RSA_PKCS1_PADDING);
- if(ret <= 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "RSA_public_encrypt",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "size=%d", inSize);
- return(-1);
- }
- outSize = ret;
+ ret = RSA_public_encrypt(inSize, xmlSecBufferGetData(in),
+ xmlSecBufferGetData(out),
+ ctx->pKey->pkey.rsa, RSA_PKCS1_PADDING);
+ if(ret <= 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "RSA_public_encrypt",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "size=%d", inSize);
+ return(-1);
+ }
+ outSize = ret;
} else {
- ret = RSA_private_decrypt(inSize, xmlSecBufferGetData(in),
- xmlSecBufferGetData(out),
- ctx->pKey->pkey.rsa, RSA_PKCS1_PADDING);
- if(ret <= 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "RSA_private_decrypt",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "size=%d", inSize);
- return(-1);
- }
- outSize = ret;
+ ret = RSA_private_decrypt(inSize, xmlSecBufferGetData(in),
+ xmlSecBufferGetData(out),
+ ctx->pKey->pkey.rsa, RSA_PKCS1_PADDING);
+ if(ret <= 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "RSA_private_decrypt",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "size=%d", inSize);
+ return(-1);
+ }
+ outSize = ret;
}
ret = xmlSecBufferSetSize(out, outSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize);
+ return(-1);
}
-
+
ret = xmlSecBufferRemoveHead(in, inSize);
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
}
return(0);
@@ -361,12 +361,12 @@ xmlSecOpenSSLRsaPkcs1Process(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
* Internal OpenSSL RSA OAPE CTX
*
*************************************************************************/
-typedef struct _xmlSecOpenSSLRsaOaepCtx xmlSecOpenSSLRsaOaepCtx,
- *xmlSecOpenSSLRsaOaepCtxPtr;
+typedef struct _xmlSecOpenSSLRsaOaepCtx xmlSecOpenSSLRsaOaepCtx,
+ *xmlSecOpenSSLRsaOaepCtxPtr;
struct _xmlSecOpenSSLRsaOaepCtx {
- EVP_PKEY* pKey;
- xmlSecBuffer oaepParams;
-};
+ EVP_PKEY* pKey;
+ xmlSecBuffer oaepParams;
+};
/*********************************************************************
*
@@ -375,51 +375,51 @@ struct _xmlSecOpenSSLRsaOaepCtx {
* xmlSecOpenSSLRsaOaepCtx is located after xmlSecTransform
*
********************************************************************/
-#define xmlSecOpenSSLRsaOaepSize \
- (sizeof(xmlSecTransform) + sizeof(xmlSecOpenSSLRsaOaepCtx))
+#define xmlSecOpenSSLRsaOaepSize \
+ (sizeof(xmlSecTransform) + sizeof(xmlSecOpenSSLRsaOaepCtx))
#define xmlSecOpenSSLRsaOaepGetCtx(transform) \
((xmlSecOpenSSLRsaOaepCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-static int xmlSecOpenSSLRsaOaepInitialize (xmlSecTransformPtr transform);
-static void xmlSecOpenSSLRsaOaepFinalize (xmlSecTransformPtr transform);
-static int xmlSecOpenSSLRsaOaepNodeRead (xmlSecTransformPtr transform,
- xmlNodePtr node,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecOpenSSLRsaOaepSetKeyReq (xmlSecTransformPtr transform,
- xmlSecKeyReqPtr keyReq);
-static int xmlSecOpenSSLRsaOaepSetKey (xmlSecTransformPtr transform,
- xmlSecKeyPtr key);
-static int xmlSecOpenSSLRsaOaepExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecOpenSSLRsaOaepProcess (xmlSecTransformPtr transform,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecOpenSSLRsaOaepInitialize (xmlSecTransformPtr transform);
+static void xmlSecOpenSSLRsaOaepFinalize (xmlSecTransformPtr transform);
+static int xmlSecOpenSSLRsaOaepNodeRead (xmlSecTransformPtr transform,
+ xmlNodePtr node,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecOpenSSLRsaOaepSetKeyReq (xmlSecTransformPtr transform,
+ xmlSecKeyReqPtr keyReq);
+static int xmlSecOpenSSLRsaOaepSetKey (xmlSecTransformPtr transform,
+ xmlSecKeyPtr key);
+static int xmlSecOpenSSLRsaOaepExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecOpenSSLRsaOaepProcess (xmlSecTransformPtr transform,
+ xmlSecTransformCtxPtr transformCtx);
static xmlSecTransformKlass xmlSecOpenSSLRsaOaepKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLRsaOaepSize, /* xmlSecSize objSize */
-
- xmlSecNameRsaOaep, /* const xmlChar* name; */
- xmlSecHrefRsaOaep, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecOpenSSLRsaOaepInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLRsaOaepFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- xmlSecOpenSSLRsaOaepNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLRsaOaepSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecOpenSSLRsaOaepSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLRsaOaepExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLRsaOaepSize, /* xmlSecSize objSize */
+
+ xmlSecNameRsaOaep, /* const xmlChar* name; */
+ xmlSecHrefRsaOaep, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecOpenSSLRsaOaepInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLRsaOaepFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ xmlSecOpenSSLRsaOaepNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLRsaOaepSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecOpenSSLRsaOaepSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLRsaOaepExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -449,12 +449,12 @@ xmlSecOpenSSLRsaOaepInitialize(xmlSecTransformPtr transform) {
ret = xmlSecBufferInitialize(&(ctx->oaepParams), 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
@@ -470,13 +470,13 @@ xmlSecOpenSSLRsaOaepFinalize(xmlSecTransformPtr transform) {
xmlSecAssert(ctx != NULL);
if(ctx->pKey != NULL) {
- EVP_PKEY_free(ctx->pKey);
+ EVP_PKEY_free(ctx->pKey);
}
xmlSecBufferFinalize(&(ctx->oaepParams));
memset(ctx, 0, sizeof(xmlSecOpenSSLRsaOaepCtx));
}
-static int
+static int
xmlSecOpenSSLRsaOaepNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransformCtxPtr transformCtx) {
xmlSecOpenSSLRsaOaepCtxPtr ctx;
xmlNodePtr cur;
@@ -493,55 +493,55 @@ xmlSecOpenSSLRsaOaepNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlS
cur = xmlSecGetNextElementNode(node->children);
if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeRsaOAEPparams, xmlSecEncNs)) {
- ret = xmlSecBufferBase64NodeContentRead(&(ctx->oaepParams), cur);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferBase64NodeContentRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- cur = xmlSecGetNextElementNode(cur->next);
+ ret = xmlSecBufferBase64NodeContentRead(&(ctx->oaepParams), cur);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferBase64NodeContentRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ cur = xmlSecGetNextElementNode(cur->next);
}
if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeDigestMethod, xmlSecDSigNs)) {
- xmlChar* algorithm;
-
- /* Algorithm attribute is required */
- algorithm = xmlGetProp(cur, xmlSecAttrAlgorithm);
- if(algorithm == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
- XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
+ xmlChar* algorithm;
+
+ /* Algorithm attribute is required */
+ algorithm = xmlGetProp(cur, xmlSecAttrAlgorithm);
+ if(algorithm == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
+ XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
}
- /* for now we support only sha1 */
- if(xmlStrcmp(algorithm, xmlSecHrefSha1) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- xmlSecErrorsSafeString(algorithm),
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- "digest algorithm is not supported for rsa/oaep");
- xmlFree(algorithm);
- return(-1);
- }
- xmlFree(algorithm);
-
- cur = xmlSecGetNextElementNode(cur->next);
+ /* for now we support only sha1 */
+ if(xmlStrcmp(algorithm, xmlSecHrefSha1) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ xmlSecErrorsSafeString(algorithm),
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ "digest algorithm is not supported for rsa/oaep");
+ xmlFree(algorithm);
+ return(-1);
+ }
+ xmlFree(algorithm);
+
+ cur = xmlSecGetNextElementNode(cur->next);
}
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -559,19 +559,19 @@ xmlSecOpenSSLRsaOaepSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr key
ctx = xmlSecOpenSSLRsaOaepGetCtx(transform);
xmlSecAssert2(ctx != NULL, -1);
- keyReq->keyId = xmlSecOpenSSLKeyDataRsaId;
+ keyReq->keyId = xmlSecOpenSSLKeyDataRsaId;
if(transform->operation == xmlSecTransformOperationEncrypt) {
keyReq->keyType = xmlSecKeyDataTypePublic;
- keyReq->keyUsage = xmlSecKeyUsageEncrypt;
+ keyReq->keyUsage = xmlSecKeyUsageEncrypt;
} else {
keyReq->keyType = xmlSecKeyDataTypePrivate;
- keyReq->keyUsage = xmlSecKeyUsageDecrypt;
+ keyReq->keyUsage = xmlSecKeyUsageDecrypt;
}
return(0);
}
-static int
+static int
xmlSecOpenSSLRsaOaepSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
xmlSecOpenSSLRsaOaepCtxPtr ctx;
EVP_PKEY* pKey;
@@ -588,24 +588,24 @@ xmlSecOpenSSLRsaOaepSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
pKey = xmlSecOpenSSLKeyDataRsaGetEvp(xmlSecKeyGetValue(key));
if(pKey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecOpenSSLKeyDataRsaGetEvp",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecOpenSSLKeyDataRsaGetEvp",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
xmlSecAssert2(pKey->type == EVP_PKEY_RSA, -1);
xmlSecAssert2(pKey->pkey.rsa != NULL, -1);
ctx->pKey = xmlSecOpenSSLEvpKeyDup(pKey);
if(ctx->pKey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecOpenSSLEvpKeyDup",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecOpenSSLEvpKeyDup",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -626,32 +626,32 @@ xmlSecOpenSSLRsaOaepExecute(xmlSecTransformPtr transform, int last, xmlSecTransf
xmlSecAssert2(ctx->pKey != NULL, -1);
if(transform->status == xmlSecTransformStatusNone) {
- transform->status = xmlSecTransformStatusWorking;
+ transform->status = xmlSecTransformStatusWorking;
}
if((transform->status == xmlSecTransformStatusWorking) && (last == 0)) {
- /* just do nothing */
+ /* just do nothing */
} else if((transform->status == xmlSecTransformStatusWorking) && (last != 0)) {
- ret = xmlSecOpenSSLRsaOaepProcess(transform, transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecOpenSSLRsaOaepProcess",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- transform->status = xmlSecTransformStatusFinished;
+ ret = xmlSecOpenSSLRsaOaepProcess(transform, transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecOpenSSLRsaOaepProcess",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ transform->status = xmlSecTransformStatusFinished;
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
}
@@ -681,7 +681,7 @@ xmlSecOpenSSLRsaOaepProcess(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
in = &(transform->inBuf);
out = &(transform->outBuf);
-
+
inSize = xmlSecBufferGetSize(in);
outSize = xmlSecBufferGetSize(out);
xmlSecAssert2(outSize == 0, -1);
@@ -689,185 +689,185 @@ xmlSecOpenSSLRsaOaepProcess(xmlSecTransformPtr transform, xmlSecTransformCtxPtr
/* the encoded size is equal to the keys size so we could not
* process more than that */
if((transform->operation == xmlSecTransformOperationEncrypt) && (inSize >= keySize)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "%d when expected less than %d", inSize, keySize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "%d when expected less than %d", inSize, keySize);
+ return(-1);
} else if((transform->operation == xmlSecTransformOperationDecrypt) && (inSize != keySize)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "%d when expected %d", inSize, keySize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "%d when expected %d", inSize, keySize);
+ return(-1);
}
-
+
outSize = keySize;
ret = xmlSecBufferSetMaxSize(out, outSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize);
+ return(-1);
}
paramsSize = xmlSecBufferGetSize(&(ctx->oaepParams));
if((transform->operation == xmlSecTransformOperationEncrypt) && (paramsSize == 0)) {
- /* encode w/o OAEPParams --> simple */
- ret = RSA_public_encrypt(inSize, xmlSecBufferGetData(in),
- xmlSecBufferGetData(out),
- ctx->pKey->pkey.rsa, RSA_PKCS1_OAEP_PADDING);
- if(ret <= 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "RSA_public_encrypt(RSA_PKCS1_OAEP_PADDING)",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- outSize = ret;
+ /* encode w/o OAEPParams --> simple */
+ ret = RSA_public_encrypt(inSize, xmlSecBufferGetData(in),
+ xmlSecBufferGetData(out),
+ ctx->pKey->pkey.rsa, RSA_PKCS1_OAEP_PADDING);
+ if(ret <= 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "RSA_public_encrypt(RSA_PKCS1_OAEP_PADDING)",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ outSize = ret;
} else if((transform->operation == xmlSecTransformOperationEncrypt) && (paramsSize > 0)) {
- xmlSecAssert2(xmlSecBufferGetData(&(ctx->oaepParams)) != NULL, -1);
-
- /* add space for padding */
- ret = xmlSecBufferSetMaxSize(in, keySize);
+ xmlSecAssert2(xmlSecBufferGetData(&(ctx->oaepParams)) != NULL, -1);
+
+ /* add space for padding */
+ ret = xmlSecBufferSetMaxSize(in, keySize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", keySize);
- return(-1);
- }
-
- /* add padding */
- ret = RSA_padding_add_PKCS1_OAEP(xmlSecBufferGetData(in), keySize,
- xmlSecBufferGetData(in), inSize,
- xmlSecBufferGetData(&(ctx->oaepParams)),
- paramsSize);
- if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "RSA_padding_add_PKCS1_OAEP",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- inSize = keySize;
-
- /* encode with OAEPParams */
- ret = RSA_public_encrypt(inSize, xmlSecBufferGetData(in),
- xmlSecBufferGetData(out),
- ctx->pKey->pkey.rsa, RSA_NO_PADDING);
- if(ret <= 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "RSA_public_encrypt(RSA_NO_PADDING)",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- outSize = ret;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", keySize);
+ return(-1);
+ }
+
+ /* add padding */
+ ret = RSA_padding_add_PKCS1_OAEP(xmlSecBufferGetData(in), keySize,
+ xmlSecBufferGetData(in), inSize,
+ xmlSecBufferGetData(&(ctx->oaepParams)),
+ paramsSize);
+ if(ret != 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "RSA_padding_add_PKCS1_OAEP",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ inSize = keySize;
+
+ /* encode with OAEPParams */
+ ret = RSA_public_encrypt(inSize, xmlSecBufferGetData(in),
+ xmlSecBufferGetData(out),
+ ctx->pKey->pkey.rsa, RSA_NO_PADDING);
+ if(ret <= 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "RSA_public_encrypt(RSA_NO_PADDING)",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ outSize = ret;
} else if((transform->operation == xmlSecTransformOperationDecrypt) && (paramsSize == 0)) {
- ret = RSA_private_decrypt(inSize, xmlSecBufferGetData(in),
- xmlSecBufferGetData(out),
- ctx->pKey->pkey.rsa, RSA_PKCS1_OAEP_PADDING);
- if(ret <= 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "RSA_private_decrypt(RSA_PKCS1_OAEP_PADDING)",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- outSize = ret;
+ ret = RSA_private_decrypt(inSize, xmlSecBufferGetData(in),
+ xmlSecBufferGetData(out),
+ ctx->pKey->pkey.rsa, RSA_PKCS1_OAEP_PADDING);
+ if(ret <= 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "RSA_private_decrypt(RSA_PKCS1_OAEP_PADDING)",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ outSize = ret;
} else if((transform->operation == xmlSecTransformOperationDecrypt) && (paramsSize != 0)) {
- BIGNUM bn;
-
- ret = RSA_private_decrypt(inSize, xmlSecBufferGetData(in),
- xmlSecBufferGetData(out),
- ctx->pKey->pkey.rsa, RSA_NO_PADDING);
- if(ret <= 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "RSA_private_decrypt(RSA_NO_PADDING)",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- outSize = ret;
-
- /*
- * the private decrypt w/o padding adds '0's at the begginning.
- * it's not clear for me can I simply skip all '0's from the
- * beggining so I have to do decode it back to BIGNUM and dump
- * buffer again
- */
- BN_init(&bn);
- if(BN_bin2bn(xmlSecBufferGetData(out), outSize, &bn) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "BN_bin2bn",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "size=%d", outSize);
- BN_clear_free(&bn);
- return(-1);
- }
-
- ret = BN_bn2bin(&bn, xmlSecBufferGetData(out));
- if(ret <= 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "BN_bn2bin",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- BN_clear_free(&bn);
- return(-1);
- }
- BN_clear_free(&bn);
- outSize = ret;
-
- ret = RSA_padding_check_PKCS1_OAEP(xmlSecBufferGetData(out), outSize,
- xmlSecBufferGetData(out), outSize,
- keySize,
- xmlSecBufferGetData(&(ctx->oaepParams)),
- paramsSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "RSA_padding_check_PKCS1_OAEP",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- outSize = ret;
+ BIGNUM bn;
+
+ ret = RSA_private_decrypt(inSize, xmlSecBufferGetData(in),
+ xmlSecBufferGetData(out),
+ ctx->pKey->pkey.rsa, RSA_NO_PADDING);
+ if(ret <= 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "RSA_private_decrypt(RSA_NO_PADDING)",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ outSize = ret;
+
+ /*
+ * the private decrypt w/o padding adds '0's at the begginning.
+ * it's not clear for me can I simply skip all '0's from the
+ * beggining so I have to do decode it back to BIGNUM and dump
+ * buffer again
+ */
+ BN_init(&bn);
+ if(BN_bin2bn(xmlSecBufferGetData(out), outSize, &bn) == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "BN_bin2bn",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "size=%d", outSize);
+ BN_clear_free(&bn);
+ return(-1);
+ }
+
+ ret = BN_bn2bin(&bn, xmlSecBufferGetData(out));
+ if(ret <= 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "BN_bn2bin",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ BN_clear_free(&bn);
+ return(-1);
+ }
+ BN_clear_free(&bn);
+ outSize = ret;
+
+ ret = RSA_padding_check_PKCS1_OAEP(xmlSecBufferGetData(out), outSize,
+ xmlSecBufferGetData(out), outSize,
+ keySize,
+ xmlSecBufferGetData(&(ctx->oaepParams)),
+ paramsSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "RSA_padding_check_PKCS1_OAEP",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ outSize = ret;
} else {
- xmlSecAssert2("we could not be here" == NULL, -1);
- return(-1);
+ xmlSecAssert2("we could not be here" == NULL, -1);
+ return(-1);
}
ret = xmlSecBufferSetSize(out, outSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize);
+ return(-1);
}
-
+
ret = xmlSecBufferRemoveHead(in, inSize);
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
}
return(0);
diff --git a/src/openssl/kw_aes.c b/src/openssl/kw_aes.c
index 94cfedd..bbaf3e4 100644
--- a/src/openssl/kw_aes.c
+++ b/src/openssl/kw_aes.c
@@ -28,11 +28,11 @@
#include <xmlsec/openssl/crypto.h>
-#define XMLSEC_OPENSSL_AES128_KEY_SIZE 16
-#define XMLSEC_OPENSSL_AES192_KEY_SIZE 24
-#define XMLSEC_OPENSSL_AES256_KEY_SIZE 32
-#define XMLSEC_OPENSSL_AES_IV_SIZE 16
-#define XMLSEC_OPENSSL_AES_BLOCK_SIZE 16
+#define XMLSEC_OPENSSL_AES128_KEY_SIZE 16
+#define XMLSEC_OPENSSL_AES192_KEY_SIZE 24
+#define XMLSEC_OPENSSL_AES256_KEY_SIZE 32
+#define XMLSEC_OPENSSL_AES_IV_SIZE 16
+#define XMLSEC_OPENSSL_AES_BLOCK_SIZE 16
/*********************************************************************
@@ -44,114 +44,114 @@
********************************************************************/
#define xmlSecOpenSSLKWAesGetKey(transform) \
((xmlSecBufferPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-#define xmlSecOpenSSLKWAesSize \
+#define xmlSecOpenSSLKWAesSize \
(sizeof(xmlSecTransform) + sizeof(xmlSecBuffer))
-static int xmlSecOpenSSLKWAesInitialize (xmlSecTransformPtr transform);
-static void xmlSecOpenSSLKWAesFinalize (xmlSecTransformPtr transform);
-static int xmlSecOpenSSLKWAesSetKeyReq (xmlSecTransformPtr transform,
- xmlSecKeyReqPtr keyReq);
-static int xmlSecOpenSSLKWAesSetKey (xmlSecTransformPtr transform,
- xmlSecKeyPtr key);
-static int xmlSecOpenSSLKWAesExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
-static xmlSecSize xmlSecOpenSSLKWAesGetKeySize (xmlSecTransformPtr transform);
-static int xmlSecOpenSSLKWAesEncode (const xmlSecByte *key,
- xmlSecSize keySize,
- const xmlSecByte* in,
- xmlSecSize inSize,
- xmlSecByte* out,
- xmlSecSize outSize);
-static int xmlSecOpenSSLKWAesDecode (const xmlSecByte *key,
- xmlSecSize keySize,
- const xmlSecByte* in,
- xmlSecSize inSize,
- xmlSecByte* out,
- xmlSecSize outSize);
+static int xmlSecOpenSSLKWAesInitialize (xmlSecTransformPtr transform);
+static void xmlSecOpenSSLKWAesFinalize (xmlSecTransformPtr transform);
+static int xmlSecOpenSSLKWAesSetKeyReq (xmlSecTransformPtr transform,
+ xmlSecKeyReqPtr keyReq);
+static int xmlSecOpenSSLKWAesSetKey (xmlSecTransformPtr transform,
+ xmlSecKeyPtr key);
+static int xmlSecOpenSSLKWAesExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
+static xmlSecSize xmlSecOpenSSLKWAesGetKeySize (xmlSecTransformPtr transform);
+static int xmlSecOpenSSLKWAesEncode (const xmlSecByte *key,
+ xmlSecSize keySize,
+ const xmlSecByte* in,
+ xmlSecSize inSize,
+ xmlSecByte* out,
+ xmlSecSize outSize);
+static int xmlSecOpenSSLKWAesDecode (const xmlSecByte *key,
+ xmlSecSize keySize,
+ const xmlSecByte* in,
+ xmlSecSize inSize,
+ xmlSecByte* out,
+ xmlSecSize outSize);
static xmlSecTransformKlass xmlSecOpenSSLKWAes128Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLKWAesSize, /* xmlSecSize objSize */
-
- xmlSecNameKWAes128, /* const xmlChar* name; */
- xmlSecHrefKWAes128, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecOpenSSLKWAesInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLKWAesFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLKWAesSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecOpenSSLKWAesSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLKWAesExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLKWAesSize, /* xmlSecSize objSize */
+
+ xmlSecNameKWAes128, /* const xmlChar* name; */
+ xmlSecHrefKWAes128, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecOpenSSLKWAesInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLKWAesFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLKWAesSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecOpenSSLKWAesSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLKWAesExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
static xmlSecTransformKlass xmlSecOpenSSLKWAes192Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLKWAesSize, /* xmlSecSize objSize */
-
- xmlSecNameKWAes192, /* const xmlChar* name; */
- xmlSecHrefKWAes192, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecOpenSSLKWAesInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLKWAesFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLKWAesSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecOpenSSLKWAesSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLKWAesExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLKWAesSize, /* xmlSecSize objSize */
+
+ xmlSecNameKWAes192, /* const xmlChar* name; */
+ xmlSecHrefKWAes192, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecOpenSSLKWAesInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLKWAesFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLKWAesSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecOpenSSLKWAesSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLKWAesExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
static xmlSecTransformKlass xmlSecOpenSSLKWAes256Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLKWAesSize, /* xmlSecSize objSize */
-
- xmlSecNameKWAes256, /* const xmlChar* name; */
- xmlSecHrefKWAes256, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecOpenSSLKWAesInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLKWAesFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLKWAesSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecOpenSSLKWAesSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLKWAesExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLKWAesSize, /* xmlSecSize objSize */
+
+ xmlSecNameKWAes256, /* const xmlChar* name; */
+ xmlSecHrefKWAes256, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecOpenSSLKWAesInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLKWAesFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLKWAesSetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecOpenSSLKWAesSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLKWAesExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
-#define XMLSEC_OPENSSL_KW_AES_MAGIC_BLOCK_SIZE 8
+#define XMLSEC_OPENSSL_KW_AES_MAGIC_BLOCK_SIZE 8
#define xmlSecOpenSSLKWAesCheckId(transform) \
(xmlSecTransformCheckId((transform), xmlSecOpenSSLTransformKWAes128Id) || \
@@ -203,12 +203,12 @@ xmlSecOpenSSLKWAesInitialize(xmlSecTransformPtr transform) {
ret = xmlSecBufferInitialize(xmlSecOpenSSLKWAesGetKey(transform), 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecOpenSSLKWAesGetKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecOpenSSLKWAesGetKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -220,7 +220,7 @@ xmlSecOpenSSLKWAesFinalize(xmlSecTransformPtr transform) {
xmlSecAssert(xmlSecTransformCheckSize(transform, xmlSecOpenSSLKWAesSize));
if(xmlSecOpenSSLKWAesGetKey(transform) != NULL) {
- xmlSecBufferFinalize(xmlSecOpenSSLKWAesGetKey(transform));
+ xmlSecBufferFinalize(xmlSecOpenSSLKWAesGetKey(transform));
}
}
@@ -231,19 +231,19 @@ xmlSecOpenSSLKWAesSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr keyRe
xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLKWAesSize), -1);
xmlSecAssert2(keyReq != NULL, -1);
- keyReq->keyId = xmlSecOpenSSLKeyDataAesId;
+ keyReq->keyId = xmlSecOpenSSLKeyDataAesId;
keyReq->keyType = xmlSecKeyDataTypeSymmetric;
if(transform->operation == xmlSecTransformOperationEncrypt) {
- keyReq->keyUsage = xmlSecKeyUsageEncrypt;
+ keyReq->keyUsage = xmlSecKeyUsageEncrypt;
} else {
- keyReq->keyUsage = xmlSecKeyUsageDecrypt;
+ keyReq->keyUsage = xmlSecKeyUsageDecrypt;
}
keyReq->keyBitsSize = 8 * xmlSecOpenSSLKWAesGetKeySize(transform);
return(0);
}
-static int
+static int
xmlSecOpenSSLKWAesSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
xmlSecBufferPtr buffer;
xmlSecSize keySize;
@@ -263,25 +263,25 @@ xmlSecOpenSSLKWAesSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
keySize = xmlSecBufferGetSize(buffer);
expectedKeySize = xmlSecOpenSSLKWAesGetKeySize(transform);
if(keySize < expectedKeySize) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
- "key=%d;expected=%d",
- keySize, expectedKeySize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
+ "key=%d;expected=%d",
+ keySize, expectedKeySize);
+ return(-1);
}
ret = xmlSecBufferSetData(xmlSecOpenSSLKWAesGetKey(transform),
- xmlSecBufferGetData(buffer),
- expectedKeySize);
+ xmlSecBufferGetData(buffer),
+ expectedKeySize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "expected-size=%d", expectedKeySize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "expected-size=%d", expectedKeySize);
+ return(-1);
}
return(0);
@@ -312,98 +312,98 @@ xmlSecOpenSSLKWAesExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
xmlSecAssert2(outSize == 0, -1);
if(transform->status == xmlSecTransformStatusNone) {
- transform->status = xmlSecTransformStatusWorking;
+ transform->status = xmlSecTransformStatusWorking;
}
if((transform->status == xmlSecTransformStatusWorking) && (last == 0)) {
- /* just do nothing */
+ /* just do nothing */
} else if((transform->status == xmlSecTransformStatusWorking) && (last != 0)) {
- if((inSize % 8) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "size=%d(not 8 bytes aligned)", inSize);
- return(-1);
- }
-
- if(transform->operation == xmlSecTransformOperationEncrypt) {
- /* the encoded key might be 8 bytes longer plus 8 bytes just in case */
- outSize = inSize + XMLSEC_OPENSSL_KW_AES_MAGIC_BLOCK_SIZE +
- XMLSEC_OPENSSL_AES_BLOCK_SIZE;
- } else {
- outSize = inSize + XMLSEC_OPENSSL_AES_BLOCK_SIZE;
- }
-
- ret = xmlSecBufferSetMaxSize(out, outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "outSize=%d", outSize);
- return(-1);
- }
-
- if(transform->operation == xmlSecTransformOperationEncrypt) {
- ret = xmlSecOpenSSLKWAesEncode(xmlSecBufferGetData(key), keySize,
- xmlSecBufferGetData(in), inSize,
- xmlSecBufferGetData(out), outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecOpenSSLKWAesEncode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- outSize = ret;
- } else {
- ret = xmlSecOpenSSLKWAesDecode(xmlSecBufferGetData(key), keySize,
- xmlSecBufferGetData(in), inSize,
- xmlSecBufferGetData(out), outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecOpenSSLKWAesDecode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- outSize = ret;
- }
-
- ret = xmlSecBufferSetSize(out, outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "outSize=%d", outSize);
- return(-1);
- }
-
- ret = xmlSecBufferRemoveHead(in, inSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "inSize%d", inSize);
- return(-1);
- }
-
- transform->status = xmlSecTransformStatusFinished;
+ if((inSize % 8) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "size=%d(not 8 bytes aligned)", inSize);
+ return(-1);
+ }
+
+ if(transform->operation == xmlSecTransformOperationEncrypt) {
+ /* the encoded key might be 8 bytes longer plus 8 bytes just in case */
+ outSize = inSize + XMLSEC_OPENSSL_KW_AES_MAGIC_BLOCK_SIZE +
+ XMLSEC_OPENSSL_AES_BLOCK_SIZE;
+ } else {
+ outSize = inSize + XMLSEC_OPENSSL_AES_BLOCK_SIZE;
+ }
+
+ ret = xmlSecBufferSetMaxSize(out, outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "outSize=%d", outSize);
+ return(-1);
+ }
+
+ if(transform->operation == xmlSecTransformOperationEncrypt) {
+ ret = xmlSecOpenSSLKWAesEncode(xmlSecBufferGetData(key), keySize,
+ xmlSecBufferGetData(in), inSize,
+ xmlSecBufferGetData(out), outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecOpenSSLKWAesEncode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ outSize = ret;
+ } else {
+ ret = xmlSecOpenSSLKWAesDecode(xmlSecBufferGetData(key), keySize,
+ xmlSecBufferGetData(in), inSize,
+ xmlSecBufferGetData(out), outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecOpenSSLKWAesDecode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ outSize = ret;
+ }
+
+ ret = xmlSecBufferSetSize(out, outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "outSize=%d", outSize);
+ return(-1);
+ }
+
+ ret = xmlSecBufferRemoveHead(in, inSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "inSize%d", inSize);
+ return(-1);
+ }
+
+ transform->status = xmlSecTransformStatusFinished;
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
}
@@ -411,11 +411,11 @@ xmlSecOpenSSLKWAesExecute(xmlSecTransformPtr transform, int last, xmlSecTransfor
static xmlSecSize
xmlSecOpenSSLKWAesGetKeySize(xmlSecTransformPtr transform) {
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformKWAes128Id)) {
- return(XMLSEC_OPENSSL_AES128_KEY_SIZE);
+ return(XMLSEC_OPENSSL_AES128_KEY_SIZE);
} else if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformKWAes192Id)) {
- return(XMLSEC_OPENSSL_AES192_KEY_SIZE);
+ return(XMLSEC_OPENSSL_AES192_KEY_SIZE);
} else if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformKWAes256Id)) {
- return(XMLSEC_OPENSSL_AES256_KEY_SIZE);
+ return(XMLSEC_OPENSSL_AES256_KEY_SIZE);
}
return(0);
}
@@ -492,11 +492,11 @@ xmlSecOpenSSLKWAesGetKeySize(xmlSecTransformPtr transform) {
static const xmlSecByte xmlSecOpenSSLKWAesMagicBlock[XMLSEC_OPENSSL_KW_AES_MAGIC_BLOCK_SIZE] = {
0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6
};
-
-static int
+
+static int
xmlSecOpenSSLKWAesEncode(const xmlSecByte *key, xmlSecSize keySize,
- const xmlSecByte *in, xmlSecSize inSize,
- xmlSecByte *out, xmlSecSize outSize) {
+ const xmlSecByte *in, xmlSecSize inSize,
+ xmlSecByte *out, xmlSecSize outSize) {
AES_KEY aesKey;
xmlSecByte block[XMLSEC_OPENSSL_AES_BLOCK_SIZE];
xmlSecByte *p;
@@ -512,12 +512,12 @@ xmlSecOpenSSLKWAesEncode(const xmlSecByte *key, xmlSecSize keySize,
ret = AES_set_encrypt_key(key, 8 * keySize, &aesKey);
if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "AES_set_encrypt_key",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "AES_set_encrypt_key",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* prepend magic block */
@@ -530,31 +530,31 @@ xmlSecOpenSSLKWAesEncode(const xmlSecByte *key, xmlSecSize keySize,
N = (inSize / 8);
if(N == 1) {
- AES_encrypt(out, out, &aesKey);
+ AES_encrypt(out, out, &aesKey);
} else {
- for(j = 0; j <= 5; ++j) {
- for(i = 1; i <= N; ++i) {
- t = i + (j * N);
- p = out + i * 8;
-
- memcpy(block, out, 8);
- memcpy(block + 8, p, 8);
-
- AES_encrypt(block, block, &aesKey);
- block[7] ^= t;
- memcpy(out, block, 8);
- memcpy(p, block + 8, 8);
- }
- }
+ for(j = 0; j <= 5; ++j) {
+ for(i = 1; i <= N; ++i) {
+ t = i + (j * N);
+ p = out + i * 8;
+
+ memcpy(block, out, 8);
+ memcpy(block + 8, p, 8);
+
+ AES_encrypt(block, block, &aesKey);
+ block[7] ^= t;
+ memcpy(out, block, 8);
+ memcpy(p, block + 8, 8);
+ }
+ }
}
return(inSize + 8);
}
-static int
+static int
xmlSecOpenSSLKWAesDecode(const xmlSecByte *key, xmlSecSize keySize,
- const xmlSecByte *in, xmlSecSize inSize,
- xmlSecByte *out, xmlSecSize outSize) {
+ const xmlSecByte *in, xmlSecSize inSize,
+ xmlSecByte *out, xmlSecSize outSize) {
AES_KEY aesKey;
xmlSecByte block[XMLSEC_OPENSSL_AES_BLOCK_SIZE];
xmlSecByte *p;
@@ -570,12 +570,12 @@ xmlSecOpenSSLKWAesDecode(const xmlSecByte *key, xmlSecSize keySize,
ret = AES_set_decrypt_key(key, 8 * keySize, &aesKey);
if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "AES_set_decrypt_key",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "AES_set_decrypt_key",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* copy input */
@@ -585,35 +585,35 @@ xmlSecOpenSSLKWAesDecode(const xmlSecByte *key, xmlSecSize keySize,
N = (inSize / 8) - 1;
if(N == 1) {
- AES_decrypt(out, out, &aesKey);
+ AES_decrypt(out, out, &aesKey);
} else {
- for(j = 5; j >= 0; --j) {
- for(i = N; i > 0; --i) {
- t = i + (j * N);
- p = out + i * 8;
-
- memcpy(block, out, 8);
- memcpy(block + 8, p, 8);
- block[7] ^= t;
-
- AES_decrypt(block, block, &aesKey);
- memcpy(out, block, 8);
- memcpy(p, block + 8, 8);
- }
- }
+ for(j = 5; j >= 0; --j) {
+ for(i = N; i > 0; --i) {
+ t = i + (j * N);
+ p = out + i * 8;
+
+ memcpy(block, out, 8);
+ memcpy(block + 8, p, 8);
+ block[7] ^= t;
+
+ AES_decrypt(block, block, &aesKey);
+ memcpy(out, block, 8);
+ memcpy(p, block + 8, 8);
+ }
+ }
}
/* do not left data in memory */
memset(block, 0, sizeof(block));
if(memcmp(xmlSecOpenSSLKWAesMagicBlock, out, XMLSEC_OPENSSL_KW_AES_MAGIC_BLOCK_SIZE) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "bad magic block");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "bad magic block");
+ return(-1);
}
-
+
memmove(out, out + XMLSEC_OPENSSL_KW_AES_MAGIC_BLOCK_SIZE, inSize - XMLSEC_OPENSSL_KW_AES_MAGIC_BLOCK_SIZE);
return(inSize - XMLSEC_OPENSSL_KW_AES_MAGIC_BLOCK_SIZE);
}
diff --git a/src/openssl/kw_des.c b/src/openssl/kw_des.c
index f5ebf43..5f92ba5 100644
--- a/src/openssl/kw_des.c
+++ b/src/openssl/kw_des.c
@@ -28,9 +28,9 @@
#include <xmlsec/openssl/crypto.h>
-#define XMLSEC_OPENSSL_DES3_KEY_LENGTH 24
-#define XMLSEC_OPENSSL_DES3_IV_LENGTH 8
-#define XMLSEC_OPENSSL_DES3_BLOCK_LENGTH 8
+#define XMLSEC_OPENSSL_DES3_KEY_LENGTH 24
+#define XMLSEC_OPENSSL_DES3_IV_LENGTH 8
+#define XMLSEC_OPENSSL_DES3_BLOCK_LENGTH 8
/*********************************************************************
*
@@ -41,67 +41,67 @@
********************************************************************/
#define xmlSecOpenSSLKWDes3GetKey(transform) \
((xmlSecBufferPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-#define xmlSecOpenSSLKWDes3Size \
+#define xmlSecOpenSSLKWDes3Size \
(sizeof(xmlSecTransform) + sizeof(xmlSecBuffer))
-static int xmlSecOpenSSLKWDes3Initialize (xmlSecTransformPtr transform);
-static void xmlSecOpenSSLKWDes3Finalize (xmlSecTransformPtr transform);
-static int xmlSecOpenSSLKWDes3SetKeyReq (xmlSecTransformPtr transform,
- xmlSecKeyReqPtr keyReq);
-static int xmlSecOpenSSLKWDes3SetKey (xmlSecTransformPtr transform,
- xmlSecKeyPtr key);
-static int xmlSecOpenSSLKWDes3Execute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecOpenSSLKWDes3Encode (const xmlSecByte *key,
- xmlSecSize keySize,
- const xmlSecByte *in,
- xmlSecSize inSize,
- xmlSecByte *out,
- xmlSecSize outSize);
-static int xmlSecOpenSSLKWDes3Decode (const xmlSecByte *key,
- xmlSecSize keySize,
- const xmlSecByte *in,
- xmlSecSize inSize,
- xmlSecByte *out,
- xmlSecSize outSize);
-static int xmlSecOpenSSLKWDes3Encrypt (const xmlSecByte *key,
- xmlSecSize keySize,
- const xmlSecByte *iv,
- xmlSecSize ivSize,
- const xmlSecByte *in,
- xmlSecSize inSize,
- xmlSecByte *out,
- xmlSecSize outSize,
- int enc);
-static int xmlSecOpenSSLKWDes3BufferReverse (xmlSecByte *buf,
- xmlSecSize size);
+static int xmlSecOpenSSLKWDes3Initialize (xmlSecTransformPtr transform);
+static void xmlSecOpenSSLKWDes3Finalize (xmlSecTransformPtr transform);
+static int xmlSecOpenSSLKWDes3SetKeyReq (xmlSecTransformPtr transform,
+ xmlSecKeyReqPtr keyReq);
+static int xmlSecOpenSSLKWDes3SetKey (xmlSecTransformPtr transform,
+ xmlSecKeyPtr key);
+static int xmlSecOpenSSLKWDes3Execute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecOpenSSLKWDes3Encode (const xmlSecByte *key,
+ xmlSecSize keySize,
+ const xmlSecByte *in,
+ xmlSecSize inSize,
+ xmlSecByte *out,
+ xmlSecSize outSize);
+static int xmlSecOpenSSLKWDes3Decode (const xmlSecByte *key,
+ xmlSecSize keySize,
+ const xmlSecByte *in,
+ xmlSecSize inSize,
+ xmlSecByte *out,
+ xmlSecSize outSize);
+static int xmlSecOpenSSLKWDes3Encrypt (const xmlSecByte *key,
+ xmlSecSize keySize,
+ const xmlSecByte *iv,
+ xmlSecSize ivSize,
+ const xmlSecByte *in,
+ xmlSecSize inSize,
+ xmlSecByte *out,
+ xmlSecSize outSize,
+ int enc);
+static int xmlSecOpenSSLKWDes3BufferReverse (xmlSecByte *buf,
+ xmlSecSize size);
static xmlSecTransformKlass xmlSecOpenSSLKWDes3Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLKWDes3Size, /* xmlSecSize objSize */
-
- xmlSecNameKWDes3, /* const xmlChar* name; */
- xmlSecHrefKWDes3, /* const xmlChar* href; */
- xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecOpenSSLKWDes3Initialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLKWDes3Finalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLKWDes3SetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
- xmlSecOpenSSLKWDes3SetKey, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLKWDes3Execute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLKWDes3Size, /* xmlSecSize objSize */
+
+ xmlSecNameKWDes3, /* const xmlChar* name; */
+ xmlSecHrefKWDes3, /* const xmlChar* href; */
+ xmlSecTransformUsageEncryptionMethod, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecOpenSSLKWDes3Initialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLKWDes3Finalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLKWDes3SetKeyReq, /* xmlSecTransformSetKeyMethod setKeyReq; */
+ xmlSecOpenSSLKWDes3SetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLKWDes3Execute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -125,12 +125,12 @@ xmlSecOpenSSLKWDes3Initialize(xmlSecTransformPtr transform) {
ret = xmlSecBufferInitialize(xmlSecOpenSSLKWDes3GetKey(transform), 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -142,7 +142,7 @@ xmlSecOpenSSLKWDes3Finalize(xmlSecTransformPtr transform) {
xmlSecAssert(xmlSecTransformCheckSize(transform, xmlSecOpenSSLKWDes3Size));
if(xmlSecOpenSSLKWDes3GetKey(transform) != NULL) {
- xmlSecBufferFinalize(xmlSecOpenSSLKWDes3GetKey(transform));
+ xmlSecBufferFinalize(xmlSecOpenSSLKWDes3GetKey(transform));
}
}
@@ -153,18 +153,18 @@ xmlSecOpenSSLKWDes3SetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr keyR
xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLKWDes3Size), -1);
xmlSecAssert2(keyReq != NULL, -1);
- keyReq->keyId = xmlSecOpenSSLKeyDataDesId;
- keyReq->keyType = xmlSecKeyDataTypeSymmetric;
+ keyReq->keyId = xmlSecOpenSSLKeyDataDesId;
+ keyReq->keyType = xmlSecKeyDataTypeSymmetric;
if(transform->operation == xmlSecTransformOperationEncrypt) {
- keyReq->keyUsage= xmlSecKeyUsageEncrypt;
+ keyReq->keyUsage= xmlSecKeyUsageEncrypt;
} else {
- keyReq->keyUsage= xmlSecKeyUsageDecrypt;
+ keyReq->keyUsage= xmlSecKeyUsageDecrypt;
}
keyReq->keyBitsSize = 8 * XMLSEC_OPENSSL_DES3_KEY_LENGTH;
return(0);
}
-static int
+static int
xmlSecOpenSSLKWDes3SetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
xmlSecBufferPtr buffer;
xmlSecSize keySize;
@@ -182,25 +182,25 @@ xmlSecOpenSSLKWDes3SetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
keySize = xmlSecBufferGetSize(buffer);
if(keySize < XMLSEC_OPENSSL_DES3_KEY_LENGTH) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
- "key length %d is not enough (%d expected)",
- keySize, XMLSEC_OPENSSL_DES3_KEY_LENGTH);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_KEY_DATA_SIZE,
+ "key length %d is not enough (%d expected)",
+ keySize, XMLSEC_OPENSSL_DES3_KEY_LENGTH);
+ return(-1);
}
ret = xmlSecBufferSetData(xmlSecOpenSSLKWDes3GetKey(transform),
- xmlSecBufferGetData(buffer),
- XMLSEC_OPENSSL_DES3_KEY_LENGTH);
+ xmlSecBufferGetData(buffer),
+ XMLSEC_OPENSSL_DES3_KEY_LENGTH);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", XMLSEC_OPENSSL_DES3_KEY_LENGTH);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", XMLSEC_OPENSSL_DES3_KEY_LENGTH);
+ return(-1);
}
return(0);
@@ -230,102 +230,102 @@ xmlSecOpenSSLKWDes3Execute(xmlSecTransformPtr transform, int last, xmlSecTransfo
xmlSecAssert2(outSize == 0, -1);
if(transform->status == xmlSecTransformStatusNone) {
- transform->status = xmlSecTransformStatusWorking;
+ transform->status = xmlSecTransformStatusWorking;
}
if((transform->status == xmlSecTransformStatusWorking) && (last == 0)) {
- /* just do nothing */
+ /* just do nothing */
} else if((transform->status == xmlSecTransformStatusWorking) && (last != 0)) {
- if((inSize % XMLSEC_OPENSSL_DES3_BLOCK_LENGTH) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "%d bytes - not %d bytes aligned",
- inSize, XMLSEC_OPENSSL_DES3_BLOCK_LENGTH);
- return(-1);
- }
-
- if(transform->operation == xmlSecTransformOperationEncrypt) {
- /* the encoded key might be 16 bytes longer plus one block just in case */
- outSize = inSize + XMLSEC_OPENSSL_DES3_IV_LENGTH +
- XMLSEC_OPENSSL_DES3_BLOCK_LENGTH +
- XMLSEC_OPENSSL_DES3_BLOCK_LENGTH;
- } else {
- outSize = inSize + XMLSEC_OPENSSL_DES3_BLOCK_LENGTH;
- }
-
- ret = xmlSecBufferSetMaxSize(out, outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize);
- return(-1);
- }
-
- if(transform->operation == xmlSecTransformOperationEncrypt) {
- ret = xmlSecOpenSSLKWDes3Encode(xmlSecBufferGetData(key), keySize,
- xmlSecBufferGetData(in), inSize,
- xmlSecBufferGetData(out), outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecOpenSSLKWDes3Encode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "key=%d,in=%d,out=%d",
- keySize, inSize, outSize);
- return(-1);
- }
- outSize = ret;
- } else {
- ret = xmlSecOpenSSLKWDes3Decode(xmlSecBufferGetData(key), keySize,
- xmlSecBufferGetData(in), inSize,
- xmlSecBufferGetData(out), outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecOpenSSLKWDes3Decode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "key=%d,in=%d,out=%d",
- keySize, inSize, outSize);
- return(-1);
- }
- outSize = ret;
- }
-
- ret = xmlSecBufferSetSize(out, outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize);
- return(-1);
- }
-
- ret = xmlSecBufferRemoveHead(in, inSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
- }
-
- transform->status = xmlSecTransformStatusFinished;
+ if((inSize % XMLSEC_OPENSSL_DES3_BLOCK_LENGTH) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "%d bytes - not %d bytes aligned",
+ inSize, XMLSEC_OPENSSL_DES3_BLOCK_LENGTH);
+ return(-1);
+ }
+
+ if(transform->operation == xmlSecTransformOperationEncrypt) {
+ /* the encoded key might be 16 bytes longer plus one block just in case */
+ outSize = inSize + XMLSEC_OPENSSL_DES3_IV_LENGTH +
+ XMLSEC_OPENSSL_DES3_BLOCK_LENGTH +
+ XMLSEC_OPENSSL_DES3_BLOCK_LENGTH;
+ } else {
+ outSize = inSize + XMLSEC_OPENSSL_DES3_BLOCK_LENGTH;
+ }
+
+ ret = xmlSecBufferSetMaxSize(out, outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize);
+ return(-1);
+ }
+
+ if(transform->operation == xmlSecTransformOperationEncrypt) {
+ ret = xmlSecOpenSSLKWDes3Encode(xmlSecBufferGetData(key), keySize,
+ xmlSecBufferGetData(in), inSize,
+ xmlSecBufferGetData(out), outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecOpenSSLKWDes3Encode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "key=%d,in=%d,out=%d",
+ keySize, inSize, outSize);
+ return(-1);
+ }
+ outSize = ret;
+ } else {
+ ret = xmlSecOpenSSLKWDes3Decode(xmlSecBufferGetData(key), keySize,
+ xmlSecBufferGetData(in), inSize,
+ xmlSecBufferGetData(out), outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecOpenSSLKWDes3Decode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "key=%d,in=%d,out=%d",
+ keySize, inSize, outSize);
+ return(-1);
+ }
+ outSize = ret;
+ }
+
+ ret = xmlSecBufferSetSize(out, outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize);
+ return(-1);
+ }
+
+ ret = xmlSecBufferRemoveHead(in, inSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
+ }
+
+ transform->status = xmlSecTransformStatusFinished;
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
}
@@ -356,10 +356,10 @@ static xmlSecByte xmlSecOpenSSLKWDes3Iv[XMLSEC_OPENSSL_DES3_IV_LENGTH] = {
* It is 40 octets long if a 168 bit key is being wrapped.
*
*/
-static int
+static int
xmlSecOpenSSLKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
- const xmlSecByte *in, xmlSecSize inSize,
- xmlSecByte *out, xmlSecSize outSize) {
+ const xmlSecByte *in, xmlSecSize inSize,
+ xmlSecByte *out, xmlSecSize outSize) {
xmlSecByte sha1[SHA_DIGEST_LENGTH];
xmlSecByte iv[XMLSEC_OPENSSL_DES3_IV_LENGTH];
xmlSecSize s;
@@ -374,12 +374,12 @@ xmlSecOpenSSLKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
/* step 2: calculate sha1 and CMS */
if(SHA1(in, inSize, sha1) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "SHA1",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "SHA1",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* step 3: construct WKCKS */
@@ -389,56 +389,56 @@ xmlSecOpenSSLKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
/* step 4: generate random iv */
ret = RAND_bytes(iv, XMLSEC_OPENSSL_DES3_IV_LENGTH);
if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "RAND_bytes",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "ret=%d", ret);
- return(-1);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "RAND_bytes",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "ret=%d", ret);
+ return(-1);
+ }
/* step 5: first encryption, result is TEMP1 */
ret = xmlSecOpenSSLKWDes3Encrypt(key, keySize,
- iv, XMLSEC_OPENSSL_DES3_IV_LENGTH,
- out, inSize + XMLSEC_OPENSSL_DES3_BLOCK_LENGTH,
- out, outSize, 1);
+ iv, XMLSEC_OPENSSL_DES3_IV_LENGTH,
+ out, inSize + XMLSEC_OPENSSL_DES3_BLOCK_LENGTH,
+ out, outSize, 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLKWDes3Encrypt",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLKWDes3Encrypt",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* step 6: construct TEMP2=IV || TEMP1 */
memmove(out + XMLSEC_OPENSSL_DES3_IV_LENGTH, out,
- inSize + XMLSEC_OPENSSL_DES3_IV_LENGTH);
+ inSize + XMLSEC_OPENSSL_DES3_IV_LENGTH);
memcpy(out, iv, XMLSEC_OPENSSL_DES3_IV_LENGTH);
s = ret + XMLSEC_OPENSSL_DES3_IV_LENGTH;
/* step 7: reverse octets order, result is TEMP3 */
ret = xmlSecOpenSSLKWDes3BufferReverse(out, s);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLKWDes3BufferReverse",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLKWDes3BufferReverse",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* step 8: second encryption with static IV */
ret = xmlSecOpenSSLKWDes3Encrypt(key, keySize,
- xmlSecOpenSSLKWDes3Iv, XMLSEC_OPENSSL_DES3_IV_LENGTH,
- out, s, out, outSize, 1);
+ xmlSecOpenSSLKWDes3Iv, XMLSEC_OPENSSL_DES3_IV_LENGTH,
+ out, s, out, outSize, 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLKWDes3Encrypt",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLKWDes3Encrypt",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
s = ret;
return(s);
@@ -470,10 +470,10 @@ xmlSecOpenSSLKWDes3Encode(const xmlSecByte *key, xmlSecSize keySize,
* error.
* 8. WK is the wrapped key, now extracted for use in data decryption.
*/
-static int
+static int
xmlSecOpenSSLKWDes3Decode(const xmlSecByte *key, xmlSecSize keySize,
- const xmlSecByte *in, xmlSecSize inSize,
- xmlSecByte *out, xmlSecSize outSize) {
+ const xmlSecByte *in, xmlSecSize inSize,
+ xmlSecByte *out, xmlSecSize outSize) {
xmlSecByte sha1[SHA_DIGEST_LENGTH];
xmlSecSize s;
int ret;
@@ -487,62 +487,62 @@ xmlSecOpenSSLKWDes3Decode(const xmlSecByte *key, xmlSecSize keySize,
/* step 2: first decryption with static IV, result is TEMP3 */
ret = xmlSecOpenSSLKWDes3Encrypt(key, keySize,
- xmlSecOpenSSLKWDes3Iv, XMLSEC_OPENSSL_DES3_IV_LENGTH,
- in, inSize, out, outSize, 0);
+ xmlSecOpenSSLKWDes3Iv, XMLSEC_OPENSSL_DES3_IV_LENGTH,
+ in, inSize, out, outSize, 0);
if((ret < 0) || (ret < XMLSEC_OPENSSL_DES3_IV_LENGTH)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLKWDes3Encrypt",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLKWDes3Encrypt",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
s = ret;
/* step 3: reverse octets order in TEMP3, result is TEMP2 */
ret = xmlSecOpenSSLKWDes3BufferReverse(out, s);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLKWDes3BufferReverse",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLKWDes3BufferReverse",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* steps 4 and 5: get IV and decrypt second time, result is WKCKS */
ret = xmlSecOpenSSLKWDes3Encrypt(key, keySize,
- out, XMLSEC_OPENSSL_DES3_IV_LENGTH,
- out + XMLSEC_OPENSSL_DES3_IV_LENGTH,
- s - XMLSEC_OPENSSL_DES3_IV_LENGTH,
- out, outSize, 0);
+ out, XMLSEC_OPENSSL_DES3_IV_LENGTH,
+ out + XMLSEC_OPENSSL_DES3_IV_LENGTH,
+ s - XMLSEC_OPENSSL_DES3_IV_LENGTH,
+ out, outSize, 0);
if((ret < 0) || (ret < XMLSEC_OPENSSL_DES3_BLOCK_LENGTH)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLKWDes3Encrypt",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLKWDes3Encrypt",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
s = ret - XMLSEC_OPENSSL_DES3_BLOCK_LENGTH;
/* steps 6 and 7: calculate SHA1 and validate it */
if(SHA1(out, s, sha1) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "SHA1",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "SHA1",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if(memcmp(sha1, out + s, XMLSEC_OPENSSL_DES3_BLOCK_LENGTH) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "SHA1 does not match");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "SHA1 does not match");
+ return(-1);
}
return(s);
@@ -550,9 +550,9 @@ xmlSecOpenSSLKWDes3Decode(const xmlSecByte *key, xmlSecSize keySize,
static int
xmlSecOpenSSLKWDes3Encrypt(const xmlSecByte *key, xmlSecSize keySize,
- const xmlSecByte *iv, xmlSecSize ivSize,
- const xmlSecByte *in, xmlSecSize inSize,
- xmlSecByte *out, xmlSecSize outSize, int enc) {
+ const xmlSecByte *iv, xmlSecSize ivSize,
+ const xmlSecByte *in, xmlSecSize inSize,
+ xmlSecByte *out, xmlSecSize outSize, int enc) {
EVP_CIPHER_CTX cipherCtx;
int updateLen;
int finalLen;
@@ -570,41 +570,41 @@ xmlSecOpenSSLKWDes3Encrypt(const xmlSecByte *key, xmlSecSize keySize,
EVP_CIPHER_CTX_init(&cipherCtx);
ret = EVP_CipherInit(&cipherCtx, EVP_des_ede3_cbc(), key, iv, enc);
if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "EVP_CipherInit",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "EVP_CipherInit",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
#ifndef XMLSEC_OPENSSL_096
EVP_CIPHER_CTX_set_padding(&cipherCtx, 0);
-#endif /* XMLSEC_OPENSSL_096 */
+#endif /* XMLSEC_OPENSSL_096 */
ret = EVP_CipherUpdate(&cipherCtx, out, &updateLen, in, inSize);
if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "EVP_CipherUpdate",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "EVP_CipherUpdate",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = EVP_CipherFinal(&cipherCtx, out + updateLen, &finalLen);
if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "EVP_CipherFinal",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "EVP_CipherFinal",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
EVP_CIPHER_CTX_cleanup(&cipherCtx);
return(updateLen + finalLen);
-}
+}
static int
xmlSecOpenSSLKWDes3BufferReverse(xmlSecByte *buf, xmlSecSize size) {
@@ -617,9 +617,9 @@ xmlSecOpenSSLKWDes3BufferReverse(xmlSecByte *buf, xmlSecSize size) {
s = size / 2;
--size;
for(i = 0; i < s; ++i) {
- c = buf[i];
- buf[i] = buf[size - i];
- buf[size - i] = c;
+ c = buf[i];
+ buf[i] = buf[size - i];
+ buf[size - i] = c;
}
return(0);
}
diff --git a/src/openssl/signatures.c b/src/openssl/signatures.c
index 6879658..b6e3737 100644
--- a/src/openssl/signatures.c
+++ b/src/openssl/signatures.c
@@ -23,8 +23,8 @@
#include <xmlsec/openssl/evp.h>
#ifndef XMLSEC_NO_DSA
-#define XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE 40
-static const EVP_MD *xmlSecOpenSSLDsaSha1Evp (void);
+#define XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE 40
+static const EVP_MD *xmlSecOpenSSLDsaSha1Evp (void);
#endif /* XMLSEC_NO_DSA */
@@ -33,14 +33,14 @@ static const EVP_MD *xmlSecOpenSSLDsaSha1Evp (void);
* Internal OpenSSL evp signatures ctx
*
*****************************************************************************/
-typedef struct _xmlSecOpenSSLEvpSignatureCtx xmlSecOpenSSLEvpSignatureCtx,
- *xmlSecOpenSSLEvpSignatureCtxPtr;
+typedef struct _xmlSecOpenSSLEvpSignatureCtx xmlSecOpenSSLEvpSignatureCtx,
+ *xmlSecOpenSSLEvpSignatureCtxPtr;
struct _xmlSecOpenSSLEvpSignatureCtx {
- const EVP_MD* digest;
- EVP_MD_CTX digestCtx;
- xmlSecKeyDataId keyId;
- EVP_PKEY* pKey;
-};
+ const EVP_MD* digest;
+ EVP_MD_CTX digestCtx;
+ xmlSecKeyDataId keyId;
+ EVP_PKEY* pKey;
+};
/******************************************************************************
*
@@ -49,25 +49,25 @@ struct _xmlSecOpenSSLEvpSignatureCtx {
* xmlSecOpenSSLEvpSignatureCtx is located after xmlSecTransform
*
*****************************************************************************/
-#define xmlSecOpenSSLEvpSignatureSize \
+#define xmlSecOpenSSLEvpSignatureSize \
(sizeof(xmlSecTransform) + sizeof(xmlSecOpenSSLEvpSignatureCtx))
#define xmlSecOpenSSLEvpSignatureGetCtx(transform) \
((xmlSecOpenSSLEvpSignatureCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-static int xmlSecOpenSSLEvpSignatureCheckId (xmlSecTransformPtr transform);
-static int xmlSecOpenSSLEvpSignatureInitialize (xmlSecTransformPtr transform);
-static void xmlSecOpenSSLEvpSignatureFinalize (xmlSecTransformPtr transform);
-static int xmlSecOpenSSLEvpSignatureSetKeyReq (xmlSecTransformPtr transform,
- xmlSecKeyReqPtr keyReq);
-static int xmlSecOpenSSLEvpSignatureSetKey (xmlSecTransformPtr transform,
- xmlSecKeyPtr key);
-static int xmlSecOpenSSLEvpSignatureVerify (xmlSecTransformPtr transform,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecOpenSSLEvpSignatureExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecOpenSSLEvpSignatureCheckId (xmlSecTransformPtr transform);
+static int xmlSecOpenSSLEvpSignatureInitialize (xmlSecTransformPtr transform);
+static void xmlSecOpenSSLEvpSignatureFinalize (xmlSecTransformPtr transform);
+static int xmlSecOpenSSLEvpSignatureSetKeyReq (xmlSecTransformPtr transform,
+ xmlSecKeyReqPtr keyReq);
+static int xmlSecOpenSSLEvpSignatureSetKey (xmlSecTransformPtr transform,
+ xmlSecKeyPtr key);
+static int xmlSecOpenSSLEvpSignatureVerify (xmlSecTransformPtr transform,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecOpenSSLEvpSignatureExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
static int
xmlSecOpenSSLEvpSignatureCheckId(xmlSecTransformPtr transform) {
@@ -75,7 +75,7 @@ xmlSecOpenSSLEvpSignatureCheckId(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_SHA1
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformDsaSha1Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_SHA1 */
@@ -85,50 +85,50 @@ xmlSecOpenSSLEvpSignatureCheckId(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_MD5
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaMd5Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_MD5 */
#ifndef XMLSEC_NO_RIPEMD160
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaRipemd160Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_RIPEMD160 */
#ifndef XMLSEC_NO_SHA1
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaSha1Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_SHA1 */
#ifndef XMLSEC_NO_SHA224
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaSha224Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_SHA224 */
#ifndef XMLSEC_NO_SHA256
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaSha256Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_SHA256 */
#ifndef XMLSEC_NO_SHA384
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaSha384Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_SHA384 */
#ifndef XMLSEC_NO_SHA512
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaSha512Id)) {
- return(1);
+ return(1);
} else
#endif /* XMLSEC_NO_SHA512 */
#endif /* XMLSEC_NO_RSA */
{
- return(0);
+ return(0);
}
return(0);
@@ -150,8 +150,8 @@ xmlSecOpenSSLEvpSignatureInitialize(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_SHA1
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformDsaSha1Id)) {
- ctx->digest = xmlSecOpenSSLDsaSha1Evp();
- ctx->keyId = xmlSecOpenSSLKeyDataDsaId;
+ ctx->digest = xmlSecOpenSSLDsaSha1Evp();
+ ctx->keyId = xmlSecOpenSSLKeyDataDsaId;
} else
#endif /* XMLSEC_NO_SHA1 */
@@ -161,62 +161,62 @@ xmlSecOpenSSLEvpSignatureInitialize(xmlSecTransformPtr transform) {
#ifndef XMLSEC_NO_MD5
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaMd5Id)) {
- ctx->digest = EVP_md5();
- ctx->keyId = xmlSecOpenSSLKeyDataRsaId;
+ ctx->digest = EVP_md5();
+ ctx->keyId = xmlSecOpenSSLKeyDataRsaId;
} else
#endif /* XMLSEC_NO_MD5 */
#ifndef XMLSEC_NO_RIPEMD160
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaRipemd160Id)) {
- ctx->digest = EVP_ripemd160();
- ctx->keyId = xmlSecOpenSSLKeyDataRsaId;
+ ctx->digest = EVP_ripemd160();
+ ctx->keyId = xmlSecOpenSSLKeyDataRsaId;
} else
#endif /* XMLSEC_NO_RIPEMD160 */
#ifndef XMLSEC_NO_SHA1
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaSha1Id)) {
- ctx->digest = EVP_sha1();
- ctx->keyId = xmlSecOpenSSLKeyDataRsaId;
+ ctx->digest = EVP_sha1();
+ ctx->keyId = xmlSecOpenSSLKeyDataRsaId;
} else
#endif /* XMLSEC_NO_SHA1 */
#ifndef XMLSEC_NO_SHA224
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaSha224Id)) {
- ctx->digest = EVP_sha224();
- ctx->keyId = xmlSecOpenSSLKeyDataRsaId;
+ ctx->digest = EVP_sha224();
+ ctx->keyId = xmlSecOpenSSLKeyDataRsaId;
} else
#endif /* XMLSEC_NO_SHA224 */
#ifndef XMLSEC_NO_SHA256
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaSha256Id)) {
- ctx->digest = EVP_sha256();
- ctx->keyId = xmlSecOpenSSLKeyDataRsaId;
+ ctx->digest = EVP_sha256();
+ ctx->keyId = xmlSecOpenSSLKeyDataRsaId;
} else
#endif /* XMLSEC_NO_SHA256 */
#ifndef XMLSEC_NO_SHA384
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaSha384Id)) {
- ctx->digest = EVP_sha384();
- ctx->keyId = xmlSecOpenSSLKeyDataRsaId;
+ ctx->digest = EVP_sha384();
+ ctx->keyId = xmlSecOpenSSLKeyDataRsaId;
} else
#endif /* XMLSEC_NO_SHA384 */
#ifndef XMLSEC_NO_SHA512
if(xmlSecTransformCheckId(transform, xmlSecOpenSSLTransformRsaSha512Id)) {
- ctx->digest = EVP_sha512();
- ctx->keyId = xmlSecOpenSSLKeyDataRsaId;
+ ctx->digest = EVP_sha512();
+ ctx->keyId = xmlSecOpenSSLKeyDataRsaId;
} else
#endif /* XMLSEC_NO_SHA512 */
#endif /* XMLSEC_NO_RSA */
if(1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
#ifndef XMLSEC_OPENSSL_096
@@ -236,7 +236,7 @@ xmlSecOpenSSLEvpSignatureFinalize(xmlSecTransformPtr transform) {
xmlSecAssert(ctx != NULL);
if(ctx->pKey != NULL) {
- EVP_PKEY_free(ctx->pKey);
+ EVP_PKEY_free(ctx->pKey);
}
#ifndef XMLSEC_OPENSSL_096
@@ -267,26 +267,26 @@ xmlSecOpenSSLEvpSignatureSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key)
pKey = xmlSecOpenSSLEvpKeyDataGetEvp(value);
if(pKey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecOpenSSLEvpKeyDataGetEvp",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecOpenSSLEvpKeyDataGetEvp",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if(ctx->pKey != NULL) {
- EVP_PKEY_free(ctx->pKey);
+ EVP_PKEY_free(ctx->pKey);
}
ctx->pKey = xmlSecOpenSSLEvpKeyDup(pKey);
if(ctx->pKey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecOpenSSLEvpKeyDup",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecOpenSSLEvpKeyDup",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -308,10 +308,10 @@ xmlSecOpenSSLEvpSignatureSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPt
keyReq->keyId = ctx->keyId;
if(transform->operation == xmlSecTransformOperationSign) {
keyReq->keyType = xmlSecKeyDataTypePrivate;
- keyReq->keyUsage = xmlSecKeyUsageSign;
+ keyReq->keyUsage = xmlSecKeyUsageSign;
} else {
keyReq->keyType = xmlSecKeyDataTypePublic;
- keyReq->keyUsage = xmlSecKeyUsageVerify;
+ keyReq->keyUsage = xmlSecKeyUsageVerify;
}
return(0);
}
@@ -319,8 +319,8 @@ xmlSecOpenSSLEvpSignatureSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPt
static int
xmlSecOpenSSLEvpSignatureVerify(xmlSecTransformPtr transform,
- const xmlSecByte* data, xmlSecSize dataSize,
- xmlSecTransformCtxPtr transformCtx) {
+ const xmlSecByte* data, xmlSecSize dataSize,
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecOpenSSLEvpSignatureCtxPtr ctx;
int ret;
@@ -336,20 +336,20 @@ xmlSecOpenSSLEvpSignatureVerify(xmlSecTransformPtr transform,
ret = EVP_VerifyFinal(&(ctx->digestCtx), (xmlSecByte*)data, dataSize, ctx->pKey);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "EVP_VerifyFinal",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "EVP_VerifyFinal",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
} else if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "EVP_VerifyFinal",
- XMLSEC_ERRORS_R_DATA_NOT_MATCH,
- "signature do not match");
- transform->status = xmlSecTransformStatusFail;
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "EVP_VerifyFinal",
+ XMLSEC_ERRORS_R_DATA_NOT_MATCH,
+ "signature do not match");
+ transform->status = xmlSecTransformStatusFail;
+ return(0);
}
transform->status = xmlSecTransformStatusOk;
@@ -382,140 +382,140 @@ xmlSecOpenSSLEvpSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecT
xmlSecAssert2(ctx->pKey != NULL, -1);
if(transform->status == xmlSecTransformStatusNone) {
- xmlSecAssert2(outSize == 0, -1);
-
- if(transform->operation == xmlSecTransformOperationSign) {
+ xmlSecAssert2(outSize == 0, -1);
+
+ if(transform->operation == xmlSecTransformOperationSign) {
#ifndef XMLSEC_OPENSSL_096
- ret = EVP_SignInit(&(ctx->digestCtx), ctx->digest);
- if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "EVP_SignInit",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ret = EVP_SignInit(&(ctx->digestCtx), ctx->digest);
+ if(ret != 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "EVP_SignInit",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
#else /* XMLSEC_OPENSSL_096 */
- EVP_SignInit(&(ctx->digestCtx), ctx->digest);
+ EVP_SignInit(&(ctx->digestCtx), ctx->digest);
#endif /* XMLSEC_OPENSSL_096 */
- } else {
+ } else {
#ifndef XMLSEC_OPENSSL_096
- ret = EVP_VerifyInit(&(ctx->digestCtx), ctx->digest);
- if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "EVP_VerifyInit",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ret = EVP_VerifyInit(&(ctx->digestCtx), ctx->digest);
+ if(ret != 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "EVP_VerifyInit",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
#else /* XMLSEC_OPENSSL_096 */
- EVP_VerifyInit(&(ctx->digestCtx), ctx->digest);
+ EVP_VerifyInit(&(ctx->digestCtx), ctx->digest);
#endif /* XMLSEC_OPENSSL_096 */
- }
- transform->status = xmlSecTransformStatusWorking;
+ }
+ transform->status = xmlSecTransformStatusWorking;
}
if((transform->status == xmlSecTransformStatusWorking) && (inSize > 0)) {
- xmlSecAssert2(outSize == 0, -1);
+ xmlSecAssert2(outSize == 0, -1);
- if(transform->operation == xmlSecTransformOperationSign) {
+ if(transform->operation == xmlSecTransformOperationSign) {
#ifndef XMLSEC_OPENSSL_096
- ret = EVP_SignUpdate(&(ctx->digestCtx), xmlSecBufferGetData(in), inSize);
- if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "EVP_SignUpdate",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ret = EVP_SignUpdate(&(ctx->digestCtx), xmlSecBufferGetData(in), inSize);
+ if(ret != 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "EVP_SignUpdate",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
#else /* XMLSEC_OPENSSL_096 */
- EVP_SignUpdate(&(ctx->digestCtx), xmlSecBufferGetData(in), inSize);
+ EVP_SignUpdate(&(ctx->digestCtx), xmlSecBufferGetData(in), inSize);
#endif /* XMLSEC_OPENSSL_096 */
- } else {
+ } else {
#ifndef XMLSEC_OPENSSL_096
- ret = EVP_VerifyUpdate(&(ctx->digestCtx), xmlSecBufferGetData(in), inSize);
- if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "EVP_VerifyUpdate",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ret = EVP_VerifyUpdate(&(ctx->digestCtx), xmlSecBufferGetData(in), inSize);
+ if(ret != 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "EVP_VerifyUpdate",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
#else /* XMLSEC_OPENSSL_096 */
- EVP_VerifyUpdate(&(ctx->digestCtx), xmlSecBufferGetData(in), inSize);
+ EVP_VerifyUpdate(&(ctx->digestCtx), xmlSecBufferGetData(in), inSize);
#endif /* XMLSEC_OPENSSL_096 */
- }
-
- ret = xmlSecBufferRemoveHead(in, inSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ }
+
+ ret = xmlSecBufferRemoveHead(in, inSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
if((transform->status == xmlSecTransformStatusWorking) && (last != 0)) {
- xmlSecAssert2(outSize == 0, -1);
- if(transform->operation == xmlSecTransformOperationSign) {
- /* this is a hack: for rsa signatures
- * we get size from EVP_PKEY_size(),
- * for dsa signature we use a fixed constant */
- outSize = EVP_PKEY_size(ctx->pKey);
+ xmlSecAssert2(outSize == 0, -1);
+ if(transform->operation == xmlSecTransformOperationSign) {
+ /* this is a hack: for rsa signatures
+ * we get size from EVP_PKEY_size(),
+ * for dsa signature we use a fixed constant */
+ outSize = EVP_PKEY_size(ctx->pKey);
#ifndef XMLSEC_NO_DSA
- if(outSize < XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE) {
- outSize = XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE;
- }
+ if(outSize < XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE) {
+ outSize = XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE;
+ }
#endif /* XMLSEC_NO_DSA */
- ret = xmlSecBufferSetMaxSize(out, outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize);
- return(-1);
- }
-
- ret = EVP_SignFinal(&(ctx->digestCtx), xmlSecBufferGetData(out), &outSize, ctx->pKey);
- if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "EVP_SignFinal",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- ret = xmlSecBufferSetSize(out, outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize);
- return(-1);
- }
- }
- transform->status = xmlSecTransformStatusFinished;
+ ret = xmlSecBufferSetMaxSize(out, outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize);
+ return(-1);
+ }
+
+ ret = EVP_SignFinal(&(ctx->digestCtx), xmlSecBufferGetData(out), &outSize, ctx->pKey);
+ if(ret != 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "EVP_SignFinal",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ ret = xmlSecBufferSetSize(out, outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize);
+ return(-1);
+ }
+ }
+ transform->status = xmlSecTransformStatusFinished;
}
if((transform->status == xmlSecTransformStatusWorking) || (transform->status == xmlSecTransformStatusFinished)) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(xmlSecBufferGetSize(&(transform->inBuf)) == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
@@ -532,29 +532,29 @@ xmlSecOpenSSLEvpSignatureExecute(xmlSecTransformPtr transform, int last, xmlSecT
static xmlSecTransformKlass xmlSecOpenSSLDsaSha1Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLEvpSignatureSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLEvpSignatureSize, /* xmlSecSize objSize */
- xmlSecNameDsaSha1, /* const xmlChar* name; */
- xmlSecHrefDsaSha1, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameDsaSha1, /* const xmlChar* name; */
+ xmlSecHrefDsaSha1, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecOpenSSLEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecOpenSSLEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -615,17 +615,17 @@ xmlSecOpenSSLDsaSha1EvpFinal(EVP_MD_CTX *ctx, unsigned char *md)
}
#endif /* XMLSEC_OPENSSL_096 */
-static int
+static int
xmlSecOpenSSLDsaSha1EvpSign(int type ATTRIBUTE_UNUSED,
- const unsigned char *dgst, unsigned int dlen,
- unsigned char *sig, unsigned int *siglen, void *dsa) {
+ const unsigned char *dgst, unsigned int dlen,
+ unsigned char *sig, unsigned int *siglen, void *dsa) {
DSA_SIG *s;
int rSize, sSize;
s = DSA_do_sign(dgst, dlen, dsa);
if(s == NULL) {
- *siglen=0;
- return(0);
+ *siglen=0;
+ return(0);
}
rSize = BN_num_bytes(s->r);
@@ -633,15 +633,15 @@ xmlSecOpenSSLDsaSha1EvpSign(int type ATTRIBUTE_UNUSED,
if((rSize > (XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE / 2)) ||
(sSize > (XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE / 2))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "size(r)=%d or size(s)=%d > %d",
- rSize, sSize, XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE / 2);
- DSA_SIG_free(s);
- return(0);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "size(r)=%d or size(s)=%d > %d",
+ rSize, sSize, XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE / 2);
+ DSA_SIG_free(s);
+ return(0);
+ }
memset(sig, 0, XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE);
BN_bn2bin(s->r, sig + (XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE / 2) - rSize);
@@ -654,37 +654,37 @@ xmlSecOpenSSLDsaSha1EvpSign(int type ATTRIBUTE_UNUSED,
static int
xmlSecOpenSSLDsaSha1EvpVerify(int type ATTRIBUTE_UNUSED,
- const unsigned char *dgst, unsigned int dgst_len,
- const unsigned char *sigbuf, unsigned int siglen,
- void *dsa) {
+ const unsigned char *dgst, unsigned int dgst_len,
+ const unsigned char *sigbuf, unsigned int siglen,
+ void *dsa) {
DSA_SIG *s;
int ret = -1;
s = DSA_SIG_new();
if (s == NULL) {
- return(ret);
+ return(ret);
}
if(siglen != XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "invalid length %d (%d expected)",
- siglen, XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE);
- goto err;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "invalid length %d (%d expected)",
+ siglen, XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE);
+ goto err;
}
s->r = BN_bin2bn(sigbuf, XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE / 2, NULL);
s->s = BN_bin2bn(sigbuf + (XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE / 2),
- XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE / 2, NULL);
+ XMLSEC_OPENSSL_DSA_SIGNATURE_SIZE / 2, NULL);
if((s->r == NULL) || (s->s == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BN_bin2bn",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto err;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BN_bin2bn",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto err;
}
ret = DSA_do_verify(dgst, dgst_len, s, dsa);
@@ -735,29 +735,29 @@ static const EVP_MD *xmlSecOpenSSLDsaSha1Evp(void)
***************************************************************************/
static xmlSecTransformKlass xmlSecOpenSSLRsaMd5Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLEvpSignatureSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLEvpSignatureSize, /* xmlSecSize objSize */
- xmlSecNameRsaMd5, /* const xmlChar* name; */
- xmlSecHrefRsaMd5, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameRsaMd5, /* const xmlChar* name; */
+ xmlSecHrefRsaMd5, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecOpenSSLEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecOpenSSLEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -782,29 +782,29 @@ xmlSecOpenSSLTransformRsaMd5GetKlass(void) {
***************************************************************************/
static xmlSecTransformKlass xmlSecOpenSSLRsaRipemd160Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLEvpSignatureSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLEvpSignatureSize, /* xmlSecSize objSize */
- xmlSecNameRsaRipemd160, /* const xmlChar* name; */
- xmlSecHrefRsaRipemd160, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameRsaRipemd160, /* const xmlChar* name; */
+ xmlSecHrefRsaRipemd160, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecOpenSSLEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecOpenSSLEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -829,29 +829,29 @@ xmlSecOpenSSLTransformRsaRipemd160GetKlass(void) {
***************************************************************************/
static xmlSecTransformKlass xmlSecOpenSSLRsaSha1Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLEvpSignatureSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLEvpSignatureSize, /* xmlSecSize objSize */
- xmlSecNameRsaSha1, /* const xmlChar* name; */
- xmlSecHrefRsaSha1, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameRsaSha1, /* const xmlChar* name; */
+ xmlSecHrefRsaSha1, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecOpenSSLEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecOpenSSLEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -876,29 +876,29 @@ xmlSecOpenSSLTransformRsaSha1GetKlass(void) {
***************************************************************************/
static xmlSecTransformKlass xmlSecOpenSSLRsaSha224Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLEvpSignatureSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLEvpSignatureSize, /* xmlSecSize objSize */
- xmlSecNameRsaSha224, /* const xmlChar* name; */
- xmlSecHrefRsaSha224, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameRsaSha224, /* const xmlChar* name; */
+ xmlSecHrefRsaSha224, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecOpenSSLEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecOpenSSLEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -923,29 +923,29 @@ xmlSecOpenSSLTransformRsaSha224GetKlass(void) {
***************************************************************************/
static xmlSecTransformKlass xmlSecOpenSSLRsaSha256Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLEvpSignatureSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLEvpSignatureSize, /* xmlSecSize objSize */
- xmlSecNameRsaSha256, /* const xmlChar* name; */
- xmlSecHrefRsaSha256, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameRsaSha256, /* const xmlChar* name; */
+ xmlSecHrefRsaSha256, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecOpenSSLEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecOpenSSLEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -970,29 +970,29 @@ xmlSecOpenSSLTransformRsaSha256GetKlass(void) {
***************************************************************************/
static xmlSecTransformKlass xmlSecOpenSSLRsaSha384Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLEvpSignatureSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLEvpSignatureSize, /* xmlSecSize objSize */
- xmlSecNameRsaSha384, /* const xmlChar* name; */
- xmlSecHrefRsaSha384, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameRsaSha384, /* const xmlChar* name; */
+ xmlSecHrefRsaSha384, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecOpenSSLEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecOpenSSLEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -1017,29 +1017,29 @@ xmlSecOpenSSLTransformRsaSha384GetKlass(void) {
***************************************************************************/
static xmlSecTransformKlass xmlSecOpenSSLRsaSha512Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecOpenSSLEvpSignatureSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecOpenSSLEvpSignatureSize, /* xmlSecSize objSize */
- xmlSecNameRsaSha512, /* const xmlChar* name; */
- xmlSecHrefRsaSha512, /* const xmlChar* href; */
- xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
+ xmlSecNameRsaSha512, /* const xmlChar* name; */
+ xmlSecHrefRsaSha512, /* const xmlChar* href; */
+ xmlSecTransformUsageSignatureMethod, /* xmlSecTransformUsage usage; */
- xmlSecOpenSSLEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecOpenSSLEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- xmlSecOpenSSLEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- xmlSecOpenSSLEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
- xmlSecOpenSSLEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecOpenSSLEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
+ xmlSecOpenSSLEvpSignatureInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecOpenSSLEvpSignatureFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ xmlSecOpenSSLEvpSignatureSetKeyReq, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ xmlSecOpenSSLEvpSignatureSetKey, /* xmlSecTransformSetKeyMethod setKey; */
+ xmlSecOpenSSLEvpSignatureVerify, /* xmlSecTransformVerifyMethod verify; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecOpenSSLEvpSignatureExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
diff --git a/src/openssl/symkeys.c b/src/openssl/symkeys.c
index fdcf287..52b417b 100644
--- a/src/openssl/symkeys.c
+++ b/src/openssl/symkeys.c
@@ -31,39 +31,39 @@
* Symmetic (binary) keys - just a wrapper for xmlSecKeyDataBinary
*
****************************************************************************/
-static int xmlSecOpenSSLSymKeyDataInitialize (xmlSecKeyDataPtr data);
-static int xmlSecOpenSSLSymKeyDataDuplicate (xmlSecKeyDataPtr dst,
- xmlSecKeyDataPtr src);
-static void xmlSecOpenSSLSymKeyDataFinalize (xmlSecKeyDataPtr data);
-static int xmlSecOpenSSLSymKeyDataXmlRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecOpenSSLSymKeyDataXmlWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecOpenSSLSymKeyDataBinRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- const xmlSecByte* buf,
- xmlSecSize bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecOpenSSLSymKeyDataBinWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlSecByte** buf,
- xmlSecSize* bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecOpenSSLSymKeyDataGenerate (xmlSecKeyDataPtr data,
- xmlSecSize sizeBits,
- xmlSecKeyDataType type);
-
-static xmlSecKeyDataType xmlSecOpenSSLSymKeyDataGetType (xmlSecKeyDataPtr data);
-static xmlSecSize xmlSecOpenSSLSymKeyDataGetSize (xmlSecKeyDataPtr data);
-static void xmlSecOpenSSLSymKeyDataDebugDump (xmlSecKeyDataPtr data,
- FILE* output);
-static void xmlSecOpenSSLSymKeyDataDebugXmlDump (xmlSecKeyDataPtr data,
- FILE* output);
-static int xmlSecOpenSSLSymKeyDataKlassCheck (xmlSecKeyDataKlass* klass);
+static int xmlSecOpenSSLSymKeyDataInitialize (xmlSecKeyDataPtr data);
+static int xmlSecOpenSSLSymKeyDataDuplicate (xmlSecKeyDataPtr dst,
+ xmlSecKeyDataPtr src);
+static void xmlSecOpenSSLSymKeyDataFinalize (xmlSecKeyDataPtr data);
+static int xmlSecOpenSSLSymKeyDataXmlRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLSymKeyDataXmlWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLSymKeyDataBinRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ const xmlSecByte* buf,
+ xmlSecSize bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLSymKeyDataBinWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlSecByte** buf,
+ xmlSecSize* bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLSymKeyDataGenerate (xmlSecKeyDataPtr data,
+ xmlSecSize sizeBits,
+ xmlSecKeyDataType type);
+
+static xmlSecKeyDataType xmlSecOpenSSLSymKeyDataGetType (xmlSecKeyDataPtr data);
+static xmlSecSize xmlSecOpenSSLSymKeyDataGetSize (xmlSecKeyDataPtr data);
+static void xmlSecOpenSSLSymKeyDataDebugDump (xmlSecKeyDataPtr data,
+ FILE* output);
+static void xmlSecOpenSSLSymKeyDataDebugXmlDump (xmlSecKeyDataPtr data,
+ FILE* output);
+static int xmlSecOpenSSLSymKeyDataKlassCheck (xmlSecKeyDataKlass* klass);
#define xmlSecOpenSSLSymKeyDataCheckId(data) \
(xmlSecKeyDataIsValid((data)) && \
@@ -94,7 +94,7 @@ xmlSecOpenSSLSymKeyDataFinalize(xmlSecKeyDataPtr data) {
static int
xmlSecOpenSSLSymKeyDataXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecAssert2(xmlSecOpenSSLSymKeyDataKlassCheck(id), -1);
return(xmlSecKeyDataBinaryValueXmlRead(id, key, node, keyInfoCtx));
@@ -102,7 +102,7 @@ xmlSecOpenSSLSymKeyDataXmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
static int
xmlSecOpenSSLSymKeyDataXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecAssert2(xmlSecOpenSSLSymKeyDataKlassCheck(id), -1);
return(xmlSecKeyDataBinaryValueXmlWrite(id, key, node, keyInfoCtx));
@@ -110,8 +110,8 @@ xmlSecOpenSSLSymKeyDataXmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
static int
xmlSecOpenSSLSymKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- const xmlSecByte* buf, xmlSecSize bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ const xmlSecByte* buf, xmlSecSize bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecAssert2(xmlSecOpenSSLSymKeyDataKlassCheck(id), -1);
return(xmlSecKeyDataBinaryValueBinRead(id, key, buf, bufSize, keyInfoCtx));
@@ -119,8 +119,8 @@ xmlSecOpenSSLSymKeyDataBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
static int
xmlSecOpenSSLSymKeyDataBinWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlSecByte** buf, xmlSecSize* bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlSecByte** buf, xmlSecSize* bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecAssert2(xmlSecOpenSSLSymKeyDataKlassCheck(id), -1);
return(xmlSecKeyDataBinaryValueBinWrite(id, key, buf, bufSize, keyInfoCtx));
@@ -176,21 +176,21 @@ static int
xmlSecOpenSSLSymKeyDataKlassCheck(xmlSecKeyDataKlass* klass) {
#ifndef XMLSEC_NO_DES
if(klass == xmlSecOpenSSLKeyDataDesId) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_DES */
#ifndef XMLSEC_NO_AES
#ifndef XMLSEC_OPENSSL_096
if(klass == xmlSecOpenSSLKeyDataAesId) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_OPENSSL_096 */
#endif /* XMLSEC_NO_AES */
#ifndef XMLSEC_NO_HMAC
if(klass == xmlSecOpenSSLKeyDataHmacId) {
- return(1);
+ return(1);
}
#endif /* XMLSEC_NO_HMAC */
@@ -211,35 +211,35 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataAesKlass = {
/* data */
xmlSecNameAESKeyValue,
xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefAESKeyValue, /* const xmlChar* href; */
- xmlSecNodeAESKeyValue, /* const xmlChar* dataNodeName; */
- xmlSecNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefAESKeyValue, /* const xmlChar* href; */
+ xmlSecNodeAESKeyValue, /* const xmlChar* dataNodeName; */
+ xmlSecNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecOpenSSLSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecOpenSSLSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecOpenSSLSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- xmlSecOpenSSLSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecOpenSSLSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecOpenSSLSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecOpenSSLSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ xmlSecOpenSSLSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecOpenSSLSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
- xmlSecOpenSSLSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecOpenSSLSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ xmlSecOpenSSLSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecOpenSSLSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecOpenSSLSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- xmlSecOpenSSLSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
- xmlSecOpenSSLSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecOpenSSLSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecOpenSSLSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ xmlSecOpenSSLSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
+ xmlSecOpenSSLSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecOpenSSLSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- xmlSecOpenSSLSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ xmlSecOpenSSLSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecOpenSSLSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -256,9 +256,9 @@ xmlSecOpenSSLKeyDataAesGetKlass(void) {
/**
* xmlSecOpenSSLKeyDataAesSet:
- * @data: the pointer to AES key data.
- * @buf: the pointer to key value.
- * @bufSize: the key value size (in bytes).
+ * @data: the pointer to AES key data.
+ * @buf: the pointer to key value.
+ * @bufSize: the key value size (in bytes).
*
* Sets the value of AES key data.
*
@@ -294,35 +294,35 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataDesKlass = {
/* data */
xmlSecNameDESKeyValue,
xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefDESKeyValue, /* const xmlChar* href; */
- xmlSecNodeDESKeyValue, /* const xmlChar* dataNodeName; */
- xmlSecNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefDESKeyValue, /* const xmlChar* href; */
+ xmlSecNodeDESKeyValue, /* const xmlChar* dataNodeName; */
+ xmlSecNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecOpenSSLSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecOpenSSLSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecOpenSSLSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- xmlSecOpenSSLSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecOpenSSLSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecOpenSSLSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecOpenSSLSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ xmlSecOpenSSLSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecOpenSSLSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
- xmlSecOpenSSLSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecOpenSSLSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ xmlSecOpenSSLSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecOpenSSLSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecOpenSSLSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- xmlSecOpenSSLSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
- xmlSecOpenSSLSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecOpenSSLSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecOpenSSLSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ xmlSecOpenSSLSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
+ xmlSecOpenSSLSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecOpenSSLSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- xmlSecOpenSSLSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ xmlSecOpenSSLSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecOpenSSLSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -339,9 +339,9 @@ xmlSecOpenSSLKeyDataDesGetKlass(void) {
/**
* xmlSecOpenSSLKeyDataDesSet:
- * @data: the pointer to DES key data.
- * @buf: the pointer to key value.
- * @bufSize: the key value size (in bytes).
+ * @data: the pointer to DES key data.
+ * @buf: the pointer to key value.
+ * @bufSize: the key value size (in bytes).
*
* Sets the value of DES key data.
*
@@ -376,35 +376,35 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataHmacKlass = {
/* data */
xmlSecNameHMACKeyValue,
xmlSecKeyDataUsageKeyValueNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefHMACKeyValue, /* const xmlChar* href; */
- xmlSecNodeHMACKeyValue, /* const xmlChar* dataNodeName; */
- xmlSecNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefHMACKeyValue, /* const xmlChar* href; */
+ xmlSecNodeHMACKeyValue, /* const xmlChar* dataNodeName; */
+ xmlSecNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecOpenSSLSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecOpenSSLSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecOpenSSLSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- xmlSecOpenSSLSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecOpenSSLSymKeyDataInitialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecOpenSSLSymKeyDataDuplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecOpenSSLSymKeyDataFinalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ xmlSecOpenSSLSymKeyDataGenerate, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecOpenSSLSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
- xmlSecOpenSSLSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecOpenSSLSymKeyDataGetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ xmlSecOpenSSLSymKeyDataGetSize, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecOpenSSLSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecOpenSSLSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- xmlSecOpenSSLSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
- xmlSecOpenSSLSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecOpenSSLSymKeyDataXmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecOpenSSLSymKeyDataXmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ xmlSecOpenSSLSymKeyDataBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
+ xmlSecOpenSSLSymKeyDataBinWrite, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecOpenSSLSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- xmlSecOpenSSLSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ xmlSecOpenSSLSymKeyDataDebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecOpenSSLSymKeyDataDebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -421,9 +421,9 @@ xmlSecOpenSSLKeyDataHmacGetKlass(void) {
/**
* xmlSecOpenSSLKeyDataHmacSet:
- * @data: the pointer to HMAC key data.
- * @buf: the pointer to key value.
- * @bufSize: the key value size (in bytes).
+ * @data: the pointer to HMAC key data.
+ * @buf: the pointer to key value.
+ * @bufSize: the key value size (in bytes).
*
* Sets the value of HMAC key data.
*
diff --git a/src/openssl/x509.c b/src/openssl/x509.c
index 74dd409..2617791 100644
--- a/src/openssl/x509.c
+++ b/src/openssl/x509.c
@@ -45,73 +45,73 @@
* X509 utility functions
*
************************************************************************/
-static int xmlSecOpenSSLX509DataNodeRead (xmlSecKeyDataPtr data,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecOpenSSLX509CertificateNodeRead (xmlSecKeyDataPtr data,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecOpenSSLX509CertificateNodeWrite (X509* cert,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecOpenSSLX509SubjectNameNodeRead (xmlSecKeyDataPtr data,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecOpenSSLX509SubjectNameNodeWrite (X509* cert,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecOpenSSLX509IssuerSerialNodeRead (xmlSecKeyDataPtr data,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecOpenSSLX509IssuerSerialNodeWrite (X509* cert,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecOpenSSLX509SKINodeRead (xmlSecKeyDataPtr data,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecOpenSSLX509SKINodeWrite (X509* cert,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecOpenSSLX509CRLNodeRead (xmlSecKeyDataPtr data,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecOpenSSLX509CRLNodeWrite (X509_CRL* crl,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecOpenSSLKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data,
- xmlSecKeyPtr key,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static X509* xmlSecOpenSSLX509CertDerRead (const xmlSecByte* buf,
- xmlSecSize size);
-static X509* xmlSecOpenSSLX509CertBase64DerRead (xmlChar* buf);
-static xmlChar* xmlSecOpenSSLX509CertBase64DerWrite (X509* cert,
- int base64LineWrap);
-static X509_CRL* xmlSecOpenSSLX509CrlDerRead (xmlSecByte* buf,
- xmlSecSize size);
-static X509_CRL* xmlSecOpenSSLX509CrlBase64DerRead (xmlChar* buf);
-static xmlChar* xmlSecOpenSSLX509CrlBase64DerWrite (X509_CRL* crl,
- int base64LineWrap);
-static xmlChar* xmlSecOpenSSLX509NameWrite (X509_NAME* nm);
-static xmlChar* xmlSecOpenSSLASN1IntegerWrite (ASN1_INTEGER *asni);
-static xmlChar* xmlSecOpenSSLX509SKIWrite (X509* cert);
-static void xmlSecOpenSSLX509CertDebugDump (X509* cert,
- FILE* output);
-static void xmlSecOpenSSLX509CertDebugXmlDump (X509* cert,
- FILE* output);
-static int xmlSecOpenSSLX509CertGetTime (ASN1_TIME* t,
- time_t* res);
+static int xmlSecOpenSSLX509DataNodeRead (xmlSecKeyDataPtr data,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLX509CertificateNodeRead (xmlSecKeyDataPtr data,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLX509CertificateNodeWrite (X509* cert,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLX509SubjectNameNodeRead (xmlSecKeyDataPtr data,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLX509SubjectNameNodeWrite (X509* cert,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLX509IssuerSerialNodeRead (xmlSecKeyDataPtr data,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLX509IssuerSerialNodeWrite (X509* cert,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLX509SKINodeRead (xmlSecKeyDataPtr data,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLX509SKINodeWrite (X509* cert,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLX509CRLNodeRead (xmlSecKeyDataPtr data,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLX509CRLNodeWrite (X509_CRL* crl,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data,
+ xmlSecKeyPtr key,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static X509* xmlSecOpenSSLX509CertDerRead (const xmlSecByte* buf,
+ xmlSecSize size);
+static X509* xmlSecOpenSSLX509CertBase64DerRead (xmlChar* buf);
+static xmlChar* xmlSecOpenSSLX509CertBase64DerWrite (X509* cert,
+ int base64LineWrap);
+static X509_CRL* xmlSecOpenSSLX509CrlDerRead (xmlSecByte* buf,
+ xmlSecSize size);
+static X509_CRL* xmlSecOpenSSLX509CrlBase64DerRead (xmlChar* buf);
+static xmlChar* xmlSecOpenSSLX509CrlBase64DerWrite (X509_CRL* crl,
+ int base64LineWrap);
+static xmlChar* xmlSecOpenSSLX509NameWrite (X509_NAME* nm);
+static xmlChar* xmlSecOpenSSLASN1IntegerWrite (ASN1_INTEGER *asni);
+static xmlChar* xmlSecOpenSSLX509SKIWrite (X509* cert);
+static void xmlSecOpenSSLX509CertDebugDump (X509* cert,
+ FILE* output);
+static void xmlSecOpenSSLX509CertDebugXmlDump (X509* cert,
+ FILE* output);
+static int xmlSecOpenSSLX509CertGetTime (ASN1_TIME* t,
+ time_t* res);
/*************************************************************************
*
* Internal OpenSSL X509 data CTX
*
************************************************************************/
-typedef struct _xmlSecOpenSSLX509DataCtx xmlSecOpenSSLX509DataCtx,
- *xmlSecOpenSSLX509DataCtxPtr;
+typedef struct _xmlSecOpenSSLX509DataCtx xmlSecOpenSSLX509DataCtx,
+ *xmlSecOpenSSLX509DataCtxPtr;
struct _xmlSecOpenSSLX509DataCtx {
- X509* keyCert;
- STACK_OF(X509)* certsList;
- STACK_OF(X509_CRL)* crlsList;
+ X509* keyCert;
+ STACK_OF(X509)* certsList;
+ STACK_OF(X509_CRL)* crlsList;
};
/**************************************************************************
@@ -128,18 +128,18 @@ struct _xmlSecOpenSSLX509DataCtx {
* 1. At least one element, from the following set of element types; any of these may appear together or more than once iff (if and only if) each instance describes or is related to the same certificate:
* 2.
* * The X509IssuerSerial element, which contains an X.509 issuer
- * distinguished name/serial number pair that SHOULD be compliant
- * with RFC2253 [LDAP-DN],
+ * distinguished name/serial number pair that SHOULD be compliant
+ * with RFC2253 [LDAP-DN],
* * The X509SubjectName element, which contains an X.509 subject
- * distinguished name that SHOULD be compliant with RFC2253 [LDAP-DN],
+ * distinguished name that SHOULD be compliant with RFC2253 [LDAP-DN],
* * The X509SKI element, which contains the base64 encoded plain (i.e.
- * non-DER-encoded) value of a X509 V.3 SubjectKeyIdentifier extension.
+ * non-DER-encoded) value of a X509 V.3 SubjectKeyIdentifier extension.
* * The X509Certificate element, which contains a base64-encoded [X509v3]
- * certificate, and
+ * certificate, and
* * Elements from an external namespace which accompanies/complements any
- * of the elements above.
+ * of the elements above.
* * The X509CRL element, which contains a base64-encoded certificate
- * revocation list (CRL) [X509v3].
+ * revocation list (CRL) [X509v3].
*
* Any X509IssuerSerial, X509SKI, and X509SubjectName elements that appear
* MUST refer to the certificate or certificates containing the validation key.
@@ -203,30 +203,30 @@ struct _xmlSecOpenSSLX509DataCtx {
* xmlSecOpenSSLX509DataCtx is located after xmlSecTransform
*
*************************************************************************/
-#define xmlSecOpenSSLX509DataSize \
- (sizeof(xmlSecKeyData) + sizeof(xmlSecOpenSSLX509DataCtx))
+#define xmlSecOpenSSLX509DataSize \
+ (sizeof(xmlSecKeyData) + sizeof(xmlSecOpenSSLX509DataCtx))
#define xmlSecOpenSSLX509DataGetCtx(data) \
((xmlSecOpenSSLX509DataCtxPtr)(((xmlSecByte*)(data)) + sizeof(xmlSecKeyData)))
-static int xmlSecOpenSSLKeyDataX509Initialize (xmlSecKeyDataPtr data);
-static int xmlSecOpenSSLKeyDataX509Duplicate (xmlSecKeyDataPtr dst,
- xmlSecKeyDataPtr src);
-static void xmlSecOpenSSLKeyDataX509Finalize (xmlSecKeyDataPtr data);
-static int xmlSecOpenSSLKeyDataX509XmlRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static int xmlSecOpenSSLKeyDataX509XmlWrite (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- xmlNodePtr node,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
-static xmlSecKeyDataType xmlSecOpenSSLKeyDataX509GetType (xmlSecKeyDataPtr data);
-static const xmlChar* xmlSecOpenSSLKeyDataX509GetIdentifier (xmlSecKeyDataPtr data);
+static int xmlSecOpenSSLKeyDataX509Initialize (xmlSecKeyDataPtr data);
+static int xmlSecOpenSSLKeyDataX509Duplicate (xmlSecKeyDataPtr dst,
+ xmlSecKeyDataPtr src);
+static void xmlSecOpenSSLKeyDataX509Finalize (xmlSecKeyDataPtr data);
+static int xmlSecOpenSSLKeyDataX509XmlRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLKeyDataX509XmlWrite (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ xmlNodePtr node,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
+static xmlSecKeyDataType xmlSecOpenSSLKeyDataX509GetType (xmlSecKeyDataPtr data);
+static const xmlChar* xmlSecOpenSSLKeyDataX509GetIdentifier (xmlSecKeyDataPtr data);
-static void xmlSecOpenSSLKeyDataX509DebugDump (xmlSecKeyDataPtr data,
- FILE* output);
-static void xmlSecOpenSSLKeyDataX509DebugXmlDump (xmlSecKeyDataPtr data,
- FILE* output);
+static void xmlSecOpenSSLKeyDataX509DebugDump (xmlSecKeyDataPtr data,
+ FILE* output);
+static void xmlSecOpenSSLKeyDataX509DebugXmlDump (xmlSecKeyDataPtr data,
+ FILE* output);
@@ -237,35 +237,35 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataX509Klass = {
/* data */
xmlSecNameX509Data,
xmlSecKeyDataUsageKeyInfoNode | xmlSecKeyDataUsageRetrievalMethodNodeXml,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefX509Data, /* const xmlChar* href; */
- xmlSecNodeX509Data, /* const xmlChar* dataNodeName; */
- xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefX509Data, /* const xmlChar* href; */
+ xmlSecNodeX509Data, /* const xmlChar* dataNodeName; */
+ xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- xmlSecOpenSSLKeyDataX509Initialize, /* xmlSecKeyDataInitializeMethod initialize; */
- xmlSecOpenSSLKeyDataX509Duplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
- xmlSecOpenSSLKeyDataX509Finalize, /* xmlSecKeyDataFinalizeMethod finalize; */
- NULL, /* xmlSecKeyDataGenerateMethod generate; */
+ xmlSecOpenSSLKeyDataX509Initialize, /* xmlSecKeyDataInitializeMethod initialize; */
+ xmlSecOpenSSLKeyDataX509Duplicate, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ xmlSecOpenSSLKeyDataX509Finalize, /* xmlSecKeyDataFinalizeMethod finalize; */
+ NULL, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- xmlSecOpenSSLKeyDataX509GetType, /* xmlSecKeyDataGetTypeMethod getType; */
- NULL, /* xmlSecKeyDataGetSizeMethod getSize; */
- xmlSecOpenSSLKeyDataX509GetIdentifier, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ xmlSecOpenSSLKeyDataX509GetType, /* xmlSecKeyDataGetTypeMethod getType; */
+ NULL, /* xmlSecKeyDataGetSizeMethod getSize; */
+ xmlSecOpenSSLKeyDataX509GetIdentifier, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- xmlSecOpenSSLKeyDataX509XmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- xmlSecOpenSSLKeyDataX509XmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- NULL, /* xmlSecKeyDataBinReadMethod binRead; */
- NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ xmlSecOpenSSLKeyDataX509XmlRead, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ xmlSecOpenSSLKeyDataX509XmlWrite, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ NULL, /* xmlSecKeyDataBinReadMethod binRead; */
+ NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- xmlSecOpenSSLKeyDataX509DebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- xmlSecOpenSSLKeyDataX509DebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ xmlSecOpenSSLKeyDataX509DebugDump, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ xmlSecOpenSSLKeyDataX509DebugXmlDump, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -282,14 +282,14 @@ xmlSecOpenSSLKeyDataX509GetKlass(void) {
/**
* xmlSecOpenSSLKeyDataX509GetKeyCert:
- * @data: the pointer to X509 key data.
+ * @data: the pointer to X509 key data.
*
* Gets the certificate from which the key was extracted.
*
* Returns: the key's certificate or NULL if key data was not used for key
* extraction or an error occurs.
*/
-X509*
+X509*
xmlSecOpenSSLKeyDataX509GetKeyCert(xmlSecKeyDataPtr data) {
xmlSecOpenSSLX509DataCtxPtr ctx;
@@ -303,8 +303,8 @@ xmlSecOpenSSLKeyDataX509GetKeyCert(xmlSecKeyDataPtr data) {
/**
* xmlSecOpenSSLKeyDataX509AdoptKeyCert:
- * @data: the pointer to X509 key data.
- * @cert: the pointer to OpenSSL X509 certificate.
+ * @data: the pointer to X509 key data.
+ * @cert: the pointer to OpenSSL X509 certificate.
*
* Sets the key's certificate in @data.
*
@@ -321,7 +321,7 @@ xmlSecOpenSSLKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data, X509* cert) {
xmlSecAssert2(ctx != NULL, -1);
if(ctx->keyCert != NULL) {
- X509_free(ctx->keyCert);
+ X509_free(ctx->keyCert);
}
ctx->keyCert = cert;
return(0);
@@ -329,8 +329,8 @@ xmlSecOpenSSLKeyDataX509AdoptKeyCert(xmlSecKeyDataPtr data, X509* cert) {
/**
* xmlSecOpenSSLKeyDataX509AdoptCert:
- * @data: the pointer to X509 key data.
- * @cert: the pointer to OpenSSL X509 certificate.
+ * @data: the pointer to X509 key data.
+ * @cert: the pointer to OpenSSL X509 certificate.
*
* Adds certificate to the X509 key data.
*
@@ -348,25 +348,25 @@ xmlSecOpenSSLKeyDataX509AdoptCert(xmlSecKeyDataPtr data, X509* cert) {
xmlSecAssert2(ctx != NULL, -1);
if(ctx->certsList == NULL) {
- ctx->certsList = sk_X509_new_null();
- if(ctx->certsList == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "sk_X509_new_null",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ctx->certsList = sk_X509_new_null();
+ if(ctx->certsList == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "sk_X509_new_null",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
ret = sk_X509_push(ctx->certsList, cert);
if(ret < 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "sk_X509_push",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "sk_X509_push",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -374,8 +374,8 @@ xmlSecOpenSSLKeyDataX509AdoptCert(xmlSecKeyDataPtr data, X509* cert) {
/**
* xmlSecOpenSSLKeyDataX509GetCert:
- * @data: the pointer to X509 key data.
- * @pos: the desired certificate position.
+ * @data: the pointer to X509 key data.
+ * @pos: the desired certificate position.
*
* Gets a certificate from X509 key data.
*
@@ -398,13 +398,13 @@ xmlSecOpenSSLKeyDataX509GetCert(xmlSecKeyDataPtr data, xmlSecSize pos) {
/**
* xmlSecOpenSSLKeyDataX509GetCertsSize:
- * @data: the pointer to X509 key data.
+ * @data: the pointer to X509 key data.
*
* Gets the number of certificates in @data.
*
* Returns: te number of certificates in @data.
*/
-xmlSecSize
+xmlSecSize
xmlSecOpenSSLKeyDataX509GetCertsSize(xmlSecKeyDataPtr data) {
xmlSecOpenSSLX509DataCtxPtr ctx;
@@ -418,8 +418,8 @@ xmlSecOpenSSLKeyDataX509GetCertsSize(xmlSecKeyDataPtr data) {
/**
* xmlSecOpenSSLKeyDataX509AdoptCrl:
- * @data: the pointer to X509 key data.
- * @crl: the pointer to OpenSSL X509 CRL.
+ * @data: the pointer to X509 key data.
+ * @crl: the pointer to OpenSSL X509 CRL.
*
* Adds CRL to the X509 key data.
*
@@ -437,25 +437,25 @@ xmlSecOpenSSLKeyDataX509AdoptCrl(xmlSecKeyDataPtr data, X509_CRL* crl) {
xmlSecAssert2(ctx != NULL, -1);
if(ctx->crlsList == NULL) {
- ctx->crlsList = sk_X509_CRL_new_null();
- if(ctx->crlsList == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "sk_X509_CRL_new_null",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ctx->crlsList = sk_X509_CRL_new_null();
+ if(ctx->crlsList == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "sk_X509_CRL_new_null",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
ret = sk_X509_CRL_push(ctx->crlsList, crl);
if(ret < 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "sk_X509_CRL_push",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "sk_X509_CRL_push",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -463,8 +463,8 @@ xmlSecOpenSSLKeyDataX509AdoptCrl(xmlSecKeyDataPtr data, X509_CRL* crl) {
/**
* xmlSecOpenSSLKeyDataX509GetCrl:
- * @data: the pointer to X509 key data.
- * @pos: the desired CRL position.
+ * @data: the pointer to X509 key data.
+ * @pos: the desired CRL position.
*
* Gets a CRL from X509 key data.
*
@@ -488,7 +488,7 @@ xmlSecOpenSSLKeyDataX509GetCrl(xmlSecKeyDataPtr data, xmlSecSize pos) {
/**
* xmlSecOpenSSLKeyDataX509GetCrlsSize:
- * @data: the pointer to X509 key data.
+ * @data: the pointer to X509 key data.
*
* Gets the number of CRLs in @data.
*
@@ -506,7 +506,7 @@ xmlSecOpenSSLKeyDataX509GetCrlsSize(xmlSecKeyDataPtr data) {
return((ctx->crlsList != NULL) ? sk_X509_CRL_num(ctx->crlsList) : 0);
}
-static int
+static int
xmlSecOpenSSLKeyDataX509Initialize(xmlSecKeyDataPtr data) {
xmlSecOpenSSLX509DataCtxPtr ctx;
@@ -534,95 +534,95 @@ xmlSecOpenSSLKeyDataX509Duplicate(xmlSecKeyDataPtr dst, xmlSecKeyDataPtr src) {
/* copy certsList */
size = xmlSecOpenSSLKeyDataX509GetCertsSize(src);
for(pos = 0; pos < size; ++pos) {
- certSrc = xmlSecOpenSSLKeyDataX509GetCert(src, pos);
- if(certSrc == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(src)),
- "xmlSecOpenSSLKeyDataX509GetCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
-
- certDst = X509_dup(certSrc);
- if(certDst == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "X509_dup",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- ret = xmlSecOpenSSLKeyDataX509AdoptCert(dst, certDst);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "xmlSecOpenSSLKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- X509_free(certDst);
- return(-1);
- }
+ certSrc = xmlSecOpenSSLKeyDataX509GetCert(src, pos);
+ if(certSrc == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(src)),
+ "xmlSecOpenSSLKeyDataX509GetCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+
+ certDst = X509_dup(certSrc);
+ if(certDst == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "X509_dup",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ ret = xmlSecOpenSSLKeyDataX509AdoptCert(dst, certDst);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "xmlSecOpenSSLKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ X509_free(certDst);
+ return(-1);
+ }
}
/* copy crls */
size = xmlSecOpenSSLKeyDataX509GetCrlsSize(src);
for(pos = 0; pos < size; ++pos) {
- crlSrc = xmlSecOpenSSLKeyDataX509GetCrl(src, pos);
- if(crlSrc == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(src)),
- "xmlSecOpenSSLKeyDataX509GetCrl",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
-
- crlDst = X509_CRL_dup(crlSrc);
- if(crlDst == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "X509_CRL_dup",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- ret = xmlSecOpenSSLKeyDataX509AdoptCrl(dst, crlDst);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "xmlSecOpenSSLKeyDataX509AdoptCrl",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- X509_CRL_free(crlDst);
- return(-1);
- }
+ crlSrc = xmlSecOpenSSLKeyDataX509GetCrl(src, pos);
+ if(crlSrc == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(src)),
+ "xmlSecOpenSSLKeyDataX509GetCrl",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+
+ crlDst = X509_CRL_dup(crlSrc);
+ if(crlDst == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "X509_CRL_dup",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ ret = xmlSecOpenSSLKeyDataX509AdoptCrl(dst, crlDst);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "xmlSecOpenSSLKeyDataX509AdoptCrl",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ X509_CRL_free(crlDst);
+ return(-1);
+ }
}
/* copy key cert if exist */
certSrc = xmlSecOpenSSLKeyDataX509GetKeyCert(src);
if(certSrc != NULL) {
- certDst = X509_dup(certSrc);
- if(certDst == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "X509_dup",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- ret = xmlSecOpenSSLKeyDataX509AdoptKeyCert(dst, certDst);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
- "xmlSecOpenSSLKeyDataX509AdoptKeyCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- X509_free(certDst);
- return(-1);
- }
+ certDst = X509_dup(certSrc);
+ if(certDst == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "X509_dup",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ ret = xmlSecOpenSSLKeyDataX509AdoptKeyCert(dst, certDst);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)),
+ "xmlSecOpenSSLKeyDataX509AdoptKeyCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ X509_free(certDst);
+ return(-1);
+ }
}
return(0);
}
@@ -637,20 +637,20 @@ xmlSecOpenSSLKeyDataX509Finalize(xmlSecKeyDataPtr data) {
xmlSecAssert(ctx != NULL);
if(ctx->certsList != NULL) {
- sk_X509_pop_free(ctx->certsList, X509_free);
+ sk_X509_pop_free(ctx->certsList, X509_free);
}
if(ctx->crlsList != NULL) {
- sk_X509_CRL_pop_free(ctx->crlsList, X509_CRL_free);
+ sk_X509_CRL_pop_free(ctx->crlsList, X509_CRL_free);
}
if(ctx->keyCert != NULL) {
- X509_free(ctx->keyCert);
+ X509_free(ctx->keyCert);
}
memset(ctx, 0, sizeof(xmlSecOpenSSLX509DataCtx));
}
static int
xmlSecOpenSSLKeyDataX509XmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyDataPtr data;
int ret;
@@ -661,33 +661,33 @@ xmlSecOpenSSLKeyDataX509XmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
data = xmlSecKeyEnsureData(key, id);
if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyEnsureData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyEnsureData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecOpenSSLX509DataNodeRead(data, node, keyInfoCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLX509DataNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLX509DataNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS) == 0) {
ret = xmlSecOpenSSLKeyDataX509VerifyAndExtractKey(data, key, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLKeyDataX509VerifyAndExtractKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLKeyDataX509VerifyAndExtractKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
}
return(0);
@@ -695,14 +695,14 @@ xmlSecOpenSSLKeyDataX509XmlRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
static int
xmlSecOpenSSLKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
- xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyDataPtr data;
X509* cert;
X509_CRL* crl;
xmlSecSize size, pos;
int content;
int ret;
-
+
xmlSecAssert2(id == xmlSecOpenSSLKeyDataX509Id, -1);
xmlSecAssert2(key != NULL, -1);
xmlSecAssert2(node != NULL, -1);
@@ -710,110 +710,110 @@ xmlSecOpenSSLKeyDataX509XmlWrite(xmlSecKeyDataId id, xmlSecKeyPtr key,
content = xmlSecX509DataGetNodeContent (node, 1, keyInfoCtx);
if (content < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecX509DataGetNodeContent",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "content=%d", content);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecX509DataGetNodeContent",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "content=%d", content);
+ return(-1);
} else if(content == 0) {
- /* by default we are writing certificates and crls */
- content = XMLSEC_X509DATA_DEFAULT;
+ /* by default we are writing certificates and crls */
+ content = XMLSEC_X509DATA_DEFAULT;
}
/* get x509 data */
data = xmlSecKeyGetData(key, id);
if(data == NULL) {
- /* no x509 data in the key */
- return(0);
+ /* no x509 data in the key */
+ return(0);
}
/* write certs */
size = xmlSecOpenSSLKeyDataX509GetCertsSize(data);
for(pos = 0; pos < size; ++pos) {
- cert = xmlSecOpenSSLKeyDataX509GetCert(data, pos);
- if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLKeyDataX509GetCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
-
- if((content & XMLSEC_X509DATA_CERTIFICATE_NODE) != 0) {
- ret = xmlSecOpenSSLX509CertificateNodeWrite(cert, node, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLX509CertificateNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
- }
-
- if((content & XMLSEC_X509DATA_SUBJECTNAME_NODE) != 0) {
- ret = xmlSecOpenSSLX509SubjectNameNodeWrite(cert, node, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLX509SubjectNameNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
- }
-
- if((content & XMLSEC_X509DATA_ISSUERSERIAL_NODE) != 0) {
- ret = xmlSecOpenSSLX509IssuerSerialNodeWrite(cert, node, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLX509IssuerSerialNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
- }
-
- if((content & XMLSEC_X509DATA_SKI_NODE) != 0) {
- ret = xmlSecOpenSSLX509SKINodeWrite(cert, node, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLX509SKINodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
- }
+ cert = xmlSecOpenSSLKeyDataX509GetCert(data, pos);
+ if(cert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLKeyDataX509GetCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+
+ if((content & XMLSEC_X509DATA_CERTIFICATE_NODE) != 0) {
+ ret = xmlSecOpenSSLX509CertificateNodeWrite(cert, node, keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLX509CertificateNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+ }
+
+ if((content & XMLSEC_X509DATA_SUBJECTNAME_NODE) != 0) {
+ ret = xmlSecOpenSSLX509SubjectNameNodeWrite(cert, node, keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLX509SubjectNameNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+ }
+
+ if((content & XMLSEC_X509DATA_ISSUERSERIAL_NODE) != 0) {
+ ret = xmlSecOpenSSLX509IssuerSerialNodeWrite(cert, node, keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLX509IssuerSerialNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+ }
+
+ if((content & XMLSEC_X509DATA_SKI_NODE) != 0) {
+ ret = xmlSecOpenSSLX509SKINodeWrite(cert, node, keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLX509SKINodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+ }
}
/* write crls if needed */
if((content & XMLSEC_X509DATA_CRL_NODE) != 0) {
- size = xmlSecOpenSSLKeyDataX509GetCrlsSize(data);
- for(pos = 0; pos < size; ++pos) {
- crl = xmlSecOpenSSLKeyDataX509GetCrl(data, pos);
- if(crl == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLKeyDataX509GetCrl",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
-
- ret = xmlSecOpenSSLX509CRLNodeWrite(crl, node, keyInfoCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLX509CRLNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return(-1);
- }
- }
+ size = xmlSecOpenSSLKeyDataX509GetCrlsSize(data);
+ for(pos = 0; pos < size; ++pos) {
+ crl = xmlSecOpenSSLKeyDataX509GetCrl(data, pos);
+ if(crl == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLKeyDataX509GetCrl",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+
+ ret = xmlSecOpenSSLX509CRLNodeWrite(crl, node, keyInfoCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLX509CRLNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return(-1);
+ }
+ }
}
return(0);
@@ -847,23 +847,23 @@ xmlSecOpenSSLKeyDataX509DebugDump(xmlSecKeyDataPtr data, FILE* output) {
fprintf(output, "=== X509 Data:\n");
cert = xmlSecOpenSSLKeyDataX509GetKeyCert(data);
if(cert != NULL) {
- fprintf(output, "==== Key Certificate:\n");
- xmlSecOpenSSLX509CertDebugDump(cert, output);
+ fprintf(output, "==== Key Certificate:\n");
+ xmlSecOpenSSLX509CertDebugDump(cert, output);
}
size = xmlSecOpenSSLKeyDataX509GetCertsSize(data);
for(pos = 0; pos < size; ++pos) {
- cert = xmlSecOpenSSLKeyDataX509GetCert(data, pos);
- if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecOpenSSLKeyDataX509GetCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return;
- }
- fprintf(output, "==== Certificate:\n");
- xmlSecOpenSSLX509CertDebugDump(cert, output);
+ cert = xmlSecOpenSSLKeyDataX509GetCert(data, pos);
+ if(cert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecOpenSSLKeyDataX509GetCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return;
+ }
+ fprintf(output, "==== Certificate:\n");
+ xmlSecOpenSSLX509CertDebugDump(cert, output);
}
/* we don't print out crls */
@@ -880,25 +880,25 @@ xmlSecOpenSSLKeyDataX509DebugXmlDump(xmlSecKeyDataPtr data, FILE* output) {
fprintf(output, "<X509Data>\n");
cert = xmlSecOpenSSLKeyDataX509GetKeyCert(data);
if(cert != NULL) {
- fprintf(output, "<KeyCertificate>\n");
- xmlSecOpenSSLX509CertDebugXmlDump(cert, output);
- fprintf(output, "</KeyCertificate>\n");
+ fprintf(output, "<KeyCertificate>\n");
+ xmlSecOpenSSLX509CertDebugXmlDump(cert, output);
+ fprintf(output, "</KeyCertificate>\n");
}
size = xmlSecOpenSSLKeyDataX509GetCertsSize(data);
for(pos = 0; pos < size; ++pos) {
- cert = xmlSecOpenSSLKeyDataX509GetCert(data, pos);
- if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecOpenSSLKeyDataX509GetCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- return;
- }
- fprintf(output, "<Certificate>\n");
- xmlSecOpenSSLX509CertDebugXmlDump(cert, output);
- fprintf(output, "</Certificate>\n");
+ cert = xmlSecOpenSSLKeyDataX509GetCert(data, pos);
+ if(cert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecOpenSSLKeyDataX509GetCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ return;
+ }
+ fprintf(output, "<Certificate>\n");
+ xmlSecOpenSSLX509CertDebugXmlDump(cert, output);
+ fprintf(output, "</Certificate>\n");
}
/* we don't print out crls */
@@ -915,43 +915,43 @@ xmlSecOpenSSLX509DataNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyI
xmlSecAssert2(keyInfoCtx != NULL, -1);
for(cur = xmlSecGetNextElementNode(node->children);
- cur != NULL;
- cur = xmlSecGetNextElementNode(cur->next)) {
-
- ret = 0;
- if(xmlSecCheckNodeName(cur, xmlSecNodeX509Certificate, xmlSecDSigNs)) {
- ret = xmlSecOpenSSLX509CertificateNodeRead(data, cur, keyInfoCtx);
- } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509SubjectName, xmlSecDSigNs)) {
- ret = xmlSecOpenSSLX509SubjectNameNodeRead(data, cur, keyInfoCtx);
- } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509IssuerSerial, xmlSecDSigNs)) {
- ret = xmlSecOpenSSLX509IssuerSerialNodeRead(data, cur, keyInfoCtx);
- } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509SKI, xmlSecDSigNs)) {
- ret = xmlSecOpenSSLX509SKINodeRead(data, cur, keyInfoCtx);
- } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509CRL, xmlSecDSigNs)) {
- ret = xmlSecOpenSSLX509CRLNodeRead(data, cur, keyInfoCtx);
- } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CHILD) != 0) {
- /* laxi schema validation: ignore unknown nodes */
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "read node failed");
- return(-1);
- }
+ cur != NULL;
+ cur = xmlSecGetNextElementNode(cur->next)) {
+
+ ret = 0;
+ if(xmlSecCheckNodeName(cur, xmlSecNodeX509Certificate, xmlSecDSigNs)) {
+ ret = xmlSecOpenSSLX509CertificateNodeRead(data, cur, keyInfoCtx);
+ } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509SubjectName, xmlSecDSigNs)) {
+ ret = xmlSecOpenSSLX509SubjectNameNodeRead(data, cur, keyInfoCtx);
+ } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509IssuerSerial, xmlSecDSigNs)) {
+ ret = xmlSecOpenSSLX509IssuerSerialNodeRead(data, cur, keyInfoCtx);
+ } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509SKI, xmlSecDSigNs)) {
+ ret = xmlSecOpenSSLX509SKINodeRead(data, cur, keyInfoCtx);
+ } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509CRL, xmlSecDSigNs)) {
+ ret = xmlSecOpenSSLX509CRLNodeRead(data, cur, keyInfoCtx);
+ } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CHILD) != 0) {
+ /* laxi schema validation: ignore unknown nodes */
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "read node failed");
+ return(-1);
+ }
}
return(0);
}
static int
-xmlSecOpenSSLX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+xmlSecOpenSSLX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlChar *content;
X509* cert;
int ret;
@@ -962,41 +962,41 @@ xmlSecOpenSSLX509CertificateNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xml
content = xmlNodeGetContent(node);
if((content == NULL) || (xmlSecIsEmptyString(content) == 1)) {
- if(content != NULL) {
- xmlFree(content);
- }
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- return(0);
+ if(content != NULL) {
+ xmlFree(content);
+ }
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ return(0);
}
cert = xmlSecOpenSSLX509CertBase64DerRead(content);
if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecOpenSSLX509CertBase64DerRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(content);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecOpenSSLX509CertBase64DerRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(content);
+ return(-1);
}
ret = xmlSecOpenSSLKeyDataX509AdoptCert(data, cert);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecOpenSSLKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- X509_free(cert);
- xmlFree(content);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecOpenSSLKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ X509_free(cert);
+ xmlFree(content);
+ return(-1);
}
xmlFree(content);
@@ -1015,24 +1015,24 @@ xmlSecOpenSSLX509CertificateNodeWrite(X509* cert, xmlNodePtr node, xmlSecKeyInfo
/* set base64 lines size from context */
buf = xmlSecOpenSSLX509CertBase64DerWrite(cert, keyInfoCtx->base64LineSize);
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLX509CertBase64DerWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLX509CertBase64DerWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
cur = xmlSecAddChild(node, xmlSecNodeX509Certificate, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509Certificate));
- xmlFree(buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509Certificate));
+ xmlFree(buf);
+ return(-1);
}
/* todo: add \n around base64 data - from context */
@@ -1043,8 +1043,8 @@ xmlSecOpenSSLX509CertificateNodeWrite(X509* cert, xmlNodePtr node, xmlSecKeyInfo
return(0);
}
-static int
-xmlSecOpenSSLX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
+static int
+xmlSecOpenSSLX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyDataStorePtr x509Store;
xmlChar* subject;
X509* cert;
@@ -1058,70 +1058,70 @@ xmlSecOpenSSLX509SubjectNameNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xml
x509Store = xmlSecKeysMngrGetDataStore(keyInfoCtx->keysMngr, xmlSecOpenSSLX509StoreId);
if(x509Store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeysMngrGetDataStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeysMngrGetDataStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
subject = xmlNodeGetContent(node);
if((subject == NULL) || (xmlSecIsEmptyString(subject) == 1)) {
- if(subject != NULL) {
- xmlFree(subject);
- }
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- return(0);
+ if(subject != NULL) {
+ xmlFree(subject);
+ }
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ return(0);
}
cert = xmlSecOpenSSLX509StoreFindCert(x509Store, subject, NULL, NULL, NULL, keyInfoCtx);
if(cert == NULL){
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- NULL,
- XMLSEC_ERRORS_R_CERT_NOT_FOUND,
- "subject=%s",
- xmlSecErrorsSafeString(subject));
- xmlFree(subject);
- return(-1);
- }
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ NULL,
+ XMLSEC_ERRORS_R_CERT_NOT_FOUND,
+ "subject=%s",
+ xmlSecErrorsSafeString(subject));
+ xmlFree(subject);
+ return(-1);
+ }
- xmlFree(subject);
- return(0);
+ xmlFree(subject);
+ return(0);
}
cert2 = X509_dup(cert);
if(cert2 == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "X509_dup",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "X509_dup",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(subject);
- return(-1);
+ xmlFree(subject);
+ return(-1);
}
ret = xmlSecOpenSSLKeyDataX509AdoptCert(data, cert2);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecOpenSSLKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- X509_free(cert2);
- xmlFree(subject);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecOpenSSLKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ X509_free(cert2);
+ xmlFree(subject);
+ return(-1);
}
xmlFree(subject);
@@ -1138,24 +1138,24 @@ xmlSecOpenSSLX509SubjectNameNodeWrite(X509* cert, xmlNodePtr node, xmlSecKeyInfo
buf = xmlSecOpenSSLX509NameWrite(X509_get_subject_name(cert));
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLX509NameWrite(X509_get_subject_name)",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLX509NameWrite(X509_get_subject_name)",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecAddChild(node, xmlSecNodeX509SubjectName, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509SubjectName));
- xmlFree(buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509SubjectName));
+ xmlFree(buf);
+ return(-1);
}
xmlSecNodeEncodeAndSetContent(cur, buf);
xmlFree(buf);
@@ -1179,128 +1179,128 @@ xmlSecOpenSSLX509IssuerSerialNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xm
x509Store = xmlSecKeysMngrGetDataStore(keyInfoCtx->keysMngr, xmlSecOpenSSLX509StoreId);
if(x509Store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeysMngrGetDataStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeysMngrGetDataStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecGetNextElementNode(node->children);
if(cur == NULL) {
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeX509IssuerName),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
- }
- return(0);
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeX509IssuerName),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
+ }
+ return(0);
}
/* the first is required node X509IssuerName */
if(!xmlSecCheckNodeName(cur, xmlSecNodeX509IssuerName, xmlSecDSigNs)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeX509IssuerName),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeX509IssuerName),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
}
issuerName = xmlNodeGetContent(cur);
if(issuerName == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509IssuerName));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509IssuerName));
+ return(-1);
}
cur = xmlSecGetNextElementNode(cur->next);
/* next is required node X509SerialNumber */
if((cur == NULL) || !xmlSecCheckNodeName(cur, xmlSecNodeX509SerialNumber, xmlSecDSigNs)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber));
- xmlFree(issuerName);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber));
+ xmlFree(issuerName);
+ return(-1);
}
issuerSerial = xmlNodeGetContent(cur);
if(issuerSerial == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- xmlFree(issuerName);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ xmlFree(issuerName);
+ return(-1);
}
cur = xmlSecGetNextElementNode(cur->next);
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(issuerSerial);
- xmlFree(issuerName);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(issuerSerial);
+ xmlFree(issuerName);
+ return(-1);
}
cert = xmlSecOpenSSLX509StoreFindCert(x509Store, NULL, issuerName, issuerSerial, NULL, keyInfoCtx);
if(cert == NULL){
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- NULL,
- XMLSEC_ERRORS_R_CERT_NOT_FOUND,
- "issuerName=%s;issuerSerial=%s",
- xmlSecErrorsSafeString(issuerName),
- xmlSecErrorsSafeString(issuerSerial));
- xmlFree(issuerSerial);
- xmlFree(issuerName);
- return(-1);
- }
- xmlFree(issuerSerial);
- xmlFree(issuerName);
- return(0);
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ NULL,
+ XMLSEC_ERRORS_R_CERT_NOT_FOUND,
+ "issuerName=%s;issuerSerial=%s",
+ xmlSecErrorsSafeString(issuerName),
+ xmlSecErrorsSafeString(issuerSerial));
+ xmlFree(issuerSerial);
+ xmlFree(issuerName);
+ return(-1);
+ }
+ xmlFree(issuerSerial);
+ xmlFree(issuerName);
+ return(0);
}
cert2 = X509_dup(cert);
if(cert2 == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "X509_dup",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(issuerSerial);
- xmlFree(issuerName);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "X509_dup",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(issuerSerial);
+ xmlFree(issuerName);
+ return(-1);
}
ret = xmlSecOpenSSLKeyDataX509AdoptCert(data, cert2);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecOpenSSLKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- X509_free(cert2);
- xmlFree(issuerSerial);
- xmlFree(issuerName);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecOpenSSLKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ X509_free(cert2);
+ xmlFree(issuerSerial);
+ xmlFree(issuerName);
+ return(-1);
}
xmlFree(issuerSerial);
@@ -1321,58 +1321,58 @@ xmlSecOpenSSLX509IssuerSerialNodeWrite(X509* cert, xmlNodePtr node, xmlSecKeyInf
/* create xml nodes */
cur = xmlSecAddChild(node, xmlSecNodeX509IssuerSerial, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509IssuerSerial));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509IssuerSerial));
+ return(-1);
}
issuerNameNode = xmlSecAddChild(cur, xmlSecNodeX509IssuerName, xmlSecDSigNs);
if(issuerNameNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509IssuerName));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509IssuerName));
+ return(-1);
}
issuerNumberNode = xmlSecAddChild(cur, xmlSecNodeX509SerialNumber, xmlSecDSigNs);
if(issuerNumberNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber));
+ return(-1);
}
/* write data */
buf = xmlSecOpenSSLX509NameWrite(X509_get_issuer_name(cert));
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLX509NameWrite(X509_get_issuer_name)",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLX509NameWrite(X509_get_issuer_name)",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
xmlSecNodeEncodeAndSetContent(issuerNameNode, buf);
xmlFree(buf);
buf = xmlSecOpenSSLASN1IntegerWrite(X509_get_serialNumber(cert));
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLASN1IntegerWrite(X509_get_serialNumber)",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLASN1IntegerWrite(X509_get_serialNumber)",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
xmlSecNodeEncodeAndSetContent(issuerNumberNode, buf);
xmlFree(buf);
@@ -1396,68 +1396,68 @@ xmlSecOpenSSLX509SKINodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyIn
x509Store = xmlSecKeysMngrGetDataStore(keyInfoCtx->keysMngr, xmlSecOpenSSLX509StoreId);
if(x509Store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeysMngrGetDataStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeysMngrGetDataStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ski = xmlNodeGetContent(node);
if((ski == NULL) || (xmlSecIsEmptyString(ski) == 1)) {
- if(ski != NULL) {
- xmlFree(ski);
- }
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509SKI));
- return(-1);
- }
- return(0);
+ if(ski != NULL) {
+ xmlFree(ski);
+ }
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509SKI));
+ return(-1);
+ }
+ return(0);
}
cert = xmlSecOpenSSLX509StoreFindCert(x509Store, NULL, NULL, NULL, ski, keyInfoCtx);
if(cert == NULL){
- xmlFree(ski);
-
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- NULL,
- XMLSEC_ERRORS_R_CERT_NOT_FOUND,
- "ski=%s",
- xmlSecErrorsSafeString(ski));
- return(-1);
- }
- return(0);
+ xmlFree(ski);
+
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ NULL,
+ XMLSEC_ERRORS_R_CERT_NOT_FOUND,
+ "ski=%s",
+ xmlSecErrorsSafeString(ski));
+ return(-1);
+ }
+ return(0);
}
cert2 = X509_dup(cert);
if(cert2 == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "X509_dup",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(ski);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "X509_dup",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(ski);
+ return(-1);
}
ret = xmlSecOpenSSLKeyDataX509AdoptCert(data, cert2);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecOpenSSLKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- X509_free(cert2);
- xmlFree(ski);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecOpenSSLKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ X509_free(cert2);
+ xmlFree(ski);
+ return(-1);
}
xmlFree(ski);
@@ -1474,24 +1474,24 @@ xmlSecOpenSSLX509SKINodeWrite(X509* cert, xmlNodePtr node, xmlSecKeyInfoCtxPtr k
buf = xmlSecOpenSSLX509SKIWrite(cert);
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLX509SKIWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLX509SKIWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecAddChild(node, xmlSecNodeX509SKI, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "new_node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509SKI));
- xmlFree(buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "new_node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509SKI));
+ xmlFree(buf);
+ return(-1);
}
xmlSecNodeEncodeAndSetContent(cur, buf);
xmlFree(buf);
@@ -1511,41 +1511,41 @@ xmlSecOpenSSLX509CRLNodeRead(xmlSecKeyDataPtr data, xmlNodePtr node, xmlSecKeyIn
content = xmlNodeGetContent(node);
if((content == NULL) || (xmlSecIsEmptyString(content) == 1)) {
- if(content != NULL) {
- xmlFree(content);
- }
- if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- return(0);
+ if(content != NULL) {
+ xmlFree(content);
+ }
+ if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_STOP_ON_EMPTY_NODE) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ return(0);
}
crl = xmlSecOpenSSLX509CrlBase64DerRead(content);
if(crl == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecOpenSSLX509CrlBase64DerRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(content);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecOpenSSLX509CrlBase64DerRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(content);
+ return(-1);
}
ret = xmlSecOpenSSLKeyDataX509AdoptCrl(data, crl);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecOpenSSLKeyDataX509AdoptCrl",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- X509_CRL_free(crl);
- xmlFree(content);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecOpenSSLKeyDataX509AdoptCrl",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ X509_CRL_free(crl);
+ xmlFree(content);
+ return(-1);
}
xmlFree(content);
@@ -1564,24 +1564,24 @@ xmlSecOpenSSLX509CRLNodeWrite(X509_CRL* crl, xmlNodePtr node, xmlSecKeyInfoCtxPt
/* set base64 lines size from context */
buf = xmlSecOpenSSLX509CrlBase64DerWrite(crl, keyInfoCtx->base64LineSize);
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLX509CrlBase64DerWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLX509CrlBase64DerWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecAddChild(node, xmlSecNodeX509CRL, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "new_node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509CRL));
- xmlFree(buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "new_node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509CRL));
+ xmlFree(buf);
+ return(-1);
}
/* todo: add \n around base64 data - from context */
/* todo: add errors check */
@@ -1594,7 +1594,7 @@ xmlSecOpenSSLX509CRLNodeWrite(X509_CRL* crl, xmlNodePtr node, xmlSecKeyInfoCtxPt
static int
xmlSecOpenSSLKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr key,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecOpenSSLX509DataCtxPtr ctx;
xmlSecKeyDataStorePtr x509Store;
int ret;
@@ -1609,93 +1609,93 @@ xmlSecOpenSSLKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr
x509Store = xmlSecKeysMngrGetDataStore(keyInfoCtx->keysMngr, xmlSecOpenSSLX509StoreId);
if(x509Store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeysMngrGetDataStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeysMngrGetDataStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if((ctx->keyCert == NULL) && (ctx->certsList != NULL) && (xmlSecKeyGetValue(key) == NULL)) {
- X509* cert;
-
- cert = xmlSecOpenSSLX509StoreVerify(x509Store, ctx->certsList, ctx->crlsList, keyInfoCtx);
- if(cert != NULL) {
- xmlSecKeyDataPtr keyValue;
-
- ctx->keyCert = X509_dup(cert);
- if(ctx->keyCert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "X509_dup",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- keyValue = xmlSecOpenSSLX509CertGetKey(ctx->keyCert);
- if(keyValue == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecOpenSSLX509CertGetKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- /* verify that the key matches our expectations */
- if(xmlSecKeyReqMatchKeyValue(&(keyInfoCtx->keyReq), keyValue) != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeyReqMatchKeyValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(keyValue);
- return(-1);
- }
-
- ret = xmlSecKeySetValue(key, keyValue);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecKeySetValue",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDataDestroy(keyValue);
- return(-1);
- }
-
- if((X509_get_notBefore(ctx->keyCert) != NULL) && (X509_get_notAfter(ctx->keyCert) != NULL)) {
- ret = xmlSecOpenSSLX509CertGetTime(X509_get_notBefore(ctx->keyCert), &(key->notValidBefore));
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecOpenSSLX509CertGetTime",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "notValidBefore");
- return(-1);
- }
- ret = xmlSecOpenSSLX509CertGetTime(X509_get_notAfter(ctx->keyCert), &(key->notValidAfter));
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- "xmlSecOpenSSLX509CertGetTime",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "notValidAfter");
- return(-1);
- }
- } else {
- key->notValidBefore = key->notValidAfter = 0;
- }
- } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_INVALID_CERT) != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
- NULL,
- XMLSEC_ERRORS_R_CERT_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ X509* cert;
+
+ cert = xmlSecOpenSSLX509StoreVerify(x509Store, ctx->certsList, ctx->crlsList, keyInfoCtx);
+ if(cert != NULL) {
+ xmlSecKeyDataPtr keyValue;
+
+ ctx->keyCert = X509_dup(cert);
+ if(ctx->keyCert == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "X509_dup",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ keyValue = xmlSecOpenSSLX509CertGetKey(ctx->keyCert);
+ if(keyValue == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecOpenSSLX509CertGetKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ /* verify that the key matches our expectations */
+ if(xmlSecKeyReqMatchKeyValue(&(keyInfoCtx->keyReq), keyValue) != 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeyReqMatchKeyValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(keyValue);
+ return(-1);
+ }
+
+ ret = xmlSecKeySetValue(key, keyValue);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecKeySetValue",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDataDestroy(keyValue);
+ return(-1);
+ }
+
+ if((X509_get_notBefore(ctx->keyCert) != NULL) && (X509_get_notAfter(ctx->keyCert) != NULL)) {
+ ret = xmlSecOpenSSLX509CertGetTime(X509_get_notBefore(ctx->keyCert), &(key->notValidBefore));
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecOpenSSLX509CertGetTime",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "notValidBefore");
+ return(-1);
+ }
+ ret = xmlSecOpenSSLX509CertGetTime(X509_get_notAfter(ctx->keyCert), &(key->notValidAfter));
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ "xmlSecOpenSSLX509CertGetTime",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "notValidAfter");
+ return(-1);
+ }
+ } else {
+ key->notValidBefore = key->notValidAfter = 0;
+ }
+ } else if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_INVALID_CERT) != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)),
+ NULL,
+ XMLSEC_ERRORS_R_CERT_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
return(0);
}
@@ -1704,7 +1704,7 @@ xmlSecOpenSSLKeyDataX509VerifyAndExtractKey(xmlSecKeyDataPtr data, xmlSecKeyPtr
extern time_t timegm (struct tm *tm);
#else /* HAVE_TIMEGM */
#ifdef WIN32
-#define timegm(tm) (mktime(tm) - _timezone)
+#define timegm(tm) (mktime(tm) - _timezone)
#else /* WIN32 */
/* Absolutely not the best way but it's the only ANSI compatible way I know.
* If you system has a native struct tm --> GMT time_t conversion function
@@ -1717,23 +1717,23 @@ my_timegm(struct tm *t) {
tl = mktime (t);
if(tl == -1) {
- t->tm_hour--;
- tl = mktime (t);
- if (tl == -1) {
- return -1;
- }
- tl += 3600;
+ t->tm_hour--;
+ tl = mktime (t);
+ if (tl == -1) {
+ return -1;
+ }
+ tl += 3600;
}
tg = gmtime (&tl);
tg->tm_isdst = 0;
tb = mktime (tg);
if (tb == -1) {
- tg->tm_hour--;
- tb = mktime (tg);
- if (tb == -1) {
- return -1;
- }
- tb += 3600;
+ tg->tm_hour--;
+ tb = mktime (tg);
+ if (tb == -1) {
+ return -1;
+ }
+ tb += 3600;
}
return (tl - (tb - tl));
}
@@ -1753,12 +1753,12 @@ xmlSecOpenSSLX509CertGetTime(ASN1_TIME* t, time_t* res) {
(*res) = 0;
#ifndef XMLSEC_OPENSSL_096
if(!ASN1_TIME_check(t)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "ASN1_TIME_check",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "ASN1_TIME_check",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
#endif /* XMLSEC_OPENSSL_096 */
@@ -1766,50 +1766,50 @@ xmlSecOpenSSLX509CertGetTime(ASN1_TIME* t, time_t* res) {
#define g2(p) (((p)[0]-'0')*10+(p)[1]-'0')
if(t->type == V_ASN1_UTCTIME) {
- xmlSecAssert2(t->length > 12, -1);
-
-
- /* this code is copied from OpenSSL asn1/a_utctm.c file */
- tm.tm_year = g2(t->data);
- if(tm.tm_year < 50) {
- tm.tm_year += 100;
- }
- tm.tm_mon = g2(t->data + 2) - 1;
- tm.tm_mday = g2(t->data + 4);
- tm.tm_hour = g2(t->data + 6);
- tm.tm_min = g2(t->data + 8);
- tm.tm_sec = g2(t->data + 10);
- if(t->data[12] == 'Z') {
- offset = 0;
- } else {
- xmlSecAssert2(t->length > 16, -1);
-
- offset = g2(t->data + 13) * 60 + g2(t->data + 15);
- if(t->data[12] == '-') {
- offset = -offset;
- }
- }
- tm.tm_isdst = -1;
+ xmlSecAssert2(t->length > 12, -1);
+
+
+ /* this code is copied from OpenSSL asn1/a_utctm.c file */
+ tm.tm_year = g2(t->data);
+ if(tm.tm_year < 50) {
+ tm.tm_year += 100;
+ }
+ tm.tm_mon = g2(t->data + 2) - 1;
+ tm.tm_mday = g2(t->data + 4);
+ tm.tm_hour = g2(t->data + 6);
+ tm.tm_min = g2(t->data + 8);
+ tm.tm_sec = g2(t->data + 10);
+ if(t->data[12] == 'Z') {
+ offset = 0;
+ } else {
+ xmlSecAssert2(t->length > 16, -1);
+
+ offset = g2(t->data + 13) * 60 + g2(t->data + 15);
+ if(t->data[12] == '-') {
+ offset = -offset;
+ }
+ }
+ tm.tm_isdst = -1;
} else {
- xmlSecAssert2(t->length > 14, -1);
-
- tm.tm_year = g2(t->data) * 100 + g2(t->data + 2);
- tm.tm_mon = g2(t->data + 4) - 1;
- tm.tm_mday = g2(t->data + 6);
- tm.tm_hour = g2(t->data + 8);
- tm.tm_min = g2(t->data + 10);
- tm.tm_sec = g2(t->data + 12);
- if(t->data[14] == 'Z') {
- offset = 0;
- } else {
- xmlSecAssert2(t->length > 18, -1);
-
- offset = g2(t->data + 15) * 60 + g2(t->data + 17);
- if(t->data[14] == '-') {
- offset = -offset;
- }
- }
- tm.tm_isdst = -1;
+ xmlSecAssert2(t->length > 14, -1);
+
+ tm.tm_year = g2(t->data) * 100 + g2(t->data + 2);
+ tm.tm_mon = g2(t->data + 4) - 1;
+ tm.tm_mday = g2(t->data + 6);
+ tm.tm_hour = g2(t->data + 8);
+ tm.tm_min = g2(t->data + 10);
+ tm.tm_sec = g2(t->data + 12);
+ if(t->data[14] == 'Z') {
+ offset = 0;
+ } else {
+ xmlSecAssert2(t->length > 18, -1);
+
+ offset = g2(t->data + 15) * 60 + g2(t->data + 17);
+ if(t->data[14] == '-') {
+ offset = -offset;
+ }
+ }
+ tm.tm_isdst = -1;
}
#undef g2
(*res) = timegm(&tm) - offset * 60;
@@ -1818,13 +1818,13 @@ xmlSecOpenSSLX509CertGetTime(ASN1_TIME* t, time_t* res) {
/**
* xmlSecOpenSSLX509CertGetKey:
- * @cert: the certificate.
+ * @cert: the certificate.
*
* Extracts public key from the @cert.
*
* Returns: public key value or NULL if an error occurs.
*/
-xmlSecKeyDataPtr
+xmlSecKeyDataPtr
xmlSecOpenSSLX509CertGetKey(X509* cert) {
xmlSecKeyDataPtr data;
EVP_PKEY *pKey = NULL;
@@ -1833,23 +1833,23 @@ xmlSecOpenSSLX509CertGetKey(X509* cert) {
pKey = X509_get_pubkey(cert);
if(pKey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "X509_get_pubkey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "X509_get_pubkey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
data = xmlSecOpenSSLEvpKeyAdopt(pKey);
if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLEvpKeyAdopt",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- EVP_PKEY_free(pKey);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLEvpKeyAdopt",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ EVP_PKEY_free(pKey);
+ return(NULL);
}
return(data);
@@ -1864,12 +1864,12 @@ xmlSecOpenSSLX509CertBase64DerRead(xmlChar* buf) {
/* usual trick with base64 decoding "in-place" */
ret = xmlSecBase64Decode(buf, (xmlSecByte*)buf, xmlStrlen(buf));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64Decode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64Decode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(xmlSecOpenSSLX509CertDerRead((xmlSecByte*)buf, ret));
@@ -1886,34 +1886,34 @@ xmlSecOpenSSLX509CertDerRead(const xmlSecByte* buf, xmlSecSize size) {
mem = BIO_new(BIO_s_mem());
if(mem == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BIO_new",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "BIO_s_mem");
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BIO_new",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "BIO_s_mem");
+ return(NULL);
}
ret = BIO_write(mem, buf, size);
if(ret <= 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BIO_write",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "size=%d", size);
- BIO_free_all(mem);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BIO_write",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "size=%d", size);
+ BIO_free_all(mem);
+ return(NULL);
}
cert = d2i_X509_bio(mem, NULL);
if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "d2i_X509_bio",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- BIO_free_all(mem);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "d2i_X509_bio",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ BIO_free_all(mem);
+ return(NULL);
}
BIO_free_all(mem);
@@ -1928,15 +1928,15 @@ xmlSecOpenSSLX509CertBase64DerWrite(X509* cert, int base64LineWrap) {
long size;
xmlSecAssert2(cert != NULL, NULL);
-
+
mem = BIO_new(BIO_s_mem());
if(mem == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BIO_new",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "BIO_s_mem");
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BIO_new",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "BIO_s_mem");
+ return(NULL);
}
/* todo: add error checks */
@@ -1945,24 +1945,24 @@ xmlSecOpenSSLX509CertBase64DerWrite(X509* cert, int base64LineWrap) {
size = BIO_get_mem_data(mem, &p);
if((size <= 0) || (p == NULL)){
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BIO_get_mem_data",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- BIO_free_all(mem);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BIO_get_mem_data",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ BIO_free_all(mem);
+ return(NULL);
}
res = xmlSecBase64Encode(p, size, base64LineWrap);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64Encode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- BIO_free_all(mem);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64Encode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ BIO_free_all(mem);
+ return(NULL);
}
BIO_free_all(mem);
@@ -1978,12 +1978,12 @@ xmlSecOpenSSLX509CrlBase64DerRead(xmlChar* buf) {
/* usual trick with base64 decoding "in-place" */
ret = xmlSecBase64Decode(buf, (xmlSecByte*)buf, xmlStrlen(buf));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64Decode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64Decode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(xmlSecOpenSSLX509CrlDerRead((xmlSecByte*)buf, ret));
@@ -2000,34 +2000,34 @@ xmlSecOpenSSLX509CrlDerRead(xmlSecByte* buf, xmlSecSize size) {
mem = BIO_new(BIO_s_mem());
if(mem == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BIO_new",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "BIO_s_mem");
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BIO_new",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "BIO_s_mem");
+ return(NULL);
}
ret = BIO_write(mem, buf, size);
if(ret <= 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BIO_write",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "size=%d", size);
- BIO_free_all(mem);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BIO_write",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "size=%d", size);
+ BIO_free_all(mem);
+ return(NULL);
}
crl = d2i_X509_CRL_bio(mem, NULL);
if(crl == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "d2i_X509_CRL_bio",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- BIO_free_all(mem);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "d2i_X509_CRL_bio",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ BIO_free_all(mem);
+ return(NULL);
}
BIO_free_all(mem);
@@ -2042,15 +2042,15 @@ xmlSecOpenSSLX509CrlBase64DerWrite(X509_CRL* crl, int base64LineWrap) {
long size;
xmlSecAssert2(crl != NULL, NULL);
-
+
mem = BIO_new(BIO_s_mem());
if(mem == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BIO_new",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "BIO_s_mem");
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BIO_new",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "BIO_s_mem");
+ return(NULL);
}
/* todo: add error checks */
@@ -2059,24 +2059,24 @@ xmlSecOpenSSLX509CrlBase64DerWrite(X509_CRL* crl, int base64LineWrap) {
size = BIO_get_mem_data(mem, &p);
if((size <= 0) || (p == NULL)){
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BIO_get_mem_data",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- BIO_free_all(mem);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BIO_get_mem_data",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ BIO_free_all(mem);
+ return(NULL);
}
res = xmlSecBase64Encode(p, size, base64LineWrap);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64Encode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- BIO_free_all(mem);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64Encode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ BIO_free_all(mem);
+ return(NULL);
}
BIO_free_all(mem);
@@ -2094,19 +2094,19 @@ xmlSecOpenSSLX509NameWrite(X509_NAME* nm) {
mem = BIO_new(BIO_s_mem());
if(mem == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BIO_new",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "BIO_s_mem");
+ NULL,
+ "BIO_new",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "BIO_s_mem");
return(NULL);
}
if (X509_NAME_print_ex(mem, nm, 0, XN_FLAG_RFC2253) <=0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "X509_NAME_print_ex",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "X509_NAME_print_ex",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
BIO_free_all(mem);
return(NULL);
}
@@ -2116,13 +2116,13 @@ xmlSecOpenSSLX509NameWrite(X509_NAME* nm) {
size = BIO_pending(mem);
res = xmlMalloc(size + 1);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlMalloc",
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- BIO_free_all(mem);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlMalloc",
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ BIO_free_all(mem);
+ return(NULL);
}
size = BIO_read(mem, res, size);
@@ -2142,23 +2142,23 @@ xmlSecOpenSSLASN1IntegerWrite(ASN1_INTEGER *asni) {
bn = ASN1_INTEGER_to_BN(asni, NULL);
if(bn == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "ASN1_INTEGER_to_BN",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "ASN1_INTEGER_to_BN",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
p = BN_bn2dec(bn);
if (p == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BN_bn2dec",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- BN_free(bn);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BN_bn2dec",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ BN_free(bn);
+ return(NULL);
}
BN_free(bn);
bn = NULL;
@@ -2169,13 +2169,13 @@ xmlSecOpenSSLASN1IntegerWrite(ASN1_INTEGER *asni) {
*/
res = xmlCharStrdup(p);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlCharStrdup",
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- OPENSSL_free(p);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlCharStrdup",
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ OPENSSL_free(p);
+ return(NULL);
}
OPENSSL_free(p);
p = NULL;
@@ -2193,44 +2193,44 @@ xmlSecOpenSSLX509SKIWrite(X509* cert) {
index = X509_get_ext_by_NID(cert, NID_subject_key_identifier, -1);
if (index < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "Certificate without SubjectKeyIdentifier extension",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "Certificate without SubjectKeyIdentifier extension",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
ext = X509_get_ext(cert, index);
if (ext == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "X509_get_ext",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "X509_get_ext",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
keyId = X509V3_EXT_d2i(ext);
if (keyId == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "X509V3_EXT_d2i",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- M_ASN1_OCTET_STRING_free(keyId);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "X509V3_EXT_d2i",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ M_ASN1_OCTET_STRING_free(keyId);
+ return(NULL);
}
res = xmlSecBase64Encode(M_ASN1_STRING_data(keyId), M_ASN1_STRING_length(keyId), 0);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64Encode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- M_ASN1_OCTET_STRING_free(keyId);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64Encode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ M_ASN1_OCTET_STRING_free(keyId);
+ return(NULL);
}
M_ASN1_OCTET_STRING_free(keyId);
@@ -2246,17 +2246,17 @@ xmlSecOpenSSLX509CertDebugDump(X509* cert, FILE* output) {
xmlSecAssert(output != NULL);
fprintf(output, "==== Subject Name: %s\n",
- X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf)));
+ X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf)));
fprintf(output, "==== Issuer Name: %s\n",
- X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf)));
+ X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf)));
fprintf(output, "==== Issuer Serial: ");
bn = ASN1_INTEGER_to_BN(X509_get_serialNumber(cert),NULL);
if(bn != NULL) {
- BN_print_fp(output, bn);
- BN_free(bn);
- fprintf(output, "\n");
+ BN_print_fp(output, bn);
+ BN_free(bn);
+ fprintf(output, "\n");
} else {
- fprintf(output, "unknown\n");
+ fprintf(output, "unknown\n");
}
}
@@ -2271,21 +2271,21 @@ xmlSecOpenSSLX509CertDebugXmlDump(X509* cert, FILE* output) {
fprintf(output, "<SubjectName>");
xmlSecPrintXmlString(output,
- BAD_CAST X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf))
+ BAD_CAST X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf))
);
fprintf(output, "</SubjectName>\n");
fprintf(output, "<IssuerName>");
xmlSecPrintXmlString(output,
- BAD_CAST X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf)));
+ BAD_CAST X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf)));
fprintf(output, "</IssuerName>\n");
fprintf(output, "<SerialNumber>");
bn = ASN1_INTEGER_to_BN(X509_get_serialNumber(cert),NULL);
if(bn != NULL) {
- BN_print_fp(output, bn);
- BN_free(bn);
+ BN_print_fp(output, bn);
+ BN_free(bn);
}
fprintf(output, "</SerialNumber>\n");
}
@@ -2297,11 +2297,11 @@ xmlSecOpenSSLX509CertDebugXmlDump(X509* cert, FILE* output) {
*
*
*************************************************************************/
-static int xmlSecOpenSSLKeyDataRawX509CertBinRead (xmlSecKeyDataId id,
- xmlSecKeyPtr key,
- const xmlSecByte* buf,
- xmlSecSize bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx);
+static int xmlSecOpenSSLKeyDataRawX509CertBinRead (xmlSecKeyDataId id,
+ xmlSecKeyPtr key,
+ const xmlSecByte* buf,
+ xmlSecSize bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx);
static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataRawX509CertKlass = {
sizeof(xmlSecKeyDataKlass),
@@ -2310,35 +2310,35 @@ static xmlSecKeyDataKlass xmlSecOpenSSLKeyDataRawX509CertKlass = {
/* data */
xmlSecNameRawX509Cert,
xmlSecKeyDataUsageRetrievalMethodNodeBin,
- /* xmlSecKeyDataUsage usage; */
- xmlSecHrefRawX509Cert, /* const xmlChar* href; */
- NULL, /* const xmlChar* dataNodeName; */
- xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
+ /* xmlSecKeyDataUsage usage; */
+ xmlSecHrefRawX509Cert, /* const xmlChar* href; */
+ NULL, /* const xmlChar* dataNodeName; */
+ xmlSecDSigNs, /* const xmlChar* dataNodeNs; */
/* constructors/destructor */
- NULL, /* xmlSecKeyDataInitializeMethod initialize; */
- NULL, /* xmlSecKeyDataDuplicateMethod duplicate; */
- NULL, /* xmlSecKeyDataFinalizeMethod finalize; */
- NULL, /* xmlSecKeyDataGenerateMethod generate; */
+ NULL, /* xmlSecKeyDataInitializeMethod initialize; */
+ NULL, /* xmlSecKeyDataDuplicateMethod duplicate; */
+ NULL, /* xmlSecKeyDataFinalizeMethod finalize; */
+ NULL, /* xmlSecKeyDataGenerateMethod generate; */
/* get info */
- NULL, /* xmlSecKeyDataGetTypeMethod getType; */
- NULL, /* xmlSecKeyDataGetSizeMethod getSize; */
- NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
+ NULL, /* xmlSecKeyDataGetTypeMethod getType; */
+ NULL, /* xmlSecKeyDataGetSizeMethod getSize; */
+ NULL, /* xmlSecKeyDataGetIdentifier getIdentifier; */
/* read/write */
- NULL, /* xmlSecKeyDataXmlReadMethod xmlRead; */
- NULL, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
- xmlSecOpenSSLKeyDataRawX509CertBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
- NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
+ NULL, /* xmlSecKeyDataXmlReadMethod xmlRead; */
+ NULL, /* xmlSecKeyDataXmlWriteMethod xmlWrite; */
+ xmlSecOpenSSLKeyDataRawX509CertBinRead, /* xmlSecKeyDataBinReadMethod binRead; */
+ NULL, /* xmlSecKeyDataBinWriteMethod binWrite; */
/* debug */
- NULL, /* xmlSecKeyDataDebugDumpMethod debugDump; */
- NULL, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
+ NULL, /* xmlSecKeyDataDebugDumpMethod debugDump; */
+ NULL, /* xmlSecKeyDataDebugDumpMethod debugXmlDump; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -2355,8 +2355,8 @@ xmlSecOpenSSLKeyDataRawX509CertGetKlass(void) {
static int
xmlSecOpenSSLKeyDataRawX509CertBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
- const xmlSecByte* buf, xmlSecSize bufSize,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ const xmlSecByte* buf, xmlSecSize bufSize,
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlSecKeyDataPtr data;
X509* cert;
int ret;
@@ -2369,44 +2369,44 @@ xmlSecOpenSSLKeyDataRawX509CertBinRead(xmlSecKeyDataId id, xmlSecKeyPtr key,
cert = xmlSecOpenSSLX509CertDerRead(buf, bufSize);
if(cert == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLX509CertDerRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLX509CertDerRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
data = xmlSecKeyEnsureData(key, xmlSecOpenSSLKeyDataX509Id);
if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecKeyEnsureData",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- X509_free(cert);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecKeyEnsureData",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ X509_free(cert);
+ return(-1);
}
ret = xmlSecOpenSSLKeyDataX509AdoptCert(data, cert);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLKeyDataX509AdoptCert",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- X509_free(cert);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLKeyDataX509AdoptCert",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ X509_free(cert);
+ return(-1);
}
ret = xmlSecOpenSSLKeyDataX509VerifyAndExtractKey(data, key, keyInfoCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
- "xmlSecOpenSSLKeyDataX509VerifyAndExtractKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)),
+ "xmlSecOpenSSLKeyDataX509VerifyAndExtractKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
diff --git a/src/openssl/x509vfy.c b/src/openssl/x509vfy.c
index 7b7f9a5..668d7ad 100644
--- a/src/openssl/x509vfy.c
+++ b/src/openssl/x509vfy.c
@@ -42,17 +42,17 @@
* Internal OpenSSL X509 store CTX
*
*************************************************************************/
-typedef struct _xmlSecOpenSSLX509StoreCtx xmlSecOpenSSLX509StoreCtx,
- *xmlSecOpenSSLX509StoreCtxPtr;
+typedef struct _xmlSecOpenSSLX509StoreCtx xmlSecOpenSSLX509StoreCtx,
+ *xmlSecOpenSSLX509StoreCtxPtr;
struct _xmlSecOpenSSLX509StoreCtx {
- X509_STORE* xst;
- STACK_OF(X509)* untrusted;
+ X509_STORE* xst;
+ STACK_OF(X509)* untrusted;
STACK_OF(X509_CRL)* crls;
#if !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097)
- X509_VERIFY_PARAM * vpm;
+ X509_VERIFY_PARAM * vpm;
#endif /* !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) */
-};
+};
/****************************************************************************
*
@@ -63,54 +63,54 @@ struct _xmlSecOpenSSLX509StoreCtx {
***************************************************************************/
#define xmlSecOpenSSLX509StoreGetCtx(store) \
((xmlSecOpenSSLX509StoreCtxPtr)(((xmlSecByte*)(store)) + \
- sizeof(xmlSecKeyDataStoreKlass)))
-#define xmlSecOpenSSLX509StoreSize \
+ sizeof(xmlSecKeyDataStoreKlass)))
+#define xmlSecOpenSSLX509StoreSize \
(sizeof(xmlSecKeyDataStoreKlass) + sizeof(xmlSecOpenSSLX509StoreCtx))
-static int xmlSecOpenSSLX509StoreInitialize (xmlSecKeyDataStorePtr store);
-static void xmlSecOpenSSLX509StoreFinalize (xmlSecKeyDataStorePtr store);
+static int xmlSecOpenSSLX509StoreInitialize (xmlSecKeyDataStorePtr store);
+static void xmlSecOpenSSLX509StoreFinalize (xmlSecKeyDataStorePtr store);
static xmlSecKeyDataStoreKlass xmlSecOpenSSLX509StoreKlass = {
sizeof(xmlSecKeyDataStoreKlass),
xmlSecOpenSSLX509StoreSize,
/* data */
- xmlSecNameX509Store, /* const xmlChar* name; */
+ xmlSecNameX509Store, /* const xmlChar* name; */
/* constructors/destructor */
- xmlSecOpenSSLX509StoreInitialize, /* xmlSecKeyDataStoreInitializeMethod initialize; */
- xmlSecOpenSSLX509StoreFinalize, /* xmlSecKeyDataStoreFinalizeMethod finalize; */
+ xmlSecOpenSSLX509StoreInitialize, /* xmlSecKeyDataStoreInitializeMethod initialize; */
+ xmlSecOpenSSLX509StoreFinalize, /* xmlSecKeyDataStoreFinalizeMethod finalize; */
/* reserved for the future */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
-static int xmlSecOpenSSLX509VerifyCRL (X509_STORE* xst,
- X509_CRL *crl );
-static X509* xmlSecOpenSSLX509FindCert (STACK_OF(X509) *certs,
- xmlChar *subjectName,
- xmlChar *issuerName,
- xmlChar *issuerSerial,
- xmlChar *ski);
-static X509* xmlSecOpenSSLX509FindNextChainCert (STACK_OF(X509) *chain,
- X509 *cert);
-static int xmlSecOpenSSLX509VerifyCertAgainstCrls (STACK_OF(X509_CRL) *crls,
- X509* cert);
-static X509_NAME* xmlSecOpenSSLX509NameRead (xmlSecByte *str,
- int len);
-static int xmlSecOpenSSLX509NameStringRead (xmlSecByte **str,
- int *strLen,
- xmlSecByte *res,
- int resLen,
- xmlSecByte delim,
- int ingoreTrailingSpaces);
-static int xmlSecOpenSSLX509NamesCompare (X509_NAME *a,
- X509_NAME *b);
-static int xmlSecOpenSSLX509_NAME_cmp (const X509_NAME * a,
- const X509_NAME * b);
-static int xmlSecOpenSSLX509_NAME_ENTRY_cmp (const X509_NAME_ENTRY * const *a,
- const X509_NAME_ENTRY * const *b);
+static int xmlSecOpenSSLX509VerifyCRL (X509_STORE* xst,
+ X509_CRL *crl );
+static X509* xmlSecOpenSSLX509FindCert (STACK_OF(X509) *certs,
+ xmlChar *subjectName,
+ xmlChar *issuerName,
+ xmlChar *issuerSerial,
+ xmlChar *ski);
+static X509* xmlSecOpenSSLX509FindNextChainCert (STACK_OF(X509) *chain,
+ X509 *cert);
+static int xmlSecOpenSSLX509VerifyCertAgainstCrls (STACK_OF(X509_CRL) *crls,
+ X509* cert);
+static X509_NAME* xmlSecOpenSSLX509NameRead (xmlSecByte *str,
+ int len);
+static int xmlSecOpenSSLX509NameStringRead (xmlSecByte **str,
+ int *strLen,
+ xmlSecByte *res,
+ int resLen,
+ xmlSecByte delim,
+ int ingoreTrailingSpaces);
+static int xmlSecOpenSSLX509NamesCompare (X509_NAME *a,
+ X509_NAME *b);
+static int xmlSecOpenSSLX509_NAME_cmp (const X509_NAME * a,
+ const X509_NAME * b);
+static int xmlSecOpenSSLX509_NAME_ENTRY_cmp (const X509_NAME_ENTRY * const *a,
+ const X509_NAME_ENTRY * const *b);
/**
* xmlSecOpenSSLX509StoreGetKlass:
@@ -126,12 +126,12 @@ xmlSecOpenSSLX509StoreGetKlass(void) {
/**
* xmlSecOpenSSLX509StoreFindCert:
- * @store: the pointer to X509 key data store klass.
- * @subjectName: the desired certificate name.
- * @issuerName: the desired certificate issuer name.
- * @issuerSerial: the desired certificate issuer serial number.
- * @ski: the desired certificate SKI.
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
+ * @store: the pointer to X509 key data store klass.
+ * @subjectName: the desired certificate name.
+ * @issuerName: the desired certificate issuer name.
+ * @issuerSerial: the desired certificate issuer serial number.
+ * @ski: the desired certificate SKI.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
*
* Searches @store for a certificate that matches given criteria.
*
@@ -140,8 +140,8 @@ xmlSecOpenSSLX509StoreGetKlass(void) {
*/
X509*
xmlSecOpenSSLX509StoreFindCert(xmlSecKeyDataStorePtr store, xmlChar *subjectName,
- xmlChar *issuerName, xmlChar *issuerSerial,
- xmlChar *ski, xmlSecKeyInfoCtx* keyInfoCtx) {
+ xmlChar *issuerName, xmlChar *issuerSerial,
+ xmlChar *ski, xmlSecKeyInfoCtx* keyInfoCtx) {
xmlSecOpenSSLX509StoreCtxPtr ctx;
X509* res = NULL;
@@ -159,18 +159,18 @@ xmlSecOpenSSLX509StoreFindCert(xmlSecKeyDataStorePtr store, xmlChar *subjectName
/**
* xmlSecOpenSSLX509StoreVerify:
- * @store: the pointer to X509 key data store klass.
- * @certs: the untrusted certificates stack.
- * @crls: the crls stack.
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
+ * @store: the pointer to X509 key data store klass.
+ * @certs: the untrusted certificates stack.
+ * @crls: the crls stack.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> element processing context.
*
* Verifies @certs list.
*
* Returns: pointer to the first verified certificate from @certs.
*/
-X509*
+X509*
xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509* certs,
- XMLSEC_STACK_OF_X509_CRL* crls, xmlSecKeyInfoCtx* keyInfoCtx) {
+ XMLSEC_STACK_OF_X509_CRL* crls, xmlSecKeyInfoCtx* keyInfoCtx) {
xmlSecOpenSSLX509StoreCtxPtr ctx;
STACK_OF(X509)* certs2 = NULL;
STACK_OF(X509_CRL)* crls2 = NULL;
@@ -193,242 +193,242 @@ xmlSecOpenSSLX509StoreVerify(xmlSecKeyDataStorePtr store, XMLSEC_STACK_OF_X509*
/* dup certs */
certs2 = sk_X509_dup(certs);
if(certs2 == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "sk_X509_dup",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "sk_X509_dup",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
/* add untrusted certs from the store */
if(ctx->untrusted != NULL) {
- for(i = 0; i < sk_X509_num(ctx->untrusted); ++i) {
- ret = sk_X509_push(certs2, sk_X509_value(ctx->untrusted, i));
- if(ret < 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "sk_X509_push",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
- }
+ for(i = 0; i < sk_X509_num(ctx->untrusted); ++i) {
+ ret = sk_X509_push(certs2, sk_X509_value(ctx->untrusted, i));
+ if(ret < 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "sk_X509_push",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
+ }
}
/* dup crls but remove all non-verified */
if(crls != NULL) {
- crls2 = sk_X509_CRL_dup(crls);
- if(crls2 == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "sk_X509_CRL_dup",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
-
- for(i = 0; i < sk_X509_CRL_num(crls2); ) {
- ret = xmlSecOpenSSLX509VerifyCRL(ctx->xst, sk_X509_CRL_value(crls2, i));
- if(ret == 1) {
- ++i;
- } else if(ret == 0) {
- sk_X509_CRL_delete(crls2, i);
- } else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "xmlSecOpenSSLX509VerifyCRL",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
- }
+ crls2 = sk_X509_CRL_dup(crls);
+ if(crls2 == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "sk_X509_CRL_dup",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
+
+ for(i = 0; i < sk_X509_CRL_num(crls2); ) {
+ ret = xmlSecOpenSSLX509VerifyCRL(ctx->xst, sk_X509_CRL_value(crls2, i));
+ if(ret == 1) {
+ ++i;
+ } else if(ret == 0) {
+ sk_X509_CRL_delete(crls2, i);
+ } else {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "xmlSecOpenSSLX509VerifyCRL",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
+ }
}
/* remove all revoked certs */
for(i = 0; i < sk_X509_num(certs2);) {
- cert = sk_X509_value(certs2, i);
-
- if(crls2 != NULL) {
- ret = xmlSecOpenSSLX509VerifyCertAgainstCrls(crls2, cert);
- if(ret == 0) {
- sk_X509_delete(certs2, i);
- continue;
- } else if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "xmlSecOpenSSLX509VerifyCertAgainstCrls",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
- }
-
- if(ctx->crls != NULL) {
- ret = xmlSecOpenSSLX509VerifyCertAgainstCrls(ctx->crls, cert);
- if(ret == 0) {
- sk_X509_delete(certs2, i);
- continue;
- } else if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "xmlSecOpenSSLX509VerifyCertAgainstCrls",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
- }
- ++i;
- }
+ cert = sk_X509_value(certs2, i);
+
+ if(crls2 != NULL) {
+ ret = xmlSecOpenSSLX509VerifyCertAgainstCrls(crls2, cert);
+ if(ret == 0) {
+ sk_X509_delete(certs2, i);
+ continue;
+ } else if(ret != 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "xmlSecOpenSSLX509VerifyCertAgainstCrls",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
+ }
+
+ if(ctx->crls != NULL) {
+ ret = xmlSecOpenSSLX509VerifyCertAgainstCrls(ctx->crls, cert);
+ if(ret == 0) {
+ sk_X509_delete(certs2, i);
+ continue;
+ } else if(ret != 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "xmlSecOpenSSLX509VerifyCertAgainstCrls",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
+ }
+ ++i;
+ }
/* get one cert after another and try to verify */
for(i = 0; i < sk_X509_num(certs2); ++i) {
- cert = sk_X509_value(certs2, i);
- if(xmlSecOpenSSLX509FindNextChainCert(certs2, cert) == NULL) {
- X509_STORE_CTX xsc;
+ cert = sk_X509_value(certs2, i);
+ if(xmlSecOpenSSLX509FindNextChainCert(certs2, cert) == NULL) {
+ X509_STORE_CTX xsc;
#if !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097)
- X509_VERIFY_PARAM * vpm = NULL;
- unsigned long vpm_flags = 0;
-
- vpm = X509_VERIFY_PARAM_new();
- if(vpm == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "X509_VERIFY_PARAM_new",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
- vpm_flags = vpm->flags;
+ X509_VERIFY_PARAM * vpm = NULL;
+ unsigned long vpm_flags = 0;
+
+ vpm = X509_VERIFY_PARAM_new();
+ if(vpm == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "X509_VERIFY_PARAM_new",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
+ vpm_flags = vpm->flags;
/*
- vpm_flags &= (~X509_V_FLAG_X509_STRICT);
+ vpm_flags &= (~X509_V_FLAG_X509_STRICT);
*/
- vpm_flags &= (~X509_V_FLAG_CRL_CHECK);
+ vpm_flags &= (~X509_V_FLAG_CRL_CHECK);
- X509_VERIFY_PARAM_set_depth(vpm, 9);
- X509_VERIFY_PARAM_set_flags(vpm, vpm_flags);
+ X509_VERIFY_PARAM_set_depth(vpm, 9);
+ X509_VERIFY_PARAM_set_flags(vpm, vpm_flags);
#endif /* !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) */
- X509_STORE_CTX_init (&xsc, ctx->xst, cert, certs2);
+ X509_STORE_CTX_init (&xsc, ctx->xst, cert, certs2);
- if(keyInfoCtx->certsVerificationTime > 0) {
+ if(keyInfoCtx->certsVerificationTime > 0) {
#if !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097)
- vpm_flags |= X509_V_FLAG_USE_CHECK_TIME;
- X509_VERIFY_PARAM_set_time(vpm, keyInfoCtx->certsVerificationTime);
+ vpm_flags |= X509_V_FLAG_USE_CHECK_TIME;
+ X509_VERIFY_PARAM_set_time(vpm, keyInfoCtx->certsVerificationTime);
#endif /* !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) */
- X509_STORE_CTX_set_time(&xsc, 0, keyInfoCtx->certsVerificationTime);
- }
+ X509_STORE_CTX_set_time(&xsc, 0, keyInfoCtx->certsVerificationTime);
+ }
#if !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097)
- X509_STORE_CTX_set0_param(&xsc, vpm);
+ X509_STORE_CTX_set0_param(&xsc, vpm);
#endif /* !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) */
-
- ret = X509_verify_cert(&xsc);
- err_cert = X509_STORE_CTX_get_current_cert(&xsc);
- err = X509_STORE_CTX_get_error(&xsc);
- depth = X509_STORE_CTX_get_error_depth(&xsc);
-
- X509_STORE_CTX_cleanup (&xsc);
-
- if(ret == 1) {
- res = cert;
- goto done;
- } else if(ret < 0) {
- const char* err_msg;
-
- buf[0] = '\0';
- X509_NAME_oneline(X509_get_subject_name(err_cert), buf, sizeof buf);
- err_msg = X509_verify_cert_error_string(err);
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "X509_verify_cert",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "subj=%s;err=%d;msg=%s",
- xmlSecErrorsSafeString(buf),
- err,
- xmlSecErrorsSafeString(err_msg));
- goto done;
- } else if(ret == 0) {
- const char* err_msg;
-
- buf[0] = '\0';
- X509_NAME_oneline(X509_get_subject_name(err_cert), buf, sizeof buf);
- err_msg = X509_verify_cert_error_string(err);
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "X509_verify_cert",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "subj=%s;err=%d;msg=%s",
- xmlSecErrorsSafeString(buf),
- err,
- xmlSecErrorsSafeString(err_msg));
- }
- }
+
+ ret = X509_verify_cert(&xsc);
+ err_cert = X509_STORE_CTX_get_current_cert(&xsc);
+ err = X509_STORE_CTX_get_error(&xsc);
+ depth = X509_STORE_CTX_get_error_depth(&xsc);
+
+ X509_STORE_CTX_cleanup (&xsc);
+
+ if(ret == 1) {
+ res = cert;
+ goto done;
+ } else if(ret < 0) {
+ const char* err_msg;
+
+ buf[0] = '\0';
+ X509_NAME_oneline(X509_get_subject_name(err_cert), buf, sizeof buf);
+ err_msg = X509_verify_cert_error_string(err);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "X509_verify_cert",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "subj=%s;err=%d;msg=%s",
+ xmlSecErrorsSafeString(buf),
+ err,
+ xmlSecErrorsSafeString(err_msg));
+ goto done;
+ } else if(ret == 0) {
+ const char* err_msg;
+
+ buf[0] = '\0';
+ X509_NAME_oneline(X509_get_subject_name(err_cert), buf, sizeof buf);
+ err_msg = X509_verify_cert_error_string(err);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "X509_verify_cert",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "subj=%s;err=%d;msg=%s",
+ xmlSecErrorsSafeString(buf),
+ err,
+ xmlSecErrorsSafeString(err_msg));
+ }
+ }
}
/* if we came here then we found nothing. do we have any error? */
if((err != 0) && (err_cert != NULL)) {
- const char* err_msg;
-
- err_msg = X509_verify_cert_error_string(err);
- switch (err) {
- case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
- X509_NAME_oneline(X509_get_issuer_name(err_cert), buf, sizeof buf);
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- NULL,
- XMLSEC_ERRORS_R_CERT_ISSUER_FAILED,
- "err=%d;msg=%s;issuer=%s",
- err,
- xmlSecErrorsSafeString(err_msg),
- xmlSecErrorsSafeString(buf));
- break;
- case X509_V_ERR_CERT_NOT_YET_VALID:
- case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- NULL,
- XMLSEC_ERRORS_R_CERT_NOT_YET_VALID,
- "err=%d;msg=%s", err,
- xmlSecErrorsSafeString(err_msg));
- break;
- case X509_V_ERR_CERT_HAS_EXPIRED:
- case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- NULL,
- XMLSEC_ERRORS_R_CERT_HAS_EXPIRED,
- "err=%d;msg=%s", err,
- xmlSecErrorsSafeString(err_msg));
- break;
- default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- NULL,
- XMLSEC_ERRORS_R_CERT_VERIFY_FAILED,
- "err=%d;msg=%s", err,
- xmlSecErrorsSafeString(err_msg));
- }
+ const char* err_msg;
+
+ err_msg = X509_verify_cert_error_string(err);
+ switch (err) {
+ case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
+ X509_NAME_oneline(X509_get_issuer_name(err_cert), buf, sizeof buf);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ NULL,
+ XMLSEC_ERRORS_R_CERT_ISSUER_FAILED,
+ "err=%d;msg=%s;issuer=%s",
+ err,
+ xmlSecErrorsSafeString(err_msg),
+ xmlSecErrorsSafeString(buf));
+ break;
+ case X509_V_ERR_CERT_NOT_YET_VALID:
+ case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ NULL,
+ XMLSEC_ERRORS_R_CERT_NOT_YET_VALID,
+ "err=%d;msg=%s", err,
+ xmlSecErrorsSafeString(err_msg));
+ break;
+ case X509_V_ERR_CERT_HAS_EXPIRED:
+ case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ NULL,
+ XMLSEC_ERRORS_R_CERT_HAS_EXPIRED,
+ "err=%d;msg=%s", err,
+ xmlSecErrorsSafeString(err_msg));
+ break;
+ default:
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ NULL,
+ XMLSEC_ERRORS_R_CERT_VERIFY_FAILED,
+ "err=%d;msg=%s", err,
+ xmlSecErrorsSafeString(err_msg));
+ }
}
done:
if(certs2 != NULL) {
- sk_X509_free(certs2);
+ sk_X509_free(certs2);
}
if(crls2 != NULL) {
- sk_X509_CRL_free(crls2);
+ sk_X509_CRL_free(crls2);
}
return(res);
}
/**
* xmlSecOpenSSLX509StoreAdoptCert:
- * @store: the pointer to X509 key data store klass.
- * @cert: the pointer to OpenSSL X509 certificate.
- * @type: the certificate type (trusted/untrusted).
+ * @store: the pointer to X509 key data store klass.
+ * @cert: the pointer to OpenSSL X509 certificate.
+ * @type: the certificate type (trusted/untrusted).
*
* Adds trusted (root) or untrusted certificate to the store.
*
@@ -460,25 +460,25 @@ xmlSecOpenSSLX509StoreAdoptCert(xmlSecKeyDataStorePtr store, X509* cert, xmlSecK
/* add cert increments the reference */
X509_free(cert);
} else {
- xmlSecAssert2(ctx->untrusted != NULL, -1);
-
- ret = sk_X509_push(ctx->untrusted, cert);
- if(ret < 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "sk_X509_push",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ xmlSecAssert2(ctx->untrusted != NULL, -1);
+
+ ret = sk_X509_push(ctx->untrusted, cert);
+ if(ret < 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "sk_X509_push",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
return(0);
}
/**
* xmlSecOpenSSLX509StoreAdoptCrl:
- * @store: the pointer to X509 key data store klass.
- * @crl: the pointer to OpenSSL X509_CRL.
+ * @store: the pointer to X509 key data store klass.
+ * @crl: the pointer to OpenSSL X509_CRL.
*
* Adds X509 CRL to the store.
*
@@ -494,17 +494,17 @@ xmlSecOpenSSLX509StoreAdoptCrl(xmlSecKeyDataStorePtr store, X509_CRL* crl) {
ctx = xmlSecOpenSSLX509StoreGetCtx(store);
xmlSecAssert2(ctx != NULL, -1);
- xmlSecAssert2(ctx->crls != NULL, -1);
-
- ret = sk_X509_CRL_push(ctx->crls, crl);
- if(ret < 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "sk_X509_CRL_push",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ xmlSecAssert2(ctx->crls != NULL, -1);
+
+ ret = sk_X509_CRL_push(ctx->crls, crl);
+ if(ret < 1) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "sk_X509_CRL_push",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
return (0);
}
@@ -533,22 +533,22 @@ xmlSecOpenSSLX509StoreAddCertsPath(xmlSecKeyDataStorePtr store, const char *path
lookup = X509_STORE_add_lookup(ctx->xst, X509_LOOKUP_hash_dir());
if(lookup == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "X509_STORE_add_lookup",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "X509_STORE_add_lookup",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if(!X509_LOOKUP_add_dir(lookup, path, X509_FILETYPE_PEM)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "X509_LOOKUP_add_dir",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "path='%s'",
- xmlSecErrorsSafeString(path)
- );
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "X509_LOOKUP_add_dir",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "path='%s'",
+ xmlSecErrorsSafeString(path)
+ );
+ return(-1);
}
return(0);
}
@@ -589,9 +589,9 @@ xmlSecOpenSSLX509StoreAddCertsFile(xmlSecKeyDataStorePtr store, const char *file
xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
"X509_LOOKUP_load_file",
XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "file='%s'",
- xmlSecErrorsSafeString(file)
- );
+ "file='%s'",
+ xmlSecErrorsSafeString(file)
+ );
return(-1);
}
return(0);
@@ -612,93 +612,93 @@ xmlSecOpenSSLX509StoreInitialize(xmlSecKeyDataStorePtr store) {
ctx->xst = X509_STORE_new();
if(ctx->xst == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "X509_STORE_new",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "X509_STORE_new",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if(!X509_STORE_set_default_paths(ctx->xst)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "X509_STORE_set_default_paths",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "X509_STORE_set_default_paths",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
-
+
lookup = X509_STORE_add_lookup(ctx->xst, X509_LOOKUP_hash_dir());
if(lookup == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "X509_STORE_add_lookup",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "X509_STORE_add_lookup",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
path = xmlSecOpenSSLGetDefaultTrustedCertsFolder();
if(path != NULL) {
- if(!X509_LOOKUP_add_dir(lookup, (char*)path, X509_FILETYPE_PEM)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "X509_LOOKUP_add_dir",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- "path='%s'",
- xmlSecErrorsSafeString(path)
- );
- return(-1);
- }
+ if(!X509_LOOKUP_add_dir(lookup, (char*)path, X509_FILETYPE_PEM)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "X509_LOOKUP_add_dir",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ "path='%s'",
+ xmlSecErrorsSafeString(path)
+ );
+ return(-1);
+ }
} else {
- if(!X509_LOOKUP_add_dir(lookup, NULL, X509_FILETYPE_DEFAULT)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "X509_LOOKUP_add_dir",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE
- );
- return(-1);
- }
+ if(!X509_LOOKUP_add_dir(lookup, NULL, X509_FILETYPE_DEFAULT)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "X509_LOOKUP_add_dir",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE
+ );
+ return(-1);
+ }
}
ctx->untrusted = sk_X509_new_null();
if(ctx->untrusted == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "sk_X509_new_null",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "sk_X509_new_null",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ctx->crls = sk_X509_CRL_new_null();
if(ctx->crls == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "sk_X509_CRL_new_null",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "sk_X509_CRL_new_null",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
#if !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097)
ctx->vpm = X509_VERIFY_PARAM_new();
if(ctx->vpm == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
- "X509_VERIFY_PARAM_new",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(store)),
+ "X509_VERIFY_PARAM_new",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
- X509_VERIFY_PARAM_set_depth(ctx->vpm, 9); /* the default cert verification path in openssl */
+ X509_VERIFY_PARAM_set_depth(ctx->vpm, 9); /* the default cert verification path in openssl */
X509_STORE_set1_param(ctx->xst, ctx->vpm);
#else /* !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) */
- ctx->xst->depth = 9; /* the default cert verification path in openssl */
+ ctx->xst->depth = 9; /* the default cert verification path in openssl */
#endif /* !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) */
return(0);
@@ -714,17 +714,17 @@ xmlSecOpenSSLX509StoreFinalize(xmlSecKeyDataStorePtr store) {
if(ctx->xst != NULL) {
- X509_STORE_free(ctx->xst);
+ X509_STORE_free(ctx->xst);
}
if(ctx->untrusted != NULL) {
- sk_X509_pop_free(ctx->untrusted, X509_free);
+ sk_X509_pop_free(ctx->untrusted, X509_free);
}
if(ctx->crls != NULL) {
- sk_X509_CRL_pop_free(ctx->crls, X509_CRL_free);
+ sk_X509_CRL_pop_free(ctx->crls, X509_CRL_free);
}
#if !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097)
if(ctx->vpm != NULL) {
- X509_VERIFY_PARAM_free(ctx->vpm);
+ X509_VERIFY_PARAM_free(ctx->vpm);
}
#endif /* !defined(XMLSEC_OPENSSL_096) && !defined(XMLSEC_OPENSSL_097) */
@@ -749,42 +749,42 @@ xmlSecOpenSSLX509VerifyCRL(X509_STORE* xst, X509_CRL *crl ) {
X509_STORE_CTX_init(&xsc, xst, NULL, NULL);
ret = X509_STORE_get_by_subject(&xsc, X509_LU_X509,
- X509_CRL_get_issuer(crl), &xobj);
+ X509_CRL_get_issuer(crl), &xobj);
if(ret <= 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "X509_STORE_get_by_subject",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "X509_STORE_get_by_subject",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
pkey = X509_get_pubkey(xobj.data.x509);
X509_OBJECT_free_contents(&xobj);
if(pkey == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "X509_get_pubkey",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "X509_get_pubkey",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = X509_CRL_verify(crl, pkey);
EVP_PKEY_free(pkey);
if(ret != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "X509_CRL_verify",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "X509_CRL_verify",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
}
X509_STORE_CTX_cleanup (&xsc);
return((ret == 1) ? 1 : 0);
}
-static X509*
+static X509*
xmlSecOpenSSLX509FindCert(STACK_OF(X509) *certs, xmlChar *subjectName,
- xmlChar *issuerName, xmlChar *issuerSerial,
- xmlChar *ski) {
+ xmlChar *issuerName, xmlChar *issuerSerial,
+ xmlChar *ski) {
X509 *cert = NULL;
int i;
@@ -792,126 +792,126 @@ xmlSecOpenSSLX509FindCert(STACK_OF(X509) *certs, xmlChar *subjectName,
/* todo: may be this is not the fastest way to search certs */
if(subjectName != NULL) {
- X509_NAME *nm;
- X509_NAME *subj;
-
- nm = xmlSecOpenSSLX509NameRead(subjectName, xmlStrlen(subjectName));
- if(nm == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLX509NameRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "subject=%s",
- xmlSecErrorsSafeString(subjectName));
- return(NULL);
- }
-
- for(i = 0; i < sk_X509_num(certs); ++i) {
- cert = sk_X509_value(certs, i);
- subj = X509_get_subject_name(cert);
- if(xmlSecOpenSSLX509NamesCompare(nm, subj) == 0) {
- X509_NAME_free(nm);
- return(cert);
- }
- }
- X509_NAME_free(nm);
+ X509_NAME *nm;
+ X509_NAME *subj;
+
+ nm = xmlSecOpenSSLX509NameRead(subjectName, xmlStrlen(subjectName));
+ if(nm == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLX509NameRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "subject=%s",
+ xmlSecErrorsSafeString(subjectName));
+ return(NULL);
+ }
+
+ for(i = 0; i < sk_X509_num(certs); ++i) {
+ cert = sk_X509_value(certs, i);
+ subj = X509_get_subject_name(cert);
+ if(xmlSecOpenSSLX509NamesCompare(nm, subj) == 0) {
+ X509_NAME_free(nm);
+ return(cert);
+ }
+ }
+ X509_NAME_free(nm);
} else if((issuerName != NULL) && (issuerSerial != NULL)) {
- X509_NAME *nm;
- X509_NAME *issuer;
- BIGNUM *bn;
- ASN1_INTEGER *serial;
-
- nm = xmlSecOpenSSLX509NameRead(issuerName, xmlStrlen(issuerName));
- if(nm == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLX509NameRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "issuer=%s",
- xmlSecErrorsSafeString(issuerName));
- return(NULL);
- }
-
- bn = BN_new();
- if(bn == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BN_new",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- X509_NAME_free(nm);
- return(NULL);
- }
- if(BN_dec2bn(&bn, (char*)issuerSerial) == 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BN_dec2bn",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- BN_free(bn);
- X509_NAME_free(nm);
- return(NULL);
- }
-
- serial = BN_to_ASN1_INTEGER(bn, NULL);
- if(serial == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "BN_to_ASN1_INTEGER",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- BN_free(bn);
- X509_NAME_free(nm);
- return(NULL);
- }
- BN_free(bn);
-
-
- for(i = 0; i < sk_X509_num(certs); ++i) {
- cert = sk_X509_value(certs, i);
- if(ASN1_INTEGER_cmp(X509_get_serialNumber(cert), serial) != 0) {
- continue;
- }
- issuer = X509_get_issuer_name(cert);
- if(xmlSecOpenSSLX509NamesCompare(nm, issuer) == 0) {
- ASN1_INTEGER_free(serial);
- X509_NAME_free(nm);
- return(cert);
- }
- }
+ X509_NAME *nm;
+ X509_NAME *issuer;
+ BIGNUM *bn;
+ ASN1_INTEGER *serial;
+
+ nm = xmlSecOpenSSLX509NameRead(issuerName, xmlStrlen(issuerName));
+ if(nm == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLX509NameRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "issuer=%s",
+ xmlSecErrorsSafeString(issuerName));
+ return(NULL);
+ }
+
+ bn = BN_new();
+ if(bn == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BN_new",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ X509_NAME_free(nm);
+ return(NULL);
+ }
+ if(BN_dec2bn(&bn, (char*)issuerSerial) == 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BN_dec2bn",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ BN_free(bn);
+ X509_NAME_free(nm);
+ return(NULL);
+ }
+
+ serial = BN_to_ASN1_INTEGER(bn, NULL);
+ if(serial == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "BN_to_ASN1_INTEGER",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ BN_free(bn);
+ X509_NAME_free(nm);
+ return(NULL);
+ }
+ BN_free(bn);
+
+
+ for(i = 0; i < sk_X509_num(certs); ++i) {
+ cert = sk_X509_value(certs, i);
+ if(ASN1_INTEGER_cmp(X509_get_serialNumber(cert), serial) != 0) {
+ continue;
+ }
+ issuer = X509_get_issuer_name(cert);
+ if(xmlSecOpenSSLX509NamesCompare(nm, issuer) == 0) {
+ ASN1_INTEGER_free(serial);
+ X509_NAME_free(nm);
+ return(cert);
+ }
+ }
X509_NAME_free(nm);
- ASN1_INTEGER_free(serial);
+ ASN1_INTEGER_free(serial);
} else if(ski != NULL) {
- int len;
- int index;
- X509_EXTENSION *ext;
- ASN1_OCTET_STRING *keyId;
-
- /* our usual trick with base64 decode */
- len = xmlSecBase64Decode(ski, (xmlSecByte*)ski, xmlStrlen(ski));
- if(len < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64Decode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "ski=%s",
- xmlSecErrorsSafeString(ski));
- return(NULL);
- }
- for(i = 0; i < sk_X509_num(certs); ++i) {
- cert = sk_X509_value(certs, i);
- index = X509_get_ext_by_NID(cert, NID_subject_key_identifier, -1);
- if((index >= 0) && (ext = X509_get_ext(cert, index))) {
- keyId = X509V3_EXT_d2i(ext);
- if((keyId != NULL) && (keyId->length == len) &&
- (memcmp(keyId->data, ski, len) == 0)) {
- M_ASN1_OCTET_STRING_free(keyId);
- return(cert);
- }
- M_ASN1_OCTET_STRING_free(keyId);
- }
- }
+ int len;
+ int index;
+ X509_EXTENSION *ext;
+ ASN1_OCTET_STRING *keyId;
+
+ /* our usual trick with base64 decode */
+ len = xmlSecBase64Decode(ski, (xmlSecByte*)ski, xmlStrlen(ski));
+ if(len < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64Decode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "ski=%s",
+ xmlSecErrorsSafeString(ski));
+ return(NULL);
+ }
+ for(i = 0; i < sk_X509_num(certs); ++i) {
+ cert = sk_X509_value(certs, i);
+ index = X509_get_ext_by_NID(cert, NID_subject_key_identifier, -1);
+ if((index >= 0) && (ext = X509_get_ext(cert, index))) {
+ keyId = X509V3_EXT_d2i(ext);
+ if((keyId != NULL) && (keyId->length == len) &&
+ (memcmp(keyId->data, ski, len) == 0)) {
+ M_ASN1_OCTET_STRING_free(keyId);
+ return(cert);
+ }
+ M_ASN1_OCTET_STRING_free(keyId);
+ }
+ }
}
return(NULL);
@@ -927,11 +927,11 @@ xmlSecOpenSSLX509FindNextChainCert(STACK_OF(X509) *chain, X509 *cert) {
certSubjHash = X509_subject_name_hash(cert);
for(i = 0; i < sk_X509_num(chain); ++i) {
- if((sk_X509_value(chain, i) != cert) &&
- (X509_issuer_name_hash(sk_X509_value(chain, i)) == certSubjHash)) {
+ if((sk_X509_value(chain, i) != cert) &&
+ (X509_issuer_name_hash(sk_X509_value(chain, i)) == certSubjHash)) {
- return(sk_X509_value(chain, i));
- }
+ return(sk_X509_value(chain, i));
+ }
}
return(NULL);
}
@@ -953,19 +953,19 @@ xmlSecOpenSSLX509VerifyCertAgainstCrls(STACK_OF(X509_CRL) *crls, X509* cert) {
*/
n = sk_X509_CRL_num(crls);
for(i = 0; i < n; i++) {
- crl = sk_X509_CRL_value(crls, i);
- if(crl == NULL) {
- continue;
- }
-
- issuer = X509_CRL_get_issuer(crl);
- if(xmlSecOpenSSLX509NamesCompare(X509_CRL_get_issuer(crl), issuer) == 0) {
- break;
- }
+ crl = sk_X509_CRL_value(crls, i);
+ if(crl == NULL) {
+ continue;
+ }
+
+ issuer = X509_CRL_get_issuer(crl);
+ if(xmlSecOpenSSLX509NamesCompare(X509_CRL_get_issuer(crl), issuer) == 0) {
+ break;
+ }
}
if((i >= n) || (crl == NULL)){
- /* no crls for this issuer */
- return(1);
+ /* no crls for this issuer */
+ return(1);
}
/*
@@ -973,8 +973,8 @@ xmlSecOpenSSLX509VerifyCertAgainstCrls(STACK_OF(X509_CRL) *crls, X509* cert) {
*/
ret = X509_cmp_current_time(X509_CRL_get_nextUpdate(crl));
if (ret == 0) {
- /* crl expired */
- return(1);
+ /* crl expired */
+ return(1);
}
/*
@@ -984,12 +984,12 @@ xmlSecOpenSSLX509VerifyCertAgainstCrls(STACK_OF(X509_CRL) *crls, X509* cert) {
for (i = 0; i < n; i++) {
revoked = sk_X509_REVOKED_value(X509_CRL_get_REVOKED(crl), i);
if (ASN1_INTEGER_cmp(revoked->serialNumber, X509_get_serialNumber(cert)) == 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_CERT_REVOKED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_CERT_REVOKED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(0);
}
}
return(1);
@@ -1007,109 +1007,109 @@ xmlSecOpenSSLX509NameRead(xmlSecByte *str, int len) {
nm = X509_NAME_new();
if(nm == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "X509_NAME_new",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "X509_NAME_new",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
while(len > 0) {
- /* skip spaces after comma or semicolon */
- while((len > 0) && isspace(*str)) {
- ++str; --len;
- }
-
- nameLen = xmlSecOpenSSLX509NameStringRead(&str, &len, name, sizeof(name), '=', 0);
- if(nameLen < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLX509NameStringRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- X509_NAME_free(nm);
- return(NULL);
- }
- name[nameLen] = '\0';
- if(len > 0) {
- ++str; --len;
- if((*str) == '\"') {
- ++str; --len;
- valueLen = xmlSecOpenSSLX509NameStringRead(&str, &len,
- value, sizeof(value), '"', 1);
- if(valueLen < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLX509NameStringRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- X509_NAME_free(nm);
- return(NULL);
- }
-
- /* skip quote */
- if((len <= 0) || ((*str) != '\"')) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "quote is expected:%s",
- xmlSecErrorsSafeString(str));
- X509_NAME_free(nm);
- return(NULL);
- }
+ /* skip spaces after comma or semicolon */
+ while((len > 0) && isspace(*str)) {
+ ++str; --len;
+ }
+
+ nameLen = xmlSecOpenSSLX509NameStringRead(&str, &len, name, sizeof(name), '=', 0);
+ if(nameLen < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLX509NameStringRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ X509_NAME_free(nm);
+ return(NULL);
+ }
+ name[nameLen] = '\0';
+ if(len > 0) {
+ ++str; --len;
+ if((*str) == '\"') {
+ ++str; --len;
+ valueLen = xmlSecOpenSSLX509NameStringRead(&str, &len,
+ value, sizeof(value), '"', 1);
+ if(valueLen < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLX509NameStringRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ X509_NAME_free(nm);
+ return(NULL);
+ }
+
+ /* skip quote */
+ if((len <= 0) || ((*str) != '\"')) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "quote is expected:%s",
+ xmlSecErrorsSafeString(str));
+ X509_NAME_free(nm);
+ return(NULL);
+ }
++str; --len;
- /* skip spaces before comma or semicolon */
- while((len > 0) && isspace(*str)) {
- ++str; --len;
- }
- if((len > 0) && ((*str) != ',')) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "comma is expected:%s",
- xmlSecErrorsSafeString(str));
- X509_NAME_free(nm);
- return(NULL);
- }
- if(len > 0) {
- ++str; --len;
- }
- type = MBSTRING_ASC;
- } else if((*str) == '#') {
- /* TODO: read octect values */
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "reading octect values is not implemented yet");
- X509_NAME_free(nm);
- return(NULL);
- } else {
- valueLen = xmlSecOpenSSLX509NameStringRead(&str, &len,
- value, sizeof(value), ',', 1);
- if(valueLen < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecOpenSSLX509NameStringRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- X509_NAME_free(nm);
- return(NULL);
- }
- type = MBSTRING_ASC;
- }
- } else {
- valueLen = 0;
- }
- value[valueLen] = '\0';
- if(len > 0) {
- ++str; --len;
- }
- X509_NAME_add_entry_by_txt(nm, (char*)name, type, value, valueLen, -1, 0);
+ /* skip spaces before comma or semicolon */
+ while((len > 0) && isspace(*str)) {
+ ++str; --len;
+ }
+ if((len > 0) && ((*str) != ',')) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "comma is expected:%s",
+ xmlSecErrorsSafeString(str));
+ X509_NAME_free(nm);
+ return(NULL);
+ }
+ if(len > 0) {
+ ++str; --len;
+ }
+ type = MBSTRING_ASC;
+ } else if((*str) == '#') {
+ /* TODO: read octect values */
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "reading octect values is not implemented yet");
+ X509_NAME_free(nm);
+ return(NULL);
+ } else {
+ valueLen = xmlSecOpenSSLX509NameStringRead(&str, &len,
+ value, sizeof(value), ',', 1);
+ if(valueLen < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecOpenSSLX509NameStringRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ X509_NAME_free(nm);
+ return(NULL);
+ }
+ type = MBSTRING_ASC;
+ }
+ } else {
+ valueLen = 0;
+ }
+ value[valueLen] = '\0';
+ if(len > 0) {
+ ++str; --len;
+ }
+ X509_NAME_add_entry_by_txt(nm, (char*)name, type, value, valueLen, -1, 0);
}
return(nm);
@@ -1117,8 +1117,8 @@ xmlSecOpenSSLX509NameRead(xmlSecByte *str, int len) {
static int
xmlSecOpenSSLX509NameStringRead(xmlSecByte **str, int *strLen,
- xmlSecByte *res, int resLen,
- xmlSecByte delim, int ingoreTrailingSpaces) {
+ xmlSecByte *res, int resLen,
+ xmlSecByte delim, int ingoreTrailingSpaces) {
xmlSecByte *p, *q, *nonSpace;
xmlSecAssert2(str != NULL, -1);
@@ -1128,43 +1128,43 @@ xmlSecOpenSSLX509NameStringRead(xmlSecByte **str, int *strLen,
p = (*str);
nonSpace = q = res;
while(((p - (*str)) < (*strLen)) && ((*p) != delim) && ((q - res) < resLen)) {
- if((*p) != '\\') {
- if(ingoreTrailingSpaces && !isspace(*p)) nonSpace = q;
- *(q++) = *(p++);
- } else {
- ++p;
- nonSpace = q;
- if(xmlSecIsHex((*p))) {
- if((p - (*str) + 1) >= (*strLen)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "two hex digits expected");
- return(-1);
- }
- *(q++) = xmlSecGetHex(p[0]) * 16 + xmlSecGetHex(p[1]);
- p += 2;
- } else {
- if(((++p) - (*str)) >= (*strLen)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "escaped symbol missed");
- return(-1);
- }
- *(q++) = *(p++);
- }
- }
+ if((*p) != '\\') {
+ if(ingoreTrailingSpaces && !isspace(*p)) nonSpace = q;
+ *(q++) = *(p++);
+ } else {
+ ++p;
+ nonSpace = q;
+ if(xmlSecIsHex((*p))) {
+ if((p - (*str) + 1) >= (*strLen)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "two hex digits expected");
+ return(-1);
+ }
+ *(q++) = xmlSecGetHex(p[0]) * 16 + xmlSecGetHex(p[1]);
+ p += 2;
+ } else {
+ if(((++p) - (*str)) >= (*strLen)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "escaped symbol missed");
+ return(-1);
+ }
+ *(q++) = *(p++);
+ }
+ }
}
if(((p - (*str)) < (*strLen)) && ((*p) != delim)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_SIZE,
- "buffer is too small");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_SIZE,
+ "buffer is too small");
+ return(-1);
}
(*strLen) -= (p - (*str));
(*str) = p;
@@ -1178,20 +1178,20 @@ int xmlSecOpenSSLX509_NAME_cmp(const X509_NAME * a, const X509_NAME * b) {
xmlSecAssert2(a != NULL, -1);
xmlSecAssert2(b != NULL, 1);
-
+
if (sk_X509_NAME_ENTRY_num(a->entries) != sk_X509_NAME_ENTRY_num(b->entries)) {
- return sk_X509_NAME_ENTRY_num(a->entries) - sk_X509_NAME_ENTRY_num(b->entries);
+ return sk_X509_NAME_ENTRY_num(a->entries) - sk_X509_NAME_ENTRY_num(b->entries);
}
-
+
for (i=sk_X509_NAME_ENTRY_num(a->entries)-1; i>=0; i--) {
- na=sk_X509_NAME_ENTRY_value(a->entries,i);
- nb=sk_X509_NAME_ENTRY_value(b->entries,i);
-
- ret = xmlSecOpenSSLX509_NAME_ENTRY_cmp(&na, &nb);
- if(ret != 0) {
- return(ret);
- }
- }
+ na=sk_X509_NAME_ENTRY_value(a->entries,i);
+ nb=sk_X509_NAME_ENTRY_value(b->entries,i);
+
+ ret = xmlSecOpenSSLX509_NAME_ENTRY_cmp(&na, &nb);
+ if(ret != 0) {
+ return(ret);
+ }
+ }
return(0);
}
@@ -1214,20 +1214,20 @@ xmlSecOpenSSLX509NamesCompare(X509_NAME *a, X509_NAME *b) {
a1 = X509_NAME_dup(a);
if(a1 == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "X509_NAME_dup",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "X509_NAME_dup",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
b1 = X509_NAME_dup(b);
if(b1 == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "X509_NAME_dup",
- XMLSEC_ERRORS_R_CRYPTO_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "X509_NAME_dup",
+ XMLSEC_ERRORS_R_CRYPTO_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(1);
}
@@ -1257,21 +1257,21 @@ xmlSecOpenSSLX509_NAME_ENTRY_cmp(const X509_NAME_ENTRY * const *a, const X509_NA
/* first compare values */
if(((*a)->value == NULL) && ((*b)->value != NULL)) {
- return(-1);
+ return(-1);
} else if(((*a)->value != NULL) && ((*b)->value == NULL)) {
- return(1);
+ return(1);
} else if(((*a)->value == NULL) && ((*b)->value == NULL)) {
- return(0);
- }
+ return(0);
+ }
ret = (*a)->value->length - (*b)->value->length;
if(ret != 0) {
- return(ret);
+ return(ret);
}
-
+
ret = memcmp((*a)->value->data, (*b)->value->data, (*a)->value->length);
if(ret != 0) {
- return(ret);
+ return(ret);
}
/* next compare names */
diff --git a/src/parser.c b/src/parser.c
index 74c1522..399b160 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -29,11 +29,11 @@
* Internal parser
*
*****************************************************************************/
-typedef struct _xmlSecParserCtx xmlSecParserCtx,
- *xmlSecParserCtxPtr;
+typedef struct _xmlSecParserCtx xmlSecParserCtx,
+ *xmlSecParserCtxPtr;
struct _xmlSecParserCtx {
- xmlParserCtxtPtr parserCtx;
-};
+ xmlParserCtxtPtr parserCtx;
+};
/**************************************************************************
*
@@ -42,49 +42,49 @@ struct _xmlSecParserCtx {
* xmlSecParserCtx is located after xmlSecTransform
*
***************************************************************************/
-#define xmlSecParserSize \
- (sizeof(xmlSecTransform) + sizeof(xmlSecParserCtx))
+#define xmlSecParserSize \
+ (sizeof(xmlSecTransform) + sizeof(xmlSecParserCtx))
#define xmlSecParserGetCtx(transform) \
((xmlSecTransformCheckSize((transform), xmlSecParserSize)) ? \
- ((xmlSecParserCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform))) : \
- (xmlSecParserCtxPtr)NULL)
-
-static int xmlSecParserInitialize (xmlSecTransformPtr transform);
-static void xmlSecParserFinalize (xmlSecTransformPtr transform);
-static int xmlSecParserPushBin (xmlSecTransformPtr transform,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- int final,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecParserPopXml (xmlSecTransformPtr transform,
- xmlSecNodeSetPtr* nodes,
- xmlSecTransformCtxPtr transformCtx);
+ ((xmlSecParserCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform))) : \
+ (xmlSecParserCtxPtr)NULL)
+
+static int xmlSecParserInitialize (xmlSecTransformPtr transform);
+static void xmlSecParserFinalize (xmlSecTransformPtr transform);
+static int xmlSecParserPushBin (xmlSecTransformPtr transform,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ int final,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecParserPopXml (xmlSecTransformPtr transform,
+ xmlSecNodeSetPtr* nodes,
+ xmlSecTransformCtxPtr transformCtx);
static xmlSecTransformKlass xmlSecParserKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecParserSize, /* xmlSecSize objSize */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecParserSize, /* xmlSecSize objSize */
- BAD_CAST "xml-parser", /* const xmlChar* name; */
- NULL, /* const xmlChar* href; */
- xmlSecTransformUsageDSigTransform, /* xmlSecTransformUsage usage; */
+ BAD_CAST "xml-parser", /* const xmlChar* name; */
+ NULL, /* const xmlChar* href; */
+ xmlSecTransformUsageDSigTransform, /* xmlSecTransformUsage usage; */
- xmlSecParserInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecParserFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecParserPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- NULL, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- xmlSecParserPopXml, /* xmlSecTransformPopXmlMethod popXml; */
- NULL, /* xmlSecTransformExecuteMethod execute; */
-
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ xmlSecParserInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecParserFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecParserPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ NULL, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ xmlSecParserPopXml, /* xmlSecTransformPopXmlMethod popXml; */
+ NULL, /* xmlSecTransformExecuteMethod execute; */
+
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -125,14 +125,14 @@ xmlSecParserFinalize(xmlSecTransformPtr transform) {
xmlSecAssert(ctx != NULL);
if(ctx->parserCtx != NULL) {
- xmlFreeParserCtxt(ctx->parserCtx);
+ xmlFreeParserCtxt(ctx->parserCtx);
}
memset(ctx, 0, sizeof(xmlSecParserCtx));
}
static int
xmlSecParserPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
- xmlSecSize dataSize, int final, xmlSecTransformCtxPtr transformCtx) {
+ xmlSecSize dataSize, int final, xmlSecTransformCtxPtr transformCtx) {
xmlSecParserCtxPtr ctx;
int ret;
@@ -144,91 +144,91 @@ xmlSecParserPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
/* check/update current transform status */
if(transform->status == xmlSecTransformStatusNone) {
- xmlSecAssert2(ctx->parserCtx == NULL, -1);
-
- ctx->parserCtx = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, NULL);
- if(ctx->parserCtx == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlCreatePushParserCtxt",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ xmlSecAssert2(ctx->parserCtx == NULL, -1);
+
+ ctx->parserCtx = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, NULL);
+ if(ctx->parserCtx == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlCreatePushParserCtxt",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
/* required for c14n! */
- ctx->parserCtx->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
- ctx->parserCtx->replaceEntities = 1;
+ ctx->parserCtx->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
+ ctx->parserCtx->replaceEntities = 1;
- transform->status = xmlSecTransformStatusWorking;
+ transform->status = xmlSecTransformStatusWorking;
} else if(transform->status == xmlSecTransformStatusFinished) {
- return(0);
+ return(0);
} else if(transform->status != xmlSecTransformStatusWorking) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
xmlSecAssert2(transform->status == xmlSecTransformStatusWorking, -1);
xmlSecAssert2(ctx->parserCtx != NULL, -1);
/* push data to the input buffer */
if((data != NULL) && (dataSize > 0)) {
- ret = xmlParseChunk(ctx->parserCtx, (const char*)data, dataSize, 0);
- if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlParseChunk",
- XMLSEC_ERRORS_R_XML_FAILED,
- "size=%d", dataSize);
- return(-1);
- }
+ ret = xmlParseChunk(ctx->parserCtx, (const char*)data, dataSize, 0);
+ if(ret != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlParseChunk",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "size=%d", dataSize);
+ return(-1);
+ }
}
/* finish parsing and push to next in the chain */
if(final != 0) {
- ret = xmlParseChunk(ctx->parserCtx, NULL, 0, 1);
- if((ret != 0) || (ctx->parserCtx->myDoc == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlParseChunk",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- /* todo: check that document is well formed? */
- transform->outNodes = xmlSecNodeSetCreate(ctx->parserCtx->myDoc,
- NULL, xmlSecNodeSetTree);
- if(transform->outNodes == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecNodeSetCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFreeDoc(ctx->parserCtx->myDoc);
- ctx->parserCtx->myDoc = NULL;
- return(-1);
- }
- xmlSecNodeSetDocDestroy(transform->outNodes); /* this node set "owns" the doc pointer */
- ctx->parserCtx->myDoc = NULL;
-
- /* push result to the next transform (if exist) */
- if(transform->next != NULL) {
- ret = xmlSecTransformPushXml(transform->next, transform->outNodes, transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformPushXml",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- }
-
- transform->status = xmlSecTransformStatusFinished;
+ ret = xmlParseChunk(ctx->parserCtx, NULL, 0, 1);
+ if((ret != 0) || (ctx->parserCtx->myDoc == NULL)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlParseChunk",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ /* todo: check that document is well formed? */
+ transform->outNodes = xmlSecNodeSetCreate(ctx->parserCtx->myDoc,
+ NULL, xmlSecNodeSetTree);
+ if(transform->outNodes == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecNodeSetCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFreeDoc(ctx->parserCtx->myDoc);
+ ctx->parserCtx->myDoc = NULL;
+ return(-1);
+ }
+ xmlSecNodeSetDocDestroy(transform->outNodes); /* this node set "owns" the doc pointer */
+ ctx->parserCtx->myDoc = NULL;
+
+ /* push result to the next transform (if exist) */
+ if(transform->next != NULL) {
+ ret = xmlSecTransformPushXml(transform->next, transform->outNodes, transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecTransformPushXml",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ }
+
+ transform->status = xmlSecTransformStatusFinished;
}
return(0);
@@ -236,7 +236,7 @@ xmlSecParserPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
static int
xmlSecParserPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecParserCtxPtr ctx;
xmlParserInputBufferPtr buf;
xmlParserInputPtr input;
@@ -254,77 +254,77 @@ xmlSecParserPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
/* check/update current transform status */
switch(transform->status) {
case xmlSecTransformStatusNone:
- transform->status = xmlSecTransformStatusWorking;
- break;
+ transform->status = xmlSecTransformStatusWorking;
+ break;
case xmlSecTransformStatusWorking:
- /* just do nothing */
- break;
+ /* just do nothing */
+ break;
case xmlSecTransformStatusFinished:
- (*nodes) = NULL;
- return(0);
+ (*nodes) = NULL;
+ return(0);
default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
xmlSecAssert2(transform->status == xmlSecTransformStatusWorking, -1);
/* prepare parser context */
if(transform->prev == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- "prev transform is null");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ "prev transform is null");
+ return(-1);
}
buf = xmlSecTransformCreateInputBuffer(transform->prev, transformCtx);
if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformCreateInputBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecTransformCreateInputBuffer",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ctxt = xmlNewParserCtxt();
if (ctxt == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlNewParserCtxt",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFreeParserInputBuffer(buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlNewParserCtxt",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFreeParserInputBuffer(buf);
+ return(-1);
}
input = xmlNewIOInputStream(ctxt, buf, XML_CHAR_ENCODING_NONE);
if(input == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlNewParserCtxt",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFreeParserCtxt(ctxt);
- xmlFreeParserInputBuffer(buf);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlNewParserCtxt",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFreeParserCtxt(ctxt);
+ xmlFreeParserInputBuffer(buf);
+ return(-1);
}
ret = inputPush(ctxt, input);
if(input == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "inputPush",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFreeInputStream(input);
- xmlFreeParserCtxt(ctxt);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "inputPush",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFreeInputStream(input);
+ xmlFreeParserCtxt(ctxt);
+ return(-1);
}
/* required for c14n! */
@@ -334,17 +334,17 @@ xmlSecParserPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
/* finaly do the parsing */
ret = xmlParseDocument(ctxt);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlParseDocument",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- if(ctxt->myDoc != NULL) {
- xmlFreeDoc(ctxt->myDoc);
- ctxt->myDoc = NULL;
- }
- xmlFreeParserCtxt(ctxt);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlParseDocument",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ if(ctxt->myDoc != NULL) {
+ xmlFreeDoc(ctxt->myDoc);
+ ctxt->myDoc = NULL;
+ }
+ xmlFreeParserCtxt(ctxt);
+ return(-1);
}
/* remember the result and free parsing context */
@@ -355,14 +355,14 @@ xmlSecParserPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
/* return result to the caller */
(*nodes) = xmlSecNodeSetCreate(doc, NULL, xmlSecNodeSetTree);
if((*nodes) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecNodeSetCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFreeDoc(doc);
- return(-1);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecNodeSetCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFreeDoc(doc);
+ return(-1);
+ }
xmlSecNodeSetDocDestroy((*nodes)); /* this node set "owns" the doc pointer */
transform->status = xmlSecTransformStatusFinished;
return(0);
@@ -374,17 +374,17 @@ xmlSecParserPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
*
*************************************************************************/
typedef struct _xmlSecExtMemoryParserCtx {
- const xmlSecByte *prefix;
- xmlSecSize prefixSize;
- const xmlSecByte *buffer;
- xmlSecSize bufferSize;
- const xmlSecByte *postfix;
- xmlSecSize postfixSize;
+ const xmlSecByte *prefix;
+ xmlSecSize prefixSize;
+ const xmlSecByte *buffer;
+ xmlSecSize bufferSize;
+ const xmlSecByte *postfix;
+ xmlSecSize postfixSize;
} xmlSecExtMemoryParserCtx, *xmlSecExtMemoryParserCtxPtr;
/**
* xmlSecParseFile:
- * @filename: the filename.
+ * @filename: the filename.
*
* Loads XML Doc from file @filename. We need a special version because of
* c14n issue. The code is copied from xmlSAXParseFileWithData() function.
@@ -402,7 +402,7 @@ xmlSecParseFile(const char *filename) {
xmlInitParser();
ctxt = xmlCreateFileParserCtxt(filename);
if (ctxt == NULL) {
- return(NULL);
+ return(NULL);
}
/* todo: set directories from current doc? */
@@ -418,7 +418,7 @@ xmlSecParseFile(const char *filename) {
xmlParseDocument(ctxt);
if(ctxt->wellFormed) {
- ret = ctxt->myDoc;
+ ret = ctxt->myDoc;
} else {
ret = NULL;
xmlFreeDoc(ctxt->myDoc);
@@ -431,12 +431,12 @@ xmlSecParseFile(const char *filename) {
/**
* xmlSecParseMemoryExt:
- * @prefix: the first part of the input.
- * @prefixSize: the size of the first part of the input.
- * @buffer: the second part of the input.
- * @bufferSize: the size of the second part of the input.
- * @postfix: the third part of the input.
- * @postfixSize: the size of the third part of the input.
+ * @prefix: the first part of the input.
+ * @prefixSize: the size of the first part of the input.
+ * @buffer: the second part of the input.
+ * @bufferSize: the size of the second part of the input.
+ * @postfix: the third part of the input.
+ * @postfixSize: the size of the third part of the input.
*
* Loads XML Doc from 3 chunks of memory: @prefix, @buffer and @postfix.
*
@@ -444,8 +444,8 @@ xmlSecParseFile(const char *filename) {
*/
xmlDocPtr
xmlSecParseMemoryExt(const xmlSecByte *prefix, xmlSecSize prefixSize,
- const xmlSecByte *buffer, xmlSecSize bufferSize,
- const xmlSecByte *postfix, xmlSecSize postfixSize) {
+ const xmlSecByte *buffer, xmlSecSize bufferSize,
+ const xmlSecByte *postfix, xmlSecSize postfixSize) {
xmlParserCtxtPtr ctxt = NULL;
xmlDocPtr doc = NULL;
int ret;
@@ -453,12 +453,12 @@ xmlSecParseMemoryExt(const xmlSecByte *prefix, xmlSecSize prefixSize,
/* create context */
ctxt = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, NULL);
if(ctxt == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlCreatePushParserCtxt",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlCreatePushParserCtxt",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
/* required for c14n! */
@@ -468,57 +468,57 @@ xmlSecParseMemoryExt(const xmlSecByte *prefix, xmlSecSize prefixSize,
/* prefix */
if((prefix != NULL) && (prefixSize > 0)) {
ret = xmlParseChunk(ctxt, (const char*)prefix, prefixSize, 0);
- if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlParseChunk",
- XMLSEC_ERRORS_R_XML_FAILED,
- "prefixSize=%d", prefixSize);
- goto done;
- }
- }
+ if(ret != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlParseChunk",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "prefixSize=%d", prefixSize);
+ goto done;
+ }
+ }
/* buffer */
if((buffer != NULL) && (bufferSize > 0)) {
ret = xmlParseChunk(ctxt, (const char*)buffer, bufferSize, 0);
- if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlParseChunk",
- XMLSEC_ERRORS_R_XML_FAILED,
- "bufferSize=%d", bufferSize);
- goto done;
- }
- }
+ if(ret != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlParseChunk",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "bufferSize=%d", bufferSize);
+ goto done;
+ }
+ }
/* postfix */
if((postfix != NULL) && (postfixSize > 0)) {
ret = xmlParseChunk(ctxt, (const char*)postfix, postfixSize, 0);
- if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlParseChunk",
- XMLSEC_ERRORS_R_XML_FAILED,
- "postfixSize=%d", postfixSize);
- goto done;
- }
- }
+ if(ret != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlParseChunk",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "postfixSize=%d", postfixSize);
+ goto done;
+ }
+ }
/* finishing */
ret = xmlParseChunk(ctxt, NULL, 0, 1);
if((ret != 0) || (ctxt->myDoc == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlParseChunk",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlParseChunk",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
+ }
doc = ctxt->myDoc;
done:
if(ctxt != NULL) {
- xmlFreeParserCtxt(ctxt);
+ xmlFreeParserCtxt(ctxt);
}
return(doc);
}
@@ -526,9 +526,9 @@ done:
/**
* xmlSecParseMemory:
- * @buffer: the input buffer.
- * @size: the input buffer size.
- * @recovery: the flag.
+ * @buffer: the input buffer.
+ * @size: the input buffer size.
+ * @recovery: the flag.
*
* Loads XML Doc from memory. We need a special version because of
* c14n issue. The code is copied from xmlSAXParseMemory() function.
@@ -544,12 +544,12 @@ xmlSecParseMemory(const xmlSecByte *buffer, xmlSecSize size, int recovery) {
ctxt = xmlCreateMemoryParserCtxt((char*)buffer, size);
if (ctxt == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlCreateMemoryParserCtxt",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlCreateMemoryParserCtxt",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
/* required for c14n! */
@@ -559,7 +559,7 @@ xmlSecParseMemory(const xmlSecByte *buffer, xmlSecSize size, int recovery) {
xmlParseDocument(ctxt);
if((ctxt->wellFormed) || recovery) {
- ret = ctxt->myDoc;
+ ret = ctxt->myDoc;
} else {
ret = NULL;
xmlFreeDoc(ctxt->myDoc);
diff --git a/src/skeleton/app.c b/src/skeleton/app.c
index e229ab3..c279882 100644
--- a/src/skeleton/app.c
+++ b/src/skeleton/app.c
@@ -22,7 +22,7 @@
/**
* xmlSecSkeletonAppInit:
- * @config: the path to Skeleton configuration (unused).
+ * @config: the path to Skeleton configuration (unused).
*
* General crypto engine initialization. This function is used
* by XMLSec command line utility and called before
@@ -54,11 +54,11 @@ xmlSecSkeletonAppShutdown(void) {
/**
* xmlSecSkeletonAppKeyLoad:
- * @filename: the key filename.
- * @format: the key file format.
- * @pwd: the key file password.
- * @pwdCallback: the key password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @filename: the key filename.
+ * @format: the key file format.
+ * @pwd: the key file password.
+ * @pwdCallback: the key password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key from the a file (not implemented yet).
*
@@ -66,29 +66,29 @@ xmlSecSkeletonAppShutdown(void) {
*/
xmlSecKeyPtr
xmlSecSkeletonAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
- const char *pwd,
- void* pwdCallback,
- void* pwdCallbackCtx) {
+ const char *pwd,
+ void* pwdCallback,
+ void* pwdCallbackCtx) {
xmlSecAssert2(filename != NULL, NULL);
xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, NULL);
/* TODO: load key */
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSkeletonAppKeyLoad",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlSecSkeletonAppKeyLoad",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(NULL);
}
/**
* xmlSecSkeletonAppKeyLoadMemory:
- * @data: the key binary data.
- * @dataSize: the key binary data size.
- * @format: the key data format.
- * @pwd: the key data2 password.
- * @pwdCallback: the key password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @data: the key binary data.
+ * @dataSize: the key binary data size.
+ * @format: the key data format.
+ * @pwd: the key data2 password.
+ * @pwdCallback: the key password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key from a binary @data.
*
@@ -96,16 +96,16 @@ xmlSecSkeletonAppKeyLoad(const char *filename, xmlSecKeyDataFormat format,
*/
xmlSecKeyPtr
xmlSecSkeletonAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlSecKeyDataFormat format,
- const char *pwd, void* pwdCallback, void* pwdCallbackCtx) {
+ const char *pwd, void* pwdCallback, void* pwdCallbackCtx) {
xmlSecAssert2(data != NULL, NULL);
xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, NULL);
/* TODO: load key */
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSkeletonAppKeyLoad",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlSecSkeletonAppKeyLoad",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(NULL);
}
@@ -113,64 +113,64 @@ xmlSecSkeletonAppKeyLoadMemory(const xmlSecByte* data, xmlSecSize dataSize, xmlS
#ifndef XMLSEC_NO_X509
/**
* xmlSecSkeletonAppKeyCertLoad:
- * @key: the pointer to key.
- * @filename: the certificate filename.
- * @format: the certificate file format.
+ * @key: the pointer to key.
+ * @filename: the certificate filename.
+ * @format: the certificate file format.
*
* Reads the certificate from $ filename and adds it to key
* (not implemented yet).
*
* Returns: 0 on success or a negative value otherwise.
*/
-int
+int
xmlSecSkeletonAppKeyCertLoad(xmlSecKeyPtr key, const char* filename,
- xmlSecKeyDataFormat format) {
+ xmlSecKeyDataFormat format) {
xmlSecAssert2(key != NULL, -1);
xmlSecAssert2(filename != NULL, -1);
xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
/* TODO */
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSkeletonAppKeyCertLoad",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlSecSkeletonAppKeyCertLoad",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
/**
* xmlSecSkeletonAppKeyCertLoadMemory:
- * @key: the pointer to key.
- * @data: the certificate binary data.
- * @dataSize: the certificate binary data size.
- * @format: the certificate file format.
+ * @key: the pointer to key.
+ * @data: the certificate binary data.
+ * @dataSize: the certificate binary data size.
+ * @format: the certificate file format.
*
* Reads the certificate from memory buffer and adds it to key.
*
* Returns: 0 on success or a negative value otherwise.
*/
-int
+int
xmlSecSkeletonAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xmlSecSize dataSize,
- xmlSecKeyDataFormat format) {
+ xmlSecKeyDataFormat format) {
xmlSecAssert2(key != NULL, -1);
xmlSecAssert2(data != NULL, -1);
xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
/* TODO */
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSkeletonAppKeyCertLoadMemory",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlSecSkeletonAppKeyCertLoadMemory",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
/**
* xmlSecSkeletonAppPkcs12Load:
- * @filename: the PKCS12 key filename.
- * @pwd: the PKCS12 file password.
- * @pwdCallback: the password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @filename: the PKCS12 key filename.
+ * @pwd: the PKCS12 file password.
+ * @pwdCallback: the password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key and all associated certificates from the PKCS12 file
* (not implemented yet).
@@ -180,29 +180,29 @@ xmlSecSkeletonAppKeyCertLoadMemory(xmlSecKeyPtr key, const xmlSecByte* data, xml
*
* Returns: pointer to the key or NULL if an error occurs.
*/
-xmlSecKeyPtr
+xmlSecKeyPtr
xmlSecSkeletonAppPkcs12Load(const char *filename,
- const char *pwd ATTRIBUTE_UNUSED,
- void* pwdCallback ATTRIBUTE_UNUSED,
- void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
+ const char *pwd ATTRIBUTE_UNUSED,
+ void* pwdCallback ATTRIBUTE_UNUSED,
+ void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
xmlSecAssert2(filename != NULL, NULL);
/* TODO: load pkcs12 file */
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSkeletonAppPkcs12Load",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlSecSkeletonAppPkcs12Load",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(NULL);
}
/**
* xmlSecSkeletonAppPkcs12LoadMemory:
- * @data: the key binary data.
- * @dataSize: the key binary data size.
- * @pwd: the PKCS12 password.
- * @pwdCallback: the password callback.
- * @pwdCallbackCtx: the user context for password callback.
+ * @data: the key binary data.
+ * @dataSize: the key binary data size.
+ * @pwd: the PKCS12 password.
+ * @pwdCallback: the password callback.
+ * @pwdCallbackCtx: the user context for password callback.
*
* Reads key and all associated certificates from the PKCS12 binary data.
* For uniformity, call xmlSecSkeletonAppKeyLoad instead of this function. Pass
@@ -210,18 +210,18 @@ xmlSecSkeletonAppPkcs12Load(const char *filename,
*
* Returns: pointer to the key or NULL if an error occurs.
*/
-xmlSecKeyPtr
+xmlSecKeyPtr
xmlSecSkeletonAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize, const char *pwd,
- void *pwdCallback ATTRIBUTE_UNUSED,
- void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
+ void *pwdCallback ATTRIBUTE_UNUSED,
+ void* pwdCallbackCtx ATTRIBUTE_UNUSED) {
xmlSecAssert2(data != NULL, NULL);
/* TODO: load pkcs12 file */
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSkeletonAppPkcs12Load",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlSecSkeletonAppPkcs12Load",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(NULL);
}
@@ -229,11 +229,11 @@ xmlSecSkeletonAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize, c
/**
* xmlSecSkeletonAppKeysMngrCertLoad:
- * @mngr: the keys manager.
- * @filename: the certificate file.
- * @format: the certificate file format.
- * @type: the flag that indicates is the certificate in @filename
- * trusted or not.
+ * @mngr: the keys manager.
+ * @filename: the certificate file.
+ * @format: the certificate file format.
+ * @type: the flag that indicates is the certificate in @filename
+ * trusted or not.
*
* Reads cert from @filename and adds to the list of trusted or known
* untrusted certs in @store (not implemented yet).
@@ -242,28 +242,28 @@ xmlSecSkeletonAppPkcs12LoadMemory(const xmlSecByte* data, xmlSecSize dataSize, c
*/
int
xmlSecSkeletonAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
- xmlSecKeyDataFormat format,
- xmlSecKeyDataType type ATTRIBUTE_UNUSED) {
+ xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type ATTRIBUTE_UNUSED) {
xmlSecAssert2(mngr != NULL, -1);
xmlSecAssert2(filename != NULL, -1);
xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
/* TODO: load cert and add to keys manager */
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSkeletonAppKeysMngrCertLoad",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlSecSkeletonAppKeysMngrCertLoad",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
/**
* xmlSecSkeletonAppKeysMngrCertLoadMemory:
- * @mngr: the pointer to keys manager.
- * @data: the key binary data.
- * @dataSize: the key binary data size.
- * @format: the certificate format (PEM or DER).
- * @type: the certificate type (trusted/untrusted).
+ * @mngr: the pointer to keys manager.
+ * @data: the key binary data.
+ * @dataSize: the key binary data size.
+ * @format: the certificate format (PEM or DER).
+ * @type: the certificate type (trusted/untrusted).
*
* Reads cert from @data and adds to the list of trusted or known
* untrusted certs in @store
@@ -272,18 +272,18 @@ xmlSecSkeletonAppKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
*/
int
xmlSecSkeletonAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte* data,
- xmlSecSize dataSize, xmlSecKeyDataFormat format,
- xmlSecKeyDataType type) {
+ xmlSecSize dataSize, xmlSecKeyDataFormat format,
+ xmlSecKeyDataType type) {
xmlSecAssert2(mngr != NULL, -1);
xmlSecAssert2(data != NULL, -1);
xmlSecAssert2(format != xmlSecKeyDataFormatUnknown, -1);
/* TODO: load cert and add to keys manager */
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSkeletonAppKeysMngrCertLoad",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlSecSkeletonAppKeysMngrCertLoad",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -291,7 +291,7 @@ xmlSecSkeletonAppKeysMngrCertLoadMemory(xmlSecKeysMngrPtr mngr, const xmlSecByte
/**
* xmlSecSkeletonAppDefaultKeysMngrInit:
- * @mngr: the pointer to keys manager.
+ * @mngr: the pointer to keys manager.
*
* Initializes @mngr with simple keys store #xmlSecSimpleKeysStoreId
* and a default Skeleton crypto key data stores.
@@ -310,38 +310,38 @@ xmlSecSkeletonAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
/* create simple keys store if needed */
if(xmlSecKeysMngrGetKeysStore(mngr) == NULL) {
- xmlSecKeyStorePtr keysStore;
-
- keysStore = xmlSecKeyStoreCreate(xmlSecSimpleKeysStoreId);
- if(keysStore == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyStoreCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecSimpleKeysStoreId");
- return(-1);
- }
-
- ret = xmlSecKeysMngrAdoptKeysStore(mngr, keysStore);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrAdoptKeysStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyStoreDestroy(keysStore);
- return(-1);
- }
+ xmlSecKeyStorePtr keysStore;
+
+ keysStore = xmlSecKeyStoreCreate(xmlSecSimpleKeysStoreId);
+ if(keysStore == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyStoreCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecSimpleKeysStoreId");
+ return(-1);
+ }
+
+ ret = xmlSecKeysMngrAdoptKeysStore(mngr, keysStore);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrAdoptKeysStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyStoreDestroy(keysStore);
+ return(-1);
+ }
}
ret = xmlSecSkeletonKeysMngrInit(mngr);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSkeletonKeysMngrInit",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSkeletonKeysMngrInit",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
mngr->getKey = xmlSecKeysMngrGetKey;
@@ -350,8 +350,8 @@ xmlSecSkeletonAppDefaultKeysMngrInit(xmlSecKeysMngrPtr mngr) {
/**
* xmlSecSkeletonAppDefaultKeysMngrAdoptKey:
- * @mngr: the pointer to keys manager.
- * @key: the pointer to key.
+ * @mngr: the pointer to keys manager.
+ * @key: the pointer to key.
*
* Adds @key to the keys manager @mngr created with #xmlSecSkeletonAppDefaultKeysMngrInit
* function.
@@ -372,22 +372,22 @@ xmlSecSkeletonAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr ke
store = xmlSecKeysMngrGetKeysStore(mngr);
if(store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrGetKeysStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrGetKeysStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecSimpleKeysStoreAdoptKey(store, key);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSimpleKeysStoreAdoptKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSimpleKeysStoreAdoptKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -395,8 +395,8 @@ xmlSecSkeletonAppDefaultKeysMngrAdoptKey(xmlSecKeysMngrPtr mngr, xmlSecKeyPtr ke
/**
* xmlSecSkeletonAppDefaultKeysMngrLoad:
- * @mngr: the pointer to keys manager.
- * @uri: the uri.
+ * @mngr: the pointer to keys manager.
+ * @uri: the uri.
*
* Loads XML keys file from @uri to the keys manager @mngr created
* with #xmlSecSkeletonAppDefaultKeysMngrInit function.
@@ -417,22 +417,22 @@ xmlSecSkeletonAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
store = xmlSecKeysMngrGetKeysStore(mngr);
if(store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrGetKeysStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrGetKeysStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecSimpleKeysStoreLoad(store, uri, mngr);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSimpleKeysStoreLoad",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "uri=%s", xmlSecErrorsSafeString(uri));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSimpleKeysStoreLoad",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "uri=%s", xmlSecErrorsSafeString(uri));
+ return(-1);
}
return(0);
@@ -440,9 +440,9 @@ xmlSecSkeletonAppDefaultKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char* uri) {
/**
* xmlSecSkeletonAppDefaultKeysMngrSave:
- * @mngr: the pointer to keys manager.
- * @filename: the destination filename.
- * @type: the type of keys to save (public/private/symmetric).
+ * @mngr: the pointer to keys manager.
+ * @filename: the destination filename.
+ * @type: the type of keys to save (public/private/symmetric).
*
* Saves keys from @mngr to XML keys file.
*
@@ -462,23 +462,23 @@ xmlSecSkeletonAppDefaultKeysMngrSave(xmlSecKeysMngrPtr mngr, const char* filenam
store = xmlSecKeysMngrGetKeysStore(mngr);
if(store == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeysMngrGetKeysStore",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeysMngrGetKeysStore",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecSimpleKeysStoreSave(store, filename, type);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSimpleKeysStoreSave",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "filename=%s",
- xmlSecErrorsSafeString(filename));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSimpleKeysStoreSave",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "filename=%s",
+ xmlSecErrorsSafeString(filename));
+ return(-1);
}
return(0);
diff --git a/src/skeleton/crypto.c b/src/skeleton/crypto.c
index aff0945..fb3ef9c 100644
--- a/src/skeleton/crypto.c
+++ b/src/skeleton/crypto.c
@@ -36,7 +36,7 @@ xmlSecCryptoGetFunctions_skeleton(void) {
static xmlSecCryptoDLFunctions functions;
if(gXmlSecSkeletonFunctions != NULL) {
- return(gXmlSecSkeletonFunctions);
+ return(gXmlSecSkeletonFunctions);
}
memset(&functions, 0, sizeof(functions));
@@ -45,118 +45,118 @@ xmlSecCryptoGetFunctions_skeleton(void) {
/**
* Crypto Init/shutdown
*/
- gXmlSecSkeletonFunctions->cryptoInit = xmlSecSkeletonInit;
- gXmlSecSkeletonFunctions->cryptoShutdown = xmlSecSkeletonShutdown;
- gXmlSecSkeletonFunctions->cryptoKeysMngrInit = xmlSecSkeletonKeysMngrInit;
+ gXmlSecSkeletonFunctions->cryptoInit = xmlSecSkeletonInit;
+ gXmlSecSkeletonFunctions->cryptoShutdown = xmlSecSkeletonShutdown;
+ gXmlSecSkeletonFunctions->cryptoKeysMngrInit = xmlSecSkeletonKeysMngrInit;
/**
* Key data ids
*/
#ifndef XMLSEC_NO_AES
- gXmlSecSkeletonFunctions->keyDataAesGetKlass = xmlSecSkeletonKeyDataAesGetKlass;
+ gXmlSecSkeletonFunctions->keyDataAesGetKlass = xmlSecSkeletonKeyDataAesGetKlass;
#endif /* XMLSEC_NO_AES */
#ifndef XMLSEC_NO_DES
- gXmlSecSkeletonFunctions->keyDataDesGetKlass = xmlSecSkeletonKeyDataDesGetKlass;
+ gXmlSecSkeletonFunctions->keyDataDesGetKlass = xmlSecSkeletonKeyDataDesGetKlass;
#endif /* XMLSEC_NO_DES */
#ifndef XMLSEC_NO_DSA
- gXmlSecSkeletonFunctions->keyDataDsaGetKlass = xmlSecSkeletonKeyDataDsaGetKlass;
+ gXmlSecSkeletonFunctions->keyDataDsaGetKlass = xmlSecSkeletonKeyDataDsaGetKlass;
#endif /* XMLSEC_NO_DSA */
#ifndef XMLSEC_NO_GOST
- gXmlSecSkeletonFunctions->keyDataGost2001GetKlass = xmlSecSkeletonKeyDataGost2001GetKlass;
+ gXmlSecSkeletonFunctions->keyDataGost2001GetKlass = xmlSecSkeletonKeyDataGost2001GetKlass;
#endif /* XMLSEC_NO_GOST */
#ifndef XMLSEC_NO_HMAC
- gXmlSecSkeletonFunctions->keyDataHmacGetKlass = xmlSecSkeletonKeyDataHmacGetKlass;
+ gXmlSecSkeletonFunctions->keyDataHmacGetKlass = xmlSecSkeletonKeyDataHmacGetKlass;
#endif /* XMLSEC_NO_HMAC */
#ifndef XMLSEC_NO_RSA
- gXmlSecSkeletonFunctions->keyDataRsaGetKlass = xmlSecSkeletonKeyDataRsaGetKlass;
+ gXmlSecSkeletonFunctions->keyDataRsaGetKlass = xmlSecSkeletonKeyDataRsaGetKlass;
#endif /* XMLSEC_NO_RSA */
#ifndef XMLSEC_NO_X509
- gXmlSecSkeletonFunctions->keyDataX509GetKlass = xmlSecSkeletonKeyDataX509GetKlass;
- gXmlSecSkeletonFunctions->keyDataRawX509CertGetKlass = xmlSecSkeletonKeyDataRawX509CertGetKlass;
+ gXmlSecSkeletonFunctions->keyDataX509GetKlass = xmlSecSkeletonKeyDataX509GetKlass;
+ gXmlSecSkeletonFunctions->keyDataRawX509CertGetKlass = xmlSecSkeletonKeyDataRawX509CertGetKlass;
#endif /* XMLSEC_NO_X509 */
/**
* Key data store ids
*/
#ifndef XMLSEC_NO_X509
- gXmlSecSkeletonFunctions->x509StoreGetKlass = xmlSecSkeletonX509StoreGetKlass;
+ gXmlSecSkeletonFunctions->x509StoreGetKlass = xmlSecSkeletonX509StoreGetKlass;
#endif /* XMLSEC_NO_X509 */
/**
* Crypto transforms ids
*/
#ifndef XMLSEC_NO_AES
- gXmlSecSkeletonFunctions->transformAes128CbcGetKlass = xmlSecSkeletonTransformAes128CbcGetKlass;
- gXmlSecSkeletonFunctions->transformAes192CbcGetKlass = xmlSecSkeletonTransformAes192CbcGetKlass;
- gXmlSecSkeletonFunctions->transformAes256CbcGetKlass = xmlSecSkeletonTransformAes256CbcGetKlass;
- gXmlSecSkeletonFunctions->transformKWAes128GetKlass = xmlSecSkeletonTransformKWAes128GetKlass;
- gXmlSecSkeletonFunctions->transformKWAes192GetKlass = xmlSecSkeletonTransformKWAes192GetKlass;
- gXmlSecSkeletonFunctions->transformKWAes256GetKlass = xmlSecSkeletonTransformKWAes256GetKlass;
+ gXmlSecSkeletonFunctions->transformAes128CbcGetKlass = xmlSecSkeletonTransformAes128CbcGetKlass;
+ gXmlSecSkeletonFunctions->transformAes192CbcGetKlass = xmlSecSkeletonTransformAes192CbcGetKlass;
+ gXmlSecSkeletonFunctions->transformAes256CbcGetKlass = xmlSecSkeletonTransformAes256CbcGetKlass;
+ gXmlSecSkeletonFunctions->transformKWAes128GetKlass = xmlSecSkeletonTransformKWAes128GetKlass;
+ gXmlSecSkeletonFunctions->transformKWAes192GetKlass = xmlSecSkeletonTransformKWAes192GetKlass;
+ gXmlSecSkeletonFunctions->transformKWAes256GetKlass = xmlSecSkeletonTransformKWAes256GetKlass;
#endif /* XMLSEC_NO_AES */
#ifndef XMLSEC_NO_DES
- gXmlSecSkeletonFunctions->transformDes3CbcGetKlass = xmlSecSkeletonTransformDes3CbcGetKlass;
- gXmlSecSkeletonFunctions->transformKWDes3GetKlass = xmlSecSkeletonTransformKWDes3GetKlass;
+ gXmlSecSkeletonFunctions->transformDes3CbcGetKlass = xmlSecSkeletonTransformDes3CbcGetKlass;
+ gXmlSecSkeletonFunctions->transformKWDes3GetKlass = xmlSecSkeletonTransformKWDes3GetKlass;
#endif /* XMLSEC_NO_DES */
#ifndef XMLSEC_NO_DSA
- gXmlSecSkeletonFunctions->transformDsaSha1GetKlass = xmlSecSkeletonTransformDsaSha1GetKlass;
+ gXmlSecSkeletonFunctions->transformDsaSha1GetKlass = xmlSecSkeletonTransformDsaSha1GetKlass;
#endif /* XMLSEC_NO_DSA */
#ifndef XMLSEC_NO_GOST
- gXmlSecSkeletonFunctions->transformGost2001GostR3411_94GetKlass = xmlSecSkeletonTransformGost2001GostR3411_94GetKlass;
+ gXmlSecSkeletonFunctions->transformGost2001GostR3411_94GetKlass = xmlSecSkeletonTransformGost2001GostR3411_94GetKlass;
#endif /* XMLSEC_GOST */
#ifndef XMLSEC_NO_HMAC
- gXmlSecSkeletonFunctions->transformHmacSha1GetKlass = xmlSecSkeletonTransformHmacSha1GetKlass;
- gXmlSecSkeletonFunctions->transformHmacRipemd160GetKlass = xmlSecSkeletonTransformHmacRipemd160GetKlass;
- gXmlSecSkeletonFunctions->transformHmacMd5GetKlass = xmlSecSkeletonTransformHmacMd5GetKlass;
+ gXmlSecSkeletonFunctions->transformHmacSha1GetKlass = xmlSecSkeletonTransformHmacSha1GetKlass;
+ gXmlSecSkeletonFunctions->transformHmacRipemd160GetKlass = xmlSecSkeletonTransformHmacRipemd160GetKlass;
+ gXmlSecSkeletonFunctions->transformHmacMd5GetKlass = xmlSecSkeletonTransformHmacMd5GetKlass;
#endif /* XMLSEC_NO_HMAC */
#ifndef XMLSEC_NO_RIPEMD160
- gXmlSecSkeletonFunctions->transformRipemd160GetKlass = xmlSecSkeletonTransformRipemd160GetKlass;
+ gXmlSecSkeletonFunctions->transformRipemd160GetKlass = xmlSecSkeletonTransformRipemd160GetKlass;
#endif /* XMLSEC_NO_RIPEMD160 */
#ifndef XMLSEC_NO_RSA
- gXmlSecSkeletonFunctions->transformRsaSha1GetKlass = xmlSecSkeletonTransformRsaSha1GetKlass;
- gXmlSecSkeletonFunctions->transformRsaPkcs1GetKlass = xmlSecSkeletonTransformRsaPkcs1GetKlass;
- gXmlSecSkeletonFunctions->transformRsaOaepGetKlass = xmlSecSkeletonTransformRsaOaepGetKlass;
+ gXmlSecSkeletonFunctions->transformRsaSha1GetKlass = xmlSecSkeletonTransformRsaSha1GetKlass;
+ gXmlSecSkeletonFunctions->transformRsaPkcs1GetKlass = xmlSecSkeletonTransformRsaPkcs1GetKlass;
+ gXmlSecSkeletonFunctions->transformRsaOaepGetKlass = xmlSecSkeletonTransformRsaOaepGetKlass;
#endif /* XMLSEC_NO_RSA */
#ifndef XMLSEC_NO_SHA1
- gXmlSecSkeletonFunctions->transformSha1GetKlass = xmlSecSkeletonTransformSha1GetKlass;
+ gXmlSecSkeletonFunctions->transformSha1GetKlass = xmlSecSkeletonTransformSha1GetKlass;
#endif /* XMLSEC_NO_SHA1 */
#ifndef XMLSEC_NO_GOST
- gXmlSecSkeletonFunctions->transformGostR3411_94GetKlass = xmlSecSkeletonTransformGostR3411_94GetKlass;
+ gXmlSecSkeletonFunctions->transformGostR3411_94GetKlass = xmlSecSkeletonTransformGostR3411_94GetKlass;
#endif /* XMLSEC_NO_GOST */
/**
* High level routines form xmlsec command line utility
*/
- gXmlSecSkeletonFunctions->cryptoAppInit = xmlSecSkeletonAppInit;
- gXmlSecSkeletonFunctions->cryptoAppShutdown = xmlSecSkeletonAppShutdown;
- gXmlSecSkeletonFunctions->cryptoAppDefaultKeysMngrInit = xmlSecSkeletonAppDefaultKeysMngrInit;
- gXmlSecSkeletonFunctions->cryptoAppDefaultKeysMngrAdoptKey = xmlSecSkeletonAppDefaultKeysMngrAdoptKey;
- gXmlSecSkeletonFunctions->cryptoAppDefaultKeysMngrLoad = xmlSecSkeletonAppDefaultKeysMngrLoad;
- gXmlSecSkeletonFunctions->cryptoAppDefaultKeysMngrSave = xmlSecSkeletonAppDefaultKeysMngrSave;
+ gXmlSecSkeletonFunctions->cryptoAppInit = xmlSecSkeletonAppInit;
+ gXmlSecSkeletonFunctions->cryptoAppShutdown = xmlSecSkeletonAppShutdown;
+ gXmlSecSkeletonFunctions->cryptoAppDefaultKeysMngrInit = xmlSecSkeletonAppDefaultKeysMngrInit;
+ gXmlSecSkeletonFunctions->cryptoAppDefaultKeysMngrAdoptKey = xmlSecSkeletonAppDefaultKeysMngrAdoptKey;
+ gXmlSecSkeletonFunctions->cryptoAppDefaultKeysMngrLoad = xmlSecSkeletonAppDefaultKeysMngrLoad;
+ gXmlSecSkeletonFunctions->cryptoAppDefaultKeysMngrSave = xmlSecSkeletonAppDefaultKeysMngrSave;
#ifndef XMLSEC_NO_X509
- gXmlSecSkeletonFunctions->cryptoAppKeysMngrCertLoad = xmlSecSkeletonAppKeysMngrCertLoad;
- gXmlSecSkeletonFunctions->cryptoAppKeysMngrCertLoadMemory = xmlSecSkeletonAppKeysMngrCertLoadMemory;
- gXmlSecSkeletonFunctions->cryptoAppPkcs12Load = xmlSecSkeletonAppPkcs12Load;
- gXmlSecSkeletonFunctions->cryptoAppPkcs12LoadMemory = xmlSecSkeletonAppPkcs12LoadMemory;
- gXmlSecSkeletonFunctions->cryptoAppKeyCertLoad = xmlSecSkeletonAppKeyCertLoad;
- gXmlSecSkeletonFunctions->cryptoAppKeyCertLoadMemory = xmlSecSkeletonAppKeyCertLoadMemory;
+ gXmlSecSkeletonFunctions->cryptoAppKeysMngrCertLoad = xmlSecSkeletonAppKeysMngrCertLoad;
+ gXmlSecSkeletonFunctions->cryptoAppKeysMngrCertLoadMemory = xmlSecSkeletonAppKeysMngrCertLoadMemory;
+ gXmlSecSkeletonFunctions->cryptoAppPkcs12Load = xmlSecSkeletonAppPkcs12Load;
+ gXmlSecSkeletonFunctions->cryptoAppPkcs12LoadMemory = xmlSecSkeletonAppPkcs12LoadMemory;
+ gXmlSecSkeletonFunctions->cryptoAppKeyCertLoad = xmlSecSkeletonAppKeyCertLoad;
+ gXmlSecSkeletonFunctions->cryptoAppKeyCertLoadMemory = xmlSecSkeletonAppKeyCertLoadMemory;
#endif /* XMLSEC_NO_X509 */
- gXmlSecSkeletonFunctions->cryptoAppKeyLoad = xmlSecSkeletonAppKeyLoad;
- gXmlSecSkeletonFunctions->cryptoAppKeyLoadMemory = xmlSecSkeletonAppKeyLoadMemory;
- gXmlSecSkeletonFunctions->cryptoAppDefaultPwdCallback = (void*)xmlSecSkeletonAppGetDefaultPwdCallback();
+ gXmlSecSkeletonFunctions->cryptoAppKeyLoad = xmlSecSkeletonAppKeyLoad;
+ gXmlSecSkeletonFunctions->cryptoAppKeyLoadMemory = xmlSecSkeletonAppKeyLoadMemory;
+ gXmlSecSkeletonFunctions->cryptoAppDefaultPwdCallback = (void*)xmlSecSkeletonAppGetDefaultPwdCallback();
return(gXmlSecSkeletonFunctions);
}
@@ -173,22 +173,22 @@ int
xmlSecSkeletonInit (void) {
/* Check loaded xmlsec library version */
if(xmlSecCheckVersionExact() != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCheckVersionExact",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCheckVersionExact",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* register our klasses */
if(xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms(xmlSecCryptoGetFunctions_skeleton()) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -210,7 +210,7 @@ xmlSecSkeletonShutdown(void) {
/**
* xmlSecSkeletonKeysMngrInit:
- * @mngr: the pointer to keys manager.
+ * @mngr: the pointer to keys manager.
*
* Adds Skeleton specific key data stores in keys manager.
*
diff --git a/src/soap.c b/src/soap.c
index 84512b2..95303ac 100644
--- a/src/soap.c
+++ b/src/soap.c
@@ -59,39 +59,39 @@ xmlSecSoap11CreateEnvelope(xmlDocPtr doc) {
/* create Envelope node */
envNode = xmlNewDocNode(doc, NULL, xmlSecNodeEnvelope, NULL);
if(envNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewDocNode",
- XMLSEC_ERRORS_R_XML_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeEnvelope));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewDocNode",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeEnvelope));
+ return(NULL);
}
ns = xmlNewNs(envNode, xmlSecSoap11Ns, NULL) ;
if(ns == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewNs",
- XMLSEC_ERRORS_R_XML_FAILED,
- "ns=%s",
- xmlSecErrorsSafeString(xmlSecSoap11Ns));
- xmlFreeNode(envNode);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewNs",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "ns=%s",
+ xmlSecErrorsSafeString(xmlSecSoap11Ns));
+ xmlFreeNode(envNode);
+ return(NULL);
}
xmlSetNs(envNode, ns);
/* add required Body node */
bodyNode = xmlSecAddChild(envNode, xmlSecNodeBody, xmlSecSoap11Ns);
if(bodyNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeBody));
- xmlFreeNode(envNode);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeBody));
+ xmlFreeNode(envNode);
+ return(NULL);
}
return(envNode);
@@ -132,22 +132,22 @@ xmlSecSoap11EnsureHeader(xmlNodePtr envNode) {
/* if the first element child is not Header then it is Body */
if((cur == NULL) || !xmlSecCheckNodeName(cur, xmlSecNodeBody, xmlSecSoap11Ns)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeBody),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeBody),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
/* finally add Header node before body */
hdrNode = xmlSecAddPrevSibling(cur, xmlSecNodeHeader, xmlSecSoap11Ns);
if(hdrNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
"xmlSecAddPrevSibling",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(NULL);
}
@@ -172,12 +172,12 @@ xmlSecSoap11AddBodyEntry(xmlNodePtr envNode, xmlNodePtr entryNode) {
bodyNode = xmlSecSoap11GetBody(envNode);
if(bodyNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap11GetBody",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSoap11GetBody",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(xmlSecAddChildNode(bodyNode, entryNode));
@@ -232,49 +232,49 @@ xmlSecSoap11AddFaultEntry(xmlNodePtr envNode, const xmlChar* faultCodeHref,
/* get Body node */
bodyNode = xmlSecSoap11GetBody(envNode);
if(bodyNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap11GetBody",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSoap11GetBody",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
/* check that we don't have Fault node already */
faultNode = xmlSecFindChild(bodyNode, xmlSecNodeFault, xmlSecSoap11Ns);
if(faultNode != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeBody),
- XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeBody),
+ XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
/* add Fault node */
faultNode = xmlSecAddChild(bodyNode, xmlSecNodeFault, xmlSecSoap11Ns);
if(faultNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeFault));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeFault));
+ return(NULL);
}
/* add faultcode node */
cur = xmlSecAddChild(faultNode, xmlSecNodeFaultCode, xmlSecSoap11Ns);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeFaultCode));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeFaultCode));
xmlUnlinkNode(faultNode);
xmlFreeNode(faultNode);
- return(NULL);
+ return(NULL);
}
/* create qname for fault code */
@@ -282,13 +282,13 @@ xmlSecSoap11AddFaultEntry(xmlNodePtr envNode, const xmlChar* faultCodeHref,
if(qname == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
- "xmlSecGetQName",
- XMLSEC_ERRORS_R_XML_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(cur->name));
+ "xmlSecGetQName",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(cur->name));
xmlUnlinkNode(faultNode);
xmlFreeNode(faultNode);
- return(NULL);
+ return(NULL);
}
/* set faultcode value */
@@ -298,15 +298,15 @@ xmlSecSoap11AddFaultEntry(xmlNodePtr envNode, const xmlChar* faultCodeHref,
/* add faultstring node */
cur = xmlSecAddChild(faultNode, xmlSecNodeFaultString, xmlSecSoap11Ns);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeFaultString));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeFaultString));
xmlUnlinkNode(faultNode);
xmlFreeNode(faultNode);
- return(NULL);
+ return(NULL);
}
/* set faultstring node */
@@ -316,15 +316,15 @@ xmlSecSoap11AddFaultEntry(xmlNodePtr envNode, const xmlChar* faultCodeHref,
/* add faultactor node */
cur = xmlSecAddChild(faultNode, xmlSecNodeFaultActor, xmlSecSoap11Ns);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeFaultActor));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeFaultActor));
xmlUnlinkNode(faultNode);
xmlFreeNode(faultNode);
- return(NULL);
+ return(NULL);
}
/* set faultactor node */
@@ -351,12 +351,12 @@ xmlSecSoap11CheckEnvelope(xmlNodePtr envNode) {
/* verify envNode itself */
if(!xmlSecCheckNodeName(envNode, xmlSecNodeEnvelope, xmlSecSoap11Ns)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeEnvelope),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeEnvelope),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(0);
}
/* optional Header node first */
@@ -367,12 +367,12 @@ xmlSecSoap11CheckEnvelope(xmlNodePtr envNode) {
/* required Body node is next */
if((cur == NULL) || !xmlSecCheckNodeName(cur, xmlSecNodeBody, xmlSecSoap11Ns)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeBody),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeBody),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(0);
}
return(1);
@@ -423,12 +423,12 @@ xmlSecSoap11GetBody(xmlNodePtr envNode) {
/* Body node is next */
if((cur == NULL) || !xmlSecCheckNodeName(cur, xmlSecNodeBody, xmlSecSoap11Ns)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeBody),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeBody),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(cur);
@@ -453,12 +453,12 @@ xmlSecSoap11GetBodyEntriesNumber(xmlNodePtr envNode) {
/* get Body node */
bodyNode = xmlSecSoap11GetBody(envNode);
if(bodyNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap11GetBody",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSoap11GetBody",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(0);
}
cur = xmlSecGetNextElementNode(bodyNode->children);
@@ -489,12 +489,12 @@ xmlSecSoap11GetBodyEntry(xmlNodePtr envNode, xmlSecSize pos) {
/* get Body node */
bodyNode = xmlSecSoap11GetBody(envNode);
if(bodyNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap11GetBody",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSoap11GetBody",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
cur = xmlSecGetNextElementNode(bodyNode->children);
@@ -523,17 +523,17 @@ xmlSecSoap11GetFaultEntry(xmlNodePtr envNode) {
/* get Body node */
bodyNode = xmlSecSoap11GetBody(envNode);
if(bodyNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap11GetBody",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSoap11GetBody",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(xmlSecFindChild(bodyNode, xmlSecNodeFault, xmlSecSoap11Ns));
}
-
+
/***********************************************************************
*
@@ -552,7 +552,7 @@ static const xmlSecQName2IntegerInfo gXmlSecSoap12FaultCodeInfo[] =
xmlSecSoap12FaultCodeSender },
{ xmlSecSoap12Ns, xmlSecSoapFaultCodeReceiver,
xmlSecSoap12FaultCodeReceiver },
- { NULL, NULL, 0 } /* MUST be last in the list */
+ { NULL, NULL, 0 } /* MUST be last in the list */
};
/**
@@ -585,39 +585,39 @@ xmlSecSoap12CreateEnvelope(xmlDocPtr doc) {
/* create Envelope node */
envNode = xmlNewDocNode(doc, NULL, xmlSecNodeEnvelope, NULL);
if(envNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewDocNode",
- XMLSEC_ERRORS_R_XML_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeEnvelope));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewDocNode",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeEnvelope));
+ return(NULL);
}
ns = xmlNewNs(envNode, xmlSecSoap12Ns, NULL) ;
if(ns == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewNs",
- XMLSEC_ERRORS_R_XML_FAILED,
- "ns=%s",
- xmlSecErrorsSafeString(xmlSecSoap12Ns));
- xmlFreeNode(envNode);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewNs",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "ns=%s",
+ xmlSecErrorsSafeString(xmlSecSoap12Ns));
+ xmlFreeNode(envNode);
+ return(NULL);
}
xmlSetNs(envNode, ns);
/* add required Body node */
bodyNode = xmlSecAddChild(envNode, xmlSecNodeBody, xmlSecSoap12Ns);
if(bodyNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeBody));
- xmlFreeNode(envNode);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeBody));
+ xmlFreeNode(envNode);
+ return(NULL);
}
return(envNode);
@@ -658,22 +658,22 @@ xmlSecSoap12EnsureHeader(xmlNodePtr envNode) {
/* if the first element child is not Header then it is Body */
if((cur == NULL) || !xmlSecCheckNodeName(cur, xmlSecNodeBody, xmlSecSoap12Ns)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeBody),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeBody),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
/* finally add Header node before body */
hdrNode = xmlSecAddPrevSibling(cur, xmlSecNodeHeader, xmlSecSoap12Ns);
if(hdrNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
"xmlSecAddPrevSibling",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(NULL);
}
@@ -709,12 +709,12 @@ xmlSecSoap12AddBodyEntry(xmlNodePtr envNode, xmlNodePtr entryNode) {
bodyNode = xmlSecSoap12GetBody(envNode);
if(bodyNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap12GetBody",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSoap12GetBody",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(xmlSecAddChildNode(bodyNode, entryNode));
@@ -798,8 +798,8 @@ xmlSecSoap12AddBodyEntry(xmlNodePtr envNode, xmlNodePtr entryNode) {
*/
xmlNodePtr
xmlSecSoap12AddFaultEntry(xmlNodePtr envNode, xmlSecSoap12FaultCode faultCode,
- const xmlChar* faultReasonText, const xmlChar* faultReasonLang,
- const xmlChar* faultNodeURI, const xmlChar* faultRole) {
+ const xmlChar* faultReasonText, const xmlChar* faultReasonLang,
+ const xmlChar* faultNodeURI, const xmlChar* faultRole) {
xmlNodePtr bodyNode;
xmlNodePtr faultNode;
xmlNodePtr cur;
@@ -813,49 +813,49 @@ xmlSecSoap12AddFaultEntry(xmlNodePtr envNode, xmlSecSoap12FaultCode faultCode,
/* get Body node */
bodyNode = xmlSecSoap12GetBody(envNode);
if(bodyNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap12GetBody",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSoap12GetBody",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
/* check that we don't have Fault node already */
faultNode = xmlSecFindChild(bodyNode, xmlSecNodeFault, xmlSecSoap12Ns);
if(faultNode != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeBody),
- XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeBody),
+ XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
/* add Fault node */
faultNode = xmlSecAddChild(bodyNode, xmlSecNodeFault, xmlSecSoap12Ns);
if(faultNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeFault));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeFault));
+ return(NULL);
}
/* add Code node */
cur = xmlSecAddChild(faultNode, xmlSecNodeCode, xmlSecSoap12Ns);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeCode));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeCode));
xmlUnlinkNode(faultNode);
xmlFreeNode(faultNode);
- return(NULL);
+ return(NULL);
}
/* write the fault code in Value child */
@@ -863,57 +863,57 @@ xmlSecSoap12AddFaultEntry(xmlNodePtr envNode, xmlSecSoap12FaultCode faultCode,
xmlSecNodeValue, xmlSecSoap12Ns,
faultCode);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecQName2IntegerNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "faultCode=%d",
- faultCode);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecQName2IntegerNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "faultCode=%d",
+ faultCode);
xmlUnlinkNode(faultNode);
xmlFreeNode(faultNode);
- return(NULL);
+ return(NULL);
}
/* add Reason node */
cur = xmlSecAddChild(faultNode, xmlSecNodeReason, xmlSecSoap12Ns);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeReason));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeReason));
xmlUnlinkNode(faultNode);
xmlFreeNode(faultNode);
- return(NULL);
+ return(NULL);
}
/* Add Reason/Text node */
if(xmlSecSoap12AddFaultReasonText(faultNode, faultReasonText, faultReasonLang) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap12AddFaultReasonText",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "text=%s",
- xmlSecErrorsSafeString(faultReasonText));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSoap12AddFaultReasonText",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "text=%s",
+ xmlSecErrorsSafeString(faultReasonText));
xmlUnlinkNode(faultNode);
xmlFreeNode(faultNode);
- return(NULL);
+ return(NULL);
}
if(faultNodeURI != NULL) {
/* add Node node */
cur = xmlSecAddChild(faultNode, xmlSecNodeNode, xmlSecSoap12Ns);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeNode));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeNode));
xmlUnlinkNode(faultNode);
xmlFreeNode(faultNode);
- return(NULL);
+ return(NULL);
}
xmlNodeSetContent(cur, faultNodeURI);
}
@@ -922,15 +922,15 @@ xmlSecSoap12AddFaultEntry(xmlNodePtr envNode, xmlSecSoap12FaultCode faultCode,
/* add Role node */
cur = xmlSecAddChild(faultNode, xmlSecNodeRole, xmlSecSoap12Ns);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRole));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRole));
xmlUnlinkNode(faultNode);
xmlFreeNode(faultNode);
- return(NULL);
+ return(NULL);
}
xmlNodeSetContent(cur, faultRole);
}
@@ -962,11 +962,11 @@ xmlSecSoap12AddFaultSubcode(xmlNodePtr faultNode, const xmlChar* subCodeHref, co
cur = xmlSecGetNextElementNode(faultNode->children);
if((cur == NULL) || !xmlSecCheckNodeName(cur, xmlSecNodeCode, xmlSecSoap12Ns)) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
NULL,
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeCode));
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeCode));
return(NULL);
}
@@ -986,27 +986,27 @@ xmlSecSoap12AddFaultSubcode(xmlNodePtr faultNode, const xmlChar* subCodeHref, co
/* add Subcode node */
subcodeNode = xmlSecAddChild(cur, xmlSecNodeSubcode, xmlSecSoap12Ns);
if(subcodeNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeSubcode));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeSubcode));
+ return(NULL);
}
/* add Value node */
valueNode = xmlSecAddChild(subcodeNode, xmlSecNodeValue, xmlSecSoap12Ns);
if(valueNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeValue));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeValue));
xmlUnlinkNode(subcodeNode);
xmlFreeNode(subcodeNode);
- return(NULL);
+ return(NULL);
}
/* create qname for fault code */
@@ -1014,13 +1014,13 @@ xmlSecSoap12AddFaultSubcode(xmlNodePtr faultNode, const xmlChar* subCodeHref, co
if(qname == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
- "xmlSecGetQName",
- XMLSEC_ERRORS_R_XML_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(cur->name));
+ "xmlSecGetQName",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(cur->name));
xmlUnlinkNode(subcodeNode);
xmlFreeNode(subcodeNode);
- return(NULL);
+ return(NULL);
}
/* set result qname in Value node */
@@ -1056,25 +1056,25 @@ xmlSecSoap12AddFaultReasonText(xmlNodePtr faultNode, const xmlChar* faultReasonT
/* find Reason node */
reasonNode = xmlSecFindChild(faultNode, xmlSecNodeReason, xmlSecSoap12Ns);
if(reasonNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecFindChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeReason));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecFindChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeReason));
+ return(NULL);
}
/* add Text node */
textNode = xmlSecAddChild(reasonNode, xmlSecNodeText, xmlSecSoap12Ns);
if(textNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeText));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeText));
+ return(NULL);
}
xmlNodeSetContent(textNode, faultReasonText);
xmlNodeSetLang(textNode, faultReasonLang);
@@ -1104,13 +1104,13 @@ xmlSecSoap12AddFaultDetailEntry(xmlNodePtr faultNode, xmlNodePtr detailEntryNode
if(detailNode == NULL) {
detailNode = xmlSecAddChild(faultNode, xmlSecNodeDetail, xmlSecSoap12Ns);
if(detailNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDetail));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDetail));
+ return(NULL);
}
}
@@ -1134,12 +1134,12 @@ xmlSecSoap12CheckEnvelope(xmlNodePtr envNode) {
/* verify envNode itself */
if(!xmlSecCheckNodeName(envNode, xmlSecNodeEnvelope, xmlSecSoap12Ns)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeEnvelope),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeEnvelope),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(0);
}
/* optional Header node first */
@@ -1150,12 +1150,12 @@ xmlSecSoap12CheckEnvelope(xmlNodePtr envNode) {
/* required Body node is next */
if((cur == NULL) || !xmlSecCheckNodeName(cur, xmlSecNodeBody, xmlSecSoap12Ns)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeBody),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeBody),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(0);
}
return(1);
@@ -1206,12 +1206,12 @@ xmlSecSoap12GetBody(xmlNodePtr envNode) {
/* Body node is next */
if((cur == NULL) || !xmlSecCheckNodeName(cur, xmlSecNodeBody, xmlSecSoap12Ns)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeBody),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeBody),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(cur);
@@ -1236,12 +1236,12 @@ xmlSecSoap12GetBodyEntriesNumber(xmlNodePtr envNode) {
/* get Body node */
bodyNode = xmlSecSoap12GetBody(envNode);
if(bodyNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap12GetBody",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSoap12GetBody",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(0);
}
cur = xmlSecGetNextElementNode(bodyNode->children);
@@ -1272,12 +1272,12 @@ xmlSecSoap12GetBodyEntry(xmlNodePtr envNode, xmlSecSize pos) {
/* get Body node */
bodyNode = xmlSecSoap12GetBody(envNode);
if(bodyNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap12GetBody",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSoap12GetBody",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
cur = xmlSecGetNextElementNode(bodyNode->children);
@@ -1306,17 +1306,17 @@ xmlSecSoap12GetFaultEntry(xmlNodePtr envNode) {
/* get Body node */
bodyNode = xmlSecSoap12GetBody(envNode);
if(bodyNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap12GetBody",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSoap12GetBody",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(xmlSecFindChild(bodyNode, xmlSecNodeFault, xmlSecSoap12Ns));
}
-
+
#endif /* XMLSEC_NO_SOAP */
diff --git a/src/strings.c b/src/strings.c
index 9897198..8de89b0 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -19,52 +19,52 @@
* Global Namespaces
*
************************************************************************/
-const xmlChar xmlSecNs[] = "http://www.aleksey.com/xmlsec/2002";
-const xmlChar xmlSecDSigNs[] = "http://www.w3.org/2000/09/xmldsig#";
-const xmlChar xmlSecEncNs[] = "http://www.w3.org/2001/04/xmlenc#";
-const xmlChar xmlSecXkmsNs[] = "http://www.w3.org/2002/03/xkms#";
-const xmlChar xmlSecXPathNs[] = "http://www.w3.org/TR/1999/REC-xpath-19991116";
-const xmlChar xmlSecXPath2Ns[] = "http://www.w3.org/2002/06/xmldsig-filter2";
-const xmlChar xmlSecXPointerNs[] = "http://www.w3.org/2001/04/xmldsig-more/xptr";
-const xmlChar xmlSecSoap11Ns[] = "http://schemas.xmlsoap.org/soap/envelope/";
-const xmlChar xmlSecSoap12Ns[] = "http://www.w3.org/2002/06/soap-envelope";
+const xmlChar xmlSecNs[] = "http://www.aleksey.com/xmlsec/2002";
+const xmlChar xmlSecDSigNs[] = "http://www.w3.org/2000/09/xmldsig#";
+const xmlChar xmlSecEncNs[] = "http://www.w3.org/2001/04/xmlenc#";
+const xmlChar xmlSecXkmsNs[] = "http://www.w3.org/2002/03/xkms#";
+const xmlChar xmlSecXPathNs[] = "http://www.w3.org/TR/1999/REC-xpath-19991116";
+const xmlChar xmlSecXPath2Ns[] = "http://www.w3.org/2002/06/xmldsig-filter2";
+const xmlChar xmlSecXPointerNs[] = "http://www.w3.org/2001/04/xmldsig-more/xptr";
+const xmlChar xmlSecSoap11Ns[] = "http://schemas.xmlsoap.org/soap/envelope/";
+const xmlChar xmlSecSoap12Ns[] = "http://www.w3.org/2002/06/soap-envelope";
/*************************************************************************
*
* DSig Nodes
*
************************************************************************/
-const xmlChar xmlSecNodeSignature[] = "Signature";
-const xmlChar xmlSecNodeSignedInfo[] = "SignedInfo";
+const xmlChar xmlSecNodeSignature[] = "Signature";
+const xmlChar xmlSecNodeSignedInfo[] = "SignedInfo";
const xmlChar xmlSecNodeCanonicalizationMethod[]= "CanonicalizationMethod";
-const xmlChar xmlSecNodeSignatureMethod[] = "SignatureMethod";
-const xmlChar xmlSecNodeSignatureValue[] = "SignatureValue";
-const xmlChar xmlSecNodeDigestMethod[] = "DigestMethod";
-const xmlChar xmlSecNodeDigestValue[] = "DigestValue";
-const xmlChar xmlSecNodeObject[] = "Object";
-const xmlChar xmlSecNodeManifest[] = "Manifest";
-const xmlChar xmlSecNodeSignatureProperties[] = "SignatureProperties";
+const xmlChar xmlSecNodeSignatureMethod[] = "SignatureMethod";
+const xmlChar xmlSecNodeSignatureValue[] = "SignatureValue";
+const xmlChar xmlSecNodeDigestMethod[] = "DigestMethod";
+const xmlChar xmlSecNodeDigestValue[] = "DigestValue";
+const xmlChar xmlSecNodeObject[] = "Object";
+const xmlChar xmlSecNodeManifest[] = "Manifest";
+const xmlChar xmlSecNodeSignatureProperties[] = "SignatureProperties";
/*************************************************************************
*
* Encryption Nodes
*
************************************************************************/
-const xmlChar xmlSecNodeEncryptedData[] = "EncryptedData";
-const xmlChar xmlSecNodeEncryptionMethod[] = "EncryptionMethod";
-const xmlChar xmlSecNodeEncryptionProperties[] = "EncryptionProperties";
-const xmlChar xmlSecNodeEncryptionProperty[] = "EncryptionProperty";
-const xmlChar xmlSecNodeCipherData[] = "CipherData";
-const xmlChar xmlSecNodeCipherValue[] = "CipherValue";
-const xmlChar xmlSecNodeCipherReference[] = "CipherReference";
-const xmlChar xmlSecNodeReferenceList[] = "ReferenceList";
+const xmlChar xmlSecNodeEncryptedData[] = "EncryptedData";
+const xmlChar xmlSecNodeEncryptionMethod[] = "EncryptionMethod";
+const xmlChar xmlSecNodeEncryptionProperties[] = "EncryptionProperties";
+const xmlChar xmlSecNodeEncryptionProperty[] = "EncryptionProperty";
+const xmlChar xmlSecNodeCipherData[] = "CipherData";
+const xmlChar xmlSecNodeCipherValue[] = "CipherValue";
+const xmlChar xmlSecNodeCipherReference[] = "CipherReference";
+const xmlChar xmlSecNodeReferenceList[] = "ReferenceList";
const xmlChar xmlSecNodeDataReference[] = "DataReference";
const xmlChar xmlSecNodeKeyReference[] = "KeyReference";
-const xmlChar xmlSecNodeCarriedKeyName[] = "CarriedKeyName";
+const xmlChar xmlSecNodeCarriedKeyName[] = "CarriedKeyName";
-const xmlChar xmlSecTypeEncContent[] = "http://www.w3.org/2001/04/xmlenc#Content";
-const xmlChar xmlSecTypeEncElement[] = "http://www.w3.org/2001/04/xmlenc#Element";
+const xmlChar xmlSecTypeEncContent[] = "http://www.w3.org/2001/04/xmlenc#Content";
+const xmlChar xmlSecTypeEncElement[] = "http://www.w3.org/2001/04/xmlenc#Element";
/*************************************************************************
*
@@ -72,108 +72,108 @@ const xmlChar xmlSecTypeEncElement[] = "http://www.w3.org/2001/04/xmlenc#Elemen
*
************************************************************************/
#ifndef XMLSEC_NO_XKMS
-const xmlChar xmlSecXkmsServerRequestResultName[] = "result-response";
-const xmlChar xmlSecXkmsServerRequestStatusName[] = "status-request";
-const xmlChar xmlSecXkmsServerRequestLocateName[] = "locate-request";
-const xmlChar xmlSecXkmsServerRequestValidateName[] = "validate-request";
-const xmlChar xmlSecXkmsServerRequestCompoundName[] = "compound-request";
-
-const xmlChar xmlSecNodeResult[] = "Result";
-const xmlChar xmlSecNodeStatusRequest[] = "StatusRequest";
-const xmlChar xmlSecNodeStatusResult[] = "StatusResult";
-const xmlChar xmlSecNodeLocateRequest[] = "LocateRequest";
-const xmlChar xmlSecNodeLocateResult[] = "LocateResult";
-const xmlChar xmlSecNodeValidateRequest[] = "ValidateRequest";
-const xmlChar xmlSecNodeValidateResult[] = "ValidateResult";
-const xmlChar xmlSecNodeCompoundRequest[] = "CompoundRequest";
-const xmlChar xmlSecNodeCompoundResult[] = "CompoundResult";
-
-const xmlChar xmlSecNodeMessageExtension[] = "MessageExtension";
-const xmlChar xmlSecNodeOpaqueClientData[] = "OpaqueClientData";
-const xmlChar xmlSecNodeResponseMechanism[] = "ResponseMechanism";
-const xmlChar xmlSecNodeRespondWith[] = "RespondWith";
-const xmlChar xmlSecNodePendingNotification[] = "PendingNotification";
-const xmlChar xmlSecNodeQueryKeyBinding[] = "QueryKeyBinding";
-const xmlChar xmlSecNodeKeyUsage[] = "KeyUsage";
-const xmlChar xmlSecNodeUseKeyWith[] = "UseKeyWith";
-const xmlChar xmlSecNodeTimeInstant[] = "TimeInstant";
-const xmlChar xmlSecNodeRequestSignatureValue[] = "RequestSignatureValue";
-const xmlChar xmlSecNodeUnverifiedKeyBinding[] = "UnverifiedKeyBinding";
-const xmlChar xmlSecNodeValidityInterval[] = "ValidityInterval";
+const xmlChar xmlSecXkmsServerRequestResultName[] = "result-response";
+const xmlChar xmlSecXkmsServerRequestStatusName[] = "status-request";
+const xmlChar xmlSecXkmsServerRequestLocateName[] = "locate-request";
+const xmlChar xmlSecXkmsServerRequestValidateName[] = "validate-request";
+const xmlChar xmlSecXkmsServerRequestCompoundName[] = "compound-request";
+
+const xmlChar xmlSecNodeResult[] = "Result";
+const xmlChar xmlSecNodeStatusRequest[] = "StatusRequest";
+const xmlChar xmlSecNodeStatusResult[] = "StatusResult";
+const xmlChar xmlSecNodeLocateRequest[] = "LocateRequest";
+const xmlChar xmlSecNodeLocateResult[] = "LocateResult";
+const xmlChar xmlSecNodeValidateRequest[] = "ValidateRequest";
+const xmlChar xmlSecNodeValidateResult[] = "ValidateResult";
+const xmlChar xmlSecNodeCompoundRequest[] = "CompoundRequest";
+const xmlChar xmlSecNodeCompoundResult[] = "CompoundResult";
+
+const xmlChar xmlSecNodeMessageExtension[] = "MessageExtension";
+const xmlChar xmlSecNodeOpaqueClientData[] = "OpaqueClientData";
+const xmlChar xmlSecNodeResponseMechanism[] = "ResponseMechanism";
+const xmlChar xmlSecNodeRespondWith[] = "RespondWith";
+const xmlChar xmlSecNodePendingNotification[] = "PendingNotification";
+const xmlChar xmlSecNodeQueryKeyBinding[] = "QueryKeyBinding";
+const xmlChar xmlSecNodeKeyUsage[] = "KeyUsage";
+const xmlChar xmlSecNodeUseKeyWith[] = "UseKeyWith";
+const xmlChar xmlSecNodeTimeInstant[] = "TimeInstant";
+const xmlChar xmlSecNodeRequestSignatureValue[] = "RequestSignatureValue";
+const xmlChar xmlSecNodeUnverifiedKeyBinding[] = "UnverifiedKeyBinding";
+const xmlChar xmlSecNodeValidityInterval[] = "ValidityInterval";
const xmlChar xmlSecNodeStatus[] = "Status";
const xmlChar xmlSecNodeValidReason[] = "ValidReason";
const xmlChar xmlSecNodeInvalidReason[] = "InvalidReason";
const xmlChar xmlSecNodeIndeterminateReason[] = "IndeterminateReason";
-const xmlChar xmlSecAttrService[] = "Service";
-const xmlChar xmlSecAttrNonce[] = "Nonce";
-const xmlChar xmlSecAttrOriginalRequestId[] = "OriginalRequestId";
-const xmlChar xmlSecAttrResponseLimit[] = "ResponseLimit";
-const xmlChar xmlSecAttrMechanism[] = "Mechanism[";
-const xmlChar xmlSecAttrIdentifier[] = "Identifier";
-const xmlChar xmlSecAttrApplication[] = "Application";
-const xmlChar xmlSecAttrResultMajor[] = "ResultMajor";
-const xmlChar xmlSecAttrResultMinor[] = "ResultMinor";
-const xmlChar xmlSecAttrRequestId[] = "RequestId";
-const xmlChar xmlSecAttrNotBefore[] = "NotBefore";
-const xmlChar xmlSecAttrNotOnOrAfter[] = "NotOnOrAfter";
-const xmlChar xmlSecAttrTime[] = "Time";
+const xmlChar xmlSecAttrService[] = "Service";
+const xmlChar xmlSecAttrNonce[] = "Nonce";
+const xmlChar xmlSecAttrOriginalRequestId[] = "OriginalRequestId";
+const xmlChar xmlSecAttrResponseLimit[] = "ResponseLimit";
+const xmlChar xmlSecAttrMechanism[] = "Mechanism[";
+const xmlChar xmlSecAttrIdentifier[] = "Identifier";
+const xmlChar xmlSecAttrApplication[] = "Application";
+const xmlChar xmlSecAttrResultMajor[] = "ResultMajor";
+const xmlChar xmlSecAttrResultMinor[] = "ResultMinor";
+const xmlChar xmlSecAttrRequestId[] = "RequestId";
+const xmlChar xmlSecAttrNotBefore[] = "NotBefore";
+const xmlChar xmlSecAttrNotOnOrAfter[] = "NotOnOrAfter";
+const xmlChar xmlSecAttrTime[] = "Time";
const xmlChar xmlSecAttrStatusValue[] = "StatusValue";
-const xmlChar xmlSecResponseMechanismPending[] = "Pending";
+const xmlChar xmlSecResponseMechanismPending[] = "Pending";
const xmlChar xmlSecResponseMechanismRepresent[]= "Represent";
const xmlChar xmlSecResponseMechanismRequestSignatureValue[] = "RequestSignatureValue";
-const xmlChar xmlSecRespondWithKeyName[] = "KeyName";
-const xmlChar xmlSecRespondWithKeyValue[] = "KeyValue";
-const xmlChar xmlSecRespondWithX509Cert[] = "X509Cert";
-const xmlChar xmlSecRespondWithX509Chain[] = "X509Chain";
-const xmlChar xmlSecRespondWithX509CRL[] = "X509CRL";
-const xmlChar xmlSecRespondWithOCSP[] = "OCSP";
+const xmlChar xmlSecRespondWithKeyName[] = "KeyName";
+const xmlChar xmlSecRespondWithKeyValue[] = "KeyValue";
+const xmlChar xmlSecRespondWithX509Cert[] = "X509Cert";
+const xmlChar xmlSecRespondWithX509Chain[] = "X509Chain";
+const xmlChar xmlSecRespondWithX509CRL[] = "X509CRL";
+const xmlChar xmlSecRespondWithOCSP[] = "OCSP";
const xmlChar xmlSecRespondWithRetrievalMethod[]= "RetrievalMethod";
-const xmlChar xmlSecRespondWithPGP[] = "PGP";
-const xmlChar xmlSecRespondWithPGPWeb[] = "PGPWeb";
-const xmlChar xmlSecRespondWithSPKI[] = "SPKI";
-const xmlChar xmlSecRespondWithPrivateKey[] = "PrivateKey";
+const xmlChar xmlSecRespondWithPGP[] = "PGP";
+const xmlChar xmlSecRespondWithPGPWeb[] = "PGPWeb";
+const xmlChar xmlSecRespondWithSPKI[] = "SPKI";
+const xmlChar xmlSecRespondWithPrivateKey[] = "PrivateKey";
-const xmlChar xmlSecStatusResultSuccess[] = "Success";
-const xmlChar xmlSecStatusResultFailed[] = "Failed";
-const xmlChar xmlSecStatusResultPending[] = "Pending";
+const xmlChar xmlSecStatusResultSuccess[] = "Success";
+const xmlChar xmlSecStatusResultFailed[] = "Failed";
+const xmlChar xmlSecStatusResultPending[] = "Pending";
-const xmlChar xmlSecKeyUsageEncryption[] = "Encryption";
-const xmlChar xmlSecKeyUsageSignature[] = "Signature";
-const xmlChar xmlSecKeyUsageExchange[] = "Exchange";
+const xmlChar xmlSecKeyUsageEncryption[] = "Encryption";
+const xmlChar xmlSecKeyUsageSignature[] = "Signature";
+const xmlChar xmlSecKeyUsageExchange[] = "Exchange";
-const xmlChar xmlSecKeyBindingStatusValid[] = "Valid";
-const xmlChar xmlSecKeyBindingStatusInvalid[] = "Invalid";
-const xmlChar xmlSecKeyBindingStatusIndeterminate[] = "Indeterminate";
+const xmlChar xmlSecKeyBindingStatusValid[] = "Valid";
+const xmlChar xmlSecKeyBindingStatusInvalid[] = "Invalid";
+const xmlChar xmlSecKeyBindingStatusIndeterminate[] = "Indeterminate";
const xmlChar xmlSecKeyBindingReasonIssuerTrust[] = "IssuerTrust";
const xmlChar xmlSecKeyBindingReasonRevocationStatus[] = "RevocationStatus";
const xmlChar xmlSecKeyBindingReasonValidityInterval[] = "ValidityInterval";
const xmlChar xmlSecKeyBindingReasonSignature[] = "Signature";
-const xmlChar xmlSecResultMajorCodeSuccess[] = "Success";
-const xmlChar xmlSecResultMajorCodeVersionMismatch[] = "VersionMismatch";
-const xmlChar xmlSecResultMajorCodeSender[] = "Sender";
-const xmlChar xmlSecResultMajorCodeReceiver[] = "Receiver";
-const xmlChar xmlSecResultMajorCodeRepresent[] = "Represent";
-const xmlChar xmlSecResultMajorCodePending[] = "Pending";
-
-const xmlChar xmlSecResultMinorCodeNoMatch[] = "NoMatch";
-const xmlChar xmlSecResultMinorCodeTooManyResponses[] = "TooManyResponses";
-const xmlChar xmlSecResultMinorCodeIncomplete[] = "Incomplete";
-const xmlChar xmlSecResultMinorCodeFailure[] = "Failure";
-const xmlChar xmlSecResultMinorCodeRefused[] = "Refused";
-const xmlChar xmlSecResultMinorCodeNoAuthentication[] = "NoAuthentication";
+const xmlChar xmlSecResultMajorCodeSuccess[] = "Success";
+const xmlChar xmlSecResultMajorCodeVersionMismatch[] = "VersionMismatch";
+const xmlChar xmlSecResultMajorCodeSender[] = "Sender";
+const xmlChar xmlSecResultMajorCodeReceiver[] = "Receiver";
+const xmlChar xmlSecResultMajorCodeRepresent[] = "Represent";
+const xmlChar xmlSecResultMajorCodePending[] = "Pending";
+
+const xmlChar xmlSecResultMinorCodeNoMatch[] = "NoMatch";
+const xmlChar xmlSecResultMinorCodeTooManyResponses[] = "TooManyResponses";
+const xmlChar xmlSecResultMinorCodeIncomplete[] = "Incomplete";
+const xmlChar xmlSecResultMinorCodeFailure[] = "Failure";
+const xmlChar xmlSecResultMinorCodeRefused[] = "Refused";
+const xmlChar xmlSecResultMinorCodeNoAuthentication[] = "NoAuthentication";
const xmlChar xmlSecResultMinorCodeMessageNotSupported[]= "MessageNotSupported";
-const xmlChar xmlSecResultMinorCodeUnknownResponseId[] = "UnknownResponseId";
-const xmlChar xmlSecResultMinorCodeNotSynchronous[] = "NotSynchronous";
+const xmlChar xmlSecResultMinorCodeUnknownResponseId[] = "UnknownResponseId";
+const xmlChar xmlSecResultMinorCodeNotSynchronous[] = "NotSynchronous";
const xmlChar xmlSecXkmsSoapSubcodeValueMessageNotSupported[] = "MessageNotSupported";
-const xmlChar xmlSecXkmsSoapSubcodeValueBadMessage[] = "BadMessage";
+const xmlChar xmlSecXkmsSoapSubcodeValueBadMessage[] = "BadMessage";
-const xmlChar xmlSecXkmsSoapFaultReasonLang[] = "en";
+const xmlChar xmlSecXkmsSoapFaultReasonLang[] = "en";
const xmlChar xmlSecXkmsSoapFaultReasonUnsupportedVersion[] = "Unsupported SOAP version";
const xmlChar xmlSecXkmsSoapFaultReasonUnableToProcess[] = "Unable to process %s";
const xmlChar xmlSecXkmsSoapFaultReasonServiceUnavailable[] = "Service temporarily unable";
@@ -191,365 +191,365 @@ const xmlChar xmlSecXkmsFormatStrSoap12[] = "soap-1.2";
* KeyInfo Nodes
*
************************************************************************/
-const xmlChar xmlSecNodeKeyInfo[] = "KeyInfo";
-const xmlChar xmlSecNodeReference[] = "Reference";
-const xmlChar xmlSecNodeTransforms[] = "Transforms";
-const xmlChar xmlSecNodeTransform[] = "Transform";
+const xmlChar xmlSecNodeKeyInfo[] = "KeyInfo";
+const xmlChar xmlSecNodeReference[] = "Reference";
+const xmlChar xmlSecNodeTransforms[] = "Transforms";
+const xmlChar xmlSecNodeTransform[] = "Transform";
/*************************************************************************
*
* Attributes
*
************************************************************************/
-const xmlChar xmlSecAttrId[] = "Id";
-const xmlChar xmlSecAttrURI[] = "URI";
-const xmlChar xmlSecAttrType[] = "Type";
-const xmlChar xmlSecAttrMimeType[] = "MimeType";
-const xmlChar xmlSecAttrEncoding[] = "Encoding";
-const xmlChar xmlSecAttrAlgorithm[] = "Algorithm";
-const xmlChar xmlSecAttrFilter[] = "Filter";
-const xmlChar xmlSecAttrRecipient[] = "Recipient";
-const xmlChar xmlSecAttrTarget[] = "Target";
+const xmlChar xmlSecAttrId[] = "Id";
+const xmlChar xmlSecAttrURI[] = "URI";
+const xmlChar xmlSecAttrType[] = "Type";
+const xmlChar xmlSecAttrMimeType[] = "MimeType";
+const xmlChar xmlSecAttrEncoding[] = "Encoding";
+const xmlChar xmlSecAttrAlgorithm[] = "Algorithm";
+const xmlChar xmlSecAttrFilter[] = "Filter";
+const xmlChar xmlSecAttrRecipient[] = "Recipient";
+const xmlChar xmlSecAttrTarget[] = "Target";
/*************************************************************************
*
* AES strings
*
************************************************************************/
-const xmlChar xmlSecNameAESKeyValue[] = "aes";
-const xmlChar xmlSecNodeAESKeyValue[] = "AESKeyValue";
-const xmlChar xmlSecHrefAESKeyValue[] = "http://www.aleksey.com/xmlsec/2002#AESKeyValue";
+const xmlChar xmlSecNameAESKeyValue[] = "aes";
+const xmlChar xmlSecNodeAESKeyValue[] = "AESKeyValue";
+const xmlChar xmlSecHrefAESKeyValue[] = "http://www.aleksey.com/xmlsec/2002#AESKeyValue";
-const xmlChar xmlSecNameAes128Cbc[] = "aes128-cbc";
-const xmlChar xmlSecHrefAes128Cbc[] = "http://www.w3.org/2001/04/xmlenc#aes128-cbc";
+const xmlChar xmlSecNameAes128Cbc[] = "aes128-cbc";
+const xmlChar xmlSecHrefAes128Cbc[] = "http://www.w3.org/2001/04/xmlenc#aes128-cbc";
-const xmlChar xmlSecNameAes192Cbc[] = "aes192-cbc";
-const xmlChar xmlSecHrefAes192Cbc[] = "http://www.w3.org/2001/04/xmlenc#aes192-cbc";
+const xmlChar xmlSecNameAes192Cbc[] = "aes192-cbc";
+const xmlChar xmlSecHrefAes192Cbc[] = "http://www.w3.org/2001/04/xmlenc#aes192-cbc";
-const xmlChar xmlSecNameAes256Cbc[] = "aes256-cbc";
-const xmlChar xmlSecHrefAes256Cbc[] = "http://www.w3.org/2001/04/xmlenc#aes256-cbc";
+const xmlChar xmlSecNameAes256Cbc[] = "aes256-cbc";
+const xmlChar xmlSecHrefAes256Cbc[] = "http://www.w3.org/2001/04/xmlenc#aes256-cbc";
-const xmlChar xmlSecNameKWAes128[] = "kw-aes128";
-const xmlChar xmlSecHrefKWAes128[] = "http://www.w3.org/2001/04/xmlenc#kw-aes128";
+const xmlChar xmlSecNameKWAes128[] = "kw-aes128";
+const xmlChar xmlSecHrefKWAes128[] = "http://www.w3.org/2001/04/xmlenc#kw-aes128";
-const xmlChar xmlSecNameKWAes192[] = "kw-aes192";
-const xmlChar xmlSecHrefKWAes192[] = "http://www.w3.org/2001/04/xmlenc#kw-aes192";
+const xmlChar xmlSecNameKWAes192[] = "kw-aes192";
+const xmlChar xmlSecHrefKWAes192[] = "http://www.w3.org/2001/04/xmlenc#kw-aes192";
-const xmlChar xmlSecNameKWAes256[] = "kw-aes256";
-const xmlChar xmlSecHrefKWAes256[] = "http://www.w3.org/2001/04/xmlenc#kw-aes256";
+const xmlChar xmlSecNameKWAes256[] = "kw-aes256";
+const xmlChar xmlSecHrefKWAes256[] = "http://www.w3.org/2001/04/xmlenc#kw-aes256";
/*************************************************************************
*
* BASE64 strings
*
************************************************************************/
-const xmlChar xmlSecNameBase64[] = "base64";
-const xmlChar xmlSecHrefBase64[] = "http://www.w3.org/2000/09/xmldsig#base64";
+const xmlChar xmlSecNameBase64[] = "base64";
+const xmlChar xmlSecHrefBase64[] = "http://www.w3.org/2000/09/xmldsig#base64";
/*************************************************************************
*
* C14N strings
*
************************************************************************/
-const xmlChar xmlSecNameC14N[] = "c14n";
-const xmlChar xmlSecHrefC14N[] = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
+const xmlChar xmlSecNameC14N[] = "c14n";
+const xmlChar xmlSecHrefC14N[] = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
-const xmlChar xmlSecNameC14NWithComments[] = "c14n-with-comments";
-const xmlChar xmlSecHrefC14NWithComments[] = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments";
+const xmlChar xmlSecNameC14NWithComments[] = "c14n-with-comments";
+const xmlChar xmlSecHrefC14NWithComments[] = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments";
-const xmlChar xmlSecNameC14N11[] = "c14n11";
-const xmlChar xmlSecHrefC14N11[] = "http://www.w3.org/2006/12/xml-c14n11";
+const xmlChar xmlSecNameC14N11[] = "c14n11";
+const xmlChar xmlSecHrefC14N11[] = "http://www.w3.org/2006/12/xml-c14n11";
-const xmlChar xmlSecNameC14N11WithComments[] = "c14n11-with-comments";
-const xmlChar xmlSecHrefC14N11WithComments[] = "http://www.w3.org/2006/12/xml-c14n11#WithComments";
+const xmlChar xmlSecNameC14N11WithComments[] = "c14n11-with-comments";
+const xmlChar xmlSecHrefC14N11WithComments[] = "http://www.w3.org/2006/12/xml-c14n11#WithComments";
-const xmlChar xmlSecNameExcC14N[] = "exc-c14n";
-const xmlChar xmlSecHrefExcC14N[] = "http://www.w3.org/2001/10/xml-exc-c14n#";
+const xmlChar xmlSecNameExcC14N[] = "exc-c14n";
+const xmlChar xmlSecHrefExcC14N[] = "http://www.w3.org/2001/10/xml-exc-c14n#";
-const xmlChar xmlSecNameExcC14NWithComments[] = "exc-c14n-with-comments";
-const xmlChar xmlSecHrefExcC14NWithComments[] = "http://www.w3.org/2001/10/xml-exc-c14n#WithComments";
+const xmlChar xmlSecNameExcC14NWithComments[] = "exc-c14n-with-comments";
+const xmlChar xmlSecHrefExcC14NWithComments[] = "http://www.w3.org/2001/10/xml-exc-c14n#WithComments";
-const xmlChar xmlSecNsExcC14N[] = "http://www.w3.org/2001/10/xml-exc-c14n#";
-const xmlChar xmlSecNsExcC14NWithComments[] = "http://www.w3.org/2001/10/xml-exc-c14n#WithComments";
+const xmlChar xmlSecNsExcC14N[] = "http://www.w3.org/2001/10/xml-exc-c14n#";
+const xmlChar xmlSecNsExcC14NWithComments[] = "http://www.w3.org/2001/10/xml-exc-c14n#WithComments";
-const xmlChar xmlSecNodeInclusiveNamespaces[] = "InclusiveNamespaces";
-const xmlChar xmlSecAttrPrefixList[] = "PrefixList";
+const xmlChar xmlSecNodeInclusiveNamespaces[] = "InclusiveNamespaces";
+const xmlChar xmlSecAttrPrefixList[] = "PrefixList";
/*************************************************************************
*
* DES strings
*
************************************************************************/
-const xmlChar xmlSecNameDESKeyValue[] = "des";
-const xmlChar xmlSecNodeDESKeyValue[] = "DESKeyValue";
-const xmlChar xmlSecHrefDESKeyValue[] = "http://www.aleksey.com/xmlsec/2002#DESKeyValue";
+const xmlChar xmlSecNameDESKeyValue[] = "des";
+const xmlChar xmlSecNodeDESKeyValue[] = "DESKeyValue";
+const xmlChar xmlSecHrefDESKeyValue[] = "http://www.aleksey.com/xmlsec/2002#DESKeyValue";
-const xmlChar xmlSecNameDes3Cbc[] = "tripledes-cbc";
-const xmlChar xmlSecHrefDes3Cbc[] = "http://www.w3.org/2001/04/xmlenc#tripledes-cbc";
+const xmlChar xmlSecNameDes3Cbc[] = "tripledes-cbc";
+const xmlChar xmlSecHrefDes3Cbc[] = "http://www.w3.org/2001/04/xmlenc#tripledes-cbc";
-const xmlChar xmlSecNameKWDes3[] = "kw-tripledes";
-const xmlChar xmlSecHrefKWDes3[] = "http://www.w3.org/2001/04/xmlenc#kw-tripledes";
+const xmlChar xmlSecNameKWDes3[] = "kw-tripledes";
+const xmlChar xmlSecHrefKWDes3[] = "http://www.w3.org/2001/04/xmlenc#kw-tripledes";
/*************************************************************************
*
* GOST2001 strings
*
************************************************************************/
-const xmlChar xmlSecNameGOST2001KeyValue[] = "gost2001";
-const xmlChar xmlSecNodeGOST2001KeyValue[] = "gostr34102001-gostr3411";
-const xmlChar xmlSecHrefGOST2001KeyValue[] = "http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411";
+const xmlChar xmlSecNameGOST2001KeyValue[] = "gost2001";
+const xmlChar xmlSecNodeGOST2001KeyValue[] = "gostr34102001-gostr3411";
+const xmlChar xmlSecHrefGOST2001KeyValue[] = "http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411";
-const xmlChar xmlSecNameGost2001GostR3411_94[] = "gostr34102001-gostr3411";
-const xmlChar xmlSecHrefGost2001GostR3411_94[] = "http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411";
+const xmlChar xmlSecNameGost2001GostR3411_94[] = "gostr34102001-gostr3411";
+const xmlChar xmlSecHrefGost2001GostR3411_94[] = "http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411";
/*************************************************************************
*
* DSA strings
*
************************************************************************/
-const xmlChar xmlSecNameDSAKeyValue[] = "dsa";
-const xmlChar xmlSecNodeDSAKeyValue[] = "DSAKeyValue";
-const xmlChar xmlSecHrefDSAKeyValue[] = "http://www.w3.org/2000/09/xmldsig#DSAKeyValue";
-const xmlChar xmlSecNodeDSAP[] = "P";
-const xmlChar xmlSecNodeDSAQ[] = "Q";
-const xmlChar xmlSecNodeDSAG[] = "G";
-const xmlChar xmlSecNodeDSAJ[] = "J";
-const xmlChar xmlSecNodeDSAX[] = "X";
-const xmlChar xmlSecNodeDSAY[] = "Y";
-const xmlChar xmlSecNodeDSASeed[] = "Seed";
-const xmlChar xmlSecNodeDSAPgenCounter[] = "PgenCounter";
-
-const xmlChar xmlSecNameDsaSha1[] = "dsa-sha1";
-const xmlChar xmlSecHrefDsaSha1[] = "http://www.w3.org/2000/09/xmldsig#dsa-sha1";
+const xmlChar xmlSecNameDSAKeyValue[] = "dsa";
+const xmlChar xmlSecNodeDSAKeyValue[] = "DSAKeyValue";
+const xmlChar xmlSecHrefDSAKeyValue[] = "http://www.w3.org/2000/09/xmldsig#DSAKeyValue";
+const xmlChar xmlSecNodeDSAP[] = "P";
+const xmlChar xmlSecNodeDSAQ[] = "Q";
+const xmlChar xmlSecNodeDSAG[] = "G";
+const xmlChar xmlSecNodeDSAJ[] = "J";
+const xmlChar xmlSecNodeDSAX[] = "X";
+const xmlChar xmlSecNodeDSAY[] = "Y";
+const xmlChar xmlSecNodeDSASeed[] = "Seed";
+const xmlChar xmlSecNodeDSAPgenCounter[] = "PgenCounter";
+
+const xmlChar xmlSecNameDsaSha1[] = "dsa-sha1";
+const xmlChar xmlSecHrefDsaSha1[] = "http://www.w3.org/2000/09/xmldsig#dsa-sha1";
/*************************************************************************
*
* EncryptedKey
*
************************************************************************/
-const xmlChar xmlSecNameEncryptedKey[] = "enc-key";
-const xmlChar xmlSecNodeEncryptedKey[] = "EncryptedKey";
-const xmlChar xmlSecHrefEncryptedKey[] = "http://www.w3.org/2001/04/xmlenc#EncryptedKey";
+const xmlChar xmlSecNameEncryptedKey[] = "enc-key";
+const xmlChar xmlSecNodeEncryptedKey[] = "EncryptedKey";
+const xmlChar xmlSecHrefEncryptedKey[] = "http://www.w3.org/2001/04/xmlenc#EncryptedKey";
/*************************************************************************
*
* Enveloped transform strings
*
************************************************************************/
-const xmlChar xmlSecNameEnveloped[] = "enveloped-signature";
-const xmlChar xmlSecHrefEnveloped[] = "http://www.w3.org/2000/09/xmldsig#enveloped-signature";
+const xmlChar xmlSecNameEnveloped[] = "enveloped-signature";
+const xmlChar xmlSecHrefEnveloped[] = "http://www.w3.org/2000/09/xmldsig#enveloped-signature";
/*************************************************************************
*
* HMAC strings
*
************************************************************************/
-const xmlChar xmlSecNameHMACKeyValue[] = "hmac";
-const xmlChar xmlSecNodeHMACKeyValue[] = "HMACKeyValue";
-const xmlChar xmlSecHrefHMACKeyValue[] = "http://www.aleksey.com/xmlsec/2002#HMACKeyValue";
+const xmlChar xmlSecNameHMACKeyValue[] = "hmac";
+const xmlChar xmlSecNodeHMACKeyValue[] = "HMACKeyValue";
+const xmlChar xmlSecHrefHMACKeyValue[] = "http://www.aleksey.com/xmlsec/2002#HMACKeyValue";
-const xmlChar xmlSecNodeHMACOutputLength[] = "HMACOutputLength";
+const xmlChar xmlSecNodeHMACOutputLength[] = "HMACOutputLength";
-const xmlChar xmlSecNameHmacMd5[] = "hmac-md5";
-const xmlChar xmlSecHrefHmacMd5[] = "http://www.w3.org/2001/04/xmldsig-more#hmac-md5";
+const xmlChar xmlSecNameHmacMd5[] = "hmac-md5";
+const xmlChar xmlSecHrefHmacMd5[] = "http://www.w3.org/2001/04/xmldsig-more#hmac-md5";
-const xmlChar xmlSecNameHmacRipemd160[] = "hmac-ripemd160";
-const xmlChar xmlSecHrefHmacRipemd160[] = "http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160";
+const xmlChar xmlSecNameHmacRipemd160[] = "hmac-ripemd160";
+const xmlChar xmlSecHrefHmacRipemd160[] = "http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160";
-const xmlChar xmlSecNameHmacSha1[] = "hmac-sha1";
-const xmlChar xmlSecHrefHmacSha1[] = "http://www.w3.org/2000/09/xmldsig#hmac-sha1";
+const xmlChar xmlSecNameHmacSha1[] = "hmac-sha1";
+const xmlChar xmlSecHrefHmacSha1[] = "http://www.w3.org/2000/09/xmldsig#hmac-sha1";
-const xmlChar xmlSecNameHmacSha224[] = "hmac-sha224";
-const xmlChar xmlSecHrefHmacSha224[] = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha224";
+const xmlChar xmlSecNameHmacSha224[] = "hmac-sha224";
+const xmlChar xmlSecHrefHmacSha224[] = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha224";
-const xmlChar xmlSecNameHmacSha256[] = "hmac-sha256";
-const xmlChar xmlSecHrefHmacSha256[] = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256";
+const xmlChar xmlSecNameHmacSha256[] = "hmac-sha256";
+const xmlChar xmlSecHrefHmacSha256[] = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256";
-const xmlChar xmlSecNameHmacSha384[] = "hmac-sha384";
-const xmlChar xmlSecHrefHmacSha384[] = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha384";
+const xmlChar xmlSecNameHmacSha384[] = "hmac-sha384";
+const xmlChar xmlSecHrefHmacSha384[] = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha384";
-const xmlChar xmlSecNameHmacSha512[] = "hmac-sha512";
-const xmlChar xmlSecHrefHmacSha512[] = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha512";
+const xmlChar xmlSecNameHmacSha512[] = "hmac-sha512";
+const xmlChar xmlSecHrefHmacSha512[] = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha512";
/*************************************************************************
*
* KeyName strings
*
************************************************************************/
-const xmlChar xmlSecNameKeyName[] = "key-name";
-const xmlChar xmlSecNodeKeyName[] = "KeyName";
+const xmlChar xmlSecNameKeyName[] = "key-name";
+const xmlChar xmlSecNodeKeyName[] = "KeyName";
/*************************************************************************
*
* KeyValue strings
*
************************************************************************/
-const xmlChar xmlSecNameKeyValue[] = "key-value";
-const xmlChar xmlSecNodeKeyValue[] = "KeyValue";
+const xmlChar xmlSecNameKeyValue[] = "key-value";
+const xmlChar xmlSecNodeKeyValue[] = "KeyValue";
/*************************************************************************
*
* Memory Buffer strings
*
************************************************************************/
-const xmlChar xmlSecNameMemBuf[] = "membuf-transform";
+const xmlChar xmlSecNameMemBuf[] = "membuf-transform";
/*************************************************************************
*
* MD5 strings
*
************************************************************************/
-const xmlChar xmlSecNameMd5[] = "md5";
-const xmlChar xmlSecHrefMd5[] = "http://www.w3.org/2001/04/xmldsig-more#md5";
+const xmlChar xmlSecNameMd5[] = "md5";
+const xmlChar xmlSecHrefMd5[] = "http://www.w3.org/2001/04/xmldsig-more#md5";
/*************************************************************************
*
* RetrievalMethod
*
************************************************************************/
-const xmlChar xmlSecNameRetrievalMethod[] = "retrieval-method";
-const xmlChar xmlSecNodeRetrievalMethod[] = "RetrievalMethod";
+const xmlChar xmlSecNameRetrievalMethod[] = "retrieval-method";
+const xmlChar xmlSecNodeRetrievalMethod[] = "RetrievalMethod";
/*************************************************************************
*
* RIPEMD160 strings
*
************************************************************************/
-const xmlChar xmlSecNameRipemd160[] = "ripemd160";
-const xmlChar xmlSecHrefRipemd160[] = "http://www.w3.org/2001/04/xmlenc#ripemd160";
+const xmlChar xmlSecNameRipemd160[] = "ripemd160";
+const xmlChar xmlSecHrefRipemd160[] = "http://www.w3.org/2001/04/xmlenc#ripemd160";
/*************************************************************************
*
* RSA strings
*
************************************************************************/
-const xmlChar xmlSecNameRSAKeyValue[] = "rsa";
-const xmlChar xmlSecNodeRSAKeyValue[] = "RSAKeyValue";
-const xmlChar xmlSecHrefRSAKeyValue[] = "http://www.w3.org/2000/09/xmldsig#RSAKeyValue";
-const xmlChar xmlSecNodeRSAModulus[] = "Modulus";
-const xmlChar xmlSecNodeRSAExponent[] = "Exponent";
-const xmlChar xmlSecNodeRSAPrivateExponent[] = "PrivateExponent";
+const xmlChar xmlSecNameRSAKeyValue[] = "rsa";
+const xmlChar xmlSecNodeRSAKeyValue[] = "RSAKeyValue";
+const xmlChar xmlSecHrefRSAKeyValue[] = "http://www.w3.org/2000/09/xmldsig#RSAKeyValue";
+const xmlChar xmlSecNodeRSAModulus[] = "Modulus";
+const xmlChar xmlSecNodeRSAExponent[] = "Exponent";
+const xmlChar xmlSecNodeRSAPrivateExponent[] = "PrivateExponent";
-const xmlChar xmlSecNameRsaMd5[] = "rsa-md5";
-const xmlChar xmlSecHrefRsaMd5[] = "http://www.w3.org/2001/04/xmldsig-more#rsa-md5";
+const xmlChar xmlSecNameRsaMd5[] = "rsa-md5";
+const xmlChar xmlSecHrefRsaMd5[] = "http://www.w3.org/2001/04/xmldsig-more#rsa-md5";
-const xmlChar xmlSecNameRsaRipemd160[] = "rsa-ripemd160";
-const xmlChar xmlSecHrefRsaRipemd160[] = "http://www.w3.org/2001/04/xmldsig-more#rsa-ripemd160";
+const xmlChar xmlSecNameRsaRipemd160[] = "rsa-ripemd160";
+const xmlChar xmlSecHrefRsaRipemd160[] = "http://www.w3.org/2001/04/xmldsig-more#rsa-ripemd160";
-const xmlChar xmlSecNameRsaSha1[] = "rsa-sha1";
-const xmlChar xmlSecHrefRsaSha1[] = "http://www.w3.org/2000/09/xmldsig#rsa-sha1";
+const xmlChar xmlSecNameRsaSha1[] = "rsa-sha1";
+const xmlChar xmlSecHrefRsaSha1[] = "http://www.w3.org/2000/09/xmldsig#rsa-sha1";
-const xmlChar xmlSecNameRsaSha224[] = "rsa-sha224";
-const xmlChar xmlSecHrefRsaSha224[] = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha224";
+const xmlChar xmlSecNameRsaSha224[] = "rsa-sha224";
+const xmlChar xmlSecHrefRsaSha224[] = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha224";
-const xmlChar xmlSecNameRsaSha256[] = "rsa-sha256";
-const xmlChar xmlSecHrefRsaSha256[] = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256";
+const xmlChar xmlSecNameRsaSha256[] = "rsa-sha256";
+const xmlChar xmlSecHrefRsaSha256[] = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256";
-const xmlChar xmlSecNameRsaSha384[] = "rsa-sha384";
-const xmlChar xmlSecHrefRsaSha384[] = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384";
+const xmlChar xmlSecNameRsaSha384[] = "rsa-sha384";
+const xmlChar xmlSecHrefRsaSha384[] = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384";
-const xmlChar xmlSecNameRsaSha512[] = "rsa-sha512";
-const xmlChar xmlSecHrefRsaSha512[] = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512";
+const xmlChar xmlSecNameRsaSha512[] = "rsa-sha512";
+const xmlChar xmlSecHrefRsaSha512[] = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512";
-const xmlChar xmlSecNameRsaPkcs1[] = "rsa-1_5";
-const xmlChar xmlSecHrefRsaPkcs1[] = "http://www.w3.org/2001/04/xmlenc#rsa-1_5";
+const xmlChar xmlSecNameRsaPkcs1[] = "rsa-1_5";
+const xmlChar xmlSecHrefRsaPkcs1[] = "http://www.w3.org/2001/04/xmlenc#rsa-1_5";
-const xmlChar xmlSecNameRsaOaep[] = "rsa-oaep-mgf1p";
-const xmlChar xmlSecHrefRsaOaep[] = "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p";
-const xmlChar xmlSecNodeRsaOAEPparams[] = "OAEPparams";
+const xmlChar xmlSecNameRsaOaep[] = "rsa-oaep-mgf1p";
+const xmlChar xmlSecHrefRsaOaep[] = "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p";
+const xmlChar xmlSecNodeRsaOAEPparams[] = "OAEPparams";
/*************************************************************************
*
* GOSTR3411_94 strings
*
************************************************************************/
-const xmlChar xmlSecNameGostR3411_94[] = "gostr3411";
-const xmlChar xmlSecHrefGostR3411_94[] = "http://www.w3.org/2001/04/xmldsig-more#gostr3411";
+const xmlChar xmlSecNameGostR3411_94[] = "gostr3411";
+const xmlChar xmlSecHrefGostR3411_94[] = "http://www.w3.org/2001/04/xmldsig-more#gostr3411";
/*************************************************************************
*
* SHA1 strings
*
************************************************************************/
-const xmlChar xmlSecNameSha1[] = "sha1";
-const xmlChar xmlSecHrefSha1[] = "http://www.w3.org/2000/09/xmldsig#sha1";
+const xmlChar xmlSecNameSha1[] = "sha1";
+const xmlChar xmlSecHrefSha1[] = "http://www.w3.org/2000/09/xmldsig#sha1";
-const xmlChar xmlSecNameSha224[] = "sha224";
-const xmlChar xmlSecHrefSha224[] = "http://www.w3.org/2001/04/xmldsig-more#sha224";
+const xmlChar xmlSecNameSha224[] = "sha224";
+const xmlChar xmlSecHrefSha224[] = "http://www.w3.org/2001/04/xmldsig-more#sha224";
-const xmlChar xmlSecNameSha256[] = "sha256";
-const xmlChar xmlSecHrefSha256[] = "http://www.w3.org/2001/04/xmlenc#sha256";
+const xmlChar xmlSecNameSha256[] = "sha256";
+const xmlChar xmlSecHrefSha256[] = "http://www.w3.org/2001/04/xmlenc#sha256";
-const xmlChar xmlSecNameSha384[] = "sha384";
-const xmlChar xmlSecHrefSha384[] = "http://www.w3.org/2001/04/xmldsig-more#sha384";
+const xmlChar xmlSecNameSha384[] = "sha384";
+const xmlChar xmlSecHrefSha384[] = "http://www.w3.org/2001/04/xmldsig-more#sha384";
-const xmlChar xmlSecNameSha512[] = "sha512";
-const xmlChar xmlSecHrefSha512[] = "http://www.w3.org/2001/04/xmlenc#sha512";
+const xmlChar xmlSecNameSha512[] = "sha512";
+const xmlChar xmlSecHrefSha512[] = "http://www.w3.org/2001/04/xmlenc#sha512";
/*************************************************************************
*
* X509 strings
*
************************************************************************/
-const xmlChar xmlSecNameX509Data[] = "x509";
-const xmlChar xmlSecNodeX509Data[] = "X509Data";
-const xmlChar xmlSecHrefX509Data[] = "http://www.w3.org/2000/09/xmldsig#X509Data";
+const xmlChar xmlSecNameX509Data[] = "x509";
+const xmlChar xmlSecNodeX509Data[] = "X509Data";
+const xmlChar xmlSecHrefX509Data[] = "http://www.w3.org/2000/09/xmldsig#X509Data";
-const xmlChar xmlSecNodeX509Certificate[] = "X509Certificate";
-const xmlChar xmlSecNodeX509CRL[] = "X509CRL";
-const xmlChar xmlSecNodeX509SubjectName[] = "X509SubjectName";
-const xmlChar xmlSecNodeX509IssuerSerial[] = "X509IssuerSerial";
-const xmlChar xmlSecNodeX509IssuerName[] = "X509IssuerName";
-const xmlChar xmlSecNodeX509SerialNumber[] = "X509SerialNumber";
-const xmlChar xmlSecNodeX509SKI[] = "X509SKI";
+const xmlChar xmlSecNodeX509Certificate[] = "X509Certificate";
+const xmlChar xmlSecNodeX509CRL[] = "X509CRL";
+const xmlChar xmlSecNodeX509SubjectName[] = "X509SubjectName";
+const xmlChar xmlSecNodeX509IssuerSerial[] = "X509IssuerSerial";
+const xmlChar xmlSecNodeX509IssuerName[] = "X509IssuerName";
+const xmlChar xmlSecNodeX509SerialNumber[] = "X509SerialNumber";
+const xmlChar xmlSecNodeX509SKI[] = "X509SKI";
-const xmlChar xmlSecNameRawX509Cert[] = "raw-x509-cert";
-const xmlChar xmlSecHrefRawX509Cert[] = "http://www.w3.org/2000/09/xmldsig#rawX509Certificate";
+const xmlChar xmlSecNameRawX509Cert[] = "raw-x509-cert";
+const xmlChar xmlSecHrefRawX509Cert[] = "http://www.w3.org/2000/09/xmldsig#rawX509Certificate";
-const xmlChar xmlSecNameX509Store[] = "x509-store";
+const xmlChar xmlSecNameX509Store[] = "x509-store";
/*************************************************************************
*
* PGP strings
*
************************************************************************/
-const xmlChar xmlSecNamePGPData[] = "pgp";
-const xmlChar xmlSecNodePGPData[] = "PGPData";
-const xmlChar xmlSecHrefPGPData[] = "http://www.w3.org/2000/09/xmldsig#PGPData";
+const xmlChar xmlSecNamePGPData[] = "pgp";
+const xmlChar xmlSecNodePGPData[] = "PGPData";
+const xmlChar xmlSecHrefPGPData[] = "http://www.w3.org/2000/09/xmldsig#PGPData";
/*************************************************************************
*
* SPKI strings
*
************************************************************************/
-const xmlChar xmlSecNameSPKIData[] = "spki";
-const xmlChar xmlSecNodeSPKIData[] = "SPKIData";
-const xmlChar xmlSecHrefSPKIData[] = "http://www.w3.org/2000/09/xmldsig#SPKIData";
+const xmlChar xmlSecNameSPKIData[] = "spki";
+const xmlChar xmlSecNodeSPKIData[] = "SPKIData";
+const xmlChar xmlSecHrefSPKIData[] = "http://www.w3.org/2000/09/xmldsig#SPKIData";
/*************************************************************************
*
* XPath/XPointer strings
*
************************************************************************/
-const xmlChar xmlSecNameXPath[] = "xpath";
-const xmlChar xmlSecNodeXPath[] = "XPath";
+const xmlChar xmlSecNameXPath[] = "xpath";
+const xmlChar xmlSecNodeXPath[] = "XPath";
-const xmlChar xmlSecNameXPath2[] = "xpath2";
-const xmlChar xmlSecNodeXPath2[] = "XPath";
-const xmlChar xmlSecXPath2FilterIntersect[] = "intersect";
-const xmlChar xmlSecXPath2FilterSubtract[] = "subtract";
-const xmlChar xmlSecXPath2FilterUnion[] = "union";
+const xmlChar xmlSecNameXPath2[] = "xpath2";
+const xmlChar xmlSecNodeXPath2[] = "XPath";
+const xmlChar xmlSecXPath2FilterIntersect[] = "intersect";
+const xmlChar xmlSecXPath2FilterSubtract[] = "subtract";
+const xmlChar xmlSecXPath2FilterUnion[] = "union";
-const xmlChar xmlSecNameXPointer[] = "xpointer";
-const xmlChar xmlSecNodeXPointer[] = "XPointer";
+const xmlChar xmlSecNameXPointer[] = "xpointer";
+const xmlChar xmlSecNodeXPointer[] = "XPointer";
/*************************************************************************
*
* Xslt strings
*
************************************************************************/
-const xmlChar xmlSecNameXslt[] = "xslt";
-const xmlChar xmlSecHrefXslt[] = "http://www.w3.org/TR/1999/REC-xslt-19991116";
+const xmlChar xmlSecNameXslt[] = "xslt";
+const xmlChar xmlSecHrefXslt[] = "http://www.w3.org/TR/1999/REC-xslt-19991116";
#ifndef XMLSEC_NO_SOAP
/*************************************************************************
@@ -557,31 +557,31 @@ const xmlChar xmlSecHrefXslt[] = "http://www.w3.org/TR/1999/REC-xslt-19991116"
* SOAP 1.1/1.2 strings
*
************************************************************************/
-const xmlChar xmlSecNodeEnvelope[] = "Envelope";
-const xmlChar xmlSecNodeHeader[] = "Header";
-const xmlChar xmlSecNodeBody[] = "Body";
-const xmlChar xmlSecNodeFault[] = "Fault";
-const xmlChar xmlSecNodeFaultCode[] = "faultcode";
-const xmlChar xmlSecNodeFaultString[] = "faultstring";
-const xmlChar xmlSecNodeFaultActor[] = "faultactor";
-const xmlChar xmlSecNodeFaultDetail[] = "detail";
-const xmlChar xmlSecNodeCode[] = "Code";
-const xmlChar xmlSecNodeReason[] = "Reason";
-const xmlChar xmlSecNodeNode[] = "Node";
-const xmlChar xmlSecNodeRole[] = "Role";
-const xmlChar xmlSecNodeDetail[] = "Detail";
-const xmlChar xmlSecNodeValue[] = "Value";
-const xmlChar xmlSecNodeSubcode[] = "Subcode";
-const xmlChar xmlSecNodeText[] = "Text";
-
-
-const xmlChar xmlSecSoapFaultCodeVersionMismatch[] = "VersionMismatch";
-const xmlChar xmlSecSoapFaultCodeMustUnderstand[] = "MustUnderstand";
-const xmlChar xmlSecSoapFaultCodeClient[] = "Client";
-const xmlChar xmlSecSoapFaultCodeServer[] = "Server";
-const xmlChar xmlSecSoapFaultCodeReceiver[] = "Receiver";
-const xmlChar xmlSecSoapFaultCodeSender[] = "Sender";
-const xmlChar xmlSecSoapFaultDataEncodningUnknown[] = "DataEncodingUnknown";
+const xmlChar xmlSecNodeEnvelope[] = "Envelope";
+const xmlChar xmlSecNodeHeader[] = "Header";
+const xmlChar xmlSecNodeBody[] = "Body";
+const xmlChar xmlSecNodeFault[] = "Fault";
+const xmlChar xmlSecNodeFaultCode[] = "faultcode";
+const xmlChar xmlSecNodeFaultString[] = "faultstring";
+const xmlChar xmlSecNodeFaultActor[] = "faultactor";
+const xmlChar xmlSecNodeFaultDetail[] = "detail";
+const xmlChar xmlSecNodeCode[] = "Code";
+const xmlChar xmlSecNodeReason[] = "Reason";
+const xmlChar xmlSecNodeNode[] = "Node";
+const xmlChar xmlSecNodeRole[] = "Role";
+const xmlChar xmlSecNodeDetail[] = "Detail";
+const xmlChar xmlSecNodeValue[] = "Value";
+const xmlChar xmlSecNodeSubcode[] = "Subcode";
+const xmlChar xmlSecNodeText[] = "Text";
+
+
+const xmlChar xmlSecSoapFaultCodeVersionMismatch[] = "VersionMismatch";
+const xmlChar xmlSecSoapFaultCodeMustUnderstand[] = "MustUnderstand";
+const xmlChar xmlSecSoapFaultCodeClient[] = "Client";
+const xmlChar xmlSecSoapFaultCodeServer[] = "Server";
+const xmlChar xmlSecSoapFaultCodeReceiver[] = "Receiver";
+const xmlChar xmlSecSoapFaultCodeSender[] = "Sender";
+const xmlChar xmlSecSoapFaultDataEncodningUnknown[] = "DataEncodingUnknown";
#endif /* XMLSEC_NO_SOAP */
@@ -591,8 +591,8 @@ const xmlChar xmlSecSoapFaultDataEncodningUnknown[] = "DataEncodingUnknown";
* Utility strings
*
************************************************************************/
-const xmlChar xmlSecStringEmpty[] = "";
-const xmlChar xmlSecStringCR[] = "\n";
+const xmlChar xmlSecStringEmpty[] = "";
+const xmlChar xmlSecStringCR[] = "\n";
diff --git a/src/templates.c b/src/templates.c
index 67cadb1..d368907 100644
--- a/src/templates.c
+++ b/src/templates.c
@@ -24,15 +24,15 @@
#include <xmlsec/errors.h>
-static xmlNodePtr xmlSecTmplAddReference (xmlNodePtr parentNode,
- xmlSecTransformId digestMethodId,
- const xmlChar *id,
- const xmlChar *uri,
- const xmlChar *type);
-static int xmlSecTmplPrepareEncData (xmlNodePtr parentNode,
- xmlSecTransformId encMethodId);
-static int xmlSecTmplNodeWriteNsList (xmlNodePtr parentNode,
- const xmlChar** namespaces);
+static xmlNodePtr xmlSecTmplAddReference (xmlNodePtr parentNode,
+ xmlSecTransformId digestMethodId,
+ const xmlChar *id,
+ const xmlChar *uri,
+ const xmlChar *type);
+static int xmlSecTmplPrepareEncData (xmlNodePtr parentNode,
+ xmlSecTransformId encMethodId);
+static int xmlSecTmplNodeWriteNsList (xmlNodePtr parentNode,
+ const xmlChar** namespaces);
/**************************************************************************
*
* <dsig:Signature/> node
@@ -40,13 +40,13 @@ static int xmlSecTmplNodeWriteNsList (xmlNodePtr parentNode,
**************************************************************************/
/**
* xmlSecTmplSignatureCreate:
- * @doc: the pointer to signature document or NULL; in the
- * second case, application must later call @xmlSetTreeDoc
- * to ensure that all the children nodes have correct
- * pointer to XML document.
- * @c14nMethodId: the signature canonicalization method.
- * @signMethodId: the signature method.
- * @id: the node id (may be NULL).
+ * @doc: the pointer to signature document or NULL; in the
+ * second case, application must later call @xmlSetTreeDoc
+ * to ensure that all the children nodes have correct
+ * pointer to XML document.
+ * @c14nMethodId: the signature canonicalization method.
+ * @signMethodId: the signature method.
+ * @id: the node id (may be NULL).
*
* Creates new <dsig:Signature/> node with the mandatory <dsig:SignedInfo/>,
* <dsig:CanonicalizationMethod/>, <dsig:SignatureMethod/> and
@@ -59,20 +59,20 @@ static int xmlSecTmplNodeWriteNsList (xmlNodePtr parentNode,
*/
xmlNodePtr
xmlSecTmplSignatureCreate(xmlDocPtr doc, xmlSecTransformId c14nMethodId,
- xmlSecTransformId signMethodId, const xmlChar *id) {
+ xmlSecTransformId signMethodId, const xmlChar *id) {
return xmlSecTmplSignatureCreateNsPref(doc, c14nMethodId, signMethodId, id, NULL);
}
/**
* xmlSecTmplSignatureCreateNsPref:
- * @doc: the pointer to signature document or NULL; in the
- * second case, application must later call @xmlSetTreeDoc
- * to ensure that all the children nodes have correct
- * pointer to XML document.
- * @c14nMethodId: the signature canonicalization method.
- * @signMethodId: the signature method.
- * @id: the node id (may be NULL).
- * @nsPrefix: the namespace prefix for the signature element (e.g. "dsig"), or NULL
+ * @doc: the pointer to signature document or NULL; in the
+ * second case, application must later call @xmlSetTreeDoc
+ * to ensure that all the children nodes have correct
+ * pointer to XML document.
+ * @c14nMethodId: the signature canonicalization method.
+ * @signMethodId: the signature method.
+ * @id: the node id (may be NULL).
+ * @nsPrefix: the namespace prefix for the signature element (e.g. "dsig"), or NULL
*
* Creates new <dsig:Signature/> node with the mandatory
* <dsig:SignedInfo/>, <dsig:CanonicalizationMethod/>,
@@ -103,104 +103,104 @@ xmlSecTmplSignatureCreateNsPref(xmlDocPtr doc, xmlSecTransformId c14nMethodId,
/* create Signature node itself */
signNode = xmlNewDocNode(doc, NULL, xmlSecNodeSignature, NULL);
if(signNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewDocNode",
- XMLSEC_ERRORS_R_XML_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeSignature));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewDocNode",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeSignature));
+ return(NULL);
}
ns = xmlNewNs(signNode, xmlSecDSigNs, nsPrefix);
if(ns == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewNs",
- XMLSEC_ERRORS_R_XML_FAILED,
- "ns=%s",
- xmlSecErrorsSafeString(xmlSecDSigNs));
- xmlFreeNode(signNode);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewNs",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "ns=%s",
+ xmlSecErrorsSafeString(xmlSecDSigNs));
+ xmlFreeNode(signNode);
+ return(NULL);
}
xmlSetNs(signNode, ns);
if(id != NULL) {
- xmlSetProp(signNode, BAD_CAST "Id", id);
+ xmlSetProp(signNode, BAD_CAST "Id", id);
}
/* add SignedInfo node */
signedInfoNode = xmlSecAddChild(signNode, xmlSecNodeSignedInfo, xmlSecDSigNs);
if(signedInfoNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeSignedInfo));
- xmlFreeNode(signNode);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeSignedInfo));
+ xmlFreeNode(signNode);
+ return(NULL);
}
/* add SignatureValue node */
cur = xmlSecAddChild(signNode, xmlSecNodeSignatureValue, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeSignatureValue));
- xmlFreeNode(signNode);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeSignatureValue));
+ xmlFreeNode(signNode);
+ return(NULL);
}
/* add CanonicaizationMethod node to SignedInfo */
cur = xmlSecAddChild(signedInfoNode, xmlSecNodeCanonicalizationMethod, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeCanonicalizationMethod));
- xmlFreeNode(signNode);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeCanonicalizationMethod));
+ xmlFreeNode(signNode);
+ return(NULL);
}
if(xmlSetProp(cur, xmlSecAttrAlgorithm, c14nMethodId->href) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSetProp",
- XMLSEC_ERRORS_R_XML_FAILED,
- "name=%s,value=%s",
- xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
- xmlSecErrorsSafeString(c14nMethodId->href));
- xmlFreeNode(signNode);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSetProp",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "name=%s,value=%s",
+ xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
+ xmlSecErrorsSafeString(c14nMethodId->href));
+ xmlFreeNode(signNode);
+ return(NULL);
}
/* add SignatureMethod node to SignedInfo */
cur = xmlSecAddChild(signedInfoNode, xmlSecNodeSignatureMethod, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeSignatureMethod));
- xmlFreeNode(signNode);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeSignatureMethod));
+ xmlFreeNode(signNode);
+ return(NULL);
}
if(xmlSetProp(cur, xmlSecAttrAlgorithm, signMethodId->href) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSetProp",
- XMLSEC_ERRORS_R_XML_FAILED,
- "name=%s,value=%s",
- xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
- xmlSecErrorsSafeString(signMethodId->href));
- xmlFreeNode(signNode);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSetProp",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "name=%s,value=%s",
+ xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
+ xmlSecErrorsSafeString(signMethodId->href));
+ xmlFreeNode(signNode);
+ return(NULL);
}
return(signNode);
@@ -208,8 +208,8 @@ xmlSecTmplSignatureCreateNsPref(xmlDocPtr doc, xmlSecTransformId c14nMethodId,
/**
* xmlSecTmplSignatureEnsureKeyInfo:
- * @signNode: the pointer to <dsig:Signature/> node.
- * @id: the node id (may be NULL).
+ * @signNode: the pointer to <dsig:Signature/> node.
+ * @id: the node id (may be NULL).
*
* Adds (if necessary) <dsig:KeyInfo/> node to the <dsig:Signature/>
* node @signNode.
@@ -225,42 +225,42 @@ xmlSecTmplSignatureEnsureKeyInfo(xmlNodePtr signNode, const xmlChar *id) {
res = xmlSecFindChild(signNode, xmlSecNodeKeyInfo, xmlSecDSigNs);
if(res == NULL) {
- xmlNodePtr signValueNode;
+ xmlNodePtr signValueNode;
signValueNode = xmlSecFindChild(signNode, xmlSecNodeSignatureValue, xmlSecDSigNs);
- if(signValueNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeSignatureValue),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
-
- res = xmlSecAddNextSibling(signValueNode, xmlSecNodeKeyInfo, xmlSecDSigNs);
- if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddNextSibling",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeKeyInfo));
- return(NULL);
- }
+ if(signValueNode == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeSignatureValue),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+
+ res = xmlSecAddNextSibling(signValueNode, xmlSecNodeKeyInfo, xmlSecDSigNs);
+ if(res == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddNextSibling",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeKeyInfo));
+ return(NULL);
+ }
}
if(id != NULL) {
- xmlSetProp(res, xmlSecAttrId, id);
+ xmlSetProp(res, xmlSecAttrId, id);
}
return(res);
}
/**
* xmlSecTmplSignatureAddReference:
- * @signNode: the pointer to <dsig:Signature/> node.
- * @digestMethodId: the reference digest method.
- * @id: the node id (may be NULL).
- * @uri: the reference node uri (may be NULL).
- * @type: the reference node type (may be NULL).
+ * @signNode: the pointer to <dsig:Signature/> node.
+ * @digestMethodId: the reference digest method.
+ * @id: the node id (may be NULL).
+ * @uri: the reference node uri (may be NULL).
+ * @type: the reference node type (may be NULL).
*
* Adds <dsig:Reference/> node with given URI (@uri), Id (@id) and
* Type (@type) attributes and the required children <dsig:DigestMethod/> and
@@ -269,9 +269,9 @@ xmlSecTmplSignatureEnsureKeyInfo(xmlNodePtr signNode, const xmlChar *id) {
* Returns: the pointer to newly created <dsig:Reference/> node or NULL
* if an error occurs.
*/
-xmlNodePtr
+xmlNodePtr
xmlSecTmplSignatureAddReference(xmlNodePtr signNode, xmlSecTransformId digestMethodId,
- const xmlChar *id, const xmlChar *uri, const xmlChar *type) {
+ const xmlChar *id, const xmlChar *uri, const xmlChar *type) {
xmlNodePtr signedInfoNode;
xmlSecAssert2(signNode != NULL, NULL);
@@ -280,12 +280,12 @@ xmlSecTmplSignatureAddReference(xmlNodePtr signNode, xmlSecTransformId digestMet
signedInfoNode = xmlSecFindChild(signNode, xmlSecNodeSignedInfo, xmlSecDSigNs);
if(signedInfoNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeSignedInfo),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeSignedInfo),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(xmlSecTmplAddReference(signedInfoNode, digestMethodId, id, uri, type));
@@ -293,7 +293,7 @@ xmlSecTmplSignatureAddReference(xmlNodePtr signNode, xmlSecTransformId digestMet
static xmlNodePtr
xmlSecTmplAddReference(xmlNodePtr parentNode, xmlSecTransformId digestMethodId,
- const xmlChar *id, const xmlChar *uri, const xmlChar *type) {
+ const xmlChar *id, const xmlChar *uri, const xmlChar *type) {
xmlNodePtr res;
xmlNodePtr cur;
@@ -304,64 +304,64 @@ xmlSecTmplAddReference(xmlNodePtr parentNode, xmlSecTransformId digestMethodId,
/* add Reference node */
res = xmlSecAddChild(parentNode, xmlSecNodeReference, xmlSecDSigNs);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeReference));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeReference));
+ return(NULL);
}
/* set Reference node attributes */
if(id != NULL) {
- xmlSetProp(res, xmlSecAttrId, id);
+ xmlSetProp(res, xmlSecAttrId, id);
}
if(type != NULL) {
- xmlSetProp(res, xmlSecAttrType, type);
+ xmlSetProp(res, xmlSecAttrType, type);
}
if(uri != NULL) {
- xmlSetProp(res, xmlSecAttrURI, uri);
+ xmlSetProp(res, xmlSecAttrURI, uri);
}
/* add DigestMethod node and set algorithm */
cur = xmlSecAddChild(res, xmlSecNodeDigestMethod, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDigestMethod));
- xmlUnlinkNode(res);
- xmlFreeNode(res);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDigestMethod));
+ xmlUnlinkNode(res);
+ xmlFreeNode(res);
+ return(NULL);
}
if(xmlSetProp(cur, xmlSecAttrAlgorithm, digestMethodId->href) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSetProp",
- XMLSEC_ERRORS_R_XML_FAILED,
- "name=%s,value=%s",
- xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
- xmlSecErrorsSafeString(digestMethodId->href));
- xmlUnlinkNode(res);
- xmlFreeNode(res);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSetProp",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "name=%s,value=%s",
+ xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
+ xmlSecErrorsSafeString(digestMethodId->href));
+ xmlUnlinkNode(res);
+ xmlFreeNode(res);
+ return(NULL);
}
/* add DigestValue node */
cur = xmlSecAddChild(res, xmlSecNodeDigestValue, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDigestValue));
- xmlUnlinkNode(res);
- xmlFreeNode(res);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDigestValue));
+ xmlUnlinkNode(res);
+ xmlFreeNode(res);
+ return(NULL);
}
return(res);
@@ -369,10 +369,10 @@ xmlSecTmplAddReference(xmlNodePtr parentNode, xmlSecTransformId digestMethodId,
/**
* xmlSecTmplSignatureAddObject:
- * @signNode: the pointer to <dsig:Signature/> node.
- * @id: the node id (may be NULL).
- * @mimeType: the object mime type (may be NULL).
- * @encoding: the object encoding (may be NULL).
+ * @signNode: the pointer to <dsig:Signature/> node.
+ * @id: the node id (may be NULL).
+ * @mimeType: the object mime type (may be NULL).
+ * @encoding: the object encoding (may be NULL).
*
* Adds <dsig:Object/> node to the <dsig:Signature/> node @signNode.
*
@@ -381,36 +381,36 @@ xmlSecTmplAddReference(xmlNodePtr parentNode, xmlSecTransformId digestMethodId,
*/
xmlNodePtr
xmlSecTmplSignatureAddObject(xmlNodePtr signNode, const xmlChar *id,
- const xmlChar *mimeType, const xmlChar *encoding) {
+ const xmlChar *mimeType, const xmlChar *encoding) {
xmlNodePtr res;
xmlSecAssert2(signNode != NULL, NULL);
res = xmlSecAddChild(signNode, xmlSecNodeObject, xmlSecDSigNs);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeObject));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeObject));
+ return(NULL);
}
if(id != NULL) {
- xmlSetProp(res, xmlSecAttrId, id);
+ xmlSetProp(res, xmlSecAttrId, id);
}
if(mimeType != NULL) {
- xmlSetProp(res, xmlSecAttrMimeType, mimeType);
+ xmlSetProp(res, xmlSecAttrMimeType, mimeType);
}
if(encoding != NULL) {
- xmlSetProp(res, xmlSecAttrEncoding, encoding);
+ xmlSetProp(res, xmlSecAttrEncoding, encoding);
}
return(res);
}
/**
* xmlSecTmplSignatureGetSignMethodNode:
- * @signNode: the pointer to <dsig:Signature /> node.
+ * @signNode: the pointer to <dsig:Signature /> node.
*
* Gets pointer to <dsig:SignatureMethod/> child of <dsig:KeyInfo/> node.
*
@@ -424,19 +424,19 @@ xmlSecTmplSignatureGetSignMethodNode(xmlNodePtr signNode) {
signedInfoNode = xmlSecFindChild(signNode, xmlSecNodeSignedInfo, xmlSecDSigNs);
if(signedInfoNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeSignedInfo),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeSignedInfo),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(xmlSecFindChild(signedInfoNode, xmlSecNodeSignatureMethod, xmlSecDSigNs));
}
/**
* xmlSecTmplSignatureGetC14NMethodNode:
- * @signNode: the pointer to <dsig:Signature /> node.
+ * @signNode: the pointer to <dsig:Signature /> node.
*
* Gets pointer to <dsig:CanonicalizationMethod/> child of <dsig:KeyInfo/> node.
*
@@ -450,20 +450,20 @@ xmlSecTmplSignatureGetC14NMethodNode(xmlNodePtr signNode) {
signedInfoNode = xmlSecFindChild(signNode, xmlSecNodeSignedInfo, xmlSecDSigNs);
if(signedInfoNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeSignedInfo),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeSignedInfo),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
return(xmlSecFindChild(signedInfoNode, xmlSecNodeCanonicalizationMethod, xmlSecDSigNs));
}
/**
* xmlSecTmplReferenceAddTransform:
- * @referenceNode: the pointer to <dsig:Reference/> node.
- * @transformId: the transform method id.
+ * @referenceNode: the pointer to <dsig:Reference/> node.
+ * @transformId: the transform method id.
*
* Adds <dsig:Transform/> node to the <dsig:Reference/> node @referenceNode.
*
@@ -482,47 +482,47 @@ xmlSecTmplReferenceAddTransform(xmlNodePtr referenceNode, xmlSecTransformId tran
/* do we need to create Transforms node first */
transformsNode = xmlSecFindChild(referenceNode, xmlSecNodeTransforms, xmlSecDSigNs);
if(transformsNode == NULL) {
- xmlNodePtr tmp;
-
- tmp = xmlSecGetNextElementNode(referenceNode->children);
- if(tmp == NULL) {
- transformsNode = xmlSecAddChild(referenceNode, xmlSecNodeTransforms, xmlSecDSigNs);
- } else {
- transformsNode = xmlSecAddPrevSibling(tmp, xmlSecNodeTransforms, xmlSecDSigNs);
- }
- if(transformsNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild or xmlSecAddPrevSibling",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeTransforms));
- return(NULL);
- }
+ xmlNodePtr tmp;
+
+ tmp = xmlSecGetNextElementNode(referenceNode->children);
+ if(tmp == NULL) {
+ transformsNode = xmlSecAddChild(referenceNode, xmlSecNodeTransforms, xmlSecDSigNs);
+ } else {
+ transformsNode = xmlSecAddPrevSibling(tmp, xmlSecNodeTransforms, xmlSecDSigNs);
+ }
+ if(transformsNode == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild or xmlSecAddPrevSibling",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeTransforms));
+ return(NULL);
+ }
}
res = xmlSecAddChild(transformsNode, xmlSecNodeTransform, xmlSecDSigNs);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeTransform));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeTransform));
+ return(NULL);
}
if(xmlSetProp(res, xmlSecAttrAlgorithm, transformId->href) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSetProp",
- XMLSEC_ERRORS_R_XML_FAILED,
- "name=%s,value=%s",
- xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
- xmlSecErrorsSafeString(transformId->href));
- xmlUnlinkNode(res);
- xmlFreeNode(res);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSetProp",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "name=%s,value=%s",
+ xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
+ xmlSecErrorsSafeString(transformId->href));
+ xmlUnlinkNode(res);
+ xmlFreeNode(res);
+ return(NULL);
}
return(res);
@@ -530,16 +530,16 @@ xmlSecTmplReferenceAddTransform(xmlNodePtr referenceNode, xmlSecTransformId tran
/**
* xmlSecTmplObjectAddSignProperties:
- * @objectNode: the pointer to <dsig:Object/> node.
- * @id: the node id (may be NULL).
- * @target: the Target (may be NULL).
+ * @objectNode: the pointer to <dsig:Object/> node.
+ * @id: the node id (may be NULL).
+ * @target: the Target (may be NULL).
*
* Adds <dsig:SignatureProperties/> node to the <dsig:Object/> node @objectNode.
*
* Returns: the pointer to newly created <dsig:SignatureProperties/> node or NULL
* if an error occurs.
*/
-xmlNodePtr
+xmlNodePtr
xmlSecTmplObjectAddSignProperties(xmlNodePtr objectNode, const xmlChar *id, const xmlChar *target) {
xmlNodePtr res;
@@ -547,27 +547,27 @@ xmlSecTmplObjectAddSignProperties(xmlNodePtr objectNode, const xmlChar *id, cons
res = xmlSecAddChild(objectNode, xmlSecNodeSignatureProperties, xmlSecDSigNs);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeSignatureProperties));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeSignatureProperties));
+ return(NULL);
}
if(id != NULL) {
- xmlSetProp(res, xmlSecAttrId, id);
+ xmlSetProp(res, xmlSecAttrId, id);
}
if(target != NULL) {
- xmlSetProp(res, xmlSecAttrTarget, target);
+ xmlSetProp(res, xmlSecAttrTarget, target);
}
return(res);
}
/**
* xmlSecTmplObjectAddManifest:
- * @objectNode: the pointer to <dsig:Object/> node.
- * @id: the node id (may be NULL).
+ * @objectNode: the pointer to <dsig:Object/> node.
+ * @id: the node id (may be NULL).
*
* Adds <dsig:Manifest/> node to the <dsig:Object/> node @objectNode.
*
@@ -582,27 +582,27 @@ xmlSecTmplObjectAddManifest(xmlNodePtr objectNode, const xmlChar *id) {
res = xmlSecAddChild(objectNode, xmlSecNodeManifest, xmlSecDSigNs);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeManifest));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeManifest));
+ return(NULL);
}
if(id != NULL) {
- xmlSetProp(res, xmlSecAttrId, id);
+ xmlSetProp(res, xmlSecAttrId, id);
}
return(res);
}
/**
* xmlSecTmplManifestAddReference:
- * @manifestNode: the pointer to <dsig:Manifest/> node.
- * @digestMethodId: the reference digest method.
- * @id: the node id (may be NULL).
- * @uri: the reference node uri (may be NULL).
- * @type: the reference node type (may be NULL).
+ * @manifestNode: the pointer to <dsig:Manifest/> node.
+ * @digestMethodId: the reference digest method.
+ * @id: the node id (may be NULL).
+ * @uri: the reference node uri (may be NULL).
+ * @type: the reference node type (may be NULL).
*
* Adds <dsig:Reference/> node with specified URI (@uri), Id (@id) and
* Type (@type) attributes and the required children <dsig:DigestMethod/> and
@@ -613,7 +613,7 @@ xmlSecTmplObjectAddManifest(xmlNodePtr objectNode, const xmlChar *id) {
*/
xmlNodePtr
xmlSecTmplManifestAddReference(xmlNodePtr manifestNode, xmlSecTransformId digestMethodId,
- const xmlChar *id, const xmlChar *uri, const xmlChar *type) {
+ const xmlChar *id, const xmlChar *uri, const xmlChar *type) {
return(xmlSecTmplAddReference(manifestNode, digestMethodId, id, uri, type));
}
@@ -624,66 +624,66 @@ xmlSecTmplManifestAddReference(xmlNodePtr manifestNode, xmlSecTransformId digest
**************************************************************************/
/**
* xmlSecTmplEncDataCreate:
- * @doc: the pointer to signature document or NULL; in the later
- * case, application must later call @xmlSetTreeDoc to ensure
- * that all the children nodes have correct pointer to XML document.
- * @encMethodId: the encryption method (may be NULL).
- * @id: the Id attribute (optional).
- * @type: the Type attribute (optional)
- * @mimeType: the MimeType attribute (optional)
- * @encoding: the Encoding attribute (optional)
+ * @doc: the pointer to signature document or NULL; in the later
+ * case, application must later call @xmlSetTreeDoc to ensure
+ * that all the children nodes have correct pointer to XML document.
+ * @encMethodId: the encryption method (may be NULL).
+ * @id: the Id attribute (optional).
+ * @type: the Type attribute (optional)
+ * @mimeType: the MimeType attribute (optional)
+ * @encoding: the Encoding attribute (optional)
*
* Creates new <enc:EncryptedData /> node for encryption template.
*
* Returns: the pointer newly created <enc:EncryptedData/> node or NULL
* if an error occurs.
*/
-xmlNodePtr
+xmlNodePtr
xmlSecTmplEncDataCreate(xmlDocPtr doc, xmlSecTransformId encMethodId,
- const xmlChar *id, const xmlChar *type,
- const xmlChar *mimeType, const xmlChar *encoding) {
+ const xmlChar *id, const xmlChar *type,
+ const xmlChar *mimeType, const xmlChar *encoding) {
xmlNodePtr encNode;
xmlNsPtr ns;
encNode = xmlNewDocNode(doc, NULL, xmlSecNodeEncryptedData, NULL);
if(encNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewDocNode",
- XMLSEC_ERRORS_R_XML_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeEncryptedData));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewDocNode",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeEncryptedData));
+ return(NULL);
}
ns = xmlNewNs(encNode, xmlSecEncNs, NULL);
if(ns == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewNs",
- XMLSEC_ERRORS_R_XML_FAILED,
- "ns=%s",
- xmlSecErrorsSafeString(xmlSecEncNs));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewNs",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "ns=%s",
+ xmlSecErrorsSafeString(xmlSecEncNs));
+ return(NULL);
}
xmlSetNs(encNode, ns);
if(id != NULL) {
- xmlSetProp(encNode, xmlSecAttrId, id);
+ xmlSetProp(encNode, xmlSecAttrId, id);
}
if(type != NULL) {
- xmlSetProp(encNode, xmlSecAttrType, type);
+ xmlSetProp(encNode, xmlSecAttrType, type);
}
if(mimeType != NULL) {
- xmlSetProp(encNode, xmlSecAttrMimeType, mimeType);
+ xmlSetProp(encNode, xmlSecAttrMimeType, mimeType);
}
if(encoding != NULL) {
- xmlSetProp(encNode, xmlSecAttrEncoding, encoding);
+ xmlSetProp(encNode, xmlSecAttrEncoding, encoding);
}
if(xmlSecTmplPrepareEncData(encNode, encMethodId) < 0) {
- xmlFreeNode(encNode);
- return(NULL);
+ xmlFreeNode(encNode);
+ return(NULL);
}
return(encNode);
}
@@ -697,38 +697,38 @@ xmlSecTmplPrepareEncData(xmlNodePtr parentNode, xmlSecTransformId encMethodId) {
/* add EncryptionMethod node if requested */
if(encMethodId != NULL) {
- cur = xmlSecAddChild(parentNode, xmlSecNodeEncryptionMethod, xmlSecEncNs);
- if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeEncryptionMethod));
- return(-1);
- }
- if(xmlSetProp(cur, xmlSecAttrAlgorithm, encMethodId->href) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSetProp",
- XMLSEC_ERRORS_R_XML_FAILED,
- "name=%s,value=%s",
- xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
- xmlSecErrorsSafeString(encMethodId->href));
- return(-1);
- }
+ cur = xmlSecAddChild(parentNode, xmlSecNodeEncryptionMethod, xmlSecEncNs);
+ if(cur == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeEncryptionMethod));
+ return(-1);
+ }
+ if(xmlSetProp(cur, xmlSecAttrAlgorithm, encMethodId->href) == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSetProp",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "name=%s,value=%s",
+ xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
+ xmlSecErrorsSafeString(encMethodId->href));
+ return(-1);
+ }
}
/* and CipherData node */
cur = xmlSecAddChild(parentNode, xmlSecNodeCipherData, xmlSecEncNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeCipherData));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeCipherData));
+ return(-1);
}
return(0);
@@ -737,8 +737,8 @@ xmlSecTmplPrepareEncData(xmlNodePtr parentNode, xmlSecTransformId encMethodId) {
/**
* xmlSecTmplEncDataEnsureKeyInfo:
- * @encNode: the pointer to <enc:EncryptedData/> node.
- * @id: the Id attrbibute (optional).
+ * @encNode: the pointer to <enc:EncryptedData/> node.
+ * @id: the Id attrbibute (optional).
*
* Adds <dsig:KeyInfo/> to the <enc:EncryptedData/> node @encNode.
*
@@ -753,39 +753,39 @@ xmlSecTmplEncDataEnsureKeyInfo(xmlNodePtr encNode, const xmlChar* id) {
res = xmlSecFindChild(encNode, xmlSecNodeKeyInfo, xmlSecDSigNs);
if(res == NULL) {
- xmlNodePtr cipherDataNode;
+ xmlNodePtr cipherDataNode;
cipherDataNode = xmlSecFindChild(encNode, xmlSecNodeCipherData, xmlSecEncNs);
- if(cipherDataNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeCipherData),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
-
- res = xmlSecAddPrevSibling(cipherDataNode, xmlSecNodeKeyInfo, xmlSecDSigNs);
- if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddPrevSibling",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeKeyInfo));
- return(NULL);
- }
+ if(cipherDataNode == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeCipherData),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+
+ res = xmlSecAddPrevSibling(cipherDataNode, xmlSecNodeKeyInfo, xmlSecDSigNs);
+ if(res == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddPrevSibling",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeKeyInfo));
+ return(NULL);
+ }
}
if(id != NULL) {
- xmlSetProp(res, xmlSecAttrId, id);
+ xmlSetProp(res, xmlSecAttrId, id);
}
return(res);
}
/**
* xmlSecTmplEncDataEnsureEncProperties:
- * @encNode: the pointer to <enc:EncryptedData/> node.
- * @id: the Id attribute (optional).
+ * @encNode: the pointer to <enc:EncryptedData/> node.
+ * @id: the Id attribute (optional).
*
* Adds <enc:EncryptionProperties/> node to the <enc:EncryptedData/>
* node @encNode.
@@ -801,20 +801,20 @@ xmlSecTmplEncDataEnsureEncProperties(xmlNodePtr encNode, const xmlChar *id) {
res = xmlSecFindChild(encNode, xmlSecNodeEncryptionProperties, xmlSecEncNs);
if(res == NULL) {
- res = xmlSecAddChild(encNode, xmlSecNodeEncryptionProperties, xmlSecEncNs);
- if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeEncryptionProperties));
- return(NULL);
- }
+ res = xmlSecAddChild(encNode, xmlSecNodeEncryptionProperties, xmlSecEncNs);
+ if(res == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeEncryptionProperties));
+ return(NULL);
+ }
}
if(id != NULL) {
- xmlSetProp(res, xmlSecAttrId, id);
+ xmlSetProp(res, xmlSecAttrId, id);
}
return(res);
@@ -822,9 +822,9 @@ xmlSecTmplEncDataEnsureEncProperties(xmlNodePtr encNode, const xmlChar *id) {
/**
* xmlSecTmplEncDataAddEncProperty:
- * @encNode: the pointer to <enc:EncryptedData/> node.
- * @id: the Id attribute (optional).
- * @target: the Target attribute (optional).
+ * @encNode: the pointer to <enc:EncryptedData/> node.
+ * @id: the Id attribute (optional).
+ * @target: the Target attribute (optional).
*
* Adds <enc:EncryptionProperty/> node (and the parent
* <enc:EncryptionProperties/> node if required) to the
@@ -833,7 +833,7 @@ xmlSecTmplEncDataEnsureEncProperties(xmlNodePtr encNode, const xmlChar *id) {
* Returns: the pointer to newly created <enc:EncryptionProperty/> node or
* NULL if an error occurs.
*/
-xmlNodePtr
+xmlNodePtr
xmlSecTmplEncDataAddEncProperty(xmlNodePtr encNode, const xmlChar *id, const xmlChar *target) {
xmlNodePtr encProps;
xmlNodePtr res;
@@ -842,29 +842,29 @@ xmlSecTmplEncDataAddEncProperty(xmlNodePtr encNode, const xmlChar *id, const xml
encProps = xmlSecTmplEncDataEnsureEncProperties(encNode, NULL);
if(encProps == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTmplEncDataEnsureEncProperties",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTmplEncDataEnsureEncProperties",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
res = xmlSecAddChild(encProps, xmlSecNodeEncryptionProperty, xmlSecEncNs);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeEncryptionProperty));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeEncryptionProperty));
+ return(NULL);
}
if(id != NULL) {
- xmlSetProp(res, xmlSecAttrId, id);
+ xmlSetProp(res, xmlSecAttrId, id);
}
if(target != NULL) {
- xmlSetProp(res, xmlSecAttrTarget, target);
+ xmlSetProp(res, xmlSecAttrTarget, target);
}
return(res);
@@ -872,7 +872,7 @@ xmlSecTmplEncDataAddEncProperty(xmlNodePtr encNode, const xmlChar *id, const xml
/**
* xmlSecTmplEncDataEnsureCipherValue:
- * @encNode: the pointer to <enc:EncryptedData/> node.
+ * @encNode: the pointer to <enc:EncryptedData/> node.
*
* Adds <enc:CipherValue/> to the <enc:EncryptedData/> node @encNode.
*
@@ -888,37 +888,37 @@ xmlSecTmplEncDataEnsureCipherValue(xmlNodePtr encNode) {
cipherDataNode = xmlSecFindChild(encNode, xmlSecNodeCipherData, xmlSecEncNs);
if(cipherDataNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeCipherData),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeCipherData),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
/* check that we don;t have CipherReference node */
tmp = xmlSecFindChild(cipherDataNode, xmlSecNodeCipherReference, xmlSecEncNs);
if(tmp != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeCipherReference),
- XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeCipherReference),
+ XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
res = xmlSecFindChild(cipherDataNode, xmlSecNodeCipherValue, xmlSecEncNs);
if(res == NULL) {
- res = xmlSecAddChild(cipherDataNode, xmlSecNodeCipherValue, xmlSecEncNs);
- if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeCipherValue));
- return(NULL);
- }
+ res = xmlSecAddChild(cipherDataNode, xmlSecNodeCipherValue, xmlSecEncNs);
+ if(res == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeCipherValue));
+ return(NULL);
+ }
}
return(res);
@@ -926,8 +926,8 @@ xmlSecTmplEncDataEnsureCipherValue(xmlNodePtr encNode) {
/**
* xmlSecTmplEncDataEnsureCipherReference:
- * @encNode: the pointer to <enc:EncryptedData/> node.
- * @uri: the URI attribute (may be NULL).
+ * @encNode: the pointer to <enc:EncryptedData/> node.
+ * @uri: the URI attribute (may be NULL).
*
* Adds <enc:CipherReference/> node with specified URI attribute @uri
* to the <enc:EncryptedData/> node @encNode.
@@ -944,41 +944,41 @@ xmlSecTmplEncDataEnsureCipherReference(xmlNodePtr encNode, const xmlChar *uri) {
cipherDataNode = xmlSecFindChild(encNode, xmlSecNodeCipherData, xmlSecEncNs);
if(cipherDataNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeCipherData),
- XMLSEC_ERRORS_R_NODE_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeCipherData),
+ XMLSEC_ERRORS_R_NODE_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
/* check that we don;t have CipherValue node */
tmp = xmlSecFindChild(cipherDataNode, xmlSecNodeCipherValue, xmlSecEncNs);
if(tmp != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeCipherValue),
- XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeCipherValue),
+ XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
res = xmlSecFindChild(cipherDataNode, xmlSecNodeCipherReference, xmlSecEncNs);
if(res == NULL) {
- res = xmlSecAddChild(cipherDataNode, xmlSecNodeCipherReference, xmlSecEncNs);
- if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeCipherReference));
- return(NULL);
- }
+ res = xmlSecAddChild(cipherDataNode, xmlSecNodeCipherReference, xmlSecEncNs);
+ if(res == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeCipherReference));
+ return(NULL);
+ }
}
if(uri != NULL) {
- xmlSetProp(res, xmlSecAttrURI, uri);
+ xmlSetProp(res, xmlSecAttrURI, uri);
}
return(res);
@@ -986,7 +986,7 @@ xmlSecTmplEncDataEnsureCipherReference(xmlNodePtr encNode, const xmlChar *uri) {
/**
* xmlSecTmplEncDataGetEncMethodNode:
- * @encNode: the pointer to <enc:EcnryptedData /> node.
+ * @encNode: the pointer to <enc:EcnryptedData /> node.
*
* Gets pointer to <enc:EncrytpionMethod/> node.
*
@@ -1001,8 +1001,8 @@ xmlSecTmplEncDataGetEncMethodNode(xmlNodePtr encNode) {
/**
* xmlSecTmplCipherReferenceAddTransform:
- * @cipherReferenceNode: the pointer to <enc:CipherReference/> node.
- * @transformId: the transform id.
+ * @cipherReferenceNode: the pointer to <enc:CipherReference/> node.
+ * @transformId: the transform id.
*
* Adds <dsig:Transform/> node (and the parent <dsig:Transforms/> node)
* with specified transform methods @transform to the <enc:CipherReference/>
@@ -1013,7 +1013,7 @@ xmlSecTmplEncDataGetEncMethodNode(xmlNodePtr encNode) {
*/
xmlNodePtr
xmlSecTmplCipherReferenceAddTransform(xmlNodePtr cipherReferenceNode,
- xmlSecTransformId transformId) {
+ xmlSecTransformId transformId) {
xmlNodePtr transformsNode;
xmlNodePtr res;
@@ -1023,40 +1023,40 @@ xmlSecTmplCipherReferenceAddTransform(xmlNodePtr cipherReferenceNode,
transformsNode = xmlSecFindChild(cipherReferenceNode, xmlSecNodeTransforms, xmlSecEncNs);
if(transformsNode == NULL) {
- transformsNode = xmlSecAddChild(cipherReferenceNode, xmlSecNodeTransforms, xmlSecEncNs);
- if(transformsNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeTransforms));
- return(NULL);
- }
+ transformsNode = xmlSecAddChild(cipherReferenceNode, xmlSecNodeTransforms, xmlSecEncNs);
+ if(transformsNode == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeTransforms));
+ return(NULL);
+ }
}
res = xmlSecAddChild(transformsNode, xmlSecNodeTransform, xmlSecDSigNs);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeTransform));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeTransform));
+ return(NULL);
}
if(xmlSetProp(res, xmlSecAttrAlgorithm, transformId->href) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSetProp",
- XMLSEC_ERRORS_R_XML_FAILED,
- "name=%s,value=%s",
- xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
- xmlSecErrorsSafeString(transformId->href));
- xmlUnlinkNode(res);
- xmlFreeNode(res);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSetProp",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "name=%s,value=%s",
+ xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
+ xmlSecErrorsSafeString(transformId->href));
+ xmlUnlinkNode(res);
+ xmlFreeNode(res);
+ return(NULL);
}
return(res);
@@ -1071,7 +1071,7 @@ xmlSecTmplCipherReferenceAddTransform(xmlNodePtr cipherReferenceNode,
/**
* xmlSecTmplReferenceListAddDataReference:
- * @encNode: the pointer to <enc:EncryptedKey/> node.
+ * @encNode: the pointer to <enc:EncryptedKey/> node.
* @uri: uri to reference (optional)
*
* Adds <enc:DataReference/> and the parent <enc:ReferenceList/> node (if needed).
@@ -1087,41 +1087,41 @@ xmlSecTmplReferenceListAddDataReference(xmlNodePtr encNode, const xmlChar *uri)
refListNode = xmlSecFindChild(encNode, xmlSecNodeReferenceList, xmlSecEncNs);
if(refListNode == NULL) {
- refListNode = xmlSecAddChild(encNode, xmlSecNodeReferenceList, xmlSecEncNs);
- if(refListNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeReferenceList));
- return(NULL);
- }
+ refListNode = xmlSecAddChild(encNode, xmlSecNodeReferenceList, xmlSecEncNs);
+ if(refListNode == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeReferenceList));
+ return(NULL);
+ }
}
res = xmlSecAddChild(refListNode, xmlSecNodeDataReference, xmlSecEncNs);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDataReference));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDataReference));
+ return(NULL);
}
if(uri != NULL) {
if(xmlSetProp(res, xmlSecAttrURI, uri) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSetProp",
- XMLSEC_ERRORS_R_XML_FAILED,
- "name=%s,value=%s",
- xmlSecErrorsSafeString(xmlSecAttrURI),
- xmlSecErrorsSafeString(uri));
- xmlUnlinkNode(res);
- xmlFreeNode(res);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSetProp",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "name=%s,value=%s",
+ xmlSecErrorsSafeString(xmlSecAttrURI),
+ xmlSecErrorsSafeString(uri));
+ xmlUnlinkNode(res);
+ xmlFreeNode(res);
+ return(NULL);
}
}
@@ -1130,7 +1130,7 @@ xmlSecTmplReferenceListAddDataReference(xmlNodePtr encNode, const xmlChar *uri)
/**
* xmlSecTmplReferenceListAddKeyReference:
- * @encNode: the pointer to <enc:EncryptedKey/> node.
+ * @encNode: the pointer to <enc:EncryptedKey/> node.
* @uri: uri to reference (optional)
*
* Adds <enc:KeyReference/> and the parent <enc:ReferenceList/> node (if needed).
@@ -1146,41 +1146,41 @@ xmlSecTmplReferenceListAddKeyReference(xmlNodePtr encNode, const xmlChar *uri) {
refListNode = xmlSecFindChild(encNode, xmlSecNodeReferenceList, xmlSecEncNs);
if(refListNode == NULL) {
- refListNode = xmlSecAddChild(encNode, xmlSecNodeReferenceList, xmlSecEncNs);
- if(refListNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeReferenceList));
- return(NULL);
- }
+ refListNode = xmlSecAddChild(encNode, xmlSecNodeReferenceList, xmlSecEncNs);
+ if(refListNode == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeReferenceList));
+ return(NULL);
+ }
}
res = xmlSecAddChild(refListNode, xmlSecNodeKeyReference, xmlSecEncNs);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeKeyReference));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeKeyReference));
+ return(NULL);
}
if(uri != NULL) {
if(xmlSetProp(res, xmlSecAttrURI, uri) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSetProp",
- XMLSEC_ERRORS_R_XML_FAILED,
- "name=%s,value=%s",
- xmlSecErrorsSafeString(xmlSecAttrURI),
- xmlSecErrorsSafeString(uri));
- xmlUnlinkNode(res);
- xmlFreeNode(res);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSetProp",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "name=%s,value=%s",
+ xmlSecErrorsSafeString(xmlSecAttrURI),
+ xmlSecErrorsSafeString(uri));
+ xmlUnlinkNode(res);
+ xmlFreeNode(res);
+ return(NULL);
}
}
@@ -1196,15 +1196,15 @@ xmlSecTmplReferenceListAddKeyReference(xmlNodePtr encNode, const xmlChar *uri) {
/**
* xmlSecTmplKeyInfoAddKeyName:
- * @keyInfoNode: the pointer to <dsig:KeyInfo/> node.
- * @name: the key name (optional).
+ * @keyInfoNode: the pointer to <dsig:KeyInfo/> node.
+ * @name: the key name (optional).
*
* Adds <dsig:KeyName/> node to the <dsig:KeyInfo/> node @keyInfoNode.
*
* Returns: the pointer to the newly created <dsig:KeyName/> node or
* NULL if an error occurs.
*/
-xmlNodePtr
+xmlNodePtr
xmlSecTmplKeyInfoAddKeyName(xmlNodePtr keyInfoNode, const xmlChar* name) {
xmlNodePtr res;
@@ -1212,23 +1212,23 @@ xmlSecTmplKeyInfoAddKeyName(xmlNodePtr keyInfoNode, const xmlChar* name) {
res = xmlSecAddChild(keyInfoNode, xmlSecNodeKeyName, xmlSecDSigNs);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeKeyName));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeKeyName));
+ return(NULL);
}
if(name != NULL) {
- xmlSecNodeEncodeAndSetContent(res, name);
+ xmlSecNodeEncodeAndSetContent(res, name);
}
return(res);
}
/**
* xmlSecTmplKeyInfoAddKeyValue:
- * @keyInfoNode: the pointer to <dsig:KeyInfo/> node.
+ * @keyInfoNode: the pointer to <dsig:KeyInfo/> node.
*
* Adds <dsig:KeyValue/> node to the <dsig:KeyInfo/> node @keyInfoNode.
*
@@ -1243,13 +1243,13 @@ xmlSecTmplKeyInfoAddKeyValue(xmlNodePtr keyInfoNode) {
res = xmlSecAddChild(keyInfoNode, xmlSecNodeKeyValue, xmlSecDSigNs);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeKeyValue));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeKeyValue));
+ return(NULL);
}
return(res);
@@ -1257,7 +1257,7 @@ xmlSecTmplKeyInfoAddKeyValue(xmlNodePtr keyInfoNode) {
/**
* xmlSecTmplKeyInfoAddX509Data:
- * @keyInfoNode: the pointer to <dsig:KeyInfo/> node.
+ * @keyInfoNode: the pointer to <dsig:KeyInfo/> node.
*
* Adds <dsig:X509Data/> node to the <dsig:KeyInfo/> node @keyInfoNode.
*
@@ -1272,13 +1272,13 @@ xmlSecTmplKeyInfoAddX509Data(xmlNodePtr keyInfoNode) {
res = xmlSecAddChild(keyInfoNode, xmlSecNodeX509Data, xmlSecDSigNs);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509Data));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509Data));
+ return(NULL);
}
return(res);
@@ -1286,9 +1286,9 @@ xmlSecTmplKeyInfoAddX509Data(xmlNodePtr keyInfoNode) {
/**
* xmlSecTmplKeyInfoAddRetrievalMethod:
- * @keyInfoNode: the pointer to <dsig:KeyInfo/> node.
- * @uri: the URI attribute (optional).
- * @type: the Type attribute(optional).
+ * @keyInfoNode: the pointer to <dsig:KeyInfo/> node.
+ * @uri: the URI attribute (optional).
+ * @type: the Type attribute(optional).
*
* Adds <dsig:RetrievalMethod/> node to the <dsig:KeyInfo/> node @keyInfoNode.
*
@@ -1297,35 +1297,35 @@ xmlSecTmplKeyInfoAddX509Data(xmlNodePtr keyInfoNode) {
*/
xmlNodePtr
xmlSecTmplKeyInfoAddRetrievalMethod(xmlNodePtr keyInfoNode, const xmlChar *uri,
- const xmlChar *type) {
+ const xmlChar *type) {
xmlNodePtr res;
xmlSecAssert2(keyInfoNode != NULL, NULL);
res = xmlSecAddChild(keyInfoNode, xmlSecNodeRetrievalMethod, xmlSecDSigNs);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRetrievalMethod));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRetrievalMethod));
+ return(NULL);
}
if(uri != NULL) {
- xmlSetProp(res, xmlSecAttrURI, uri);
+ xmlSetProp(res, xmlSecAttrURI, uri);
}
if(type != NULL) {
- xmlSetProp(res, xmlSecAttrType, type);
+ xmlSetProp(res, xmlSecAttrType, type);
}
return(res);
}
/**
* xmlSecTmplRetrievalMethodAddTransform:
- * @retrMethodNode: the pointer to <dsig:RetrievalMethod/> node.
- * @transformId: the transform id.
+ * @retrMethodNode: the pointer to <dsig:RetrievalMethod/> node.
+ * @transformId: the transform id.
*
* Adds <dsig:Transform/> node (and the parent <dsig:Transforms/> node
* if required) to the <dsig:RetrievalMethod/> node @retrMethod.
@@ -1344,40 +1344,40 @@ xmlSecTmplRetrievalMethodAddTransform(xmlNodePtr retrMethodNode, xmlSecTransform
transformsNode = xmlSecFindChild(retrMethodNode, xmlSecNodeTransforms, xmlSecDSigNs);
if(transformsNode == NULL) {
- transformsNode = xmlSecAddChild(retrMethodNode, xmlSecNodeTransforms, xmlSecDSigNs);
- if(transformsNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeTransforms));
- return(NULL);
- }
+ transformsNode = xmlSecAddChild(retrMethodNode, xmlSecNodeTransforms, xmlSecDSigNs);
+ if(transformsNode == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeTransforms));
+ return(NULL);
+ }
}
res = xmlSecAddChild(transformsNode, xmlSecNodeTransform, xmlSecDSigNs);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeTransform));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeTransform));
+ return(NULL);
}
if(xmlSetProp(res, xmlSecAttrAlgorithm, transformId->href) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSetProp",
- XMLSEC_ERRORS_R_XML_FAILED,
- "name=%s,value=%s",
- xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
- xmlSecErrorsSafeString(transformId->href));
- xmlUnlinkNode(res);
- xmlFreeNode(res);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSetProp",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "name=%s,value=%s",
+ xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
+ xmlSecErrorsSafeString(transformId->href));
+ xmlUnlinkNode(res);
+ xmlFreeNode(res);
+ return(NULL);
}
return(res);
@@ -1386,11 +1386,11 @@ xmlSecTmplRetrievalMethodAddTransform(xmlNodePtr retrMethodNode, xmlSecTransform
/**
* xmlSecTmplKeyInfoAddEncryptedKey:
- * @keyInfoNode: the pointer to <dsig:KeyInfo/> node.
- * @encMethodId: the encryption method (optional).
- * @id: the Id attribute (optional).
- * @type: the Type attribute (optional).
- * @recipient: the Recipient attribute (optional).
+ * @keyInfoNode: the pointer to <dsig:KeyInfo/> node.
+ * @encMethodId: the encryption method (optional).
+ * @id: the Id attribute (optional).
+ * @type: the Type attribute (optional).
+ * @recipient: the Recipient attribute (optional).
*
* Adds <enc:EncryptedKey/> node with given attributes to
* the <dsig:KeyInfo/> node @keyInfoNode.
@@ -1400,7 +1400,7 @@ xmlSecTmplRetrievalMethodAddTransform(xmlNodePtr retrMethodNode, xmlSecTransform
*/
xmlNodePtr
xmlSecTmplKeyInfoAddEncryptedKey(xmlNodePtr keyInfoNode, xmlSecTransformId encMethodId,
- const xmlChar* id, const xmlChar* type, const xmlChar* recipient) {
+ const xmlChar* id, const xmlChar* type, const xmlChar* recipient) {
xmlNodePtr encKeyNode;
xmlSecAssert2(keyInfoNode != NULL, NULL);
@@ -1408,29 +1408,29 @@ xmlSecTmplKeyInfoAddEncryptedKey(xmlNodePtr keyInfoNode, xmlSecTransformId encMe
/* we allow multiple encrypted key elements */
encKeyNode = xmlSecAddChild(keyInfoNode, xmlSecNodeEncryptedKey, xmlSecEncNs);
if(encKeyNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeEncryptedKey));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeEncryptedKey));
+ return(NULL);
}
if(id != NULL) {
- xmlSetProp(encKeyNode, xmlSecAttrId, id);
+ xmlSetProp(encKeyNode, xmlSecAttrId, id);
}
if(type != NULL) {
- xmlSetProp(encKeyNode, xmlSecAttrType, type);
+ xmlSetProp(encKeyNode, xmlSecAttrType, type);
}
if(recipient != NULL) {
- xmlSetProp(encKeyNode, xmlSecAttrRecipient, recipient);
+ xmlSetProp(encKeyNode, xmlSecAttrRecipient, recipient);
}
if(xmlSecTmplPrepareEncData(encKeyNode, encMethodId) < 0) {
- xmlUnlinkNode(encKeyNode);
- xmlFreeNode(encKeyNode);
- return(NULL);
+ xmlUnlinkNode(encKeyNode);
+ xmlFreeNode(encKeyNode);
+ return(NULL);
}
return(encKeyNode);
}
@@ -1442,7 +1442,7 @@ xmlSecTmplKeyInfoAddEncryptedKey(xmlNodePtr keyInfoNode, xmlSecTransformId encMe
**********************************************************************/
/**
* xmlSecTmplX509DataAddIssuerSerial:
- * @x509DataNode: the pointer to <dsig:X509Data/> node.
+ * @x509DataNode: the pointer to <dsig:X509Data/> node.
*
* Adds <dsig:X509IssuerSerial/> node to the given <dsig:X509Data/> node.
*
@@ -1458,23 +1458,23 @@ xmlSecTmplX509DataAddIssuerSerial(xmlNodePtr x509DataNode) {
cur = xmlSecFindChild(x509DataNode, xmlSecNodeX509IssuerSerial, xmlSecDSigNs);
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeX509IssuerSerial),
- XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeX509IssuerSerial),
+ XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
cur = xmlSecAddChild(x509DataNode, xmlSecNodeX509IssuerSerial, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509IssuerSerial));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509IssuerSerial));
+ return(NULL);
}
return (cur);
@@ -1482,8 +1482,8 @@ xmlSecTmplX509DataAddIssuerSerial(xmlNodePtr x509DataNode) {
/**
* xmlSecTmplX509IssuerSerialAddIssuerName:
- * @x509IssuerSerialNode: the pointer to <dsig:X509IssuerSerial/> node.
- * @issuerName: the issuer name (optional).
+ * @x509IssuerSerialNode: the pointer to <dsig:X509IssuerSerial/> node.
+ * @issuerName: the issuer name (optional).
*
* Adds <dsig:X509IssuerName/> node to the <dsig:X509IssuerSerial/> node @x509IssuerSerialNode.
*
@@ -1492,41 +1492,41 @@ xmlSecTmplX509DataAddIssuerSerial(xmlNodePtr x509DataNode) {
*/
xmlNodePtr
xmlSecTmplX509IssuerSerialAddIssuerName(xmlNodePtr x509IssuerSerialNode, const xmlChar* issuerName) {
- xmlNodePtr res;
-
- xmlSecAssert2(x509IssuerSerialNode != NULL, NULL);
-
+ xmlNodePtr res;
+
+ xmlSecAssert2(x509IssuerSerialNode != NULL, NULL);
+
if(xmlSecFindChild(x509IssuerSerialNode, xmlSecNodeX509IssuerName,
- xmlSecDSigNs) != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeX509IssuerName),
- XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
-
- res = xmlSecAddChild(x509IssuerSerialNode, xmlSecNodeX509IssuerName, xmlSecDSigNs);
+ xmlSecDSigNs) != NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeX509IssuerName),
+ XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+
+ res = xmlSecAddChild(x509IssuerSerialNode, xmlSecNodeX509IssuerName, xmlSecDSigNs);
if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509IssuerName));
- return(NULL);
- }
-
- if (issuerName != NULL) {
- xmlSecNodeEncodeAndSetContent(res, issuerName);
- }
- return(res);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509IssuerName));
+ return(NULL);
+ }
+
+ if (issuerName != NULL) {
+ xmlSecNodeEncodeAndSetContent(res, issuerName);
+ }
+ return(res);
}
/**
* xmlSecTmplX509IssuerSerialAddSerialNumber:
- * @x509IssuerSerialNode: the pointer to <dsig:X509IssuerSerial/> node.
- * @serial: the serial number (optional).
+ * @x509IssuerSerialNode: the pointer to <dsig:X509IssuerSerial/> node.
+ * @serial: the serial number (optional).
*
* Adds <dsig:X509SerialNumber/> node to the <dsig:X509IssuerSerial/> node @x509IssuerSerialNode.
*
@@ -1535,40 +1535,40 @@ xmlSecTmplX509IssuerSerialAddIssuerName(xmlNodePtr x509IssuerSerialNode, const x
*/
xmlNodePtr
xmlSecTmplX509IssuerSerialAddSerialNumber(xmlNodePtr x509IssuerSerialNode, const xmlChar* serial) {
- xmlNodePtr res;
-
- xmlSecAssert2(x509IssuerSerialNode != NULL, NULL);
-
- if(xmlSecFindChild(x509IssuerSerialNode, xmlSecNodeX509SerialNumber,
- xmlSecDSigNs) != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber),
- XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
-
- res = xmlSecAddChild(x509IssuerSerialNode, xmlSecNodeX509SerialNumber, xmlSecDSigNs);
- if(res == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber));
- return(NULL);
- }
-
- if (serial != NULL) {
- xmlSecNodeEncodeAndSetContent(res, serial);
- }
- return(res);
+ xmlNodePtr res;
+
+ xmlSecAssert2(x509IssuerSerialNode != NULL, NULL);
+
+ if(xmlSecFindChild(x509IssuerSerialNode, xmlSecNodeX509SerialNumber,
+ xmlSecDSigNs) != NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber),
+ XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+
+ res = xmlSecAddChild(x509IssuerSerialNode, xmlSecNodeX509SerialNumber, xmlSecDSigNs);
+ if(res == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber));
+ return(NULL);
+ }
+
+ if (serial != NULL) {
+ xmlSecNodeEncodeAndSetContent(res, serial);
+ }
+ return(res);
}
/**
* xmlSecTmplX509DataAddSubjectName:
- * @x509DataNode: the pointer to <dsig:X509Data/> node.
+ * @x509DataNode: the pointer to <dsig:X509Data/> node.
*
* Adds <dsig:X509SubjectName/> node to the given <dsig:X509Data/> node.
*
@@ -1584,23 +1584,23 @@ xmlSecTmplX509DataAddSubjectName(xmlNodePtr x509DataNode) {
cur = xmlSecFindChild(x509DataNode, xmlSecNodeX509SubjectName, xmlSecDSigNs);
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeX509SubjectName),
- XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeX509SubjectName),
+ XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
cur = xmlSecAddChild(x509DataNode, xmlSecNodeX509SubjectName, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509SubjectName));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509SubjectName));
+ return(NULL);
}
return (cur);
@@ -1608,7 +1608,7 @@ xmlSecTmplX509DataAddSubjectName(xmlNodePtr x509DataNode) {
/**
* xmlSecTmplX509DataAddSKI:
- * @x509DataNode: the pointer to <dsig:X509Data/> node.
+ * @x509DataNode: the pointer to <dsig:X509Data/> node.
*
* Adds <dsig:X509SKI/> node to the given <dsig:X509Data/> node.
*
@@ -1624,23 +1624,23 @@ xmlSecTmplX509DataAddSKI(xmlNodePtr x509DataNode) {
cur = xmlSecFindChild(x509DataNode, xmlSecNodeX509SKI, xmlSecDSigNs);
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeX509SKI),
- XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeX509SKI),
+ XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
cur = xmlSecAddChild(x509DataNode, xmlSecNodeX509SKI, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509SKI));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509SKI));
+ return(NULL);
}
return (cur);
@@ -1649,7 +1649,7 @@ xmlSecTmplX509DataAddSKI(xmlNodePtr x509DataNode) {
/**
* xmlSecTmplX509DataAddCertificate:
- * @x509DataNode: the pointer to <dsig:X509Data/> node.
+ * @x509DataNode: the pointer to <dsig:X509Data/> node.
*
* Adds <dsig:X509Certificate/> node to the given <dsig:X509Data/> node.
*
@@ -1665,23 +1665,23 @@ xmlSecTmplX509DataAddCertificate(xmlNodePtr x509DataNode) {
cur = xmlSecFindChild(x509DataNode, xmlSecNodeX509Certificate, xmlSecDSigNs);
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeX509Certificate),
- XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeX509Certificate),
+ XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
cur = xmlSecAddChild(x509DataNode, xmlSecNodeX509Certificate, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509Certificate));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509Certificate));
+ return(NULL);
}
return (cur);
@@ -1689,7 +1689,7 @@ xmlSecTmplX509DataAddCertificate(xmlNodePtr x509DataNode) {
/**
* xmlSecTmplX509DataAddCRL:
- * @x509DataNode: the pointer to <dsig:X509Data/> node.
+ * @x509DataNode: the pointer to <dsig:X509Data/> node.
*
* Adds <dsig:X509CRL/> node to the given <dsig:X509Data/> node.
*
@@ -1705,23 +1705,23 @@ xmlSecTmplX509DataAddCRL(xmlNodePtr x509DataNode) {
cur = xmlSecFindChild(x509DataNode, xmlSecNodeX509CRL, xmlSecDSigNs);
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeX509CRL),
- XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeX509CRL),
+ XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
cur = xmlSecAddChild(x509DataNode, xmlSecNodeX509CRL, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeX509CRL));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeX509CRL));
+ return(NULL);
}
return (cur);
@@ -1735,8 +1735,8 @@ xmlSecTmplX509DataAddCRL(xmlNodePtr x509DataNode) {
/**
* xmlSecTmplTransformAddHmacOutputLength:
- * @transformNode: the pointer to <dsig:Transform/> node
- * @bitsLen: the required length in bits
+ * @transformNode: the pointer to <dsig:Transform/> node
+ * @bitsLen: the required length in bits
*
* Creates <dsig:HMACOutputLength/> child for the HMAC transform
* node @node.
@@ -1753,23 +1753,23 @@ xmlSecTmplTransformAddHmacOutputLength(xmlNodePtr transformNode, xmlSecSize bits
cur = xmlSecFindChild(transformNode, xmlSecNodeHMACOutputLength, xmlSecDSigNs);
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeHMACOutputLength),
- XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeHMACOutputLength),
+ XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecAddChild(transformNode, xmlSecNodeHMACOutputLength, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeHMACOutputLength));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeHMACOutputLength));
+ return(-1);
}
sprintf(buf, "%u", bitsLen);
@@ -1779,17 +1779,17 @@ xmlSecTmplTransformAddHmacOutputLength(xmlNodePtr transformNode, xmlSecSize bits
/**
* xmlSecTmplTransformAddRsaOaepParam:
- * @transformNode: the pointer to <dsig:Transform/> node.
- * @buf: the OAEP param buffer.
- * @size: the OAEP param buffer size.
+ * @transformNode: the pointer to <dsig:Transform/> node.
+ * @buf: the OAEP param buffer.
+ * @size: the OAEP param buffer size.
*
* Creates <enc:OAEPParam/> child node in the @node.
*
* Returns: 0 on success or a negative value if an error occurs.
*/
-int
+int
xmlSecTmplTransformAddRsaOaepParam(xmlNodePtr transformNode,
- const xmlSecByte *buf, xmlSecSize size) {
+ const xmlSecByte *buf, xmlSecSize size) {
xmlNodePtr oaepParamNode;
xmlChar *base64;
@@ -1799,33 +1799,33 @@ xmlSecTmplTransformAddRsaOaepParam(xmlNodePtr transformNode,
oaepParamNode = xmlSecFindChild(transformNode, xmlSecNodeRsaOAEPparams, xmlSecEncNs);
if(oaepParamNode != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeRsaOAEPparams),
- XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeRsaOAEPparams),
+ XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
oaepParamNode = xmlSecAddChild(transformNode, xmlSecNodeRsaOAEPparams, xmlSecEncNs);
if(oaepParamNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeRsaOAEPparams));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeRsaOAEPparams));
+ return(-1);
}
base64 = xmlSecBase64Encode(buf, size, 0);
if(base64 == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64Encode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", size);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64Encode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", size);
+ return(-1);
}
xmlNodeSetContent(oaepParamNode, base64);
@@ -1835,8 +1835,8 @@ xmlSecTmplTransformAddRsaOaepParam(xmlNodePtr transformNode,
/**
* xmlSecTmplTransformAddXsltStylesheet:
- * @transformNode: the pointer to <dsig:Transform/> node.
- * @xslt: the XSLT transform exspression.
+ * @transformNode: the pointer to <dsig:Transform/> node.
+ * @xslt: the XSLT transform exspression.
*
* Writes the XSLT transform expression to the @node.
*
@@ -1852,23 +1852,23 @@ xmlSecTmplTransformAddXsltStylesheet(xmlNodePtr transformNode, const xmlChar *xs
xsltDoc = xmlParseMemory((const char*)xslt, xmlStrlen(xslt));
if(xsltDoc == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlParseMemory",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlParseMemory",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecReplaceContent(transformNode, xmlDocGetRootElement(xsltDoc));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecReplaceContent",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFreeDoc(xsltDoc);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecReplaceContent",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFreeDoc(xsltDoc);
+ return(-1);
}
xmlFreeDoc(xsltDoc);
@@ -1877,18 +1877,18 @@ xmlSecTmplTransformAddXsltStylesheet(xmlNodePtr transformNode, const xmlChar *xs
/**
* xmlSecTmplTransformAddC14NInclNamespaces:
- * @transformNode: the pointer to <dsig:Transform/> node.
- * @prefixList: the white space delimited list of namespace prefixes,
- * where "#default" indicates the default namespace
- * (optional).
+ * @transformNode: the pointer to <dsig:Transform/> node.
+ * @prefixList: the white space delimited list of namespace prefixes,
+ * where "#default" indicates the default namespace
+ * (optional).
*
* Adds "inclusive" namespaces to the ExcC14N transform node @node.
*
* Returns: 0 if success or a negative value otherwise.
*/
-int
+int
xmlSecTmplTransformAddC14NInclNamespaces(xmlNodePtr transformNode,
- const xmlChar *prefixList) {
+ const xmlChar *prefixList) {
xmlNodePtr cur;
xmlSecAssert2(transformNode != NULL, -1);
@@ -1896,23 +1896,23 @@ xmlSecTmplTransformAddC14NInclNamespaces(xmlNodePtr transformNode,
cur = xmlSecFindChild(transformNode, xmlSecNodeInclusiveNamespaces, xmlSecNsExcC14N);
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeInclusiveNamespaces),
- XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeInclusiveNamespaces),
+ XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecAddChild(transformNode, xmlSecNodeInclusiveNamespaces, xmlSecNsExcC14N);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecNodeGetName(transformNode)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeInclusiveNamespaces));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(transformNode)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeInclusiveNamespaces));
+ return(-1);
}
xmlSetProp(cur, xmlSecAttrPrefixList, prefixList);
@@ -1921,19 +1921,19 @@ xmlSecTmplTransformAddC14NInclNamespaces(xmlNodePtr transformNode,
/**
* xmlSecTmplTransformAddXPath:
- * @transformNode: the pointer to the <dsig:Transform/> node.
- * @expression: the XPath expression.
- * @nsList: the NULL terminated list of namespace prefix/href pairs
- * (optional).
+ * @transformNode: the pointer to the <dsig:Transform/> node.
+ * @expression: the XPath expression.
+ * @nsList: the NULL terminated list of namespace prefix/href pairs
+ * (optional).
*
* Writes XPath transform infromation to the <dsig:Transform/> node
* @node.
*
* Returns: 0 for success or a negative value otherwise.
*/
-int
+int
xmlSecTmplTransformAddXPath(xmlNodePtr transformNode, const xmlChar *expression,
- const xmlChar **nsList) {
+ const xmlChar **nsList) {
xmlNodePtr xpathNode;
xmlSecAssert2(transformNode != NULL, -1);
@@ -1941,23 +1941,23 @@ xmlSecTmplTransformAddXPath(xmlNodePtr transformNode, const xmlChar *expression,
xpathNode = xmlSecFindChild(transformNode, xmlSecNodeXPath, xmlSecDSigNs);
if(xpathNode != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeXPath),
- XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeXPath),
+ XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
xpathNode = xmlSecAddChild(transformNode, xmlSecNodeXPath, xmlSecDSigNs);
if(xpathNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeXPath));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeXPath));
+ return(-1);
}
xmlSecNodeEncodeAndSetContent(xpathNode, expression);
@@ -1966,11 +1966,11 @@ xmlSecTmplTransformAddXPath(xmlNodePtr transformNode, const xmlChar *expression,
/**
* xmlSecTmplTransformAddXPath2:
- * @transformNode: the pointer to the <dsig:Transform/> node.
- * @type: the XPath2 transform type ("union", "intersect" or "subtract").
- * @expression: the XPath expression.
- * @nsList: the NULL terminated list of namespace prefix/href pairs.
- * (optional).
+ * @transformNode: the pointer to the <dsig:Transform/> node.
+ * @type: the XPath2 transform type ("union", "intersect" or "subtract").
+ * @expression: the XPath expression.
+ * @nsList: the NULL terminated list of namespace prefix/href pairs.
+ * (optional).
*
* Writes XPath2 transform infromation to the <dsig:Transform/> node
* @node.
@@ -1979,7 +1979,7 @@ xmlSecTmplTransformAddXPath(xmlNodePtr transformNode, const xmlChar *expression,
*/
int
xmlSecTmplTransformAddXPath2(xmlNodePtr transformNode, const xmlChar* type,
- const xmlChar *expression, const xmlChar **nsList) {
+ const xmlChar *expression, const xmlChar **nsList) {
xmlNodePtr xpathNode;
xmlSecAssert2(transformNode != NULL, -1);
@@ -1988,13 +1988,13 @@ xmlSecTmplTransformAddXPath2(xmlNodePtr transformNode, const xmlChar* type,
xpathNode = xmlSecAddChild(transformNode, xmlSecNodeXPath, xmlSecXPath2Ns);
if(xpathNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeXPath));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeXPath));
+ return(-1);
}
xmlSetProp(xpathNode, xmlSecAttrFilter, type);
@@ -2004,19 +2004,19 @@ xmlSecTmplTransformAddXPath2(xmlNodePtr transformNode, const xmlChar* type,
/**
* xmlSecTmplTransformAddXPointer:
- * @transformNode: the pointer to the <dsig:Transform/> node.
- * @expression: the XPath expression.
- * @nsList: the NULL terminated list of namespace prefix/href pairs.
- * (optional).
+ * @transformNode: the pointer to the <dsig:Transform/> node.
+ * @expression: the XPath expression.
+ * @nsList: the NULL terminated list of namespace prefix/href pairs.
+ * (optional).
*
* Writes XPoniter transform infromation to the <dsig:Transform/> node
* @node.
*
* Returns: 0 for success or a negative value otherwise.
*/
-int
+int
xmlSecTmplTransformAddXPointer(xmlNodePtr transformNode, const xmlChar *expression,
- const xmlChar **nsList) {
+ const xmlChar **nsList) {
xmlNodePtr xpointerNode;
xmlSecAssert2(expression != NULL, -1);
@@ -2024,23 +2024,23 @@ xmlSecTmplTransformAddXPointer(xmlNodePtr transformNode, const xmlChar *expressi
xpointerNode = xmlSecFindChild(transformNode, xmlSecNodeXPointer, xmlSecXPointerNs);
if(xpointerNode != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeXPointer),
- XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeXPointer),
+ XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
xpointerNode = xmlSecAddChild(transformNode, xmlSecNodeXPointer, xmlSecXPointerNs);
if(xpointerNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeXPointer));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeXPointer));
+ return(-1);
}
@@ -2057,35 +2057,35 @@ xmlSecTmplNodeWriteNsList(xmlNodePtr parentNode, const xmlChar** nsList) {
xmlSecAssert2(parentNode != NULL, -1);
xmlSecAssert2(nsList != NULL, -1);
-
+
ptr = nsList;
while((*ptr) != NULL) {
- if(xmlStrEqual(BAD_CAST "#default", (*ptr))) {
- prefix = NULL;
- } else {
- prefix = (*ptr);
- }
- if((++ptr) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "unexpected end of ns list");
- return(-1);
- }
- href = *(ptr++);
-
- ns = xmlNewNs(parentNode, href, prefix);
- if(ns == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewNs",
- XMLSEC_ERRORS_R_XML_FAILED,
- "href=%s;prefix=%s",
- xmlSecErrorsSafeString(href),
- xmlSecErrorsSafeString(prefix));
- return(-1);
- }
+ if(xmlStrEqual(BAD_CAST "#default", (*ptr))) {
+ prefix = NULL;
+ } else {
+ prefix = (*ptr);
+ }
+ if((++ptr) == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "unexpected end of ns list");
+ return(-1);
+ }
+ href = *(ptr++);
+
+ ns = xmlNewNs(parentNode, href, prefix);
+ if(ns == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewNs",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "href=%s;prefix=%s",
+ xmlSecErrorsSafeString(href),
+ xmlSecErrorsSafeString(prefix));
+ return(-1);
+ }
}
return(0);
}
diff --git a/src/transforms.c b/src/transforms.c
index 2ed3fe8..56372a8 100644
--- a/src/transforms.c
+++ b/src/transforms.c
@@ -95,21 +95,21 @@ xmlSecTransformIdsInit(void) {
ret = xmlSecPtrListInitialize(xmlSecTransformIdsGet(), xmlSecTransformIdListId);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListPtrInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecTransformIdListId");
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListPtrInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecTransformIdListId");
return(-1);
}
ret = xmlSecTransformIdsRegisterDefault();
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformIdsRegisterDefault",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformIdsRegisterDefault",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -129,7 +129,7 @@ xmlSecTransformIdsShutdown(void) {
/**
* xmlSecTransformIdsRegister:
- * @id: the transform klass.
+ * @id: the transform klass.
*
* Registers @id in the global list of transform klasses.
*
@@ -143,12 +143,12 @@ xmlSecTransformIdsRegister(xmlSecTransformId id) {
ret = xmlSecPtrListAdd(xmlSecTransformIdsGet(), (xmlSecPtr)id);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)));
return(-1);
}
@@ -166,120 +166,120 @@ xmlSecTransformIdsRegister(xmlSecTransformId id) {
int
xmlSecTransformIdsRegisterDefault(void) {
if(xmlSecTransformIdsRegister(xmlSecTransformBase64Id) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformBase64Id)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformBase64Id)));
+ return(-1);
}
if(xmlSecTransformIdsRegister(xmlSecTransformEnvelopedId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformEnvelopedId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformEnvelopedId)));
+ return(-1);
}
/* c14n methods */
if(xmlSecTransformIdsRegister(xmlSecTransformInclC14NId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInclC14NId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInclC14NId)));
+ return(-1);
}
if(xmlSecTransformIdsRegister(xmlSecTransformInclC14NWithCommentsId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInclC14NWithCommentsId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInclC14NWithCommentsId)));
+ return(-1);
}
if(xmlSecTransformIdsRegister(xmlSecTransformInclC14N11Id) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInclC14N11Id)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInclC14N11Id)));
+ return(-1);
}
if(xmlSecTransformIdsRegister(xmlSecTransformInclC14N11WithCommentsId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInclC14N11WithCommentsId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInclC14N11WithCommentsId)));
+ return(-1);
}
if(xmlSecTransformIdsRegister(xmlSecTransformExclC14NId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformExclC14NId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformExclC14NId)));
+ return(-1);
}
if(xmlSecTransformIdsRegister(xmlSecTransformExclC14NWithCommentsId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformExclC14NWithCommentsId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformExclC14NWithCommentsId)));
+ return(-1);
}
if(xmlSecTransformIdsRegister(xmlSecTransformXPathId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXPathId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXPathId)));
+ return(-1);
}
if(xmlSecTransformIdsRegister(xmlSecTransformXPath2Id) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXPath2Id)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXPath2Id)));
+ return(-1);
}
if(xmlSecTransformIdsRegister(xmlSecTransformXPointerId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXPointerId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXPointerId)));
+ return(-1);
}
#ifndef XMLSEC_NO_XSLT
if(xmlSecTransformIdsRegister(xmlSecTransformXsltId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXsltId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXsltId)));
+ return(-1);
}
#endif /* XMLSEC_NO_XSLT */
@@ -293,8 +293,8 @@ xmlSecTransformIdsRegisterDefault(void) {
*************************************************************************/
/**
* xmlSecTransformUriTypeCheck:
- * @type: the expected URI type.
- * @uri: the uri for checking.
+ * @type: the expected URI type.
+ * @uri: the uri for checking.
*
* Checks if @uri matches expected type @type.
*
@@ -306,13 +306,13 @@ xmlSecTransformUriTypeCheck(xmlSecTransformUriType type, const xmlChar* uri) {
xmlSecTransformUriType uriType = 0;
if((uri == NULL) || (xmlStrlen(uri) == 0)) {
- uriType = xmlSecTransformUriTypeEmpty;
+ uriType = xmlSecTransformUriTypeEmpty;
} else if(uri[0] == '#') {
- uriType = xmlSecTransformUriTypeSameDocument;
+ uriType = xmlSecTransformUriTypeSameDocument;
} else if(xmlStrncmp(uri, BAD_CAST "file://", 7) == 0) {
- uriType = xmlSecTransformUriTypeLocal;
+ uriType = xmlSecTransformUriTypeLocal;
} else {
- uriType = xmlSecTransformUriTypeRemote;
+ uriType = xmlSecTransformUriTypeRemote;
}
return(((uriType & type) != 0) ? 1 : 0);
}
@@ -341,23 +341,23 @@ xmlSecTransformCtxCreate(void) {
/* Allocate a new xmlSecTransform and fill the fields. */
ctx = (xmlSecTransformCtxPtr)xmlMalloc(sizeof(xmlSecTransformCtx));
if(ctx == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "size=%d", sizeof(xmlSecTransformCtx));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "size=%d", sizeof(xmlSecTransformCtx));
+ return(NULL);
}
ret = xmlSecTransformCtxInitialize(ctx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecTransformCtxDestroy(ctx);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecTransformCtxDestroy(ctx);
+ return(NULL);
}
return(ctx);
@@ -365,7 +365,7 @@ xmlSecTransformCtxCreate(void) {
/**
* xmlSecTransformCtxDestroy:
- * @ctx: the pointer to transforms chain processing context.
+ * @ctx: the pointer to transforms chain processing context.
*
* Destroy context object created with #xmlSecTransformCtxCreate function.
*/
@@ -379,7 +379,7 @@ xmlSecTransformCtxDestroy(xmlSecTransformCtxPtr ctx) {
/**
* xmlSecTransformCtxInitialize:
- * @ctx: the pointer to transforms chain processing context.
+ * @ctx: the pointer to transforms chain processing context.
*
* Initializes transforms chain processing context.
* The caller is responsible for cleaing up returend object by calling
@@ -397,12 +397,12 @@ xmlSecTransformCtxInitialize(xmlSecTransformCtxPtr ctx) {
ret = xmlSecPtrListInitialize(&(ctx->enabledTransforms), xmlSecTransformIdListId);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ctx->enabledUris = xmlSecTransformUriTypeAny;
@@ -411,7 +411,7 @@ xmlSecTransformCtxInitialize(xmlSecTransformCtxPtr ctx) {
/**
* xmlSecTransformCtxFinalize:
- * @ctx: the pointer to transforms chain processing context.
+ * @ctx: the pointer to transforms chain processing context.
*
* Cleans up @ctx object initialized with #xmlSecTransformCtxInitialize function.
*/
@@ -426,7 +426,7 @@ xmlSecTransformCtxFinalize(xmlSecTransformCtxPtr ctx) {
/**
* xmlSecTransformCtxReset:
- * @ctx: the pointer to transforms chain processing context.
+ * @ctx: the pointer to transforms chain processing context.
*
* Resets transfroms context for new processing.
*/
@@ -441,26 +441,26 @@ xmlSecTransformCtxReset(xmlSecTransformCtxPtr ctx) {
/* destroy uri */
if(ctx->uri != NULL) {
- xmlFree(ctx->uri);
- ctx->uri = NULL;
+ xmlFree(ctx->uri);
+ ctx->uri = NULL;
}
if(ctx->xptrExpr != NULL) {
- xmlFree(ctx->xptrExpr);
- ctx->xptrExpr = NULL;
+ xmlFree(ctx->xptrExpr);
+ ctx->xptrExpr = NULL;
}
/* destroy transforms chain */
for(transform = ctx->first; transform != NULL; transform = tmp) {
- tmp = transform->next;
- xmlSecTransformDestroy(transform);
+ tmp = transform->next;
+ xmlSecTransformDestroy(transform);
}
ctx->first = ctx->last = NULL;
}
/**
* xmlSecTransformCtxCopyUserPref:
- * @dst: the pointer to destination transforms chain processing context.
- * @src: the pointer to source transforms chain processing context.
+ * @dst: the pointer to destination transforms chain processing context.
+ * @src: the pointer to source transforms chain processing context.
*
* Copies user settings from @src context to @dst.
*
@@ -473,20 +473,20 @@ xmlSecTransformCtxCopyUserPref(xmlSecTransformCtxPtr dst, xmlSecTransformCtxPtr
xmlSecAssert2(dst != NULL, -1);
xmlSecAssert2(src != NULL, -1);
- dst->userData = src->userData;
- dst->flags = src->flags;
- dst->flags2 = src->flags2;
- dst->enabledUris = src->enabledUris;
+ dst->userData = src->userData;
+ dst->flags = src->flags;
+ dst->flags2 = src->flags2;
+ dst->enabledUris = src->enabledUris;
dst->preExecCallback = src->preExecCallback;
ret = xmlSecPtrListCopy(&(dst->enabledTransforms), &(src->enabledTransforms));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListCopy",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListCopy",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -494,8 +494,8 @@ xmlSecTransformCtxCopyUserPref(xmlSecTransformCtxPtr dst, xmlSecTransformCtxPtr
/**
* xmlSecTransformCtxAppend:
- * @ctx: the pointer to transforms chain processing context.
- * @transform: the pointer to new transform.
+ * @ctx: the pointer to transforms chain processing context.
+ * @transform: the pointer to new transform.
*
* Connects the @transform to the end of the chain of transforms in the @ctx
* (see #xmlSecTransformConnect function for details).
@@ -511,19 +511,19 @@ xmlSecTransformCtxAppend(xmlSecTransformCtxPtr ctx, xmlSecTransformPtr transform
xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
if(ctx->last != NULL) {
- ret = xmlSecTransformConnect(ctx->last, transform, ctx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformConnect",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
- return(-1);
- }
+ ret = xmlSecTransformConnect(ctx->last, transform, ctx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformConnect",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
+ return(-1);
+ }
} else {
- xmlSecAssert2(ctx->first == NULL, -1);
- ctx->first = transform;
+ xmlSecAssert2(ctx->first == NULL, -1);
+ ctx->first = transform;
}
ctx->last = transform;
@@ -532,8 +532,8 @@ xmlSecTransformCtxAppend(xmlSecTransformCtxPtr ctx, xmlSecTransformPtr transform
/**
* xmlSecTransformCtxPrepend:
- * @ctx: the pointer to transforms chain processing context.
- * @transform: the pointer to new transform.
+ * @ctx: the pointer to transforms chain processing context.
+ * @transform: the pointer to new transform.
*
* Connects the @transform to the beggining of the chain of transforms in the @ctx
* (see #xmlSecTransformConnect function for details).
@@ -549,19 +549,19 @@ xmlSecTransformCtxPrepend(xmlSecTransformCtxPtr ctx, xmlSecTransformPtr transfor
xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
if(ctx->first != NULL) {
- ret = xmlSecTransformConnect(transform, ctx->first, ctx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformConnect",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
- return(-1);
- }
+ ret = xmlSecTransformConnect(transform, ctx->first, ctx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformConnect",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
+ return(-1);
+ }
} else {
- xmlSecAssert2(ctx->last == NULL, -1);
- ctx->last = transform;
+ xmlSecAssert2(ctx->last == NULL, -1);
+ ctx->last = transform;
}
ctx->first = transform;
@@ -570,8 +570,8 @@ xmlSecTransformCtxPrepend(xmlSecTransformCtxPtr ctx, xmlSecTransformPtr transfor
/**
* xmlSecTransformCtxCreateAndAppend:
- * @ctx: the pointer to transforms chain processing context.
- * @id: the new transform klass.
+ * @ctx: the pointer to transforms chain processing context.
+ * @id: the new transform klass.
*
* Creaeates new transform and connects it to the end of the chain of
* transforms in the @ctx (see #xmlSecTransformConnect function for details).
@@ -589,25 +589,25 @@ xmlSecTransformCtxCreateAndAppend(xmlSecTransformCtxPtr ctx, xmlSecTransformId i
transform = xmlSecTransformCreate(id);
if(!xmlSecTransformIsValid(transform)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)));
+ return(NULL);
}
ret = xmlSecTransformCtxAppend(ctx, transform);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
- xmlSecTransformDestroy(transform);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
+ xmlSecTransformDestroy(transform);
+ return(NULL);
}
return(transform);
@@ -615,8 +615,8 @@ xmlSecTransformCtxCreateAndAppend(xmlSecTransformCtxPtr ctx, xmlSecTransformId i
/**
* xmlSecTransformCtxCreateAndPrepend:
- * @ctx: the pointer to transforms chain processing context.
- * @id: the new transform klass.
+ * @ctx: the pointer to transforms chain processing context.
+ * @id: the new transform klass.
*
* Creaeates new transform and connects it to the end of the chain of
* transforms in the @ctx (see #xmlSecTransformConnect function for details).
@@ -634,25 +634,25 @@ xmlSecTransformCtxCreateAndPrepend(xmlSecTransformCtxPtr ctx, xmlSecTransformId
transform = xmlSecTransformCreate(id);
if(!xmlSecTransformIsValid(transform)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)));
+ return(NULL);
}
ret = xmlSecTransformCtxPrepend(ctx, transform);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxPrepend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
- xmlSecTransformDestroy(transform);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxPrepend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
+ xmlSecTransformDestroy(transform);
+ return(NULL);
}
return(transform);
@@ -660,9 +660,9 @@ xmlSecTransformCtxCreateAndPrepend(xmlSecTransformCtxPtr ctx, xmlSecTransformId
/**
* xmlSecTransformCtxNodeRead:
- * @ctx: the pointer to transforms chain processing context.
- * @node: the pointer to transform's node.
- * @usage: the transform's usage (signature, encryption, etc.).
+ * @ctx: the pointer to transforms chain processing context.
+ * @node: the pointer to transform's node.
+ * @usage: the transform's usage (signature, encryption, etc.).
*
* Reads the transform from the @node and appends it to the current chain
* of transforms in @ctx.
@@ -671,7 +671,7 @@ xmlSecTransformCtxCreateAndPrepend(xmlSecTransformCtxPtr ctx, xmlSecTransformId
*/
xmlSecTransformPtr
xmlSecTransformCtxNodeRead(xmlSecTransformCtxPtr ctx, xmlNodePtr node,
- xmlSecTransformUsage usage) {
+ xmlSecTransformUsage usage) {
xmlSecTransformPtr transform;
int ret;
@@ -681,25 +681,25 @@ xmlSecTransformCtxNodeRead(xmlSecTransformCtxPtr ctx, xmlNodePtr node,
transform = xmlSecTransformNodeRead(node, usage, ctx);
if(transform == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
+ return(NULL);
}
ret = xmlSecTransformCtxAppend(ctx, transform);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
- xmlSecTransformDestroy(transform);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
+ xmlSecTransformDestroy(transform);
+ return(NULL);
}
return(transform);
@@ -707,9 +707,9 @@ xmlSecTransformCtxNodeRead(xmlSecTransformCtxPtr ctx, xmlNodePtr node,
/**
* xmlSecTransformCtxNodesListRead:
- * @ctx: the pointer to transforms chain processing context.
- * @node: the pointer to <dsig:Transform/> nodes parent node.
- * @usage: the transform's usage (signature, encryption, etc.).
+ * @ctx: the pointer to transforms chain processing context.
+ * @node: the pointer to <dsig:Transform/> nodes parent node.
+ * @usage: the transform's usage (signature, encryption, etc.).
*
* Reads transforms from the <dsig:Transform/> children of the @node and
* appends them to the current transforms chain in @ctx object.
@@ -728,48 +728,48 @@ xmlSecTransformCtxNodesListRead(xmlSecTransformCtxPtr ctx, xmlNodePtr node, xmlS
cur = xmlSecGetNextElementNode(node->children);
while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeTransform, xmlSecDSigNs)) {
- transform = xmlSecTransformNodeRead(cur, usage, ctx);
- if(transform == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
- }
-
- ret = xmlSecTransformCtxAppend(ctx, transform);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- xmlSecTransformDestroy(transform);
- return(-1);
- }
- cur = xmlSecGetNextElementNode(cur->next);
+ transform = xmlSecTransformNodeRead(cur, usage, ctx);
+ if(transform == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
+ }
+
+ ret = xmlSecTransformCtxAppend(ctx, transform);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ xmlSecTransformDestroy(transform);
+ return(-1);
+ }
+ cur = xmlSecGetNextElementNode(cur->next);
}
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
/**
* xmlSecTransformCtxSetUri:
- * @ctx: the pointer to transforms chain processing context.
- * @uri: the URI.
- * @hereNode: the pointer to "here" node required by some
- * XML transforms (may be NULL).
+ * @ctx: the pointer to transforms chain processing context.
+ * @uri: the URI.
+ * @hereNode: the pointer to "here" node required by some
+ * XML transforms (may be NULL).
*
* Parses uri and adds xpointer transforms if required.
*
@@ -818,162 +818,162 @@ xmlSecTransformCtxSetUri(xmlSecTransformCtxPtr ctx, const xmlChar* uri, xmlNodeP
/* check uri */
if(xmlSecTransformUriTypeCheck(ctx->enabledUris, uri) != 1) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_URI_TYPE,
- "uri=%s",
- xmlSecErrorsSafeString(uri));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_URI_TYPE,
+ "uri=%s",
+ xmlSecErrorsSafeString(uri));
+ return(-1);
}
/* is it an empty uri? */
if((uri == NULL) || (xmlStrlen(uri) == 0)) {
- return(0);
+ return(0);
}
/* do we have barename or full xpointer? */
xptr = xmlStrchr(uri, '#');
if(xptr == NULL){
ctx->uri = xmlStrdup(uri);
- if(ctx->uri == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_STRDUP_FAILED,
- "size=%d", xmlStrlen(uri));
- return(-1);
- }
- /* we are done */
- return(0);
+ if(ctx->uri == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_STRDUP_FAILED,
+ "size=%d", xmlStrlen(uri));
+ return(-1);
+ }
+ /* we are done */
+ return(0);
} else if(xmlStrcmp(uri, BAD_CAST "#xpointer(/)") == 0) {
ctx->xptrExpr = xmlStrdup(uri);
- if(ctx->xptrExpr == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_STRDUP_FAILED,
- "size=%d", xmlStrlen(uri));
- return(-1);
- }
- /* we are done */
- return(0);
+ if(ctx->xptrExpr == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_STRDUP_FAILED,
+ "size=%d", xmlStrlen(uri));
+ return(-1);
+ }
+ /* we are done */
+ return(0);
}
ctx->uri = xmlStrndup(uri, xptr - uri);
if(ctx->uri == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_STRDUP_FAILED,
- "size=%d", xptr - uri);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_STRDUP_FAILED,
+ "size=%d", xptr - uri);
+ return(-1);
}
ctx->xptrExpr = xmlStrdup(xptr);
if(ctx->xptrExpr == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_STRDUP_FAILED,
- "size=%d", xmlStrlen(xptr));
- return(-1);
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_STRDUP_FAILED,
+ "size=%d", xmlStrlen(xptr));
+ return(-1);
}
/* do we have barename or full xpointer? */
xmlSecAssert2(xptr != NULL, -1);
if((xmlStrncmp(xptr, BAD_CAST "#xpointer(", 10) == 0) || (xmlStrncmp(xptr, BAD_CAST "#xmlns(", 7) == 0)) {
- ++xptr;
- nodeSetType = xmlSecNodeSetTree;
+ ++xptr;
+ nodeSetType = xmlSecNodeSetTree;
} else if((ctx->flags & XMLSEC_TRANSFORMCTX_FLAGS_USE_VISA3D_HACK) != 0) {
- ++xptr;
- nodeSetType = xmlSecNodeSetTreeWithoutComments;
- useVisa3DHack = 1;
+ ++xptr;
+ nodeSetType = xmlSecNodeSetTreeWithoutComments;
+ useVisa3DHack = 1;
} else {
- static const char tmpl[] = "xpointer(id(\'%s\'))";
- xmlSecSize size;
-
- /* we need to add "xpointer(id('..')) because otherwise we have
- * problems with numeric ("111" and so on) and other "strange" ids */
- size = xmlStrlen(BAD_CAST tmpl) + xmlStrlen(xptr) + 2;
- buf = (xmlChar*)xmlMalloc(size * sizeof(xmlChar));
- if(buf == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "size=%d", size);
- return(-1);
- }
- sprintf((char*)buf, tmpl, xptr + 1);
- xptr = buf;
- nodeSetType = xmlSecNodeSetTreeWithoutComments;
+ static const char tmpl[] = "xpointer(id(\'%s\'))";
+ xmlSecSize size;
+
+ /* we need to add "xpointer(id('..')) because otherwise we have
+ * problems with numeric ("111" and so on) and other "strange" ids */
+ size = xmlStrlen(BAD_CAST tmpl) + xmlStrlen(xptr) + 2;
+ buf = (xmlChar*)xmlMalloc(size * sizeof(xmlChar));
+ if(buf == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "size=%d", size);
+ return(-1);
+ }
+ sprintf((char*)buf, tmpl, xptr + 1);
+ xptr = buf;
+ nodeSetType = xmlSecNodeSetTreeWithoutComments;
}
if(useVisa3DHack == 0) {
- xmlSecTransformPtr transform;
+ xmlSecTransformPtr transform;
- /* we need to create XPonter transform to execute expr */
- transform = xmlSecTransformCtxCreateAndPrepend(ctx, xmlSecTransformXPointerId);
- if(!xmlSecTransformIsValid(transform)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxCreateAndPrepend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXPointerId)));
- return(-1);
- }
+ /* we need to create XPonter transform to execute expr */
+ transform = xmlSecTransformCtxCreateAndPrepend(ctx, xmlSecTransformXPointerId);
+ if(!xmlSecTransformIsValid(transform)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxCreateAndPrepend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXPointerId)));
+ return(-1);
+ }
ret = xmlSecTransformXPointerSetExpr(transform, xptr, nodeSetType, hereNode);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformXPointerSetExpr",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
- if(buf != NULL) {
- xmlFree(buf);
- }
- return(-1);
- }
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformXPointerSetExpr",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
+ if(buf != NULL) {
+ xmlFree(buf);
+ }
+ return(-1);
+ }
} else {
- /* Visa3D protocol doesn't follow XML/XPointer/XMLDSig specs
- * and allows invalid XPointer expressions (e.g. "#12345") in
- * the URI attribute.
- * Since we couldn't evaluate such expressions thru XPath/XPointer
- * engine, we need to have this hack here
- */
- xmlSecTransformPtr transform;
+ /* Visa3D protocol doesn't follow XML/XPointer/XMLDSig specs
+ * and allows invalid XPointer expressions (e.g. "#12345") in
+ * the URI attribute.
+ * Since we couldn't evaluate such expressions thru XPath/XPointer
+ * engine, we need to have this hack here
+ */
+ xmlSecTransformPtr transform;
- transform = xmlSecTransformCtxCreateAndPrepend(ctx, xmlSecTransformVisa3DHackId);
- if(!xmlSecTransformIsValid(transform)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxCreateAndPrepend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformVisa3DHackId)));
- return(-1);
- }
+ transform = xmlSecTransformCtxCreateAndPrepend(ctx, xmlSecTransformVisa3DHackId);
+ if(!xmlSecTransformIsValid(transform)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxCreateAndPrepend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformVisa3DHackId)));
+ return(-1);
+ }
ret = xmlSecTransformVisa3DHackSetID(transform, xptr);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformVisa3DHackSetID",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
- if(buf != NULL) {
- xmlFree(buf);
- }
- return(-1);
- }
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformVisa3DHackSetID",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
+ if(buf != NULL) {
+ xmlFree(buf);
+ }
+ return(-1);
+ }
}
if(buf != NULL) {
- xmlFree(buf);
+ xmlFree(buf);
}
return(0);
@@ -981,8 +981,8 @@ xmlSecTransformCtxSetUri(xmlSecTransformCtxPtr ctx, const xmlChar* uri, xmlNodeP
/**
* xmlSecTransformCtxPrepare:
- * @ctx: the pointer to transforms chain processing context.
- * @inputDataType: the expected input type.
+ * @ctx: the pointer to transforms chain processing context.
+ * @inputDataType: the expected input type.
*
* Prepares the transform context for processing data of @inputDataType.
*
@@ -1001,68 +1001,68 @@ xmlSecTransformCtxPrepare(xmlSecTransformCtxPtr ctx, xmlSecTransformDataType inp
/* add binary buffer to store result */
transform = xmlSecTransformCtxCreateAndAppend(ctx, xmlSecTransformMemBufId);
if(!xmlSecTransformIsValid(transform)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformMemBufId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformMemBufId)));
+ return(-1);
}
ctx->result = xmlSecTransformMemBufGetBuffer(transform);
if(ctx->result == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformMemBufGetBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformMemBufId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformMemBufGetBuffer",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformMemBufId)));
+ return(-1);
}
firstType = xmlSecTransformGetDataType(ctx->first, xmlSecTransformModePush, ctx);
if(((firstType & xmlSecTransformDataTypeBin) == 0) &&
((inputDataType & xmlSecTransformDataTypeBin) != 0)) {
-
+
/* need to add parser transform */
- transform = xmlSecTransformCtxCreateAndPrepend(ctx, xmlSecTransformXmlParserId);
- if(transform == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxCreateAndPrepend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXmlParserId)));
- return(-1);
- }
+ transform = xmlSecTransformCtxCreateAndPrepend(ctx, xmlSecTransformXmlParserId);
+ if(transform == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxCreateAndPrepend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformXmlParserId)));
+ return(-1);
+ }
} else if(((firstType & xmlSecTransformDataTypeXml) == 0) &&
((inputDataType & xmlSecTransformDataTypeXml) != 0)) {
- /* need to add c14n transform */
- transform = xmlSecTransformCtxCreateAndPrepend(ctx, xmlSecTransformInclC14NId);
- if(transform == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxCreateAndPrepend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInclC14NId)));
- return(-1);
- }
+ /* need to add c14n transform */
+ transform = xmlSecTransformCtxCreateAndPrepend(ctx, xmlSecTransformInclC14NId);
+ if(transform == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxCreateAndPrepend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInclC14NId)));
+ return(-1);
+ }
}
/* finally let application a chance to verify that it's ok to execte
* this transforms chain */
if(ctx->preExecCallback != NULL) {
- ret = (ctx->preExecCallback)(ctx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "ctx->preExecCallback",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ret = (ctx->preExecCallback)(ctx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "ctx->preExecCallback",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
ctx->status = xmlSecTransformStatusWorking;
@@ -1071,9 +1071,9 @@ xmlSecTransformCtxPrepare(xmlSecTransformCtxPtr ctx, xmlSecTransformDataType inp
/**
* xmlSecTransformCtxBinaryExecute:
- * @ctx: the pointer to transforms chain processing context.
- * @data: the input binary data buffer.
- * @dataSize: the input data size.
+ * @ctx: the pointer to transforms chain processing context.
+ * @data: the input binary data buffer.
+ * @dataSize: the input data size.
*
* Processes binary data using transforms chain in the @ctx.
*
@@ -1081,7 +1081,7 @@ xmlSecTransformCtxPrepare(xmlSecTransformCtxPtr ctx, xmlSecTransformDataType inp
*/
int
xmlSecTransformCtxBinaryExecute(xmlSecTransformCtxPtr ctx,
- const xmlSecByte* data, xmlSecSize dataSize) {
+ const xmlSecByte* data, xmlSecSize dataSize) {
int ret;
xmlSecAssert2(ctx != NULL, -1);
@@ -1096,21 +1096,21 @@ xmlSecTransformCtxBinaryExecute(xmlSecTransformCtxPtr ctx,
ret = xmlSecTransformCtxPrepare(ctx, xmlSecTransformDataTypeBin);
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxPrepare",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "type=bin");
- return(-1);
- }
+ NULL,
+ "xmlSecTransformCtxPrepare",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "type=bin");
+ return(-1);
+ }
ret = xmlSecTransformPushBin(ctx->first, data, dataSize, 1, ctx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxPushBin",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "dataSize=%d", dataSize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxPushBin",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "dataSize=%d", dataSize);
+ return(-1);
}
ctx->status = xmlSecTransformStatusFinished;
@@ -1119,8 +1119,8 @@ xmlSecTransformCtxBinaryExecute(xmlSecTransformCtxPtr ctx,
/**
* xmlSecTransformCtxUriExecute:
- * @ctx: the pointer to transforms chain processing context.
- * @uri: the URI.
+ * @ctx: the pointer to transforms chain processing context.
+ * @uri: the URI.
*
* Process binary data from the URI using transforms chain in @ctx.
*
@@ -1140,49 +1140,49 @@ xmlSecTransformCtxUriExecute(xmlSecTransformCtxPtr ctx, const xmlChar* uri) {
uriTransform = xmlSecTransformCtxCreateAndPrepend(ctx, xmlSecTransformInputURIId);
if(uriTransform == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxCreateAndPrepend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInputURIId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxCreateAndPrepend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformInputURIId)));
+ return(-1);
}
ret = xmlSecTransformInputURIOpen(uriTransform, uri);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformInputURIOpen",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "uri=%s",
- xmlSecErrorsSafeString(uri));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformInputURIOpen",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "uri=%s",
+ xmlSecErrorsSafeString(uri));
+ return(-1);
}
/* we do not need to do something special for this transform */
ret = xmlSecTransformCtxPrepare(ctx, xmlSecTransformDataTypeUnknown);
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxPrepare",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "type=bin");
- return(-1);
- }
+ NULL,
+ "xmlSecTransformCtxPrepare",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "type=bin");
+ return(-1);
+ }
/* Now we have a choice: we either can push from first transform or pop
* from last. Our C14N transforms prefers push, so push data!
*/
ret = xmlSecTransformPump(uriTransform, uriTransform->next, ctx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformPump",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "uri=%s",
- xmlSecErrorsSafeString(uri));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformPump",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "uri=%s",
+ xmlSecErrorsSafeString(uri));
+ return(-1);
}
ctx->status = xmlSecTransformStatusFinished;
@@ -1191,8 +1191,8 @@ xmlSecTransformCtxUriExecute(xmlSecTransformCtxPtr ctx, const xmlChar* uri) {
/**
* xmlSecTransformCtxXmlExecute:
- * @ctx: the pointer to transforms chain processing context.
- * @nodes: the input node set.
+ * @ctx: the pointer to transforms chain processing context.
+ * @nodes: the input node set.
*
* Process @nodes using transforms in the transforms chain in @ctx.
*
@@ -1211,25 +1211,25 @@ xmlSecTransformCtxXmlExecute(xmlSecTransformCtxPtr ctx, xmlSecNodeSetPtr nodes)
ret = xmlSecTransformCtxPrepare(ctx, xmlSecTransformDataTypeXml);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxPrepare",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "type=xml");
- return(-1);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxPrepare",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "type=xml");
+ return(-1);
+ }
/* it's better to do push than pop because all XML transform
* just don't care and c14n likes push more than pop */
ret = xmlSecTransformPushXml(ctx->first, nodes, ctx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformPushXml",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformGetName(ctx->first)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformPushXml",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformGetName(ctx->first)));
+ return(-1);
}
ctx->status = xmlSecTransformStatusFinished;
@@ -1238,8 +1238,8 @@ xmlSecTransformCtxXmlExecute(xmlSecTransformCtxPtr ctx, xmlSecNodeSetPtr nodes)
/**
* xmlSecTransformCtxExecute:
- * @ctx: the pointer to transforms chain processing context.
- * @doc: the pointer to input document.
+ * @ctx: the pointer to transforms chain processing context.
+ * @doc: the pointer to input document.
*
* Executes transforms chain in @ctx.
*
@@ -1255,54 +1255,54 @@ xmlSecTransformCtxExecute(xmlSecTransformCtxPtr ctx, xmlDocPtr doc) {
xmlSecAssert2(doc != NULL, -1);
if((ctx->uri == NULL) || (xmlStrlen(ctx->uri) == 0)) {
- xmlSecNodeSetPtr nodes;
+ xmlSecNodeSetPtr nodes;
- if((ctx->xptrExpr != NULL) && (xmlStrlen(ctx->xptrExpr) > 0)){
- /* our xpointer transform takes care of providing correct nodes set */
- nodes = xmlSecNodeSetCreate(doc, NULL, xmlSecNodeSetNormal);
- if(nodes == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNodeSetCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- } else {
- /* we do not want to have comments for empty URI */
- nodes = xmlSecNodeSetGetChildren(doc, NULL, 0, 0);
- if(nodes == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNodeSetGetChildren",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- }
- ret = xmlSecTransformCtxXmlExecute(ctx, nodes);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxXmlExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecNodeSetDestroy(nodes);
- return(-1);
- }
- /* TODO: don't destroy nodes here */
- xmlSecNodeSetDestroy(nodes);
+ if((ctx->xptrExpr != NULL) && (xmlStrlen(ctx->xptrExpr) > 0)){
+ /* our xpointer transform takes care of providing correct nodes set */
+ nodes = xmlSecNodeSetCreate(doc, NULL, xmlSecNodeSetNormal);
+ if(nodes == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNodeSetCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ } else {
+ /* we do not want to have comments for empty URI */
+ nodes = xmlSecNodeSetGetChildren(doc, NULL, 0, 0);
+ if(nodes == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNodeSetGetChildren",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ }
+ ret = xmlSecTransformCtxXmlExecute(ctx, nodes);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxXmlExecute",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecNodeSetDestroy(nodes);
+ return(-1);
+ }
+ /* TODO: don't destroy nodes here */
+ xmlSecNodeSetDestroy(nodes);
} else {
- ret = xmlSecTransformCtxUriExecute(ctx, ctx->uri);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxUriExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ret = xmlSecTransformCtxUriExecute(ctx, ctx->uri);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxUriExecute",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
return(0);
@@ -1310,8 +1310,8 @@ xmlSecTransformCtxExecute(xmlSecTransformCtxPtr ctx, xmlDocPtr doc) {
/**
* xmlSecTransformCtxDebugDump:
- * @ctx: the pointer to transforms chain processing context.
- * @output: the pointer to output FILE.
+ * @ctx: the pointer to transforms chain processing context.
+ * @output: the pointer to output FILE.
*
* Prints transforms context debug information to @output.
*/
@@ -1327,25 +1327,25 @@ xmlSecTransformCtxDebugDump(xmlSecTransformCtxPtr ctx, FILE* output) {
fprintf(output, "== flags: 0x%08x\n", ctx->flags);
fprintf(output, "== flags2: 0x%08x\n", ctx->flags2);
if(xmlSecPtrListGetSize(&(ctx->enabledTransforms)) > 0) {
- fprintf(output, "== enabled transforms: ");
- xmlSecTransformIdListDebugDump(&(ctx->enabledTransforms), output);
+ fprintf(output, "== enabled transforms: ");
+ xmlSecTransformIdListDebugDump(&(ctx->enabledTransforms), output);
} else {
- fprintf(output, "== enabled transforms: all\n");
+ fprintf(output, "== enabled transforms: all\n");
}
fprintf(output, "=== uri: %s\n",
- (ctx->uri != NULL) ? ctx->uri : BAD_CAST "NULL");
+ (ctx->uri != NULL) ? ctx->uri : BAD_CAST "NULL");
fprintf(output, "=== uri xpointer expr: %s\n",
- (ctx->xptrExpr != NULL) ? ctx->xptrExpr : BAD_CAST "NULL");
+ (ctx->xptrExpr != NULL) ? ctx->xptrExpr : BAD_CAST "NULL");
for(transform = ctx->first; transform != NULL; transform = transform->next) {
- xmlSecTransformDebugDump(transform, output);
+ xmlSecTransformDebugDump(transform, output);
}
}
/**
* xmlSecTransformCtxDebugXmlDump:
- * @ctx: the pointer to transforms chain processing context.
- * @output: the pointer to output FILE.
+ * @ctx: the pointer to transforms chain processing context.
+ * @output: the pointer to output FILE.
*
* Prints transforms context debug information to @output in XML format.
*/
@@ -1361,11 +1361,11 @@ xmlSecTransformCtxDebugXmlDump(xmlSecTransformCtxPtr ctx, FILE* output) {
fprintf(output, "<Flags>%08x</Flags>\n", ctx->flags);
fprintf(output, "<Flags2>%08x</Flags2>\n", ctx->flags2);
if(xmlSecPtrListGetSize(&(ctx->enabledTransforms)) > 0) {
- fprintf(output, "<EnabledTransforms>\n");
- xmlSecTransformIdListDebugXmlDump(&(ctx->enabledTransforms), output);
- fprintf(output, "</EnabledTransforms>\n");
+ fprintf(output, "<EnabledTransforms>\n");
+ xmlSecTransformIdListDebugXmlDump(&(ctx->enabledTransforms), output);
+ fprintf(output, "</EnabledTransforms>\n");
} else {
- fprintf(output, "<EnabledTransforms>all</EnabledTransforms>\n");
+ fprintf(output, "<EnabledTransforms>all</EnabledTransforms>\n");
}
@@ -1378,7 +1378,7 @@ xmlSecTransformCtxDebugXmlDump(xmlSecTransformCtxPtr ctx, FILE* output) {
fprintf(output, "</UriXPointer>\n");
for(transform = ctx->first; transform != NULL; transform = transform->next) {
- xmlSecTransformDebugXmlDump(transform, output);
+ xmlSecTransformDebugXmlDump(transform, output);
}
fprintf(output, "</TransformCtx>\n");
}
@@ -1390,14 +1390,14 @@ xmlSecTransformCtxDebugXmlDump(xmlSecTransformCtxPtr ctx, FILE* output) {
*************************************************************************/
/**
* xmlSecTransformCreate:
- * @id: the transform id to create.
+ * @id: the transform id to create.
*
* Creates new transform of the @id klass. The caller is responsible for
* destroying returned tansform using #xmlSecTransformDestroy function.
*
* Returns: pointer to newly created transform or NULL if an error occurs.
*/
-xmlSecTransformPtr
+xmlSecTransformPtr
xmlSecTransformCreate(xmlSecTransformId id) {
xmlSecTransformPtr transform;
int ret;
@@ -1410,49 +1410,49 @@ xmlSecTransformCreate(xmlSecTransformId id) {
/* Allocate a new xmlSecTransform and fill the fields. */
transform = (xmlSecTransformPtr)xmlMalloc(id->objSize);
if(transform == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "size=%d", id->objSize);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "size=%d", id->objSize);
+ return(NULL);
}
memset(transform, 0, id->objSize);
transform->id = id;
if(id->initialize != NULL) {
- ret = (id->initialize)(transform);
+ ret = (id->initialize)(transform);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "id->initialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecTransformDestroy(transform);
- return(NULL);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "id->initialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecTransformDestroy(transform);
+ return(NULL);
+ }
}
ret = xmlSecBufferInitialize(&(transform->inBuf), 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", 0);
- xmlSecTransformDestroy(transform);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", 0);
+ xmlSecTransformDestroy(transform);
+ return(NULL);
}
ret = xmlSecBufferInitialize(&(transform->outBuf), 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", 0);
- xmlSecTransformDestroy(transform);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", 0);
+ xmlSecTransformDestroy(transform);
+ return(NULL);
}
return(transform);
@@ -1460,7 +1460,7 @@ xmlSecTransformCreate(xmlSecTransformId id) {
/**
* xmlSecTransformDestroy:
- * @transform: the pointer to transform.
+ * @transform: the pointer to transform.
*
* Destroys transform created with #xmlSecTransformCreate function.
*/
@@ -1480,10 +1480,10 @@ xmlSecTransformDestroy(xmlSecTransformPtr transform) {
* from input nodes
*/
if((transform->outNodes != NULL) && (transform->outNodes != transform->inNodes)) {
- xmlSecNodeSetDestroy(transform->outNodes);
+ xmlSecNodeSetDestroy(transform->outNodes);
}
if(transform->id->finalize != NULL) {
- (transform->id->finalize)(transform);
+ (transform->id->finalize)(transform);
}
memset(transform, 0, transform->id->objSize);
xmlFree(transform);
@@ -1491,9 +1491,9 @@ xmlSecTransformDestroy(xmlSecTransformPtr transform) {
/**
* xmlSecTransformNodeRead:
- * @node: the pointer to the transform's node.
- * @usage: the transform usage (signature, encryption, ...).
- * @transformCtx: the transform's chaing processing context.
+ * @node: the pointer to the transform's node.
+ * @usage: the transform usage (signature, encryption, ...).
+ * @transformCtx: the transform's chaing processing context.
*
* Reads transform from the @node as follows:
*
@@ -1519,65 +1519,65 @@ xmlSecTransformNodeRead(xmlNodePtr node, xmlSecTransformUsage usage, xmlSecTrans
href = xmlGetProp(node, xmlSecAttrAlgorithm);
if(href == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
- XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecAttrAlgorithm),
+ XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
+ return(NULL);
}
id = xmlSecTransformIdListFindByHref(xmlSecTransformIdsGet(), href, usage);
if(id == xmlSecTransformIdUnknown) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformIdListFindByHref",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "href=%s",
- xmlSecErrorsSafeString(href));
- xmlFree(href);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformIdListFindByHref",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "href=%s",
+ xmlSecErrorsSafeString(href));
+ xmlFree(href);
+ return(NULL);
}
/* check with enabled transforms list */
if((xmlSecPtrListGetSize(&(transformCtx->enabledTransforms)) > 0) &&
(xmlSecTransformIdListFind(&(transformCtx->enabledTransforms), id) != 1)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)),
- XMLSEC_ERRORS_R_TRANSFORM_DISABLED,
- "href=%s",
- xmlSecErrorsSafeString(href));
- xmlFree(href);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)),
+ XMLSEC_ERRORS_R_TRANSFORM_DISABLED,
+ "href=%s",
+ xmlSecErrorsSafeString(href));
+ xmlFree(href);
+ return(NULL);
}
transform = xmlSecTransformCreate(id);
if(!xmlSecTransformIsValid(transform)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)));
- xmlFree(href);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(id)));
+ xmlFree(href);
+ return(NULL);
}
if(transform->id->readNode != NULL) {
- ret = transform->id->readNode(transform, node, transformCtx);
+ ret = transform->id->readNode(transform, node, transformCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "id->readNode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
- xmlSecTransformDestroy(transform);
- xmlFree(href);
- return(NULL);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "id->readNode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)));
+ xmlSecTransformDestroy(transform);
+ xmlFree(href);
+ return(NULL);
+ }
}
/* finally remember the transform node */
@@ -1588,9 +1588,9 @@ xmlSecTransformNodeRead(xmlNodePtr node, xmlSecTransformUsage usage, xmlSecTrans
/**
* xmlSecTransformPump:
- * @left: the source pumping transform.
- * @right: the destination pumping transform.
- * @transformCtx: the transform's chaing processing context.
+ * @left: the source pumping transform.
+ * @right: the destination pumping transform.
+ * @transformCtx: the transform's chaing processing context.
*
* Pops data from @left transform and pushes to @right transform until
* no more data is available.
@@ -1617,56 +1617,56 @@ xmlSecTransformPump(xmlSecTransformPtr left, xmlSecTransformPtr right, xmlSecTra
ret = xmlSecTransformPopXml(left, &nodes, transformCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(left)),
- "xmlSecTransformPopXml",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(left)),
+ "xmlSecTransformPopXml",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecTransformPushXml(right, nodes, transformCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(right)),
- "xmlSecTransformPushXml",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(right)),
+ "xmlSecTransformPushXml",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
} else if(((leftType & xmlSecTransformDataTypeBin) != 0) &&
- ((rightType & xmlSecTransformDataTypeBin) != 0)) {
- xmlSecByte buf[XMLSEC_TRANSFORM_BINARY_CHUNK];
- xmlSecSize bufSize;
- int final;
-
- do {
- ret = xmlSecTransformPopBin(left, buf, sizeof(buf), &bufSize, transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(left)),
- "xmlSecTransformPopBin",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- final = (bufSize == 0) ? 1 : 0;
- ret = xmlSecTransformPushBin(right, buf, bufSize, final, transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(right)),
- "xmlSecTransformPushBin",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- } while(final == 0);
+ ((rightType & xmlSecTransformDataTypeBin) != 0)) {
+ xmlSecByte buf[XMLSEC_TRANSFORM_BINARY_CHUNK];
+ xmlSecSize bufSize;
+ int final;
+
+ do {
+ ret = xmlSecTransformPopBin(left, buf, sizeof(buf), &bufSize, transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(left)),
+ "xmlSecTransformPopBin",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ final = (bufSize == 0) ? 1 : 0;
+ ret = xmlSecTransformPushBin(right, buf, bufSize, final, transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(right)),
+ "xmlSecTransformPushBin",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ } while(final == 0);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(left)),
- xmlSecErrorsSafeString(xmlSecTransformGetName(right)),
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- "transforms input/output data formats do not match");
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(left)),
+ xmlSecErrorsSafeString(xmlSecTransformGetName(right)),
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ "transforms input/output data formats do not match");
}
return(0);
}
@@ -1674,8 +1674,8 @@ xmlSecTransformPump(xmlSecTransformPtr left, xmlSecTransformPtr right, xmlSecTra
/**
* xmlSecTransformSetKey:
- * @transform: the pointer to transform.
- * @key: the pointer to key.
+ * @transform: the pointer to transform.
+ * @key: the pointer to key.
*
* Sets the transform's key.
*
@@ -1687,15 +1687,15 @@ xmlSecTransformSetKey(xmlSecTransformPtr transform, xmlSecKeyPtr key) {
xmlSecAssert2(key != NULL, -1);
if(transform->id->setKey != NULL) {
- return((transform->id->setKey)(transform, key));
+ return((transform->id->setKey)(transform, key));
}
return(0);
}
/**
* xmlSecTransformSetKeyReq:
- * @transform: the pointer to transform.
- * @keyReq: the pointer to keys requirements object.
+ * @transform: the pointer to transform.
+ * @keyReq: the pointer to keys requirements object.
*
* Sets the key requirements for @transform in the @keyReq.
*
@@ -1706,23 +1706,23 @@ xmlSecTransformSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr keyReq) {
xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
xmlSecAssert2(keyReq != NULL, -1);
- keyReq->keyId = xmlSecKeyDataIdUnknown;
- keyReq->keyType = xmlSecKeyDataTypeUnknown;
- keyReq->keyUsage = xmlSecKeyUsageAny;
- keyReq->keyBitsSize = 0;
+ keyReq->keyId = xmlSecKeyDataIdUnknown;
+ keyReq->keyType = xmlSecKeyDataTypeUnknown;
+ keyReq->keyUsage = xmlSecKeyUsageAny;
+ keyReq->keyBitsSize = 0;
if(transform->id->setKeyReq != NULL) {
- return((transform->id->setKeyReq)(transform, keyReq));
+ return((transform->id->setKeyReq)(transform, keyReq));
}
return(0);
}
/**
* xmlSecTransformVerify:
- * @transform: the pointer to transform.
- * @data: the binary data for verification.
- * @dataSize: the data size.
- * @transformCtx: the transform's chaing processing context.
+ * @transform: the pointer to transform.
+ * @data: the binary data for verification.
+ * @dataSize: the data size.
+ * @transformCtx: the transform's chaing processing context.
*
* Verifies the data with transform's processing results
* (for digest, HMAC and signature transforms). The verification
@@ -1732,7 +1732,7 @@ xmlSecTransformSetKeyReq(xmlSecTransformPtr transform, xmlSecKeyReqPtr keyReq) {
*/
int
xmlSecTransformVerify(xmlSecTransformPtr transform, const xmlSecByte* data,
- xmlSecSize dataSize, xmlSecTransformCtxPtr transformCtx) {
+ xmlSecSize dataSize, xmlSecTransformCtxPtr transformCtx) {
xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
xmlSecAssert2(transform->id->verify != NULL, -1);
xmlSecAssert2(transformCtx != NULL, -1);
@@ -1742,9 +1742,9 @@ xmlSecTransformVerify(xmlSecTransformPtr transform, const xmlSecByte* data,
/**
* xmlSecTransformVerifyNodeContent:
- * @transform: the pointer to transform.
- * @node: the pointer to node.
- * @transformCtx: the transform's chaing processing context.
+ * @transform: the pointer to transform.
+ * @node: the pointer to node.
+ * @transformCtx: the transform's chaing processing context.
*
* Gets the @node content, base64 decodes it and calls #xmlSecTransformVerify
* function to verify binary results.
@@ -1753,7 +1753,7 @@ xmlSecTransformVerify(xmlSecTransformPtr transform, const xmlSecByte* data,
*/
int
xmlSecTransformVerifyNodeContent(xmlSecTransformPtr transform, xmlNodePtr node,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecBuffer buffer;
int ret;
@@ -1763,35 +1763,35 @@ xmlSecTransformVerifyNodeContent(xmlSecTransformPtr transform, xmlNodePtr node,
ret = xmlSecBufferInitialize(&buffer, 0);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecBufferBase64NodeContentRead(&buffer, node);
if((ret < 0) || (xmlSecBufferGetData(&buffer) == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferBase64NodeContentRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBufferFinalize(&buffer);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferBase64NodeContentRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBufferFinalize(&buffer);
+ return(-1);
}
ret = xmlSecTransformVerify(transform, xmlSecBufferGetData(&buffer),
- xmlSecBufferGetSize(&buffer), transformCtx);
+ xmlSecBufferGetSize(&buffer), transformCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformVerify",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBufferFinalize(&buffer);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecTransformVerify",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBufferFinalize(&buffer);
+ return(-1);
}
xmlSecBufferFinalize(&buffer);
@@ -1800,18 +1800,18 @@ xmlSecTransformVerifyNodeContent(xmlSecTransformPtr transform, xmlNodePtr node,
/**
* xmlSecTransformGetDataType:
- * @transform: the pointer to transform.
- * @mode: the data mode (push or pop).
- * @transformCtx: the transform's chaing processing context.
+ * @transform: the pointer to transform.
+ * @mode: the data mode (push or pop).
+ * @transformCtx: the transform's chaing processing context.
*
* Gets transform input (@mode is "push") or output (@mode is "pop") data
* type (binary or XML).
*
* Returns: the transform's data type for the @mode operation.
*/
-xmlSecTransformDataType
+xmlSecTransformDataType
xmlSecTransformGetDataType(xmlSecTransformPtr transform, xmlSecTransformMode mode,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecAssert2(xmlSecTransformIsValid(transform), xmlSecTransformDataTypeUnknown);
xmlSecAssert2(transform->id->getDataType != NULL, xmlSecTransformDataTypeUnknown);
@@ -1820,12 +1820,12 @@ xmlSecTransformGetDataType(xmlSecTransformPtr transform, xmlSecTransformMode mod
/**
* xmlSecTransformPushBin:
- * @transform: the pointer to transform object.
- * @data: the input binary data,
- * @dataSize: the input data size.
- * @final: the flag: if set to 1 then it's the last
- * data chunk.
- * @transformCtx: the pointer to transform context object.
+ * @transform: the pointer to transform object.
+ * @data: the input binary data,
+ * @dataSize: the input data size.
+ * @final: the flag: if set to 1 then it's the last
+ * data chunk.
+ * @transformCtx: the pointer to transform context object.
*
* Process binary @data and pushes results to next transform.
*
@@ -1833,7 +1833,7 @@ xmlSecTransformGetDataType(xmlSecTransformPtr transform, xmlSecTransformMode mod
*/
int
xmlSecTransformPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
- xmlSecSize dataSize, int final, xmlSecTransformCtxPtr transformCtx) {
+ xmlSecSize dataSize, int final, xmlSecTransformCtxPtr transformCtx) {
xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
xmlSecAssert2(transform->id->pushBin != NULL, -1);
xmlSecAssert2(transformCtx != NULL, -1);
@@ -1843,11 +1843,11 @@ xmlSecTransformPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
/**
* xmlSecTransformPopBin:
- * @transform: the pointer to transform object.
- * @data: the buffer to store result data.
- * @maxDataSize: the size of the buffer #data.
- * @dataSize: the pointer to returned data size.
- * @transformCtx: the pointer to transform context object.
+ * @transform: the pointer to transform object.
+ * @data: the buffer to store result data.
+ * @maxDataSize: the size of the buffer #data.
+ * @dataSize: the pointer to returned data size.
+ * @transformCtx: the pointer to transform context object.
*
* Pops data from previous transform in the chain, processes data and
* returns result in the @data buffer. The size of returned data is
@@ -1857,7 +1857,7 @@ xmlSecTransformPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
*/
int
xmlSecTransformPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
- xmlSecSize maxDataSize, xmlSecSize* dataSize, xmlSecTransformCtxPtr transformCtx) {
+ xmlSecSize maxDataSize, xmlSecSize* dataSize, xmlSecTransformCtxPtr transformCtx) {
xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
xmlSecAssert2(transform->id->popBin != NULL, -1);
xmlSecAssert2(data != NULL, -1);
@@ -1869,9 +1869,9 @@ xmlSecTransformPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
/**
* xmlSecTransformPushXml:
- * @transform: the pointer to transform object.
- * @nodes: the input nodes.
- * @transformCtx: the pointer to transform context object.
+ * @transform: the pointer to transform object.
+ * @nodes: the input nodes.
+ * @transformCtx: the pointer to transform context object.
*
* Processes @nodes and pushes result to the next transform in the chain.
*
@@ -1879,7 +1879,7 @@ xmlSecTransformPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
*/
int
xmlSecTransformPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nodes,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
xmlSecAssert2(transform->id->pushXml != NULL, -1);
xmlSecAssert2(transformCtx != NULL, -1);
@@ -1889,9 +1889,9 @@ xmlSecTransformPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nodes,
/**
* xmlSecTransformPopXml:
- * @transform: the pointer to transform object.
- * @nodes: the pointer to store popinter to result nodes.
- * @transformCtx: the pointer to transform context object.
+ * @transform: the pointer to transform object.
+ * @nodes: the pointer to store popinter to result nodes.
+ * @transformCtx: the pointer to transform context object.
*
* Pops data from previous transform in the chain, processes the data and
* returns result in @nodes.
@@ -1900,7 +1900,7 @@ xmlSecTransformPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nodes,
*/
int
xmlSecTransformPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
xmlSecAssert2(transform->id->popXml != NULL, -1);
xmlSecAssert2(transformCtx != NULL, -1);
@@ -1910,9 +1910,9 @@ xmlSecTransformPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
/**
* xmlSecTransformExecute:
- * @transform: the pointer to transform.
- * @last: the flag: if set to 1 then it's the last data chunk.
- * @transformCtx: the transform's chaing processing context.
+ * @transform: the pointer to transform.
+ * @last: the flag: if set to 1 then it's the last data chunk.
+ * @transformCtx: the transform's chaing processing context.
*
* Executes transform (used by default popBin/pushBin/popXml/pushXml methods).
*
@@ -1929,8 +1929,8 @@ xmlSecTransformExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCt
/**
* xmlSecTransformDebugDump:
- * @transform: the pointer to transform.
- * @output: the pointer to output FILE.
+ * @transform: the pointer to transform.
+ * @output: the pointer to output FILE.
*
* Prints transform's debug information to @output.
*/
@@ -1940,14 +1940,14 @@ xmlSecTransformDebugDump(xmlSecTransformPtr transform, FILE* output) {
xmlSecAssert(output != NULL);
fprintf(output, "=== Transform: %s (href=%s)\n",
- xmlSecErrorsSafeString(transform->id->name),
- xmlSecErrorsSafeString(transform->id->href));
+ xmlSecErrorsSafeString(transform->id->name),
+ xmlSecErrorsSafeString(transform->id->href));
}
/**
* xmlSecTransformDebugXmlDump:
- * @transform: the pointer to transform.
- * @output: the pointer to output FILE.
+ * @transform: the pointer to transform.
+ * @output: the pointer to output FILE.
*
* Prints transform's debug information to @output in XML format.
*/
@@ -1970,9 +1970,9 @@ xmlSecTransformDebugXmlDump(xmlSecTransformPtr transform, FILE* output) {
************************************************************************/
/**
* xmlSecTransformConnect:
- * @left: the pointer to left (prev) transform.
- * @right: the pointer to right (next) transform.
- * @transformCtx: the transform's chaing processing context.
+ * @left: the pointer to left (prev) transform.
+ * @right: the pointer to right (next) transform.
+ * @transformCtx: the transform's chaing processing context.
*
* If the data object is a node-set and the next transform requires octets,
* the signature application MUST attempt to convert the node-set to an octet
@@ -1996,7 +1996,7 @@ xmlSecTransformDebugXmlDump(xmlSecTransformPtr transform, FILE* output) {
*/
int
xmlSecTransformConnect(xmlSecTransformPtr left, xmlSecTransformPtr right,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecTransformDataType leftType;
xmlSecTransformDataType rightType;
xmlSecTransformId middleId;
@@ -2014,47 +2014,47 @@ xmlSecTransformConnect(xmlSecTransformPtr left, xmlSecTransformPtr right,
((rightType & xmlSecTransformDataTypeBin) != 0)) ||
(((leftType & xmlSecTransformDataTypeXml) != 0) &&
((rightType & xmlSecTransformDataTypeXml) != 0))) {
-
- left->next = right;
- right->prev = left;
- return(0);
+
+ left->next = right;
+ right->prev = left;
+ return(0);
}
if(((leftType & xmlSecTransformDataTypeBin) != 0) &&
((rightType & xmlSecTransformDataTypeXml) != 0)) {
-
- /* need to insert parser */
- middleId = xmlSecTransformXmlParserId;
+
+ /* need to insert parser */
+ middleId = xmlSecTransformXmlParserId;
} else if(((leftType & xmlSecTransformDataTypeXml) != 0) &&
((rightType & xmlSecTransformDataTypeBin) != 0)) {
-
- /* need to insert c14n or special pre-base64 transform */
- if(xmlSecTransformCheckId(right, xmlSecTransformBase64Id)) {
- middleId = xmlSecTransformRemoveXmlTagsC14NId;
- } else {
- middleId = xmlSecTransformInclC14NId;
- }
+
+ /* need to insert c14n or special pre-base64 transform */
+ if(xmlSecTransformCheckId(right, xmlSecTransformBase64Id)) {
+ middleId = xmlSecTransformRemoveXmlTagsC14NId;
+ } else {
+ middleId = xmlSecTransformInclC14NId;
+ }
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(left)),
- xmlSecErrorsSafeString(xmlSecTransformGetName(right)),
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- "leftType=%d;rightType=%d",
- leftType, rightType);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(left)),
+ xmlSecErrorsSafeString(xmlSecTransformGetName(right)),
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ "leftType=%d;rightType=%d",
+ leftType, rightType);
+ return(-1);
}
/* insert transform */
middle = xmlSecTransformCreate(middleId);
if(middle == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(left)),
- "xmlSecTransformCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(middleId)));
- return(-1);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(left)),
+ "xmlSecTransformCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(middleId)));
+ return(-1);
+ }
left->next = middle;
middle->prev = left;
middle->next = right;
@@ -2073,10 +2073,10 @@ xmlSecTransformRemove(xmlSecTransformPtr transform) {
xmlSecAssert(xmlSecTransformIsValid(transform));
if(transform->next != NULL) {
- transform->next->prev = transform->prev;
+ transform->next->prev = transform->prev;
}
if(transform->prev != NULL) {
- transform->prev->next = transform->next;
+ transform->prev->next = transform->next;
}
transform->next = transform->prev = NULL;
}
@@ -2089,9 +2089,9 @@ xmlSecTransformRemove(xmlSecTransformPtr transform) {
************************************************************************/
/**
* xmlSecTransformDefaultGetDataType:
- * @transform: the pointer to transform.
- * @mode: the data mode (push or pop).
- * @transformCtx: the transform's chaing processing context.
+ * @transform: the pointer to transform.
+ * @mode: the data mode (push or pop).
+ * @transformCtx: the transform's chaing processing context.
*
* Gets transform input (@mode is "push") or output (@mode is "pop") data
* type (binary or XML) by analyzing available pushBin/popBin/pushXml/popXml
@@ -2101,7 +2101,7 @@ xmlSecTransformRemove(xmlSecTransformPtr transform) {
*/
xmlSecTransformDataType
xmlSecTransformDefaultGetDataType(xmlSecTransformPtr transform, xmlSecTransformMode mode,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecTransformDataType type = xmlSecTransformDataTypeUnknown;
xmlSecAssert2(xmlSecTransformIsValid(transform), xmlSecTransformDataTypeUnknown);
@@ -2109,29 +2109,29 @@ xmlSecTransformDefaultGetDataType(xmlSecTransformPtr transform, xmlSecTransformM
/* we'll try to guess the data type based on the handlers we have */
switch(mode) {
- case xmlSecTransformModePush:
- if(transform->id->pushBin != NULL) {
- type |= xmlSecTransformDataTypeBin;
- }
- if(transform->id->pushXml != NULL) {
- type |= xmlSecTransformDataTypeXml;
- }
- break;
- case xmlSecTransformModePop:
- if(transform->id->popBin != NULL) {
- type |= xmlSecTransformDataTypeBin;
- }
- if(transform->id->popXml != NULL) {
- type |= xmlSecTransformDataTypeXml;
- }
- break;
- default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "mode=%d", mode);
- return(xmlSecTransformDataTypeUnknown);
+ case xmlSecTransformModePush:
+ if(transform->id->pushBin != NULL) {
+ type |= xmlSecTransformDataTypeBin;
+ }
+ if(transform->id->pushXml != NULL) {
+ type |= xmlSecTransformDataTypeXml;
+ }
+ break;
+ case xmlSecTransformModePop:
+ if(transform->id->popBin != NULL) {
+ type |= xmlSecTransformDataTypeBin;
+ }
+ if(transform->id->popXml != NULL) {
+ type |= xmlSecTransformDataTypeXml;
+ }
+ break;
+ default:
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "mode=%d", mode);
+ return(xmlSecTransformDataTypeUnknown);
}
return(type);
@@ -2139,12 +2139,12 @@ xmlSecTransformDefaultGetDataType(xmlSecTransformPtr transform, xmlSecTransformM
/**
* xmlSecTransformDefaultPushBin:
- * @transform: the pointer to transform object.
- * @data: the input binary data,
- * @dataSize: the input data size.
- * @final: the flag: if set to 1 then it's the last
- * data chunk.
- * @transformCtx: the pointer to transform context object.
+ * @transform: the pointer to transform object.
+ * @data: the input binary data,
+ * @dataSize: the input data size.
+ * @final: the flag: if set to 1 then it's the last
+ * data chunk.
+ * @transformCtx: the pointer to transform context object.
*
* Process binary @data by calling transform's execute method and pushes
* results to next transform.
@@ -2153,7 +2153,7 @@ xmlSecTransformDefaultGetDataType(xmlSecTransformPtr transform, xmlSecTransformM
*/
int
xmlSecTransformDefaultPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
- xmlSecSize dataSize, int final, xmlSecTransformCtxPtr transformCtx) {
+ xmlSecSize dataSize, int final, xmlSecTransformCtxPtr transformCtx) {
xmlSecSize inSize = 0;
xmlSecSize outSize = 0;
int finalData = 0;
@@ -2164,84 +2164,84 @@ xmlSecTransformDefaultPushBin(xmlSecTransformPtr transform, const xmlSecByte* da
do {
/* append data to input buffer */
- if(dataSize > 0) {
- xmlSecSize chunkSize;
-
- xmlSecAssert2(data != NULL, -1);
-
- chunkSize = dataSize;
- if(chunkSize > XMLSEC_TRANSFORM_BINARY_CHUNK) {
- chunkSize = XMLSEC_TRANSFORM_BINARY_CHUNK;
- }
-
- ret = xmlSecBufferAppend(&(transform->inBuf), data, chunkSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", chunkSize);
- return(-1);
- }
-
- dataSize -= chunkSize;
- data += chunkSize;
- }
-
- /* process data */
- inSize = xmlSecBufferGetSize(&(transform->inBuf));
- outSize = xmlSecBufferGetSize(&(transform->outBuf));
- finalData = (((dataSize == 0) && (final != 0)) ? 1 : 0);
- ret = xmlSecTransformExecute(transform, finalData, transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "final=%d", final);
- return(-1);
- }
-
- /* push data to the next transform */
- inSize = xmlSecBufferGetSize(&(transform->inBuf));
- outSize = xmlSecBufferGetSize(&(transform->outBuf));
- if(inSize > 0) {
- finalData = 0;
- }
-
- /* we don't want to puch too much */
- if(outSize > XMLSEC_TRANSFORM_BINARY_CHUNK) {
- outSize = XMLSEC_TRANSFORM_BINARY_CHUNK;
- finalData = 0;
- }
- if((transform->next != NULL) && ((outSize > 0) || (finalData != 0))) {
- ret = xmlSecTransformPushBin(transform->next,
- xmlSecBufferGetData(&(transform->outBuf)),
- outSize,
- finalData,
- transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform->next)),
- "xmlSecTransformPushBin",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "final=%d;outSize=%d", final, outSize);
- return(-1);
- }
- }
-
- /* remove data anyway */
- if(outSize > 0) {
- ret = xmlSecBufferRemoveHead(&(transform->outBuf), outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize);
- return(-1);
- }
- }
+ if(dataSize > 0) {
+ xmlSecSize chunkSize;
+
+ xmlSecAssert2(data != NULL, -1);
+
+ chunkSize = dataSize;
+ if(chunkSize > XMLSEC_TRANSFORM_BINARY_CHUNK) {
+ chunkSize = XMLSEC_TRANSFORM_BINARY_CHUNK;
+ }
+
+ ret = xmlSecBufferAppend(&(transform->inBuf), data, chunkSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", chunkSize);
+ return(-1);
+ }
+
+ dataSize -= chunkSize;
+ data += chunkSize;
+ }
+
+ /* process data */
+ inSize = xmlSecBufferGetSize(&(transform->inBuf));
+ outSize = xmlSecBufferGetSize(&(transform->outBuf));
+ finalData = (((dataSize == 0) && (final != 0)) ? 1 : 0);
+ ret = xmlSecTransformExecute(transform, finalData, transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecTransformExecute",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "final=%d", final);
+ return(-1);
+ }
+
+ /* push data to the next transform */
+ inSize = xmlSecBufferGetSize(&(transform->inBuf));
+ outSize = xmlSecBufferGetSize(&(transform->outBuf));
+ if(inSize > 0) {
+ finalData = 0;
+ }
+
+ /* we don't want to puch too much */
+ if(outSize > XMLSEC_TRANSFORM_BINARY_CHUNK) {
+ outSize = XMLSEC_TRANSFORM_BINARY_CHUNK;
+ finalData = 0;
+ }
+ if((transform->next != NULL) && ((outSize > 0) || (finalData != 0))) {
+ ret = xmlSecTransformPushBin(transform->next,
+ xmlSecBufferGetData(&(transform->outBuf)),
+ outSize,
+ finalData,
+ transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform->next)),
+ "xmlSecTransformPushBin",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "final=%d;outSize=%d", final, outSize);
+ return(-1);
+ }
+ }
+
+ /* remove data anyway */
+ if(outSize > 0) {
+ ret = xmlSecBufferRemoveHead(&(transform->outBuf), outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize);
+ return(-1);
+ }
+ }
} while((dataSize > 0) || (outSize > 0));
return(0);
@@ -2249,11 +2249,11 @@ xmlSecTransformDefaultPushBin(xmlSecTransformPtr transform, const xmlSecByte* da
/**
* xmlSecTransformDefaultPopBin:
- * @transform: the pointer to transform object.
- * @data: the buffer to store result data.
- * @maxDataSize: the size of the buffer #data.
- * @dataSize: the pointer to returned data size.
- * @transformCtx: the pointer to transform context object.
+ * @transform: the pointer to transform object.
+ * @data: the buffer to store result data.
+ * @maxDataSize: the size of the buffer #data.
+ * @dataSize: the pointer to returned data size.
+ * @transformCtx: the pointer to transform context object.
*
* Pops data from previous transform in the chain, processes data by calling
* transform's execute method and returns result in the @data buffer. The
@@ -2263,7 +2263,7 @@ xmlSecTransformDefaultPushBin(xmlSecTransformPtr transform, const xmlSecByte* da
*/
int
xmlSecTransformDefaultPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
- xmlSecSize maxDataSize, xmlSecSize* dataSize, xmlSecTransformCtxPtr transformCtx) {
+ xmlSecSize maxDataSize, xmlSecSize* dataSize, xmlSecTransformCtxPtr transformCtx) {
xmlSecSize outSize;
int final = 0;
int ret;
@@ -2274,92 +2274,92 @@ xmlSecTransformDefaultPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
xmlSecAssert2(transformCtx != NULL, -1);
while((xmlSecBufferGetSize(&(transform->outBuf)) == 0) && (final == 0)) {
- /* read data from previous transform if exist */
- if(transform->prev != NULL) {
- xmlSecSize inSize, chunkSize;
-
- inSize = xmlSecBufferGetSize(&(transform->inBuf));
- chunkSize = XMLSEC_TRANSFORM_BINARY_CHUNK;
-
- /* ensure that we have space for at least one data chunk */
- ret = xmlSecBufferSetMaxSize(&(transform->inBuf), inSize + chunkSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetMaxSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize + chunkSize);
- return(-1);
- }
-
- /* get data from previous transform */
- ret = xmlSecTransformPopBin(transform->prev,
- xmlSecBufferGetData(&(transform->inBuf)) + inSize,
- chunkSize, &chunkSize, transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform->prev)),
- "xmlSecTransformPopBin",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- /* adjust our size if needed */
- if(chunkSize > 0) {
- ret = xmlSecBufferSetSize(&(transform->inBuf), inSize + chunkSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize + chunkSize);
- return(-1);
- }
- final = 0; /* the previous transform returned some data..*/
- } else {
- final = 1; /* no data returned from previous transform, we are done */
- }
- } else {
- final = 1; /* no previous transform, we are "permanently final" */
- }
-
- /* execute our transform */
- ret = xmlSecTransformExecute(transform, final, transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ /* read data from previous transform if exist */
+ if(transform->prev != NULL) {
+ xmlSecSize inSize, chunkSize;
+
+ inSize = xmlSecBufferGetSize(&(transform->inBuf));
+ chunkSize = XMLSEC_TRANSFORM_BINARY_CHUNK;
+
+ /* ensure that we have space for at least one data chunk */
+ ret = xmlSecBufferSetMaxSize(&(transform->inBuf), inSize + chunkSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetMaxSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize + chunkSize);
+ return(-1);
+ }
+
+ /* get data from previous transform */
+ ret = xmlSecTransformPopBin(transform->prev,
+ xmlSecBufferGetData(&(transform->inBuf)) + inSize,
+ chunkSize, &chunkSize, transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform->prev)),
+ "xmlSecTransformPopBin",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ /* adjust our size if needed */
+ if(chunkSize > 0) {
+ ret = xmlSecBufferSetSize(&(transform->inBuf), inSize + chunkSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize + chunkSize);
+ return(-1);
+ }
+ final = 0; /* the previous transform returned some data..*/
+ } else {
+ final = 1; /* no data returned from previous transform, we are done */
+ }
+ } else {
+ final = 1; /* no previous transform, we are "permanently final" */
+ }
+
+ /* execute our transform */
+ ret = xmlSecTransformExecute(transform, final, transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecTransformExecute",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
/* copy result (if any) */
outSize = xmlSecBufferGetSize(&(transform->outBuf));
if(outSize > maxDataSize) {
- outSize = maxDataSize;
+ outSize = maxDataSize;
}
/* we don't want to put too much */
if(outSize > XMLSEC_TRANSFORM_BINARY_CHUNK) {
- outSize = XMLSEC_TRANSFORM_BINARY_CHUNK;
+ outSize = XMLSEC_TRANSFORM_BINARY_CHUNK;
}
if(outSize > 0) {
- xmlSecAssert2(xmlSecBufferGetData(&(transform->outBuf)), -1);
-
- memcpy(data, xmlSecBufferGetData(&(transform->outBuf)), outSize);
+ xmlSecAssert2(xmlSecBufferGetData(&(transform->outBuf)), -1);
+
+ memcpy(data, xmlSecBufferGetData(&(transform->outBuf)), outSize);
- ret = xmlSecBufferRemoveHead(&(transform->outBuf), outSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", outSize);
- return(-1);
- }
+ ret = xmlSecBufferRemoveHead(&(transform->outBuf), outSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", outSize);
+ return(-1);
+ }
}
/* set the result size */
@@ -2369,9 +2369,9 @@ xmlSecTransformDefaultPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
/**
* xmlSecTransformDefaultPushXml:
- * @transform: the pointer to transform object.
- * @nodes: the input nodes.
- * @transformCtx: the pointer to transform context object.
+ * @transform: the pointer to transform object.
+ * @nodes: the input nodes.
+ * @transformCtx: the pointer to transform context object.
*
* Processes @nodes by calling transform's execute method and pushes
* result to the next transform in the chain.
@@ -2380,7 +2380,7 @@ xmlSecTransformDefaultPopBin(xmlSecTransformPtr transform, xmlSecByte* data,
*/
int
xmlSecTransformDefaultPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nodes,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecTransformCtxPtr transformCtx) {
int ret;
xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
@@ -2392,34 +2392,34 @@ xmlSecTransformDefaultPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nod
transform->inNodes = nodes;
ret = xmlSecTransformExecute(transform, 1, transformCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecTransformExecute",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* push result to the next transform (if exist) */
if(transform->next != NULL) {
- ret = xmlSecTransformPushXml(transform->next, transform->outNodes, transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformPushXml",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ret = xmlSecTransformPushXml(transform->next, transform->outNodes, transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecTransformPushXml",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
return(0);
}
/**
* xmlSecTransformDefaultPopXml:
- * @transform: the pointer to transform object.
- * @nodes: the pointer to store popinter to result nodes.
- * @transformCtx: the pointer to transform context object.
+ * @transform: the pointer to transform object.
+ * @nodes: the pointer to store popinter to result nodes.
+ * @transformCtx: the pointer to transform context object.
*
* Pops data from previous transform in the chain, processes the data
* by calling transform's execute method and returns result in @nodes.
@@ -2428,7 +2428,7 @@ xmlSecTransformDefaultPushXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr nod
*/
int
xmlSecTransformDefaultPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nodes,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecTransformCtxPtr transformCtx) {
int ret;
xmlSecAssert2(xmlSecTransformIsValid(transform), -1);
@@ -2438,31 +2438,31 @@ xmlSecTransformDefaultPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nod
/* pop result from the prev transform (if exist) */
if(transform->prev != NULL) {
- ret = xmlSecTransformPopXml(transform->prev, &(transform->inNodes), transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformPopXml",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ret = xmlSecTransformPopXml(transform->prev, &(transform->inNodes), transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecTransformPopXml",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
/* execute our transform */
ret = xmlSecTransformExecute(transform, 1, transformCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecTransformExecute",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* return result if requested */
if(nodes != NULL) {
- (*nodes) = transform->outNodes;
+ (*nodes) = transform->outNodes;
}
return(0);
@@ -2475,10 +2475,10 @@ xmlSecTransformDefaultPopXml(xmlSecTransformPtr transform, xmlSecNodeSetPtr* nod
**********************************************************************/
static xmlSecPtrListKlass xmlSecTransformIdListKlass = {
BAD_CAST "transform-ids-list",
- NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
- NULL, /* xmlSecPtrDestroyItemMethod destroyItem; */
- NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
- NULL, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
+ NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
+ NULL, /* xmlSecPtrDestroyItemMethod destroyItem; */
+ NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
+ NULL, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
};
/**
@@ -2495,8 +2495,8 @@ xmlSecTransformIdListGetKlass(void) {
/**
* xmlSecTransformIdListFind:
- * @list: the pointer to transform ids list.
- * @transformId: the transform klass.
+ * @list: the pointer to transform ids list.
+ * @transformId: the transform klass.
*
* Lookups @dataId in @list.
*
@@ -2512,26 +2512,26 @@ xmlSecTransformIdListFind(xmlSecPtrListPtr list, xmlSecTransformId transformId)
size = xmlSecPtrListGetSize(list);
for(i = 0; i < size; ++i) {
- if((xmlSecTransformId)xmlSecPtrListGetItem(list, i) == transformId) {
- return(1);
- }
+ if((xmlSecTransformId)xmlSecPtrListGetItem(list, i) == transformId) {
+ return(1);
+ }
}
return(0);
}
/**
* xmlSecTransformIdListFindByHref:
- * @list: the pointer to transform ids list.
- * @href: the desired transform klass href.
- * @usage: the desired transform usage.
+ * @list: the pointer to transform ids list.
+ * @href: the desired transform klass href.
+ * @usage: the desired transform usage.
*
* Lookups data klass in the list with given @href and @usage in @list.
*
* Returns: transform klass is found and NULL otherwise.
*/
-xmlSecTransformId
+xmlSecTransformId
xmlSecTransformIdListFindByHref(xmlSecPtrListPtr list, const xmlChar* href,
- xmlSecTransformUsage usage) {
+ xmlSecTransformUsage usage) {
xmlSecTransformId transformId;
xmlSecSize i, size;
@@ -2540,30 +2540,30 @@ xmlSecTransformIdListFindByHref(xmlSecPtrListPtr list, const xmlChar* href,
size = xmlSecPtrListGetSize(list);
for(i = 0; i < size; ++i) {
- transformId = (xmlSecTransformId)xmlSecPtrListGetItem(list, i);
- xmlSecAssert2(transformId != xmlSecTransformIdUnknown, xmlSecTransformIdUnknown);
+ transformId = (xmlSecTransformId)xmlSecPtrListGetItem(list, i);
+ xmlSecAssert2(transformId != xmlSecTransformIdUnknown, xmlSecTransformIdUnknown);
- if(((usage & transformId->usage) != 0) && (transformId->href != NULL) &&
- xmlStrEqual(href, transformId->href)) {
- return(transformId);
- }
+ if(((usage & transformId->usage) != 0) && (transformId->href != NULL) &&
+ xmlStrEqual(href, transformId->href)) {
+ return(transformId);
+ }
}
return(xmlSecTransformIdUnknown);
}
/**
* xmlSecTransformIdListFindByName:
- * @list: the pointer to transform ids list.
- * @name: the desired transform klass name.
- * @usage: the desired transform usage.
+ * @list: the pointer to transform ids list.
+ * @name: the desired transform klass name.
+ * @usage: the desired transform usage.
*
* Lookups data klass in the list with given @name and @usage in @list.
*
* Returns: transform klass is found and NULL otherwise.
*/
-xmlSecTransformId
+xmlSecTransformId
xmlSecTransformIdListFindByName(xmlSecPtrListPtr list, const xmlChar* name,
- xmlSecTransformUsage usage) {
+ xmlSecTransformUsage usage) {
xmlSecTransformId transformId;
xmlSecSize i, size;
@@ -2572,22 +2572,22 @@ xmlSecTransformIdListFindByName(xmlSecPtrListPtr list, const xmlChar* name,
size = xmlSecPtrListGetSize(list);
for(i = 0; i < size; ++i) {
- transformId = (xmlSecTransformId)xmlSecPtrListGetItem(list, i);
- xmlSecAssert2(transformId != xmlSecTransformIdUnknown, xmlSecTransformIdUnknown);
+ transformId = (xmlSecTransformId)xmlSecPtrListGetItem(list, i);
+ xmlSecAssert2(transformId != xmlSecTransformIdUnknown, xmlSecTransformIdUnknown);
- if(((usage & transformId->usage) != 0) && (transformId->name != NULL) &&
- xmlStrEqual(name, BAD_CAST transformId->name)) {
-
- return(transformId);
- }
+ if(((usage & transformId->usage) != 0) && (transformId->name != NULL) &&
+ xmlStrEqual(name, BAD_CAST transformId->name)) {
+
+ return(transformId);
+ }
}
return(xmlSecTransformIdUnknown);
}
/**
* xmlSecTransformIdListDebugDump:
- * @list: the pointer to transform ids list.
- * @output: the pointer to output FILE.
+ * @list: the pointer to transform ids list.
+ * @output: the pointer to output FILE.
*
* Prints binary transform debug information to @output.
*/
@@ -2601,23 +2601,23 @@ xmlSecTransformIdListDebugDump(xmlSecPtrListPtr list, FILE* output) {
size = xmlSecPtrListGetSize(list);
for(i = 0; i < size; ++i) {
- transformId = (xmlSecTransformId)xmlSecPtrListGetItem(list, i);
- xmlSecAssert(transformId != NULL);
- xmlSecAssert(transformId->name != NULL);
-
- if(i > 0) {
- fprintf(output, ",\"%s\"", transformId->name);
- } else {
- fprintf(output, "\"%s\"", transformId->name);
- }
+ transformId = (xmlSecTransformId)xmlSecPtrListGetItem(list, i);
+ xmlSecAssert(transformId != NULL);
+ xmlSecAssert(transformId->name != NULL);
+
+ if(i > 0) {
+ fprintf(output, ",\"%s\"", transformId->name);
+ } else {
+ fprintf(output, "\"%s\"", transformId->name);
+ }
}
fprintf(output, "\n");
}
/**
* xmlSecTransformIdListDebugXmlDump:
- * @list: the pointer to transform ids list.
- * @output: the pointer to output FILE.
+ * @list: the pointer to transform ids list.
+ * @output: the pointer to output FILE.
*
* Prints binary transform debug information to @output in XML format.
*/
@@ -2632,11 +2632,11 @@ xmlSecTransformIdListDebugXmlDump(xmlSecPtrListPtr list, FILE* output) {
fprintf(output, "<TransformIdsList>\n");
size = xmlSecPtrListGetSize(list);
for(i = 0; i < size; ++i) {
- transformId = (xmlSecTransformId)xmlSecPtrListGetItem(list, i);
- xmlSecAssert(transformId != NULL);
- xmlSecAssert(transformId->name != NULL);
-
- fprintf(output, "<TransformId name=\"");
+ transformId = (xmlSecTransformId)xmlSecPtrListGetItem(list, i);
+ xmlSecAssert(transformId != NULL);
+ xmlSecAssert(transformId->name != NULL);
+
+ fprintf(output, "<TransformId name=\"");
xmlSecPrintXmlString(output, transformId->name);
fprintf(output, "\" />");
}
@@ -2648,36 +2648,36 @@ xmlSecTransformIdListDebugXmlDump(xmlSecPtrListPtr list, FILE* output) {
* IO buffers for transforms
*
************************************************************************/
-typedef struct _xmlSecTransformIOBuffer xmlSecTransformIOBuffer,
- *xmlSecTransformIOBufferPtr;
+typedef struct _xmlSecTransformIOBuffer xmlSecTransformIOBuffer,
+ *xmlSecTransformIOBufferPtr;
typedef enum {
xmlSecTransformIOBufferModeRead,
xmlSecTransformIOBufferModeWrite
} xmlSecTransformIOBufferMode;
struct _xmlSecTransformIOBuffer {
- xmlSecTransformIOBufferMode mode;
- xmlSecTransformPtr transform;
- xmlSecTransformCtxPtr transformCtx;
+ xmlSecTransformIOBufferMode mode;
+ xmlSecTransformPtr transform;
+ xmlSecTransformCtxPtr transformCtx;
};
-static xmlSecTransformIOBufferPtr xmlSecTransformIOBufferCreate (xmlSecTransformIOBufferMode mode,
- xmlSecTransformPtr transform,
- xmlSecTransformCtxPtr transformCtx);
-static void xmlSecTransformIOBufferDestroy (xmlSecTransformIOBufferPtr buffer);
-static int xmlSecTransformIOBufferRead (xmlSecTransformIOBufferPtr buffer,
- xmlSecByte *buf,
- xmlSecSize size);
-static int xmlSecTransformIOBufferWrite (xmlSecTransformIOBufferPtr buffer,
- const xmlSecByte *buf,
- xmlSecSize size);
-static int xmlSecTransformIOBufferClose (xmlSecTransformIOBufferPtr buffer);
+static xmlSecTransformIOBufferPtr xmlSecTransformIOBufferCreate (xmlSecTransformIOBufferMode mode,
+ xmlSecTransformPtr transform,
+ xmlSecTransformCtxPtr transformCtx);
+static void xmlSecTransformIOBufferDestroy (xmlSecTransformIOBufferPtr buffer);
+static int xmlSecTransformIOBufferRead (xmlSecTransformIOBufferPtr buffer,
+ xmlSecByte *buf,
+ xmlSecSize size);
+static int xmlSecTransformIOBufferWrite (xmlSecTransformIOBufferPtr buffer,
+ const xmlSecByte *buf,
+ xmlSecSize size);
+static int xmlSecTransformIOBufferClose (xmlSecTransformIOBufferPtr buffer);
/**
* xmlSecTransformCreateOutputBuffer:
- * @transform: the pointer to transform.
- * @transformCtx: the pointer to transform context object.
+ * @transform: the pointer to transform.
+ * @transformCtx: the pointer to transform context object.
*
* Creates output buffer to write data to @transform.
*
@@ -2695,36 +2695,36 @@ xmlSecTransformCreateOutputBuffer(xmlSecTransformPtr transform, xmlSecTransformC
/* check that we have binary push method for this transform */
type = xmlSecTransformDefaultGetDataType(transform, xmlSecTransformModePush, transformCtx);
if((type & xmlSecTransformDataTypeBin) == 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- "push binary data not supported");
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ "push binary data not supported");
+ return(NULL);
}
buffer = xmlSecTransformIOBufferCreate(xmlSecTransformIOBufferModeWrite, transform, transformCtx);
if(buffer == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformIOBufferCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecTransformIOBufferCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
output = xmlOutputBufferCreateIO((xmlOutputWriteCallback)xmlSecTransformIOBufferWrite,
- (xmlOutputCloseCallback)xmlSecTransformIOBufferClose,
- buffer,
- NULL);
+ (xmlOutputCloseCallback)xmlSecTransformIOBufferClose,
+ buffer,
+ NULL);
if(output == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlOutputBufferCreateIO",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecTransformIOBufferDestroy(buffer);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlOutputBufferCreateIO",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecTransformIOBufferDestroy(buffer);
+ return(NULL);
}
return(output);
@@ -2732,8 +2732,8 @@ xmlSecTransformCreateOutputBuffer(xmlSecTransformPtr transform, xmlSecTransformC
/**
* xmlSecTransformCreateInputBuffer:
- * @transform: the pointer to transform.
- * @transformCtx: the pointer to transform context object.
+ * @transform: the pointer to transform.
+ * @transformCtx: the pointer to transform context object.
*
* Creates input buffer to read data from @transform.
*
@@ -2751,36 +2751,36 @@ xmlSecTransformCreateInputBuffer(xmlSecTransformPtr transform, xmlSecTransformCt
/* check that we have binary pop method for this transform */
type = xmlSecTransformDefaultGetDataType(transform, xmlSecTransformModePop, transformCtx);
if((type & xmlSecTransformDataTypeBin) == 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_TRANSFORM,
- "pop binary data not supported");
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TRANSFORM,
+ "pop binary data not supported");
+ return(NULL);
}
buffer = xmlSecTransformIOBufferCreate(xmlSecTransformIOBufferModeRead, transform, transformCtx);
if(buffer == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformIOBufferCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecTransformIOBufferCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
input = xmlParserInputBufferCreateIO((xmlInputReadCallback)xmlSecTransformIOBufferRead,
- (xmlInputCloseCallback)xmlSecTransformIOBufferClose,
- buffer,
- XML_CHAR_ENCODING_NONE);
+ (xmlInputCloseCallback)xmlSecTransformIOBufferClose,
+ buffer,
+ XML_CHAR_ENCODING_NONE);
if(input == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlParserInputBufferCreateIO",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecTransformIOBufferDestroy(buffer);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlParserInputBufferCreateIO",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecTransformIOBufferDestroy(buffer);
+ return(NULL);
}
return(input);
@@ -2788,7 +2788,7 @@ xmlSecTransformCreateInputBuffer(xmlSecTransformPtr transform, xmlSecTransformCt
static xmlSecTransformIOBufferPtr
xmlSecTransformIOBufferCreate(xmlSecTransformIOBufferMode mode, xmlSecTransformPtr transform,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecTransformIOBufferPtr buffer;
xmlSecAssert2(xmlSecTransformIsValid(transform), NULL);
@@ -2796,12 +2796,12 @@ xmlSecTransformIOBufferCreate(xmlSecTransformIOBufferMode mode, xmlSecTransformP
buffer = (xmlSecTransformIOBufferPtr)xmlMalloc(sizeof(xmlSecTransformIOBuffer));
if(buffer == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "size=%d", sizeof(xmlSecTransformIOBuffer));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "size=%d", sizeof(xmlSecTransformIOBuffer));
+ return(NULL);
}
memset(buffer, 0, sizeof(xmlSecTransformIOBuffer));
@@ -2822,7 +2822,7 @@ xmlSecTransformIOBufferDestroy(xmlSecTransformIOBufferPtr buffer) {
static int
xmlSecTransformIOBufferRead(xmlSecTransformIOBufferPtr buffer,
- xmlSecByte *buf, xmlSecSize size) {
+ xmlSecByte *buf, xmlSecSize size) {
int ret;
xmlSecAssert2(buffer != NULL, -1);
@@ -2833,19 +2833,19 @@ xmlSecTransformIOBufferRead(xmlSecTransformIOBufferPtr buffer,
ret = xmlSecTransformPopBin(buffer->transform, buf, size, &size, buffer->transformCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(buffer->transform)),
- "xmlSecTransformPopBin",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(buffer->transform)),
+ "xmlSecTransformPopBin",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(size);
}
static int
xmlSecTransformIOBufferWrite(xmlSecTransformIOBufferPtr buffer,
- const xmlSecByte *buf, xmlSecSize size) {
+ const xmlSecByte *buf, xmlSecSize size) {
int ret;
xmlSecAssert2(buffer != NULL, -1);
@@ -2856,12 +2856,12 @@ xmlSecTransformIOBufferWrite(xmlSecTransformIOBufferPtr buffer,
ret = xmlSecTransformPushBin(buffer->transform, buf, size, 0, buffer->transformCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(buffer->transform)),
- "xmlSecTransformPushBin",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(buffer->transform)),
+ "xmlSecTransformPushBin",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(size);
}
@@ -2877,14 +2877,14 @@ xmlSecTransformIOBufferClose(xmlSecTransformIOBufferPtr buffer) {
/* need to flush write buffer before destroing */
if(buffer->mode == xmlSecTransformIOBufferModeWrite) {
ret = xmlSecTransformPushBin(buffer->transform, NULL, 0, 1, buffer->transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(buffer->transform)),
- "xmlSecTransformPushBin",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(buffer->transform)),
+ "xmlSecTransformPushBin",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
xmlSecTransformIOBufferDestroy(buffer);
diff --git a/src/x509.c b/src/x509.c
index 22f5a19..679c35e 100644
--- a/src/x509.c
+++ b/src/x509.c
@@ -29,9 +29,9 @@
/**
* xmlSecX509DataGetNodeContent:
- * @node: the pointer to <dsig:X509Data/> node.
- * @deleteChildren: the flag that indicates whether to remove node children after reading.
- * @keyInfoCtx: the pointer to <dsig:KeyInfo/> node processing context.
+ * @node: the pointer to <dsig:X509Data/> node.
+ * @deleteChildren: the flag that indicates whether to remove node children after reading.
+ * @keyInfoCtx: the pointer to <dsig:KeyInfo/> node processing context.
*
* Reads the contents of <dsig:X509Data/> node and returns it as
* a bits mask.
@@ -41,7 +41,7 @@
*/
int
xmlSecX509DataGetNodeContent (xmlNodePtr node, int deleteChildren,
- xmlSecKeyInfoCtxPtr keyInfoCtx) {
+ xmlSecKeyInfoCtxPtr keyInfoCtx) {
xmlNodePtr cur, next;
int deleteCurNode;
int content = 0;
@@ -52,42 +52,42 @@ xmlSecX509DataGetNodeContent (xmlNodePtr node, int deleteChildren,
/* determine the current node content */
cur = xmlSecGetNextElementNode(node->children);
while(cur != NULL) {
- deleteCurNode = 0;
- if(xmlSecCheckNodeName(cur, xmlSecNodeX509Certificate, xmlSecDSigNs)) {
- if(xmlSecIsEmptyNode(cur) == 1) {
- content |= XMLSEC_X509DATA_CERTIFICATE_NODE;
- deleteCurNode = 1;
- }
- } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509SubjectName, xmlSecDSigNs)) {
- if(xmlSecIsEmptyNode(cur) == 1) {
- content |= XMLSEC_X509DATA_SUBJECTNAME_NODE;
- deleteCurNode = 1;
- }
- } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509IssuerSerial, xmlSecDSigNs)) {
- if(xmlSecIsEmptyNode(cur) == 1) {
- content |= XMLSEC_X509DATA_ISSUERSERIAL_NODE;
- deleteCurNode = 1;
- }
- } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509SKI, xmlSecDSigNs)) {
- if(xmlSecIsEmptyNode(cur) == 1) {
- content |= XMLSEC_X509DATA_SKI_NODE;
- deleteCurNode = 1;
- }
- } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509CRL, xmlSecDSigNs)) {
- if(xmlSecIsEmptyNode(cur) == 1) {
- content |= XMLSEC_X509DATA_CRL_NODE;
- deleteCurNode = 1;
- }
- } else {
- /* todo: fail on unknown child node? */
- }
- next = xmlSecGetNextElementNode(cur->next);
- if((deleteCurNode != 0) && (deleteChildren != 0)) {
- /* remove "template" nodes */
- xmlUnlinkNode(cur);
- xmlFreeNode(cur);
- }
- cur = next;
+ deleteCurNode = 0;
+ if(xmlSecCheckNodeName(cur, xmlSecNodeX509Certificate, xmlSecDSigNs)) {
+ if(xmlSecIsEmptyNode(cur) == 1) {
+ content |= XMLSEC_X509DATA_CERTIFICATE_NODE;
+ deleteCurNode = 1;
+ }
+ } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509SubjectName, xmlSecDSigNs)) {
+ if(xmlSecIsEmptyNode(cur) == 1) {
+ content |= XMLSEC_X509DATA_SUBJECTNAME_NODE;
+ deleteCurNode = 1;
+ }
+ } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509IssuerSerial, xmlSecDSigNs)) {
+ if(xmlSecIsEmptyNode(cur) == 1) {
+ content |= XMLSEC_X509DATA_ISSUERSERIAL_NODE;
+ deleteCurNode = 1;
+ }
+ } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509SKI, xmlSecDSigNs)) {
+ if(xmlSecIsEmptyNode(cur) == 1) {
+ content |= XMLSEC_X509DATA_SKI_NODE;
+ deleteCurNode = 1;
+ }
+ } else if(xmlSecCheckNodeName(cur, xmlSecNodeX509CRL, xmlSecDSigNs)) {
+ if(xmlSecIsEmptyNode(cur) == 1) {
+ content |= XMLSEC_X509DATA_CRL_NODE;
+ deleteCurNode = 1;
+ }
+ } else {
+ /* todo: fail on unknown child node? */
+ }
+ next = xmlSecGetNextElementNode(cur->next);
+ if((deleteCurNode != 0) && (deleteChildren != 0)) {
+ /* remove "template" nodes */
+ xmlUnlinkNode(cur);
+ xmlFreeNode(cur);
+ }
+ cur = next;
}
return (content);
diff --git a/src/xkms.c b/src/xkms.c
index 7b47530..ed0adc6 100644
--- a/src/xkms.c
+++ b/src/xkms.c
@@ -33,65 +33,65 @@
#include <xmlsec/private/xkms.h>
#include <xmlsec/errors.h>
-#define XMLSEC_XKMS_ID_ATTRIBUTE_LEN 32
+#define XMLSEC_XKMS_ID_ATTRIBUTE_LEN 32
/* The ID attribute in XKMS is 'Id' */
static const xmlChar* xmlSecXkmsServerIds[] = { BAD_CAST "Id", NULL };
#ifndef XMLSEC_NO_SOAP
-static int xmlSecXkmsServerCtxWriteSoap11FatalError (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr envNode);
-static int xmlSecXkmsServerCtxWriteSoap12FatalError (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr envNode);
+static int xmlSecXkmsServerCtxWriteSoap11FatalError (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr envNode);
+static int xmlSecXkmsServerCtxWriteSoap12FatalError (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr envNode);
#endif /* XMLSEC_NO_SOAP */
-static int xmlSecXkmsServerCtxRequestAbstractTypeNodeRead (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr* node);
-static int xmlSecXkmsServerCtxSignatureNodeRead (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-static int xmlSecXkmsServerCtxMessageExtensionNodesRead (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr* node);
-static int xmlSecXkmsServerCtxOpaqueClientDataNodeRead (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-static int xmlSecXkmsServerCtxPendingNotificationNodeRead (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-static int xmlSecXkmsServerCtxRespondWithNodesRead (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr* node);
-static int xmlSecXkmsServerCtxPendingRequestNodeRead (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr* node);
-static int xmlSecXkmsServerCtxQueryKeyBindingNodeRead (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-static int xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr* node);
-static int xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node,
- xmlSecKeyPtr key);
-static int xmlSecXkmsServerCtxKeyInfoNodeWrite (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node,
- xmlSecKeyPtr key);
-static int xmlSecXkmsServerCtxUseKeyWithNodesRead (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr* node);
-static int xmlSecXkmsServerCtxUseKeyWithNodesWrite (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node,
- xmlSecKeyPtr key);
-static int xmlSecXkmsServerCtxTimeInstantNodeRead (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-static int xmlSecXkmsServerCtxResultTypeNodeWrite (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-static int xmlSecXkmsServerCtxRequestSignatureValueNodeWrite(xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-static int xmlSecXkmsServerCtxUnverifiedKeyBindingNodeWrite(xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node,
- xmlSecKeyPtr key);
-static int xmlSecXkmsServerCtxKeyBindingNodeWrite (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node,
- xmlSecKeyPtr key);
-static int xmlSecXkmsServerCtxValidityIntervalNodeWrite (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node,
- xmlSecKeyPtr key);
-static int xmlSecXkmsServerCtxKeyBindingStatusNodeWrite (xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node,
- xmlSecKeyPtr key);
+static int xmlSecXkmsServerCtxRequestAbstractTypeNodeRead (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr* node);
+static int xmlSecXkmsServerCtxSignatureNodeRead (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+static int xmlSecXkmsServerCtxMessageExtensionNodesRead (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr* node);
+static int xmlSecXkmsServerCtxOpaqueClientDataNodeRead (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+static int xmlSecXkmsServerCtxPendingNotificationNodeRead (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+static int xmlSecXkmsServerCtxRespondWithNodesRead (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr* node);
+static int xmlSecXkmsServerCtxPendingRequestNodeRead (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr* node);
+static int xmlSecXkmsServerCtxQueryKeyBindingNodeRead (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+static int xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr* node);
+static int xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node,
+ xmlSecKeyPtr key);
+static int xmlSecXkmsServerCtxKeyInfoNodeWrite (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node,
+ xmlSecKeyPtr key);
+static int xmlSecXkmsServerCtxUseKeyWithNodesRead (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr* node);
+static int xmlSecXkmsServerCtxUseKeyWithNodesWrite (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node,
+ xmlSecKeyPtr key);
+static int xmlSecXkmsServerCtxTimeInstantNodeRead (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+static int xmlSecXkmsServerCtxResultTypeNodeWrite (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+static int xmlSecXkmsServerCtxRequestSignatureValueNodeWrite(xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+static int xmlSecXkmsServerCtxUnverifiedKeyBindingNodeWrite(xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node,
+ xmlSecKeyPtr key);
+static int xmlSecXkmsServerCtxKeyBindingNodeWrite (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node,
+ xmlSecKeyPtr key);
+static int xmlSecXkmsServerCtxValidityIntervalNodeWrite (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node,
+ xmlSecKeyPtr key);
+static int xmlSecXkmsServerCtxKeyBindingStatusNodeWrite (xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node,
+ xmlSecKeyPtr key);
static const xmlSecQName2IntegerInfo gXmlSecXkmsResultMajorInfo[] =
@@ -108,7 +108,7 @@ static const xmlSecQName2IntegerInfo gXmlSecXkmsResultMajorInfo[] =
xmlSecXkmsResultMajorRepresent },
{ xmlSecXkmsNs, xmlSecResultMajorCodePending,
xmlSecXkmsResultMajorPending, },
- { NULL , NULL, 0 } /* MUST be last in the list */
+ { NULL , NULL, 0 } /* MUST be last in the list */
};
static const xmlSecQName2IntegerInfo gXmlSecXkmsMinorErrorInfo[] =
@@ -131,7 +131,7 @@ static const xmlSecQName2IntegerInfo gXmlSecXkmsMinorErrorInfo[] =
xmlSecXkmsResultMinorUnknownResponseId },
{ xmlSecXkmsNs, xmlSecResultMinorCodeNotSynchronous,
xmlSecXkmsResultMinorSynchronous },
- { NULL, NULL, 0 } /* MUST be last in the list */
+ { NULL, NULL, 0 } /* MUST be last in the list */
};
static const xmlSecQName2IntegerInfo gXmlSecXkmsKeyBindingStatusInfo[] =
@@ -142,7 +142,7 @@ static const xmlSecQName2IntegerInfo gXmlSecXkmsKeyBindingStatusInfo[] =
xmlSecXkmsKeyBindingStatusInvalid },
{ xmlSecXkmsNs, xmlSecKeyBindingStatusIndeterminate,
xmlSecXkmsKeyBindingStatusIndeterminate },
- { NULL, NULL, 0 } /* MUST be last in the list */
+ { NULL, NULL, 0 } /* MUST be last in the list */
};
static const xmlSecQName2BitMaskInfo gXmlSecXkmsKeyUsageInfo[] =
@@ -153,7 +153,7 @@ static const xmlSecQName2BitMaskInfo gXmlSecXkmsKeyUsageInfo[] =
xmlSecKeyUsageSign | xmlSecKeyUsageVerify },
{ xmlSecXkmsNs, xmlSecKeyUsageExchange,
xmlSecKeyUsageKeyExchange},
- { NULL, NULL, 0 } /* MUST be last in the list */
+ { NULL, NULL, 0 } /* MUST be last in the list */
};
static const xmlSecQName2BitMaskInfo gXmlSecXkmsKeyBindingReasonInfo[] =
@@ -166,7 +166,7 @@ static const xmlSecQName2BitMaskInfo gXmlSecXkmsKeyBindingReasonInfo[] =
XMLSEC_XKMS_KEY_BINDING_REASON_MASK_VALIDITY_INTERVAL },
{ xmlSecXkmsNs, xmlSecKeyBindingReasonSignature,
XMLSEC_XKMS_KEY_BINDING_REASON_MASK_SIGNATURE },
- { NULL, NULL, 0 } /* MUST be last in the list */
+ { NULL, NULL, 0 } /* MUST be last in the list */
};
static const xmlSecQName2BitMaskInfo gXmlSecXkmsResponseMechanismInfo[] =
@@ -177,7 +177,7 @@ static const xmlSecQName2BitMaskInfo gXmlSecXkmsResponseMechanismInfo[] =
XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_PENDING },
{ xmlSecXkmsNs, xmlSecResponseMechanismRequestSignatureValue,
XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REQUEST_SIGNATURE_VALUE },
- { NULL, NULL, 0 } /* MUST be last in the list */
+ { NULL, NULL, 0 } /* MUST be last in the list */
};
static const xmlSecQName2IntegerInfo gXmlSecXkmsFormatInfo[] =
@@ -190,7 +190,7 @@ static const xmlSecQName2IntegerInfo gXmlSecXkmsFormatInfo[] =
{ NULL, xmlSecXkmsFormatStrSoap12,
xmlSecXkmsServerFormatSoap12 },
#endif /* XMLSEC_NO_SOAP */
- { NULL, NULL, 0 } /* MUST be last in the list */
+ { NULL, NULL, 0 } /* MUST be last in the list */
};
/**
@@ -211,12 +211,12 @@ xmlSecXkmsServerFormatFromString(const xmlChar* str) {
ret = xmlSecQName2IntegerGetInteger(gXmlSecXkmsFormatInfo, NULL, str, &res);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecQName2IntegerGetInteger",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(xmlSecXkmsServerFormatUnknown);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecQName2IntegerGetInteger",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(xmlSecXkmsServerFormatUnknown);
}
return((xmlSecXkmsServerFormat)res);
@@ -238,11 +238,11 @@ xmlSecXkmsServerFormatToString (xmlSecXkmsServerFormat format) {
info = xmlSecQName2IntegerGetInfo(gXmlSecXkmsFormatInfo, format);
if(info == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecQName2IntegerGetInfo",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecQName2IntegerGetInfo",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(NULL);
}
return(info->qnameLocalPart);
@@ -250,7 +250,7 @@ xmlSecXkmsServerFormatToString (xmlSecXkmsServerFormat format) {
/**
* xmlSecXkmsServerCtxCreate:
- * @keysMngr: the pointer to keys manager.
+ * @keysMngr: the pointer to keys manager.
*
* Creates XKMS request server side processing context.
* The caller is responsible for destroying returend object by calling
@@ -259,38 +259,38 @@ xmlSecXkmsServerFormatToString (xmlSecXkmsServerFormat format) {
* Returns: pointer to newly allocated context object or NULL if an error
* occurs.
*/
-xmlSecXkmsServerCtxPtr
+xmlSecXkmsServerCtxPtr
xmlSecXkmsServerCtxCreate(xmlSecKeysMngrPtr keysMngr) {
xmlSecXkmsServerCtxPtr ctx;
int ret;
ctx = (xmlSecXkmsServerCtxPtr) xmlMalloc(sizeof(xmlSecXkmsServerCtx));
if(ctx == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "sizeof(xmlSecXkmsServerCtx)=%d",
- sizeof(xmlSecXkmsServerCtx));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "sizeof(xmlSecXkmsServerCtx)=%d",
+ sizeof(xmlSecXkmsServerCtx));
+ return(NULL);
}
ret = xmlSecXkmsServerCtxInitialize(ctx, keysMngr);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxDestroy(ctx);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxDestroy(ctx);
+ return(NULL);
}
return(ctx);
}
/**
* xmlSecXkmsServerCtxDestroy:
- * @ctx: the pointer to XKMS processing context.
+ * @ctx: the pointer to XKMS processing context.
*
* Destroy context object created with #xmlSecXkmsServerCtxCreate function.
*/
@@ -304,8 +304,8 @@ xmlSecXkmsServerCtxDestroy(xmlSecXkmsServerCtxPtr ctx) {
/**
* xmlSecXkmsServerCtxInitialize:
- * @ctx: the pointer to XKMS processing context.
- * @keysMngr: the pointer to keys manager.
+ * @ctx: the pointer to XKMS processing context.
+ * @keysMngr: the pointer to keys manager.
*
* Initializes XKMS element processing context.
* The caller is responsible for cleaing up returend object by calling
@@ -321,54 +321,54 @@ xmlSecXkmsServerCtxInitialize(xmlSecXkmsServerCtxPtr ctx, xmlSecKeysMngrPtr keys
memset(ctx, 0, sizeof(xmlSecXkmsServerCtx));
- ctx->resultMajor = xmlSecXkmsResultMajorSuccess;
- ctx->resultMinor = xmlSecXkmsResultMinorNone;
+ ctx->resultMajor = xmlSecXkmsResultMajorSuccess;
+ ctx->resultMinor = xmlSecXkmsResultMinorNone;
ctx->responseLimit = XMLSEC_XKMS_NO_RESPONSE_LIMIT;
- ctx->idLen = XMLSEC_XKMS_ID_ATTRIBUTE_LEN;
+ ctx->idLen = XMLSEC_XKMS_ID_ATTRIBUTE_LEN;
/* initialize key info */
ret = xmlSecKeyInfoCtxInitialize(&(ctx->keyInfoReadCtx), keysMngr);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyInfoCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyInfoCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ctx->keyInfoReadCtx.mode = xmlSecKeyInfoModeRead;
ret = xmlSecKeyInfoCtxInitialize(&(ctx->keyInfoWriteCtx), keysMngr);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyInfoCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyInfoCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ctx->keyInfoWriteCtx.mode = xmlSecKeyInfoModeWrite;
/* enabled RespondWith */
ret = xmlSecPtrListInitialize(&(ctx->enabledRespondWithIds), xmlSecXkmsRespondWithIdListId);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* enabled ServerRequest */
ret = xmlSecPtrListInitialize(&(ctx->enabledServerRequestIds), xmlSecXkmsServerRequestIdListId);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
@@ -376,23 +376,23 @@ xmlSecXkmsServerCtxInitialize(xmlSecXkmsServerCtxPtr ctx, xmlSecKeysMngrPtr keys
/* initialize keys list */
ret = xmlSecPtrListInitialize(&(ctx->keys), xmlSecKeyPtrListId);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* initialize RespondWith list */
ret = xmlSecPtrListInitialize(&(ctx->respWithList), xmlSecXkmsRespondWithIdListId);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -400,7 +400,7 @@ xmlSecXkmsServerCtxInitialize(xmlSecXkmsServerCtxPtr ctx, xmlSecKeysMngrPtr keys
/**
* xmlSecXkmsServerCtxFinalize:
- * @ctx: the pointer to XKMS processing context.
+ * @ctx: the pointer to XKMS processing context.
*
* Cleans up @ctx object.
*/
@@ -411,10 +411,10 @@ xmlSecXkmsServerCtxFinalize(xmlSecXkmsServerCtxPtr ctx) {
xmlSecXkmsServerCtxReset(ctx);
if(ctx->expectedService != NULL) {
- xmlFree(ctx->expectedService);
+ xmlFree(ctx->expectedService);
}
if(ctx->idPrefix != NULL) {
- xmlFree(ctx->idPrefix);
+ xmlFree(ctx->idPrefix);
}
xmlSecKeyInfoCtxFinalize(&(ctx->keyInfoReadCtx));
@@ -428,7 +428,7 @@ xmlSecXkmsServerCtxFinalize(xmlSecXkmsServerCtxPtr ctx) {
/**
* xmlSecXkmsServerCtxReset:
- * @ctx: the pointer to XKMS processing context.
+ * @ctx: the pointer to XKMS processing context.
*
* Resets @ctx object, user settings are not touched.
*/
@@ -445,43 +445,43 @@ xmlSecXkmsServerCtxReset(xmlSecXkmsServerCtxPtr ctx) {
ctx->requestNode = NULL;
ctx->opaqueClientDataNode = NULL;
- ctx->firtsMsgExtNode = NULL;
- ctx->keyInfoNode = NULL;
- ctx->requestId = xmlSecXkmsServerRequestIdUnknown;
+ ctx->firtsMsgExtNode = NULL;
+ ctx->keyInfoNode = NULL;
+ ctx->requestId = xmlSecXkmsServerRequestIdUnknown;
if(ctx->id != NULL) {
- xmlFree(ctx->id); ctx->id = NULL;
+ xmlFree(ctx->id); ctx->id = NULL;
}
if(ctx->service != NULL) {
- xmlFree(ctx->service); ctx->service = NULL;
+ xmlFree(ctx->service); ctx->service = NULL;
}
if(ctx->nonce != NULL) {
- xmlFree(ctx->nonce); ctx->nonce = NULL;
+ xmlFree(ctx->nonce); ctx->nonce = NULL;
}
if(ctx->originalRequestId != NULL) {
- xmlFree(ctx->originalRequestId); ctx->originalRequestId = NULL;
+ xmlFree(ctx->originalRequestId); ctx->originalRequestId = NULL;
}
if(ctx->pendingNotificationMechanism != NULL) {
- xmlFree(ctx->pendingNotificationMechanism);
- ctx->pendingNotificationMechanism = NULL;
+ xmlFree(ctx->pendingNotificationMechanism);
+ ctx->pendingNotificationMechanism = NULL;
}
if(ctx->pendingNotificationIdentifier != NULL) {
- xmlFree(ctx->pendingNotificationIdentifier);
- ctx->pendingNotificationIdentifier = NULL;
+ xmlFree(ctx->pendingNotificationIdentifier);
+ ctx->pendingNotificationIdentifier = NULL;
}
if(ctx->compoundRequestContexts != NULL) {
xmlSecPtrListDestroy(ctx->compoundRequestContexts);
ctx->compoundRequestContexts = NULL;
}
- ctx->responseLimit = XMLSEC_XKMS_NO_RESPONSE_LIMIT;
+ ctx->responseLimit = XMLSEC_XKMS_NO_RESPONSE_LIMIT;
ctx->responseMechanismMask = 0;
}
/**
* xmlSecXkmsServerCtxCopyUserPref:
- * @dst: the pointer to destination context.
- * @src: the pointer to source context.
+ * @dst: the pointer to destination context.
+ * @src: the pointer to source context.
*
* Copies user preference from @src context to @dst.
*
@@ -494,74 +494,74 @@ xmlSecXkmsServerCtxCopyUserPref(xmlSecXkmsServerCtxPtr dst, xmlSecXkmsServerCtxP
xmlSecAssert2(dst != NULL, -1);
xmlSecAssert2(src != NULL, -1);
- dst->userData = src->userData;
- dst->flags = src->flags;
- dst->flags2 = src->flags2;
+ dst->userData = src->userData;
+ dst->flags = src->flags;
+ dst->flags2 = src->flags2;
ret = xmlSecKeyInfoCtxCopyUserPref(&(dst->keyInfoReadCtx), &(src->keyInfoReadCtx));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyInfoCtxCopyUserPref",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyInfoCtxCopyUserPref",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecKeyInfoCtxCopyUserPref(&(dst->keyInfoWriteCtx), &(src->keyInfoWriteCtx));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyInfoCtxCopyUserPref",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyInfoCtxCopyUserPref",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if(src->expectedService != NULL) {
- dst->expectedService = xmlStrdup(src->expectedService);
- if(dst->expectedService == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlStrdup",
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ dst->expectedService = xmlStrdup(src->expectedService);
+ if(dst->expectedService == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlStrdup",
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
if(src->idPrefix != NULL) {
- dst->idPrefix = xmlStrdup(src->idPrefix);
- if(dst->idPrefix == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlStrdup",
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ dst->idPrefix = xmlStrdup(src->idPrefix);
+ if(dst->idPrefix == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlStrdup",
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
src->idLen = dst->idLen;
ret = xmlSecPtrListCopy(&(dst->enabledRespondWithIds), &(src->enabledRespondWithIds));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListCopy",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListCopy",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecPtrListCopy(&(dst->enabledServerRequestIds), &(src->enabledServerRequestIds));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListCopy",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListCopy",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -569,10 +569,10 @@ xmlSecXkmsServerCtxCopyUserPref(xmlSecXkmsServerCtxPtr dst, xmlSecXkmsServerCtxP
/**
* xmlSecXkmsServerCtxProcess:
- * @ctx: the pointer to XKMS processing context.
- * @node: the pointer to request node.
+ * @ctx: the pointer to XKMS processing context.
+ * @node: the pointer to request node.
* @format: the request/response format.
- * @doc: the pointer to response parent XML document (might be NULL).
+ * @doc: the pointer to response parent XML document (might be NULL).
*
* Reads XKMS request from @node and creates response to a newly created node.
* Caller is responsible for adding the returned node to the XML document.
@@ -592,38 +592,38 @@ xmlSecXkmsServerCtxProcess(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node,
ctx->requestNode = xmlSecXkmsServerCtxRequestUnwrap(ctx, node, format);
if(ctx->requestNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxRequestUnwrap",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(node->name));
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxRequestUnwrap",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(node->name));
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ goto done;
}
ret = xmlSecXkmsServerCtxRequestRead(ctx, ctx->requestNode);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerRequestIdListFindByNode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "ctx->requestNode=%s",
- xmlSecErrorsSafeString(ctx->requestNode->name));
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerRequestIdListFindByNode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "ctx->requestNode=%s",
+ xmlSecErrorsSafeString(ctx->requestNode->name));
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ goto done;
}
ret = xmlSecXkmsServerRequestExecute(ctx->requestId, ctx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerRequestExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "ctx->requestNode=%s",
- xmlSecErrorsSafeString(ctx->requestNode->name));
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerRequestExecute",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "ctx->requestNode=%s",
+ xmlSecErrorsSafeString(ctx->requestNode->name));
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ goto done;
}
done:
@@ -634,26 +634,26 @@ done:
respNode = xmlSecXkmsServerCtxResponseWrite(ctx, doc);
if(respNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxResponseWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "ctx->requestNode=%s",
- xmlSecErrorsSafeString(ctx->requestNode->name));
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxResponseWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "ctx->requestNode=%s",
+ xmlSecErrorsSafeString(ctx->requestNode->name));
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
goto error;
}
wrappedRespNode = xmlSecXkmsServerCtxResponseWrap(ctx, respNode, format, doc);
if(wrappedRespNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxResponseWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "ctx->requestNode=%s",
- xmlSecErrorsSafeString(ctx->requestNode->name));
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxResponseWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "ctx->requestNode=%s",
+ xmlSecErrorsSafeString(ctx->requestNode->name));
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
xmlFreeNode(respNode);
goto error;
}
@@ -668,8 +668,8 @@ error:
/**
* xmlSecXkmsServerCtxRequestRead:
- * @ctx: the pointer to XKMS processing context.
- * @node: the pointer to request node.
+ * @ctx: the pointer to XKMS processing context.
+ * @node: the pointer to request node.
*
* Reads XKMS request from @node and stores data in @ctx.
*
@@ -685,32 +685,32 @@ xmlSecXkmsServerCtxRequestRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
/* find out what the request is */
if(xmlSecPtrListGetSize(&(ctx->enabledServerRequestIds)) > 0) {
- ctx->requestId = xmlSecXkmsServerRequestIdListFindByNode(&(ctx->enabledServerRequestIds), node);
+ ctx->requestId = xmlSecXkmsServerRequestIdListFindByNode(&(ctx->enabledServerRequestIds), node);
} else {
- ctx->requestId = xmlSecXkmsServerRequestIdListFindByNode(xmlSecXkmsServerRequestIdsGet(), node);
+ ctx->requestId = xmlSecXkmsServerRequestIdListFindByNode(xmlSecXkmsServerRequestIdsGet(), node);
}
if(ctx->requestId == xmlSecXkmsServerRequestIdUnknown) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerRequestIdListFindByNode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(node->name));
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorMessageNotSupported);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerRequestIdListFindByNode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(node->name));
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorMessageNotSupported);
+ return(-1);
}
xmlSecAddIDs(node->doc, node, xmlSecXkmsServerIds);
ret = xmlSecXkmsServerRequestNodeRead(ctx->requestId, ctx, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerRequestNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "request=%s",
- xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(ctx->requestId)));
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerRequestNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "request=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(ctx->requestId)));
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
+ return(-1);
}
return(0);
@@ -718,8 +718,8 @@ xmlSecXkmsServerCtxRequestRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
/**
* xmlSecXkmsServerCtxResponseWrite:
- * @ctx: the pointer to XKMS processing context.
- * @doc: the pointer to response parent XML document (might be NULL).
+ * @ctx: the pointer to XKMS processing context.
+ * @doc: the pointer to response parent XML document (might be NULL).
*
* Writes XKMS response from context to a newly created node. Caller is
* responsible for adding the returned node to the XML document.
@@ -737,13 +737,13 @@ xmlSecXkmsServerCtxResponseWrite(xmlSecXkmsServerCtxPtr ctx, xmlDocPtr doc) {
/* now write results */
respNode = xmlSecXkmsServerRequestNodeWrite(ctx->requestId, ctx, doc, NULL);
if(respNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerRequestNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "request=%s",
- xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(ctx->requestId)));
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerRequestNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "request=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(ctx->requestId)));
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
return(NULL);
}
@@ -752,8 +752,8 @@ xmlSecXkmsServerCtxResponseWrite(xmlSecXkmsServerCtxPtr ctx, xmlDocPtr doc) {
/**
* xmlSecXkmsServerCtxRequestUnwrap:
- * @ctx: the pointer to XKMS processing context.
- * @node: the pointer to request node.
+ * @ctx: the pointer to XKMS processing context.
+ * @node: the pointer to request node.
* @format: the request/response format.
*
* Removes SOAP or other envelope from XKMS request.
@@ -776,35 +776,35 @@ xmlSecXkmsServerCtxRequestUnwrap(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, x
/* verify that it is actually soap Envelope node */
if(xmlSecSoap11CheckEnvelope(node) != 1) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap11CheckEnvelope",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
- return(NULL);
+ NULL,
+ "xmlSecSoap11CheckEnvelope",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
+ return(NULL);
}
/* check that Body has exactly one entry */
if(xmlSecSoap11GetBodyEntriesNumber(node) != 1) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap11GetBodyEntriesNumber",
- XMLSEC_ERRORS_R_INVALID_DATA,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
- return(NULL);
+ NULL,
+ "xmlSecSoap11GetBodyEntriesNumber",
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
+ return(NULL);
}
/* this one enntry is our xkms request */
result = xmlSecSoap11GetBodyEntry(node, 0);
if(result == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap11GetBodyEntry",
- XMLSEC_ERRORS_R_INVALID_DATA,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
- return(NULL);
+ NULL,
+ "xmlSecSoap11GetBodyEntry",
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
+ return(NULL);
}
break;
@@ -812,48 +812,48 @@ xmlSecXkmsServerCtxRequestUnwrap(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, x
/* verify that it is actually soap Envelope node */
if(xmlSecSoap12CheckEnvelope(node) != 1) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap12CheckEnvelope",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
- return(NULL);
+ NULL,
+ "xmlSecSoap12CheckEnvelope",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
+ return(NULL);
}
/* check that Body has exactly one entry */
if(xmlSecSoap12GetBodyEntriesNumber(node) != 1) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap12GetBodyEntriesNumber",
- XMLSEC_ERRORS_R_INVALID_DATA,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
- return(NULL);
+ NULL,
+ "xmlSecSoap12GetBodyEntriesNumber",
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
+ return(NULL);
}
/* this one enntry is our xkms request */
result = xmlSecSoap12GetBodyEntry(node, 0);
if(result == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap12GetBodyEntry",
- XMLSEC_ERRORS_R_INVALID_DATA,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
- return(NULL);
+ NULL,
+ "xmlSecSoap12GetBodyEntry",
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
+ return(NULL);
}
break;
#endif /* XMLSEC_NO_SOAP */
default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- "format=%d",
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ "format=%d",
format);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
- return(NULL);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
+ return(NULL);
}
return(result);
@@ -861,10 +861,10 @@ xmlSecXkmsServerCtxRequestUnwrap(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, x
/**
* xmlSecXkmsServerCtxResponseWrap:
- * @ctx: the pointer to XKMS processing context.
- * @node: the pointer to response node.
+ * @ctx: the pointer to XKMS processing context.
+ * @node: the pointer to response node.
* @format: the request/response format.
- * @doc: the pointer to response parent XML document (might be NULL).
+ * @doc: the pointer to response parent XML document (might be NULL).
*
* Creates SOAP or other envelope around XKMS response.
* Caller is responsible for adding the returned node to the XML document.
@@ -888,56 +888,56 @@ xmlSecXkmsServerCtxResponseWrap(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xml
result = xmlSecSoap11CreateEnvelope(doc);
if(result == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap11CreateEnvelope",
- XMLSEC_ERRORS_R_INVALID_DATA,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
- return(NULL);
+ NULL,
+ "xmlSecSoap11CreateEnvelope",
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ return(NULL);
}
if(xmlSecSoap11AddBodyEntry(result, node) == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap11AddBodyEntry",
- XMLSEC_ERRORS_R_INVALID_DATA,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
- return(NULL);
+ NULL,
+ "xmlSecSoap11AddBodyEntry",
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ return(NULL);
}
break;
case xmlSecXkmsServerFormatSoap12:
result = xmlSecSoap12CreateEnvelope(doc);
if(result == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap12CreateEnvelope",
- XMLSEC_ERRORS_R_INVALID_DATA,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
- return(NULL);
+ NULL,
+ "xmlSecSoap12CreateEnvelope",
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ return(NULL);
}
if(xmlSecSoap12AddBodyEntry(result, node) == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap12AddBodyEntry",
- XMLSEC_ERRORS_R_INVALID_DATA,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
- return(NULL);
+ NULL,
+ "xmlSecSoap12AddBodyEntry",
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ return(NULL);
}
break;
#endif /* XMLSEC_NO_SOAP */
default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- "format=%d",
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ "format=%d",
format);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
- return(NULL);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
+ return(NULL);
}
return(result);
@@ -945,9 +945,9 @@ xmlSecXkmsServerCtxResponseWrap(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node, xml
/**
* xmlSecXkmsServerCtxFatalErrorResponseCreate:
- * @ctx: the pointer to XKMS processing context.
+ * @ctx: the pointer to XKMS processing context.
* @format: the request/response format.
- * @doc: the pointer to response parent XML document (might be NULL).
+ * @doc: the pointer to response parent XML document (might be NULL).
*
* Creates a "fatal error" SOAP or other envelope respons. Caller is
* responsible for adding the returned node to the XML document.
@@ -963,7 +963,7 @@ xmlSecXkmsServerCtxFatalErrorResponseCreate(xmlSecXkmsServerCtxPtr ctx, xmlSecXk
/* make sure that we have an error */
if(ctx->resultMajor == xmlSecXkmsResultMajorSuccess) {
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
}
switch(format) {
@@ -972,11 +972,11 @@ xmlSecXkmsServerCtxFatalErrorResponseCreate(xmlSecXkmsServerCtxPtr ctx, xmlSecXk
result = xmlSecXkmsServerRequestNodeWrite(xmlSecXkmsServerRequestResultId, ctx, doc, NULL);
if(result == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerRequestNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ NULL,
+ "xmlSecXkmsServerRequestNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
break;
#ifndef XMLSEC_NO_SOAP
@@ -984,24 +984,24 @@ xmlSecXkmsServerCtxFatalErrorResponseCreate(xmlSecXkmsServerCtxPtr ctx, xmlSecXk
result = xmlSecSoap11CreateEnvelope(doc);
if(result == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap11CreateEnvelope",
- XMLSEC_ERRORS_R_INVALID_DATA,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
- return(NULL);
+ NULL,
+ "xmlSecSoap11CreateEnvelope",
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ return(NULL);
}
ret = xmlSecXkmsServerCtxWriteSoap11FatalError(ctx, result);
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxWriteSoap11FatalError",
- XMLSEC_ERRORS_R_INVALID_DATA,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ NULL,
+ "xmlSecXkmsServerCtxWriteSoap11FatalError",
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
xmlFreeNode(result);
- return(NULL);
+ return(NULL);
}
break;
@@ -1009,37 +1009,37 @@ xmlSecXkmsServerCtxFatalErrorResponseCreate(xmlSecXkmsServerCtxPtr ctx, xmlSecXk
result = xmlSecSoap12CreateEnvelope(doc);
if(result == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap12CreateEnvelope",
- XMLSEC_ERRORS_R_INVALID_DATA,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
- return(NULL);
+ NULL,
+ "xmlSecSoap12CreateEnvelope",
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ return(NULL);
}
ret = xmlSecXkmsServerCtxWriteSoap12FatalError(ctx, result);
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxWriteSoap12FatalError",
- XMLSEC_ERRORS_R_INVALID_DATA,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ NULL,
+ "xmlSecXkmsServerCtxWriteSoap12FatalError",
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
xmlFreeNode(result);
- return(NULL);
+ return(NULL);
}
break;
#endif /* XMLSEC_NO_SOAP */
default:
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- "format=%d",
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ "format=%d",
format);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
- return(NULL);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
+ return(NULL);
}
return(result);
@@ -1064,11 +1064,11 @@ xmlSecXkmsServerCtxWriteSoap11FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
faultString = xmlStrdup(xmlSecXkmsSoapFaultReasonUnsupportedVersion);
if(faultString == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlStrdup",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ NULL,
+ "xmlStrdup",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
return(-1);
}
} else if((ctx->resultMajor == xmlSecXkmsResultMajorSender) &&
@@ -1082,11 +1082,11 @@ xmlSecXkmsServerCtxWriteSoap11FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
faultString = xmlMalloc(len + 1);
if(faultString == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlMalloc",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ NULL,
+ "xmlMalloc",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
return(-1);
}
xmlSecStrPrintf(faultString, len , xmlSecXkmsSoapFaultReasonMessageInvalid,
@@ -1099,11 +1099,11 @@ xmlSecXkmsServerCtxWriteSoap11FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
faultString = xmlStrdup(xmlSecXkmsSoapFaultReasonServiceUnavailable);
if(faultString == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlStrdup",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ NULL,
+ "xmlStrdup",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
return(-1);
}
} else if((ctx->requestId == NULL) && (ctx->requestNode != NULL)) {
@@ -1116,11 +1116,11 @@ xmlSecXkmsServerCtxWriteSoap11FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
faultString = xmlMalloc(len + 1);
if(faultString == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlMalloc",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ NULL,
+ "xmlMalloc",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
return(-1);
}
xmlSecStrPrintf(faultString, len , xmlSecXkmsSoapFaultReasonMessageNotSupported,
@@ -1132,22 +1132,22 @@ xmlSecXkmsServerCtxWriteSoap11FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
faultString = xmlStrdup(xmlSecXkmsSoapFaultReasonServiceUnavailable);
if(faultString == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlStrdup",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ NULL,
+ "xmlStrdup",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
return(-1);
}
}
if(xmlSecSoap11AddFaultEntry(envNode, faultCodeHref, faultCodeLocalPart, faultString, NULL) == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap11AddFaultEntry",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ NULL,
+ "xmlSecSoap11AddFaultEntry",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
xmlFree(faultString);
return(-1);
}
@@ -1175,11 +1175,11 @@ xmlSecXkmsServerCtxWriteSoap12FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
faultReason = xmlStrdup(xmlSecXkmsSoapFaultReasonUnsupportedVersion);
if(faultReason == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlStrdup",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ NULL,
+ "xmlStrdup",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
return(-1);
}
} else if((ctx->resultMajor == xmlSecXkmsResultMajorSender) &&
@@ -1194,11 +1194,11 @@ xmlSecXkmsServerCtxWriteSoap12FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
faultReason = xmlMalloc(len + 1);
if(faultReason == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlMalloc",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ NULL,
+ "xmlMalloc",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
return(-1);
}
xmlSecStrPrintf(faultReason, len , xmlSecXkmsSoapFaultReasonMessageInvalid,
@@ -1210,11 +1210,11 @@ xmlSecXkmsServerCtxWriteSoap12FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
faultReason = xmlStrdup(xmlSecXkmsSoapFaultReasonServiceUnavailable);
if(faultReason == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlStrdup",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ NULL,
+ "xmlStrdup",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
return(-1);
}
} else if((ctx->requestId == NULL) && (ctx->requestNode != NULL)) {
@@ -1228,11 +1228,11 @@ xmlSecXkmsServerCtxWriteSoap12FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
faultReason = xmlMalloc(len + 1);
if(faultReason == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlMalloc",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ NULL,
+ "xmlMalloc",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
return(-1);
}
xmlSecStrPrintf(faultReason, len , xmlSecXkmsSoapFaultReasonMessageNotSupported,
@@ -1243,11 +1243,11 @@ xmlSecXkmsServerCtxWriteSoap12FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
faultReason = xmlStrdup(xmlSecXkmsSoapFaultReasonServiceUnavailable);
if(faultReason == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlStrdup",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ NULL,
+ "xmlStrdup",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
return(-1);
}
}
@@ -1258,11 +1258,11 @@ xmlSecXkmsServerCtxWriteSoap12FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
xmlSecXkmsSoapFaultReasonLang, NULL, NULL);
if(faultNode == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap12AddFaultEntry",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ NULL,
+ "xmlSecSoap12AddFaultEntry",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
xmlFree(faultReason);
return(-1);
}
@@ -1271,22 +1271,22 @@ xmlSecXkmsServerCtxWriteSoap12FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
if((faultSubCodeHref != NULL) && (faultSubCodeLocalPart != NULL)) {
/* make sure that we have subcode (xkms) namespace declared */
if(xmlNewNs(faultNode, faultSubCodeHref, BAD_CAST "xkms") == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewNs",
- XMLSEC_ERRORS_R_XML_FAILED,
- "ns=%s",
- xmlSecErrorsSafeString(faultSubCodeHref));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewNs",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "ns=%s",
+ xmlSecErrorsSafeString(faultSubCodeHref));
return(-1);
}
if(xmlSecSoap12AddFaultSubcode(faultNode, faultSubCodeHref, faultSubCodeLocalPart) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecSoap12AddFaultSubcode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "href=%s,value=%s",
- xmlSecErrorsSafeString(faultSubCodeHref),
- xmlSecErrorsSafeString(faultSubCodeLocalPart));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecSoap12AddFaultSubcode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "href=%s,value=%s",
+ xmlSecErrorsSafeString(faultSubCodeHref),
+ xmlSecErrorsSafeString(faultSubCodeLocalPart));
return(-1);
}
}
@@ -1299,7 +1299,7 @@ xmlSecXkmsServerCtxWriteSoap12FatalError(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
/**
* xmlSecXkmsServerCtxSetResult:
- * @ctx: the pointer to XKMS processing context.
+ * @ctx: the pointer to XKMS processing context.
* @resultMajor: the major result code.
* @resultMinor: the minor result code.
*
@@ -1313,21 +1313,21 @@ xmlSecXkmsServerCtxSetResult(xmlSecXkmsServerCtxPtr ctx, xmlSecXkmsResultMajor r
if((ctx->resultMajor == xmlSecXkmsResultMajorSuccess) &&
(resultMinor != xmlSecXkmsResultMajorSuccess)) {
- ctx->resultMajor = resultMajor;
- ctx->resultMinor = resultMinor;
+ ctx->resultMajor = resultMajor;
+ ctx->resultMinor = resultMinor;
} else if((ctx->resultMajor == xmlSecXkmsResultMajorSuccess) &&
(ctx->resultMinor == xmlSecXkmsResultMinorNone)) {
- xmlSecAssert(resultMajor == xmlSecXkmsResultMajorSuccess);
-
- ctx->resultMinor = resultMinor;
+ xmlSecAssert(resultMajor == xmlSecXkmsResultMajorSuccess);
+
+ ctx->resultMinor = resultMinor;
}
}
/**
* xmlSecXkmsServerCtxDebugDump:
- * @ctx: the pointer to XKMS processing context.
- * @output: the pointer to output FILE.
+ * @ctx: the pointer to XKMS processing context.
+ * @output: the pointer to output FILE.
*
* Prints the debug information about @ctx to @output.
*/
@@ -1337,37 +1337,37 @@ xmlSecXkmsServerCtxDebugDump(xmlSecXkmsServerCtxPtr ctx, FILE* output) {
xmlSecAssert(output != NULL);
fprintf(output, "= XKMS SERVER CONTEXT: %s\n",
- (ctx->requestId != xmlSecXkmsServerRequestIdUnknown &&
- xmlSecXkmsServerRequestKlassGetName(ctx->requestId)) ?
- xmlSecXkmsServerRequestKlassGetName(ctx->requestId) :
- BAD_CAST "NULL");
+ (ctx->requestId != xmlSecXkmsServerRequestIdUnknown &&
+ xmlSecXkmsServerRequestKlassGetName(ctx->requestId)) ?
+ xmlSecXkmsServerRequestKlassGetName(ctx->requestId) :
+ BAD_CAST "NULL");
xmlSecQName2IntegerDebugDump(gXmlSecXkmsResultMajorInfo,
- ctx->resultMajor, BAD_CAST "resultMajor", output);
+ ctx->resultMajor, BAD_CAST "resultMajor", output);
xmlSecQName2IntegerDebugDump(gXmlSecXkmsMinorErrorInfo,
- ctx->resultMinor, BAD_CAST "resultMinor", output);
+ ctx->resultMinor, BAD_CAST "resultMinor", output);
fprintf(output, "== id: %s\n",
- (ctx->id) ? ctx->id : BAD_CAST "");
+ (ctx->id) ? ctx->id : BAD_CAST "");
fprintf(output, "== service: %s\n",
- (ctx->service) ? ctx->service : BAD_CAST "");
+ (ctx->service) ? ctx->service : BAD_CAST "");
fprintf(output, "== nonce: %s\n",
- (ctx->nonce) ? ctx->nonce : BAD_CAST "");
+ (ctx->nonce) ? ctx->nonce : BAD_CAST "");
fprintf(output, "== originalRequestId: %s\n",
- (ctx->originalRequestId) ? ctx->originalRequestId : BAD_CAST "");
+ (ctx->originalRequestId) ? ctx->originalRequestId : BAD_CAST "");
fprintf(output, "== pendingNotificationMechanism: %s\n",
- (ctx->pendingNotificationMechanism) ?
- ctx->pendingNotificationMechanism :
- BAD_CAST "");
+ (ctx->pendingNotificationMechanism) ?
+ ctx->pendingNotificationMechanism :
+ BAD_CAST "");
fprintf(output, "== pendingNotificationIdentifier: %s\n",
- (ctx->pendingNotificationIdentifier) ?
- ctx->pendingNotificationIdentifier :
- BAD_CAST "");
+ (ctx->pendingNotificationIdentifier) ?
+ ctx->pendingNotificationIdentifier :
+ BAD_CAST "");
if(ctx->responseLimit != XMLSEC_XKMS_NO_RESPONSE_LIMIT) {
fprintf(output, "== ResponseLimit: %d\n", ctx->responseLimit);
}
xmlSecQName2BitMaskDebugDump(gXmlSecXkmsResponseMechanismInfo,
- ctx->responseMechanismMask, BAD_CAST "responseMechanism", output);
+ ctx->responseMechanismMask, BAD_CAST "responseMechanism", output);
if(ctx->expectedService != NULL) {
fprintf(output, "== expected service: %s\n", ctx->expectedService);
@@ -1382,17 +1382,17 @@ xmlSecXkmsServerCtxDebugDump(xmlSecXkmsServerCtxPtr ctx, FILE* output) {
xmlSecKeyInfoCtxDebugDump(&(ctx->keyInfoWriteCtx), output);
if(xmlSecPtrListGetSize(&(ctx->enabledRespondWithIds)) > 0) {
- fprintf(output, "== Enabled RespondWith: ");
- xmlSecTransformIdListDebugDump(&(ctx->enabledRespondWithIds), output);
+ fprintf(output, "== Enabled RespondWith: ");
+ xmlSecTransformIdListDebugDump(&(ctx->enabledRespondWithIds), output);
} else {
- fprintf(output, "== Enabled RespondWith: all\n");
+ fprintf(output, "== Enabled RespondWith: all\n");
}
if(xmlSecPtrListGetSize(&(ctx->enabledServerRequestIds)) > 0) {
- fprintf(output, "== Enabled ServerRequest: ");
- xmlSecTransformIdListDebugDump(&(ctx->enabledServerRequestIds), output);
+ fprintf(output, "== Enabled ServerRequest: ");
+ xmlSecTransformIdListDebugDump(&(ctx->enabledServerRequestIds), output);
} else {
- fprintf(output, "== Enabled ServerRequest: all\n");
+ fprintf(output, "== Enabled ServerRequest: all\n");
}
fprintf(output, "== RespondWith List:\n");
@@ -1409,8 +1409,8 @@ xmlSecXkmsServerCtxDebugDump(xmlSecXkmsServerCtxPtr ctx, FILE* output) {
/**
* xmlSecXkmsServerCtxDebugXmlDump:
- * @ctx: the pointer to XKMS processing context.
- * @output: the pointer to output FILE.
+ * @ctx: the pointer to XKMS processing context.
+ * @output: the pointer to output FILE.
*
* Prints the debug information about @ctx to @output in XML format.
*/
@@ -1421,16 +1421,16 @@ xmlSecXkmsServerCtxDebugXmlDump(xmlSecXkmsServerCtxPtr ctx, FILE* output) {
fprintf(output, "<XkmsServerRequestContext name=\"");
xmlSecPrintXmlString(output,
- (ctx->requestId != xmlSecXkmsServerRequestIdUnknown) ?
- xmlSecXkmsServerRequestKlassGetName(ctx->requestId) :
- BAD_CAST "NULL"
+ (ctx->requestId != xmlSecXkmsServerRequestIdUnknown) ?
+ xmlSecXkmsServerRequestKlassGetName(ctx->requestId) :
+ BAD_CAST "NULL"
);
fprintf(output, "\">\n");
xmlSecQName2IntegerDebugXmlDump(gXmlSecXkmsResultMajorInfo,
- ctx->resultMajor, BAD_CAST "MajorError", output);
+ ctx->resultMajor, BAD_CAST "MajorError", output);
xmlSecQName2IntegerDebugXmlDump(gXmlSecXkmsMinorErrorInfo,
- ctx->resultMinor, BAD_CAST "MinorError", output);
+ ctx->resultMinor, BAD_CAST "MinorError", output);
fprintf(output, "<Id>");
xmlSecPrintXmlString(output, ctx->id);
@@ -1460,7 +1460,7 @@ xmlSecXkmsServerCtxDebugXmlDump(xmlSecXkmsServerCtxPtr ctx, FILE* output) {
fprintf(output, "<ResponseLimit>%d</ResponseLimit>\n", ctx->responseLimit);
}
xmlSecQName2BitMaskDebugXmlDump(gXmlSecXkmsResponseMechanismInfo,
- ctx->responseMechanismMask, BAD_CAST "ResponseMechanism", output);
+ ctx->responseMechanismMask, BAD_CAST "ResponseMechanism", output);
fprintf(output, "<ExpectedService>");
@@ -1479,19 +1479,19 @@ xmlSecXkmsServerCtxDebugXmlDump(xmlSecXkmsServerCtxPtr ctx, FILE* output) {
fprintf(output, "</KeyInfoWriteCtx>\n");
if(xmlSecPtrListGetSize(&(ctx->enabledRespondWithIds)) > 0) {
- fprintf(output, "<EnabledRespondWith>\n");
- xmlSecTransformIdListDebugXmlDump(&(ctx->enabledRespondWithIds), output);
- fprintf(output, "</EnabledRespondWith>\n");
+ fprintf(output, "<EnabledRespondWith>\n");
+ xmlSecTransformIdListDebugXmlDump(&(ctx->enabledRespondWithIds), output);
+ fprintf(output, "</EnabledRespondWith>\n");
} else {
- fprintf(output, "<EnabledRespondWith>all</EnabledRespondWith>\n");
+ fprintf(output, "<EnabledRespondWith>all</EnabledRespondWith>\n");
}
if(xmlSecPtrListGetSize(&(ctx->enabledServerRequestIds)) > 0) {
- fprintf(output, "<EnabledServerRequest>\n");
- xmlSecTransformIdListDebugXmlDump(&(ctx->enabledServerRequestIds), output);
- fprintf(output, "</EnabledServerRequest>\n");
+ fprintf(output, "<EnabledServerRequest>\n");
+ xmlSecTransformIdListDebugXmlDump(&(ctx->enabledServerRequestIds), output);
+ fprintf(output, "</EnabledServerRequest>\n");
} else {
- fprintf(output, "<EnabledServerRequest>all</EnabledServerRequest>\n");
+ fprintf(output, "<EnabledServerRequest>all</EnabledServerRequest>\n");
}
@@ -1582,40 +1582,40 @@ xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNo
xmlSecAssert2(ctx->id == NULL, -1);
ctx->id = xmlGetProp(cur, xmlSecAttrId);
if(ctx->id == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlGetProp",
- XMLSEC_ERRORS_R_XML_FAILED,
- "name=%s;node=%s",
- xmlSecErrorsSafeString(xmlSecAttrId),
- xmlSecErrorsSafeString(cur->name));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlGetProp",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "name=%s;node=%s",
+ xmlSecErrorsSafeString(xmlSecAttrId),
+ xmlSecErrorsSafeString(cur->name));
+ return(-1);
}
/* required Service attribute */
xmlSecAssert2(ctx->service == NULL, -1);
ctx->service = xmlGetProp(cur, xmlSecAttrService);
if(ctx->service == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlGetProp",
- XMLSEC_ERRORS_R_XML_FAILED,
- "name=%s;node=%s",
- xmlSecErrorsSafeString(xmlSecAttrService),
- xmlSecErrorsSafeString(cur->name));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlGetProp",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "name=%s;node=%s",
+ xmlSecErrorsSafeString(xmlSecAttrService),
+ xmlSecErrorsSafeString(cur->name));
+ return(-1);
}
/* check service */
if((ctx->expectedService != NULL) && (!xmlStrEqual(ctx->expectedService, ctx->service))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "expectedService=%s;actualService=%s",
- xmlSecErrorsSafeString(ctx->expectedService),
- xmlSecErrorsSafeString(ctx->service));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "expectedService=%s;actualService=%s",
+ xmlSecErrorsSafeString(ctx->expectedService),
+ xmlSecErrorsSafeString(ctx->service));
+ return(-1);
}
/* optional Nonce attribute */
@@ -1630,8 +1630,8 @@ xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNo
xmlSecAssert2(ctx->responseLimit == XMLSEC_XKMS_NO_RESPONSE_LIMIT, -1);
tmp = xmlGetProp(cur, xmlSecAttrResponseLimit);
if(tmp != NULL) {
- ctx->responseLimit = atoi((char*)tmp);
- xmlFree(tmp);
+ ctx->responseLimit = atoi((char*)tmp);
+ xmlFree(tmp);
}
/* now read children */
@@ -1639,81 +1639,81 @@ xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNo
/* first node is optional <dsig:Signature/> node */
if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeSignature, xmlSecDSigNs)) {
- ret = xmlSecXkmsServerCtxSignatureNodeRead(ctx, cur);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxSignatureNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- cur = xmlSecGetNextElementNode(cur->next);
+ ret = xmlSecXkmsServerCtxSignatureNodeRead(ctx, cur);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxSignatureNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* next is zero or more <xkms:MessageExtension/> nodes */
ret = xmlSecXkmsServerCtxMessageExtensionNodesRead(ctx, &cur);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxMessageExtensionNodesRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxMessageExtensionNodesRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* next is optional <xkms:OpaqueClientData/> node */
if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeOpaqueClientData, xmlSecXkmsNs)) {
- ret = xmlSecXkmsServerCtxOpaqueClientDataNodeRead(ctx, cur);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxOpaqueClientDataNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- cur = xmlSecGetNextElementNode(cur->next);
+ ret = xmlSecXkmsServerCtxOpaqueClientDataNodeRead(ctx, cur);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxOpaqueClientDataNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* next is zero or more <xkms:ResponseMechanism/> nodes */
ret = xmlSecQName2BitMaskNodesRead(gXmlSecXkmsResponseMechanismInfo, &cur,
- xmlSecNodeResponseMechanism, xmlSecXkmsNs,
+ xmlSecNodeResponseMechanism, xmlSecXkmsNs,
((ctx->flags & XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPONSE_MECHANISM) != 0) ? 1 : 0,
- &ctx->responseMechanismMask);
+ &ctx->responseMechanismMask);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecQName2BitMaskNodesRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecNodeResponseMechanism));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecQName2BitMaskNodesRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecNodeResponseMechanism));
+ return(-1);
}
/* next is zero or more <xkms:RespondWith/> nodes */
ret = xmlSecXkmsServerCtxRespondWithNodesRead(ctx, &cur);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxRespondWithNodesRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxRespondWithNodesRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* next is optional <xkms:PendingNotification/> node */
if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodePendingNotification, xmlSecXkmsNs)) {
- ret = xmlSecXkmsServerCtxPendingNotificationNodeRead(ctx, cur);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxPendingNotificationNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- cur = xmlSecGetNextElementNode(cur->next);
+ ret = xmlSecXkmsServerCtxPendingNotificationNodeRead(ctx, cur);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxPendingNotificationNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ cur = xmlSecGetNextElementNode(cur->next);
}
(*node) = cur;
@@ -1746,10 +1746,10 @@ xmlSecXkmsServerCtxMessageExtensionNodesRead(xmlSecXkmsServerCtxPtr ctx, xmlNode
cur = (*node);
while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeMessageExtension, xmlSecXkmsNs)) {
- if(ctx->firtsMsgExtNode == NULL) {
- ctx->firtsMsgExtNode = cur;
- }
- cur = xmlSecGetNextElementNode(cur->next);
+ if(ctx->firtsMsgExtNode == NULL) {
+ ctx->firtsMsgExtNode = cur;
+ }
+ cur = xmlSecGetNextElementNode(cur->next);
}
(*node) = cur;
@@ -1777,41 +1777,41 @@ xmlSecXkmsServerCtxRespondWithNodesRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr*
cur = (*node);
while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeRespondWith, xmlSecXkmsNs)) {
- xmlSecXkmsRespondWithId id = xmlSecXkmsRespondWithIdUnknown;
-
- if(xmlSecPtrListGetSize(&(ctx->enabledRespondWithIds)) > 0) {
- id = xmlSecXkmsRespondWithIdListFindByNodeValue(&(ctx->enabledRespondWithIds), cur);
- } else {
- id = xmlSecXkmsRespondWithIdListFindByNodeValue(xmlSecXkmsRespondWithIdsGet(), cur);
- }
-
- if(id != xmlSecXkmsRespondWithIdUnknown) {
- ret = xmlSecXkmsRespondWithNodeRead(id, ctx, cur);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCreateTree",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- } else if((ctx->flags & XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPOND_WITH) != 0) {
+ xmlSecXkmsRespondWithId id = xmlSecXkmsRespondWithIdUnknown;
+
+ if(xmlSecPtrListGetSize(&(ctx->enabledRespondWithIds)) > 0) {
+ id = xmlSecXkmsRespondWithIdListFindByNodeValue(&(ctx->enabledRespondWithIds), cur);
+ } else {
+ id = xmlSecXkmsRespondWithIdListFindByNodeValue(xmlSecXkmsRespondWithIdsGet(), cur);
+ }
+
+ if(id != xmlSecXkmsRespondWithIdUnknown) {
+ ret = xmlSecXkmsRespondWithNodeRead(id, ctx, cur);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCreateTree",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ } else if((ctx->flags & XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_RESPOND_WITH) != 0) {
xmlChar* content ;
content = xmlNodeGetContent(cur);
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s,value=%s",
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s,value=%s",
xmlSecErrorsSafeString(cur->name),
xmlSecErrorsSafeString(content));
if(content != NULL) {
xmlFree(content);
}
- return(-1);
- }
- cur = xmlSecGetNextElementNode(cur->next);
+ return(-1);
+ }
+ cur = xmlSecGetNextElementNode(cur->next);
}
(*node) = cur;
@@ -1836,27 +1836,27 @@ xmlSecXkmsServerCtxPendingNotificationNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNo
xmlSecAssert2(ctx->pendingNotificationMechanism == NULL, -1);
ctx->pendingNotificationMechanism = xmlGetProp(node, xmlSecAttrMechanism);
if(ctx->pendingNotificationMechanism == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlGetProp",
- XMLSEC_ERRORS_R_XML_FAILED,
- "name=%s;node=%s",
- xmlSecErrorsSafeString(xmlSecAttrMechanism),
- xmlSecErrorsSafeString(node->name));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlGetProp",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "name=%s;node=%s",
+ xmlSecErrorsSafeString(xmlSecAttrMechanism),
+ xmlSecErrorsSafeString(node->name));
+ return(-1);
}
xmlSecAssert2(ctx->pendingNotificationIdentifier == NULL, -1);
ctx->pendingNotificationIdentifier = xmlGetProp(node, xmlSecAttrIdentifier);
if(ctx->pendingNotificationIdentifier == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlGetProp",
- XMLSEC_ERRORS_R_XML_FAILED,
- "name=%s;node=%s",
- xmlSecErrorsSafeString(xmlSecAttrIdentifier),
- xmlSecErrorsSafeString(node->name));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlGetProp",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "name=%s;node=%s",
+ xmlSecErrorsSafeString(xmlSecAttrIdentifier),
+ xmlSecErrorsSafeString(node->name));
+ return(-1);
}
return(0);
@@ -1896,12 +1896,12 @@ xmlSecXkmsServerCtxPendingRequestNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
/* first read "parent" type */
ret = xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(ctx, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxRequestAbstractTypeNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxRequestAbstractTypeNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* todo: read responseId */
@@ -1923,11 +1923,11 @@ xmlSecXkmsServerCtxPendingRequestNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr
* <complexType name="QueryKeyBindingType">
* <complexContent>
* <extension base="xkms:KeyBindingAbstractType">
- * <sequence>
- * <element ref="xkms:TimeInstant" minOccurs="0"/>
- * </sequence>
- * </extension>
- * </complexContent>
+ * <sequence>
+ * <element ref="xkms:TimeInstant" minOccurs="0"/>
+ * </sequence>
+ * </extension>
+ * </complexContent>
* </complexType>
* <!-- /QueryKeyBinding -->
*/
@@ -1943,36 +1943,36 @@ xmlSecXkmsServerCtxQueryKeyBindingNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePt
cur = node;
ret = xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeRead(ctx, &cur);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* next is optional <xkms:TimeInstant/> node */
if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeTimeInstant, xmlSecXkmsNs)) {
- ret = xmlSecXkmsServerCtxTimeInstantNodeRead(ctx, cur);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxTimeInstantNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- cur = xmlSecGetNextElementNode(cur->next);
+ ret = xmlSecXkmsServerCtxTimeInstantNodeRead(ctx, cur);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxTimeInstantNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* check that there is nothing after the last node */
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -2017,34 +2017,34 @@ xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeRead(xmlSecXkmsServerCtxPtr ctx, xm
/* first node is optional <dsig:KeyInfo/> node. for now we only remember pointer */
xmlSecAssert2(ctx->keyInfoNode == NULL, -1);
if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeKeyInfo, xmlSecDSigNs)) {
- ctx->keyInfoNode = cur;
- cur = xmlSecGetNextElementNode(cur->next);
+ ctx->keyInfoNode = cur;
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* next is zero or more <xkms:KeyUsage/> nodes */
ret = xmlSecQName2BitMaskNodesRead(gXmlSecXkmsKeyUsageInfo, &cur,
- xmlSecNodeKeyUsage, xmlSecXkmsNs,
+ xmlSecNodeKeyUsage, xmlSecXkmsNs,
((ctx->flags & XMLSEC_XKMS_SERVER_FLAGS_STOP_ON_UNKNOWN_KEY_USAGE) != 0) ? 1 : 0,
- &(ctx->keyInfoReadCtx.keyReq.keyUsage));
+ &(ctx->keyInfoReadCtx.keyReq.keyUsage));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecQName2BitMaskNodesRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecNodeKeyUsage));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecQName2BitMaskNodesRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecNodeKeyUsage));
+ return(-1);
}
/* next is zero or more <xkms:UseKeyWith/> nodes */
ret = xmlSecXkmsServerCtxUseKeyWithNodesRead(ctx, &cur);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxUseKeyWithNodesRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxUseKeyWithNodesRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
(*node) = cur;
@@ -2063,59 +2063,59 @@ xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx, x
/* generate and add Id attribute */
ret = xmlSecGenerateAndAddID(node, xmlSecAttrId, ctx->idPrefix, ctx->idLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecGenerateAndAddID",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecGenerateAndAddID",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* <dsig:KeyInfo/> node */
cur = xmlSecAddChild(node, xmlSecNodeKeyInfo, xmlSecDSigNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeKeyInfo));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeKeyInfo));
+ return(-1);
}
ret = xmlSecXkmsServerCtxKeyInfoNodeWrite(ctx, cur, key);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxKeyInfoNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxKeyInfoNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* next is <xkms:KeyUsage/> node */
ret = xmlSecQName2BitMaskNodesWrite(gXmlSecXkmsKeyUsageInfo, node,
- xmlSecNodeKeyUsage, xmlSecXkmsNs,
- key->usage);
+ xmlSecNodeKeyUsage, xmlSecXkmsNs,
+ key->usage);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecQName2BitMaskNodesWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecNodeKeyUsage));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecQName2BitMaskNodesWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecNodeKeyUsage));
+ return(-1);
}
/* and the last node is <xkms:UseKeyWith/> */
ret = xmlSecXkmsServerCtxUseKeyWithNodesWrite(ctx, node, key);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxUseKeyWithNodesWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxUseKeyWithNodesWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -2132,22 +2132,22 @@ xmlSecXkmsServerCtxKeyInfoNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node,
/* add child nodes as requested in <xkms:RespondWith/> nodes */
ret = xmlSecXkmsRespondWithIdListWrite(&(ctx->respWithList), ctx, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsRespondWithIdListWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsRespondWithIdListWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecKeyInfoNodeWrite(node, key, &(ctx->keyInfoWriteCtx));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyInfoNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyInfoNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -2181,57 +2181,57 @@ xmlSecXkmsServerCtxUseKeyWithNodesRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr* n
cur = (*node);
while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeUseKeyWith, xmlSecXkmsNs)) {
- application = xmlGetProp(cur, xmlSecAttrApplication);
- if(application == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlGetProp",
- XMLSEC_ERRORS_R_XML_FAILED,
- "name=%s;node=%s",
- xmlSecErrorsSafeString(xmlSecAttrApplication),
- xmlSecErrorsSafeString(cur->name));
- return(-1);
- }
-
- identifier = xmlGetProp(cur, xmlSecAttrIdentifier);
- if(identifier == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlGetProp",
- XMLSEC_ERRORS_R_XML_FAILED,
- "name=%s;node=%s",
- xmlSecErrorsSafeString(xmlSecAttrIdentifier),
- xmlSecErrorsSafeString(cur->name));
- xmlFree(application);
- return(-1);
- }
-
- keyUseWith = xmlSecKeyUseWithCreate(application, identifier);
- if(keyUseWith == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyUseWithCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(application);
- xmlFree(identifier);
- return(-1);
- }
- xmlFree(application);
- xmlFree(identifier);
-
- ret = xmlSecPtrListAdd(list, keyUseWith);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyUseWithDestroy(keyUseWith);
- return(-1);
- }
-
- cur = xmlSecGetNextElementNode(cur->next);
+ application = xmlGetProp(cur, xmlSecAttrApplication);
+ if(application == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlGetProp",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "name=%s;node=%s",
+ xmlSecErrorsSafeString(xmlSecAttrApplication),
+ xmlSecErrorsSafeString(cur->name));
+ return(-1);
+ }
+
+ identifier = xmlGetProp(cur, xmlSecAttrIdentifier);
+ if(identifier == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlGetProp",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "name=%s;node=%s",
+ xmlSecErrorsSafeString(xmlSecAttrIdentifier),
+ xmlSecErrorsSafeString(cur->name));
+ xmlFree(application);
+ return(-1);
+ }
+
+ keyUseWith = xmlSecKeyUseWithCreate(application, identifier);
+ if(keyUseWith == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyUseWithCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(application);
+ xmlFree(identifier);
+ return(-1);
+ }
+ xmlFree(application);
+ xmlFree(identifier);
+
+ ret = xmlSecPtrListAdd(list, keyUseWith);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyUseWithDestroy(keyUseWith);
+ return(-1);
+ }
+
+ cur = xmlSecGetNextElementNode(cur->next);
}
(*node) = cur;
@@ -2275,12 +2275,12 @@ xmlSecXkmsServerCtxTimeInstantNodeRead(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr no
* <extension base="xkms:MessageAbstractType">
* <sequence>
* <element ref="xkms:RequestSignatureValue" minOccurs="0"/>
- * </sequence>
- * <attribute name="ResultMajor" type="QName" use="required"/>
- * <attribute name="ResultMinor" type="QName" use="optional"/>
- * <attribute name="RequestId" type="anyURI" use="optional"/>
- * </extension>
- * </complexContent>
+ * </sequence>
+ * <attribute name="ResultMajor" type="QName" use="required"/>
+ * <attribute name="ResultMinor" type="QName" use="optional"/>
+ * <attribute name="RequestId" type="anyURI" use="optional"/>
+ * </extension>
+ * </complexContent>
* </complexType>
* <!-- /ResultType -->
*/
@@ -2294,70 +2294,70 @@ xmlSecXkmsServerCtxResultTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr no
/* generate and add Id attribute */
ret = xmlSecGenerateAndAddID(node, xmlSecAttrId, ctx->idPrefix, ctx->idLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecGenerateAndAddID",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecGenerateAndAddID",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* todo: generate nonce? */
/* set Service atribute (required) */
if((ctx->service == NULL) || (xmlSetProp(node, xmlSecAttrService, ctx->service) == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSetProp",
- XMLSEC_ERRORS_R_XML_FAILED,
- "name=%s,value=%s",
- xmlSecErrorsSafeString(xmlSecAttrService),
- xmlSecErrorsSafeString(ctx->service));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSetProp",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "name=%s,value=%s",
+ xmlSecErrorsSafeString(xmlSecAttrService),
+ xmlSecErrorsSafeString(ctx->service));
+ return(-1);
}
/* set RequestId atribute (optional) */
if((ctx->id != NULL) && (xmlSetProp(node, xmlSecAttrRequestId, ctx->id) == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSetProp",
- XMLSEC_ERRORS_R_XML_FAILED,
- "name=%s,value=%s",
- xmlSecErrorsSafeString(xmlSecAttrRequestId),
- xmlSecErrorsSafeString(ctx->id));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSetProp",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "name=%s,value=%s",
+ xmlSecErrorsSafeString(xmlSecAttrRequestId),
+ xmlSecErrorsSafeString(ctx->id));
+ return(-1);
}
/* set major code (required) */
ret = xmlSecQName2IntegerAttributeWrite(gXmlSecXkmsResultMajorInfo, node,
- xmlSecAttrResultMajor, ctx->resultMajor);
+ xmlSecAttrResultMajor, ctx->resultMajor);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecQName2IntegerAttributeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s,value=%d",
- xmlSecErrorsSafeString(xmlSecAttrResultMajor),
- ctx->resultMajor);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecQName2IntegerAttributeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s,value=%d",
+ xmlSecErrorsSafeString(xmlSecAttrResultMajor),
+ ctx->resultMajor);
+ return(-1);
}
/* set minor code (optional) */
if(ctx->resultMinor != xmlSecXkmsResultMinorNone) {
ret = xmlSecQName2IntegerAttributeWrite(gXmlSecXkmsMinorErrorInfo, node,
- xmlSecAttrResultMinor, ctx->resultMinor);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecQName2IntegerAttributeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s,value=%d",
- xmlSecErrorsSafeString(xmlSecAttrResultMinor),
- ctx->resultMinor);
- return(-1);
- }
+ xmlSecAttrResultMinor, ctx->resultMinor);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecQName2IntegerAttributeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s,value=%d",
+ xmlSecErrorsSafeString(xmlSecAttrResultMinor),
+ ctx->resultMinor);
+ return(-1);
+ }
}
/* todo: create signature template */
@@ -2370,36 +2370,36 @@ xmlSecXkmsServerCtxResultTypeNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr no
if((ctx->resultMajor == xmlSecXkmsResultMajorSuccess) && (ctx->opaqueClientDataNode != NULL)) {
xmlNodePtr copyNode;
- copyNode = xmlDocCopyNode(ctx->opaqueClientDataNode, node->doc, 1);
- if(copyNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSetProp",
- XMLSEC_ERRORS_R_XML_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(ctx->opaqueClientDataNode->name));
- return(-1);
- }
-
- if(xmlSecAddChildNode(node, copyNode) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChildNode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(copyNode->name));
- return(-1);
- }
+ copyNode = xmlDocCopyNode(ctx->opaqueClientDataNode, node->doc, 1);
+ if(copyNode == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSetProp",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(ctx->opaqueClientDataNode->name));
+ return(-1);
+ }
+
+ if(xmlSecAddChildNode(node, copyNode) == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChildNode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(copyNode->name));
+ return(-1);
+ }
}
ret = xmlSecXkmsServerCtxRequestSignatureValueNodeWrite(ctx, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxRequestSignatureValueNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxRequestSignatureValueNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -2424,8 +2424,8 @@ xmlSecXkmsServerCtxRequestSignatureValueNodeWrite(xmlSecXkmsServerCtxPtr ctx, xm
/* todo: check all conditions for RequestSignatureValue */
if((ctx->responseMechanismMask & XMLSEC_XKMS_RESPONSE_MECHANISM_MASK_REQUEST_SIGNATURE_VALUE) == 0) {
- /* The ResponseMechanism RequestSignatureValue was not specified. */
- return(0);
+ /* The ResponseMechanism RequestSignatureValue was not specified. */
+ return(0);
}
/* todo: write RequestSignatureValue */
@@ -2469,23 +2469,23 @@ xmlSecXkmsServerCtxUnverifiedKeyBindingNodeWrite(xmlSecXkmsServerCtxPtr ctx, xml
/* first write "parent" type */
ret = xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite(ctx, node, key);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* <xkms:ValidityInterval/> node */
ret = xmlSecXkmsServerCtxValidityIntervalNodeWrite(ctx, node, key);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxValidityIntervalNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxValidityIntervalNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -2541,23 +2541,23 @@ xmlSecXkmsServerCtxKeyBindingNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNodePtr no
/* first write "parent" type */
ret = xmlSecXkmsServerCtxUnverifiedKeyBindingNodeWrite(ctx, node, key);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxKeyBindingAbstractTypeNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* <xkms:Status/> node */
ret = xmlSecXkmsServerCtxKeyBindingStatusNodeWrite(ctx, node, key);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxKeyBindingStatusNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxKeyBindingStatusNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -2606,26 +2606,26 @@ xmlSecXkmsServerCtxKeyBindingStatusNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNode
cur = xmlSecAddChild(node, xmlSecNodeStatus, xmlSecXkmsNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeStatus));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeStatus));
+ return(-1);
}
/* if we are here then the key was validated */
ret = xmlSecQName2IntegerAttributeWrite(gXmlSecXkmsKeyBindingStatusInfo, cur,
- xmlSecAttrStatusValue, xmlSecXkmsKeyBindingStatusValid);
+ xmlSecAttrStatusValue, xmlSecXkmsKeyBindingStatusValid);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecQName2IntegerAttributeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecAttrStatusValue));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecQName2IntegerAttributeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecAttrStatusValue));
+ return(-1);
}
/* todo: write the reasons */
@@ -2639,13 +2639,13 @@ xmlSecXkmsServerCtxKeyBindingStatusNodeWrite(xmlSecXkmsServerCtxPtr ctx, xmlNode
************************************************************************/
static xmlSecPtrListKlass xmlSecXkmsServerCtxPtrListKlass = {
BAD_CAST "xkms-server-ctx-list",
- NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
- (xmlSecPtrDestroyItemMethod)xmlSecXkmsServerCtxDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */
- (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsServerCtxDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
- (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsServerCtxDebugXmlDump, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
+ NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
+ (xmlSecPtrDestroyItemMethod)xmlSecXkmsServerCtxDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */
+ (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsServerCtxDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
+ (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsServerCtxDebugXmlDump, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
};
-xmlSecPtrListId
+xmlSecPtrListId
xmlSecXkmsServerCtxPtrListGetKlass(void) {
return(&xmlSecXkmsServerCtxPtrListKlass);
}
@@ -2685,21 +2685,21 @@ xmlSecXkmsRespondWithIdsInit(void) {
ret = xmlSecPtrListInitialize(xmlSecXkmsRespondWithIdsGet(), xmlSecXkmsRespondWithIdListId);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListPtrInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecXkmsRespondWithIdListId");
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListPtrInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecXkmsRespondWithIdListId");
return(-1);
}
ret = xmlSecXkmsRespondWithIdsRegisterDefault();
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsRespondWithIdsRegisterDefault",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsRespondWithIdsRegisterDefault",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -2719,7 +2719,7 @@ xmlSecXkmsRespondWithIdsShutdown(void) {
/**
* xmlSecXkmsRespondWithIdsRegister:
- * @id: the RespondWith klass.
+ * @id: the RespondWith klass.
*
* Registers @id in the global list of RespondWith klasses.
*
@@ -2733,12 +2733,12 @@ xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithId id) {
ret = xmlSecPtrListAdd(xmlSecXkmsRespondWithIdsGet(), (xmlSecPtr)id);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "RespondWith=%s",
- xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "RespondWith=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)));
return(-1);
}
@@ -2756,95 +2756,95 @@ xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithId id) {
int
xmlSecXkmsRespondWithIdsRegisterDefault(void) {
if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithKeyNameId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsRespondWithIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithKeyNameId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsRespondWithIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithKeyNameId)));
+ return(-1);
}
if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithKeyValueId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsRespondWithIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithKeyValueId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsRespondWithIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithKeyValueId)));
+ return(-1);
}
if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithPrivateKeyId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsRespondWithIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithPrivateKeyId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsRespondWithIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithPrivateKeyId)));
+ return(-1);
}
if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithRetrievalMethodId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsRespondWithIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithRetrievalMethodId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsRespondWithIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithRetrievalMethodId)));
+ return(-1);
}
if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithX509CertId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsRespondWithIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithX509CertId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsRespondWithIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithX509CertId)));
+ return(-1);
}
if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithX509ChainId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsRespondWithIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithX509ChainId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsRespondWithIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithX509ChainId)));
+ return(-1);
}
if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithX509CRLId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsRespondWithIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithX509CRLId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsRespondWithIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithX509CRLId)));
+ return(-1);
}
/* TODO: OCSP, PGP, PGPWeb, SPKI */
/*
if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithPGPId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsRespondWithIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithPGPId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsRespondWithIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithPGPId)));
+ return(-1);
}
if(xmlSecXkmsRespondWithIdsRegister(xmlSecXkmsRespondWithSPKIId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsRespondWithIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithSPKIId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsRespondWithIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(xmlSecXkmsRespondWithSPKIId)));
+ return(-1);
}
*/
return(0);
@@ -2858,9 +2858,9 @@ xmlSecXkmsRespondWithIdsRegisterDefault(void) {
************************************************************************/
/**
* xmlSecXkmsRespondWithNodeRead:
- * @id: the RespondWith class.
- * @ctx: the XKMS request processing context.
- * @node: the pointer to <xkms:RespondWith/> node.
+ * @id: the RespondWith class.
+ * @ctx: the XKMS request processing context.
+ * @node: the pointer to <xkms:RespondWith/> node.
*
* Reads the content of the <xkms:RespondWith/> @node.
*
@@ -2868,22 +2868,22 @@ xmlSecXkmsRespondWithIdsRegisterDefault(void) {
*/
int
xmlSecXkmsRespondWithNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node) {
+ xmlNodePtr node) {
xmlSecAssert2(id != xmlSecXkmsRespondWithIdUnknown, -1);
xmlSecAssert2(ctx != NULL, -1);
xmlSecAssert2(node != NULL, -1);
if(id->readNode != NULL) {
- return((id->readNode)(id, ctx, node));
+ return((id->readNode)(id, ctx, node));
}
return(0);
}
/**
* xmlSecXkmsRespondWithNodeWrite:
- * @id: the RespondWith class.
- * @ctx: the XKMS request processing context.
- * @node: the pointer to <xkms:RespondWith/> node.
+ * @id: the RespondWith class.
+ * @ctx: the XKMS request processing context.
+ * @node: the pointer to <xkms:RespondWith/> node.
*
* Writes the content of the <xkms:RespondWith/> @node.
*
@@ -2891,21 +2891,21 @@ xmlSecXkmsRespondWithNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr
*/
int
xmlSecXkmsRespondWithNodeWrite(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node) {
+ xmlNodePtr node) {
xmlSecAssert2(id != xmlSecXkmsRespondWithIdUnknown, -1);
xmlSecAssert2(ctx != NULL, -1);
xmlSecAssert2(node != NULL, -1);
if(id->writeNode != NULL) {
- return((id->writeNode)(id, ctx, node));
+ return((id->writeNode)(id, ctx, node));
}
return(0);
}
/**
* xmlSecXkmsRespondWithDebugDump:
- * @id: the RespondWith class.
- * @output: the output file.
+ * @id: the RespondWith class.
+ * @output: the output file.
*
* Writes debug information about @id into the @output.
*/
@@ -2921,8 +2921,8 @@ xmlSecXkmsRespondWithDebugDump(xmlSecXkmsRespondWithId id, FILE* output) {
/**
* xmlSecXkmsRespondWithDebugXmlDump:
- * @id: the RespondWith class.
- * @output: the output file.
+ * @id: the RespondWith class.
+ * @output: the output file.
*
* Writes debug information about @id into the @output in XML format.
*/
@@ -2940,7 +2940,7 @@ xmlSecXkmsRespondWithDebugXmlDump(xmlSecXkmsRespondWithId id, FILE* output) {
int
xmlSecXkmsRespondWithDefaultNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node) {
+ xmlNodePtr node) {
int ret;
xmlSecAssert2(id != xmlSecXkmsRespondWithIdUnknown, -1);
@@ -2949,25 +2949,25 @@ xmlSecXkmsRespondWithDefaultNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServe
ret = xmlSecXkmsRespondWithIdListFind(&(ctx->respWithList), id);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)),
- "xmlSecXkmsRespondWithIdListFind",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)),
+ "xmlSecXkmsRespondWithIdListFind",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
} else if(ret > 0) {
- /* do nothing, we already have it in the list */
- return(0);
+ /* do nothing, we already have it in the list */
+ return(0);
}
ret = xmlSecPtrListAdd(&(ctx->respWithList), id);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)),
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)),
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -2975,7 +2975,7 @@ xmlSecXkmsRespondWithDefaultNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServe
int
xmlSecXkmsRespondWithDefaultNodeWrite(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node) {
+ xmlNodePtr node) {
xmlNodePtr cur;
xmlSecAssert2(id != xmlSecXkmsRespondWithIdUnknown, -1);
@@ -2985,13 +2985,13 @@ xmlSecXkmsRespondWithDefaultNodeWrite(xmlSecXkmsRespondWithId id, xmlSecXkmsServ
cur = xmlSecAddChild(node, id->nodeName, id->nodeNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)),
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(id->nodeName));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)),
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(id->nodeName));
+ return(-1);
}
return(0);
@@ -3004,13 +3004,13 @@ xmlSecXkmsRespondWithDefaultNodeWrite(xmlSecXkmsRespondWithId id, xmlSecXkmsServ
************************************************************************/
static xmlSecPtrListKlass xmlSecXkmsRespondWithIdListKlass = {
BAD_CAST "respond-with-ids-list",
- NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
- NULL, /* xmlSecPtrDestroyItemMethod destroyItem; */
- (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsRespondWithDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
- (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsRespondWithDebugXmlDump, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
+ NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
+ NULL, /* xmlSecPtrDestroyItemMethod destroyItem; */
+ (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsRespondWithDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
+ (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsRespondWithDebugXmlDump, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
};
-xmlSecPtrListId
+xmlSecPtrListId
xmlSecXkmsRespondWithIdListGetKlass(void) {
return(&xmlSecXkmsRespondWithIdListKlass);
}
@@ -3024,9 +3024,9 @@ xmlSecXkmsRespondWithIdListFind(xmlSecPtrListPtr list, xmlSecXkmsRespondWithId i
size = xmlSecPtrListGetSize(list);
for(i = 0; i < size; ++i) {
- if((xmlSecXkmsRespondWithId)xmlSecPtrListGetItem(list, i) == id) {
- return(1);
- }
+ if((xmlSecXkmsRespondWithId)xmlSecPtrListGetItem(list, i) == id) {
+ return(1);
+ }
}
return(0);
}
@@ -3047,13 +3047,13 @@ xmlSecXkmsRespondWithIdListFindByNodeValue(xmlSecPtrListPtr list, xmlNodePtr nod
content = xmlNodeGetContent(node);
if(content == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecError(XMLSEC_ERRORS_HERE,
NULL,
- "xmlNodeGetContent",
- XMLSEC_ERRORS_R_XML_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(node->name));
- return(xmlSecXkmsRespondWithIdUnknown);
+ "xmlNodeGetContent",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(node->name));
+ return(xmlSecXkmsRespondWithIdUnknown);
}
qnameLocalPart = (xmlChar*)xmlStrchr(content, ':');
@@ -3068,27 +3068,27 @@ xmlSecXkmsRespondWithIdListFindByNodeValue(xmlSecPtrListPtr list, xmlNodePtr nod
/* search namespace href */
ns = xmlSearchNs(node->doc, node, qnamePrefix);
if((ns == NULL) && (qnamePrefix != NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSearchNs",
- XMLSEC_ERRORS_R_XML_FAILED,
- "node=%s,qnamePrefix=%s",
- xmlSecErrorsSafeString(node->name),
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSearchNs",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "node=%s,qnamePrefix=%s",
+ xmlSecErrorsSafeString(node->name),
xmlSecErrorsSafeString(qnamePrefix));
xmlFree(content);
- return(xmlSecXkmsRespondWithIdUnknown);
+ return(xmlSecXkmsRespondWithIdUnknown);
}
qnameHref = (ns != NULL) ? ns->href : BAD_CAST NULL;
size = xmlSecPtrListGetSize(list);
for(i = 0; i < size; ++i) {
- id = (xmlSecXkmsRespondWithId)xmlSecPtrListGetItem(list, i);
- if((id != xmlSecXkmsRespondWithIdUnknown) &&
+ id = (xmlSecXkmsRespondWithId)xmlSecPtrListGetItem(list, i);
+ if((id != xmlSecXkmsRespondWithIdUnknown) &&
xmlStrEqual(id->valueName, qnameLocalPart) &&
xmlStrEqual(id->valueNs, qnameHref)) {
- result = id;
+ result = id;
break;
- }
+ }
}
xmlFree(content);
@@ -3107,18 +3107,18 @@ xmlSecXkmsRespondWithIdListWrite(xmlSecPtrListPtr list, xmlSecXkmsServerCtxPtr c
size = xmlSecPtrListGetSize(list);
for(i = 0; i < size; ++i) {
- id = (xmlSecXkmsRespondWithId)xmlSecPtrListGetItem(list, i);
- if(id != xmlSecXkmsRespondWithIdUnknown) {
- ret = xmlSecXkmsRespondWithNodeWrite(id, ctx, node);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)),
- "xmlSecXkmsRespondWithNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- }
+ id = (xmlSecXkmsRespondWithId)xmlSecPtrListGetItem(list, i);
+ if(id != xmlSecXkmsRespondWithIdUnknown) {
+ ret = xmlSecXkmsRespondWithNodeWrite(id, ctx, node);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)),
+ "xmlSecXkmsRespondWithNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ }
}
return(0);
@@ -3130,12 +3130,12 @@ xmlSecXkmsRespondWithIdListWrite(xmlSecPtrListPtr list, xmlSecXkmsServerCtxPtr c
*
*******************************************************************/
static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithKeyNameKlass = {
- xmlSecRespondWithKeyName, /* const xmlChar* valueName; */
- xmlSecXkmsNs, /* const xmlChar* valueNs; */
- xmlSecNodeKeyName, /* const xmlChar* nodeName; */
- xmlSecDSigNs, /* const xmlChar* nodeNs; */
- xmlSecXkmsRespondWithDefaultNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */
- xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */
+ xmlSecRespondWithKeyName, /* const xmlChar* valueName; */
+ xmlSecXkmsNs, /* const xmlChar* valueNs; */
+ xmlSecNodeKeyName, /* const xmlChar* nodeName; */
+ xmlSecDSigNs, /* const xmlChar* nodeNs; */
+ xmlSecXkmsRespondWithDefaultNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */
+ xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */
NULL, /* void* reserved1; */
NULL /* void* reserved2; */
};
@@ -3147,23 +3147,23 @@ static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithKeyNameKlass = {
*
* Returns: respond with KeyName klass.
*/
-xmlSecXkmsRespondWithId
+xmlSecXkmsRespondWithId
xmlSecXkmsRespondWithKeyNameGetKlass(void) {
return(&xmlSecXkmsRespondWithKeyNameKlass);
}
-static int xmlSecXkmsRespondWithKeyValueNodeRead (xmlSecXkmsRespondWithId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
+static int xmlSecXkmsRespondWithKeyValueNodeRead (xmlSecXkmsRespondWithId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithKeyValueKlass = {
- xmlSecRespondWithKeyValue, /* const xmlChar* valueName; */
- xmlSecXkmsNs, /* const xmlChar* valueNs; */
- xmlSecNodeKeyValue, /* const xmlChar* nodeName; */
- xmlSecDSigNs, /* const xmlChar* nodeNs; */
- xmlSecXkmsRespondWithKeyValueNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */
- xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */
+ xmlSecRespondWithKeyValue, /* const xmlChar* valueName; */
+ xmlSecXkmsNs, /* const xmlChar* valueNs; */
+ xmlSecNodeKeyValue, /* const xmlChar* nodeName; */
+ xmlSecDSigNs, /* const xmlChar* nodeNs; */
+ xmlSecXkmsRespondWithKeyValueNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */
+ xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */
NULL, /* void* reserved1; */
NULL /* void* reserved2; */
};
@@ -3175,14 +3175,14 @@ static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithKeyValueKlass = {
*
* Returns: respond with KeyValue klass.
*/
-xmlSecXkmsRespondWithId
+xmlSecXkmsRespondWithId
xmlSecXkmsRespondWithKeyValueGetKlass(void) {
return(&xmlSecXkmsRespondWithKeyValueKlass);
}
static int
xmlSecXkmsRespondWithKeyValueNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node) {
+ xmlNodePtr node) {
int ret;
xmlSecAssert2(id == xmlSecXkmsRespondWithKeyValueId, -1);
@@ -3192,12 +3192,12 @@ xmlSecXkmsRespondWithKeyValueNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServ
/* do usual stuff */
ret = xmlSecXkmsRespondWithDefaultNodeRead(id, ctx, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)),
- "xmlSecXkmsRespondWithDefaultNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)),
+ "xmlSecXkmsRespondWithDefaultNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* and now set some parameters in the ctx to look for a public or private
@@ -3209,16 +3209,16 @@ xmlSecXkmsRespondWithKeyValueNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServ
return(0);
}
-static int xmlSecXkmsRespondWithPrivateKeyNodeRead (xmlSecXkmsRespondWithId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
+static int xmlSecXkmsRespondWithPrivateKeyNodeRead (xmlSecXkmsRespondWithId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithPrivateKeyKlass = {
- xmlSecRespondWithPrivateKey, /* const xmlChar* valueName; */
- xmlSecXkmsNs, /* const xmlChar* valueNs; */
- xmlSecNodeKeyValue, /* const xmlChar* nodeName; */
- xmlSecDSigNs, /* const xmlChar* nodeNs; */
- xmlSecXkmsRespondWithPrivateKeyNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */
- xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */
+ xmlSecRespondWithPrivateKey, /* const xmlChar* valueName; */
+ xmlSecXkmsNs, /* const xmlChar* valueNs; */
+ xmlSecNodeKeyValue, /* const xmlChar* nodeName; */
+ xmlSecDSigNs, /* const xmlChar* nodeNs; */
+ xmlSecXkmsRespondWithPrivateKeyNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */
+ xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */
NULL, /* void* reserved1; */
NULL /* void* reserved2; */
};
@@ -3230,14 +3230,14 @@ static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithPrivateKeyKlass = {
*
* Returns: respond with PrivateKey klass.
*/
-xmlSecXkmsRespondWithId
+xmlSecXkmsRespondWithId
xmlSecXkmsRespondWithPrivateKeyGetKlass(void) {
return(&xmlSecXkmsRespondWithPrivateKeyKlass);
}
static int
xmlSecXkmsRespondWithPrivateKeyNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node) {
+ xmlNodePtr node) {
int ret;
xmlSecAssert2(id == xmlSecXkmsRespondWithPrivateKeyId, -1);
@@ -3247,12 +3247,12 @@ xmlSecXkmsRespondWithPrivateKeyNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsSe
/* do usual stuff */
ret = xmlSecXkmsRespondWithDefaultNodeRead(id, ctx, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)),
- "xmlSecXkmsRespondWithDefaultNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)),
+ "xmlSecXkmsRespondWithDefaultNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* and now set some parameters in the ctx to look for a private
@@ -3265,12 +3265,12 @@ xmlSecXkmsRespondWithPrivateKeyNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsSe
}
static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithRetrievalMethodKlass = {
- xmlSecRespondWithRetrievalMethod, /* const xmlChar* valueName; */
- xmlSecXkmsNs, /* const xmlChar* valueNs; */
- xmlSecNodeRetrievalMethod, /* const xmlChar* nodeName; */
- xmlSecDSigNs, /* const xmlChar* nodeNs; */
- xmlSecXkmsRespondWithDefaultNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */
- xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */
+ xmlSecRespondWithRetrievalMethod, /* const xmlChar* valueName; */
+ xmlSecXkmsNs, /* const xmlChar* valueNs; */
+ xmlSecNodeRetrievalMethod, /* const xmlChar* nodeName; */
+ xmlSecDSigNs, /* const xmlChar* nodeNs; */
+ xmlSecXkmsRespondWithDefaultNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */
+ xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */
NULL, /* void* reserved1; */
NULL /* void* reserved2; */
};
@@ -3282,23 +3282,23 @@ static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithRetrievalMethodKlass = {
*
* Returns: respond with RetrievalMethod klass.
*/
-xmlSecXkmsRespondWithId
+xmlSecXkmsRespondWithId
xmlSecXkmsRespondWithRetrievalMethodGetKlass(void) {
return(&xmlSecXkmsRespondWithRetrievalMethodKlass);
}
-static int xmlSecXkmsRespondWithX509CertNodeRead (xmlSecXkmsRespondWithId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
+static int xmlSecXkmsRespondWithX509CertNodeRead (xmlSecXkmsRespondWithId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithX509CertKlass = {
- xmlSecRespondWithX509Cert, /* const xmlChar* valueName; */
- xmlSecXkmsNs, /* const xmlChar* valueNs; */
- xmlSecNodeX509Data, /* const xmlChar* nodeName; */
- xmlSecDSigNs, /* const xmlChar* nodeNs; */
- xmlSecXkmsRespondWithX509CertNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */
- xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */
+ xmlSecRespondWithX509Cert, /* const xmlChar* valueName; */
+ xmlSecXkmsNs, /* const xmlChar* valueNs; */
+ xmlSecNodeX509Data, /* const xmlChar* nodeName; */
+ xmlSecDSigNs, /* const xmlChar* nodeNs; */
+ xmlSecXkmsRespondWithX509CertNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */
+ xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */
NULL, /* void* reserved1; */
NULL /* void* reserved2; */
};
@@ -3310,14 +3310,14 @@ static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithX509CertKlass = {
*
* Returns: respond with X509Cert klass.
*/
-xmlSecXkmsRespondWithId
+xmlSecXkmsRespondWithId
xmlSecXkmsRespondWithX509CertGetKlass(void) {
return(&xmlSecXkmsRespondWithX509CertKlass);
}
static int
xmlSecXkmsRespondWithX509CertNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node) {
+ xmlNodePtr node) {
int ret;
xmlSecAssert2(id == xmlSecXkmsRespondWithX509CertId, -1);
@@ -3327,27 +3327,27 @@ xmlSecXkmsRespondWithX509CertNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServ
/* do usual stuff */
ret = xmlSecXkmsRespondWithDefaultNodeRead(id, ctx, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)),
- "xmlSecXkmsRespondWithDefaultNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)),
+ "xmlSecXkmsRespondWithDefaultNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
-static int xmlSecXkmsRespondWithX509ChainNodeRead (xmlSecXkmsRespondWithId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
+static int xmlSecXkmsRespondWithX509ChainNodeRead (xmlSecXkmsRespondWithId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithX509ChainKlass = {
- xmlSecRespondWithX509Chain, /* const xmlChar* valueName; */
- xmlSecXkmsNs, /* const xmlChar* valueNs; */
- xmlSecNodeX509Data, /* const xmlChar* nodeName; */
- xmlSecDSigNs, /* const xmlChar* nodeNs; */
- xmlSecXkmsRespondWithX509ChainNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */
- xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */
+ xmlSecRespondWithX509Chain, /* const xmlChar* valueName; */
+ xmlSecXkmsNs, /* const xmlChar* valueNs; */
+ xmlSecNodeX509Data, /* const xmlChar* nodeName; */
+ xmlSecDSigNs, /* const xmlChar* nodeNs; */
+ xmlSecXkmsRespondWithX509ChainNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */
+ xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */
NULL, /* void* reserved1; */
NULL /* void* reserved2; */
};
@@ -3359,14 +3359,14 @@ static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithX509ChainKlass = {
*
* Returns: respond with X509Chain klass.
*/
-xmlSecXkmsRespondWithId
+xmlSecXkmsRespondWithId
xmlSecXkmsRespondWithX509ChainGetKlass(void) {
return(&xmlSecXkmsRespondWithX509ChainKlass);
}
static int
xmlSecXkmsRespondWithX509ChainNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node) {
+ xmlNodePtr node) {
int ret;
xmlSecAssert2(id == xmlSecXkmsRespondWithX509ChainId, -1);
@@ -3376,27 +3376,27 @@ xmlSecXkmsRespondWithX509ChainNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsSer
/* do usual stuff */
ret = xmlSecXkmsRespondWithDefaultNodeRead(id, ctx, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)),
- "xmlSecXkmsRespondWithDefaultNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)),
+ "xmlSecXkmsRespondWithDefaultNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
-static int xmlSecXkmsRespondWithX509CRLNodeRead (xmlSecXkmsRespondWithId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
+static int xmlSecXkmsRespondWithX509CRLNodeRead (xmlSecXkmsRespondWithId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithX509CRLKlass = {
- xmlSecRespondWithX509CRL, /* const xmlChar* valueName; */
- xmlSecXkmsNs, /* const xmlChar* valueNs; */
- xmlSecNodeX509Data, /* const xmlChar* nodeName; */
- xmlSecDSigNs, /* const xmlChar* nodeNs; */
- xmlSecXkmsRespondWithX509CRLNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */
- xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */
+ xmlSecRespondWithX509CRL, /* const xmlChar* valueName; */
+ xmlSecXkmsNs, /* const xmlChar* valueNs; */
+ xmlSecNodeX509Data, /* const xmlChar* nodeName; */
+ xmlSecDSigNs, /* const xmlChar* nodeNs; */
+ xmlSecXkmsRespondWithX509CRLNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */
+ xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */
NULL, /* void* reserved1; */
NULL /* void* reserved2; */
};
@@ -3408,14 +3408,14 @@ static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithX509CRLKlass = {
*
* Returns: respond with X509CRL klass.
*/
-xmlSecXkmsRespondWithId
+xmlSecXkmsRespondWithId
xmlSecXkmsRespondWithX509CRLGetKlass(void) {
return(&xmlSecXkmsRespondWithX509CRLKlass);
}
static int
xmlSecXkmsRespondWithX509CRLNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node) {
+ xmlNodePtr node) {
int ret;
xmlSecAssert2(id == xmlSecXkmsRespondWithX509CRLId, -1);
@@ -3425,24 +3425,24 @@ xmlSecXkmsRespondWithX509CRLNodeRead(xmlSecXkmsRespondWithId id, xmlSecXkmsServe
/* do usual stuff */
ret = xmlSecXkmsRespondWithDefaultNodeRead(id, ctx, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)),
- "xmlSecXkmsRespondWithDefaultNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecXkmsRespondWithKlassGetName(id)),
+ "xmlSecXkmsRespondWithDefaultNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithPGPKlass = {
- xmlSecRespondWithPGP, /* const xmlChar* valueName; */
- xmlSecXkmsNs, /* const xmlChar* valueNs; */
- xmlSecNodePGPData, /* const xmlChar* nodeName; */
- xmlSecDSigNs, /* const xmlChar* nodeNs; */
- xmlSecXkmsRespondWithDefaultNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */
- xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */
+ xmlSecRespondWithPGP, /* const xmlChar* valueName; */
+ xmlSecXkmsNs, /* const xmlChar* valueNs; */
+ xmlSecNodePGPData, /* const xmlChar* nodeName; */
+ xmlSecDSigNs, /* const xmlChar* nodeNs; */
+ xmlSecXkmsRespondWithDefaultNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */
+ xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */
NULL, /* void* reserved1; */
NULL /* void* reserved2; */
};
@@ -3454,18 +3454,18 @@ static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithPGPKlass = {
*
* Returns: respond with PGP klass.
*/
-xmlSecXkmsRespondWithId
+xmlSecXkmsRespondWithId
xmlSecXkmsRespondWithPGPGetKlass(void) {
return(&xmlSecXkmsRespondWithPGPKlass);
}
static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithSPKIKlass = {
- xmlSecRespondWithSPKI, /* const xmlChar* valueName; */
- xmlSecXkmsNs, /* const xmlChar* valueNs; */
- xmlSecNodeSPKIData, /* const xmlChar* nodeName; */
- xmlSecDSigNs, /* const xmlChar* nodeNs; */
- xmlSecXkmsRespondWithDefaultNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */
- xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */
+ xmlSecRespondWithSPKI, /* const xmlChar* valueName; */
+ xmlSecXkmsNs, /* const xmlChar* valueNs; */
+ xmlSecNodeSPKIData, /* const xmlChar* nodeName; */
+ xmlSecDSigNs, /* const xmlChar* nodeNs; */
+ xmlSecXkmsRespondWithDefaultNodeRead, /* xmlSecXkmsRespondWithNodeReadMethod readNode; */
+ xmlSecXkmsRespondWithDefaultNodeWrite, /* xmlSecXkmsRespondWithNodeWriteMethod writeNode; */
NULL, /* void* reserved1; */
NULL /* void* reserved2; */
};
@@ -3477,7 +3477,7 @@ static xmlSecXkmsRespondWithKlass xmlSecXkmsRespondWithSPKIKlass = {
*
* Returns: respond with SPKI klass.
*/
-xmlSecXkmsRespondWithId
+xmlSecXkmsRespondWithId
xmlSecXkmsRespondWithSPKIGetKlass(void) {
return(&xmlSecXkmsRespondWithSPKIKlass);
}
@@ -3516,21 +3516,21 @@ xmlSecXkmsServerRequestIdsInit(void) {
ret = xmlSecPtrListInitialize(xmlSecXkmsServerRequestIdsGet(), xmlSecXkmsServerRequestIdListId);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListPtrInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecXkmsServerRequestIdListId");
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListPtrInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecXkmsServerRequestIdListId");
return(-1);
}
ret = xmlSecXkmsServerRequestIdsRegisterDefault();
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerRequestIdsRegisterDefault",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerRequestIdsRegisterDefault",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -3550,7 +3550,7 @@ xmlSecXkmsServerRequestIdsShutdown(void) {
/**
* xmlSecXkmsServerRequestIdsRegister:
- * @id: the ServerRequest klass.
+ * @id: the ServerRequest klass.
*
* Registers @id in the global list of ServerRequest klasses.
*
@@ -3564,12 +3564,12 @@ xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestId id) {
ret = xmlSecPtrListAdd(xmlSecXkmsServerRequestIdsGet(), (xmlSecPtr)id);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "ServerRequest=%s",
- xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(id)));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "ServerRequest=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(id)));
return(-1);
}
@@ -3587,53 +3587,53 @@ xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestId id) {
int
xmlSecXkmsServerRequestIdsRegisterDefault(void) {
if(xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestResultId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerRequestIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(xmlSecXkmsServerRequestResultId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerRequestIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(xmlSecXkmsServerRequestResultId)));
+ return(-1);
}
if(xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestStatusId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerRequestIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(xmlSecXkmsServerRequestStatusId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerRequestIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(xmlSecXkmsServerRequestStatusId)));
+ return(-1);
}
if(xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestCompoundId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerRequestIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(xmlSecXkmsServerRequestCompoundId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerRequestIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(xmlSecXkmsServerRequestCompoundId)));
+ return(-1);
}
if(xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestLocateId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerRequestIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(xmlSecXkmsServerRequestLocateId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerRequestIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(xmlSecXkmsServerRequestLocateId)));
+ return(-1);
}
if(xmlSecXkmsServerRequestIdsRegister(xmlSecXkmsServerRequestValidateId) < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerRequestIdsRegister",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "name=%s",
- xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(xmlSecXkmsServerRequestValidateId)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerRequestIdsRegister",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "name=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(xmlSecXkmsServerRequestValidateId)));
+ return(-1);
}
return(0);
@@ -3647,9 +3647,9 @@ xmlSecXkmsServerRequestIdsRegisterDefault(void) {
************************************************************************/
/**
* xmlSecXkmsServerRequestNodeRead:
- * @id: the ServerRequest class.
- * @ctx: the XKMS request processing context.
- * @node: the pointer to <xkms:ServerRequest/> node.
+ * @id: the ServerRequest class.
+ * @ctx: the XKMS request processing context.
+ * @node: the pointer to <xkms:ServerRequest/> node.
*
* Reads the content of the <xkms:ServerRequest/> @node.
*
@@ -3657,21 +3657,21 @@ xmlSecXkmsServerRequestIdsRegisterDefault(void) {
*/
int
xmlSecXkmsServerRequestNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node) {
+ xmlNodePtr node) {
xmlSecAssert2(id != xmlSecXkmsServerRequestIdUnknown, -1);
xmlSecAssert2(ctx != NULL, -1);
xmlSecAssert2(node != NULL, -1);
if(id->readNode != NULL) {
- return((id->readNode)(id, ctx, node));
+ return((id->readNode)(id, ctx, node));
}
return(0);
}
/**
* xmlSecXkmsServerExecute:
- * @id: the ServerRequest class.
- * @ctx: the XKMS request processing context.
+ * @id: the ServerRequest class.
+ * @ctx: the XKMS request processing context.
*
* Executes XKMS server request.
*
@@ -3683,7 +3683,7 @@ xmlSecXkmsServerRequestExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtx
xmlSecAssert2(ctx != NULL, -1);
if(id->execute != NULL) {
- return((id->execute)(id, ctx));
+ return((id->execute)(id, ctx));
}
return(0);
}
@@ -3691,9 +3691,9 @@ xmlSecXkmsServerRequestExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtx
/**
* xmlSecXkmsServerResponseNodeWrite:
- * @id: the ServerRequest class.
- * @ctx: the XKMS request processing context.
- * @doc: the pointer to response parent XML document (might be NULL).
+ * @id: the ServerRequest class.
+ * @ctx: the XKMS request processing context.
+ * @doc: the pointer to response parent XML document (might be NULL).
* @node: the pointer to response parent XML node (might be NULL).
*
* Writes XKMS response from context to a newly created node. Caller is
@@ -3704,7 +3704,7 @@ xmlSecXkmsServerRequestExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtx
*/
xmlNodePtr
xmlSecXkmsServerRequestNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx,
- xmlDocPtr doc, xmlNodePtr node) {
+ xmlDocPtr doc, xmlNodePtr node) {
xmlNodePtr respNode;
int ret;
@@ -3717,22 +3717,22 @@ xmlSecXkmsServerRequestNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsServerC
respNode = xmlNewDocNode(doc, NULL, id->resultNodeName, NULL);
if(respNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewDocNode",
- XMLSEC_ERRORS_R_XML_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(id->resultNodeName));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewDocNode",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(id->resultNodeName));
return(NULL);
}
ns = xmlNewNs(respNode, id->resultNodeNs, NULL);
if(ns == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewNs",
- XMLSEC_ERRORS_R_XML_FAILED,
- "ns=%s",
- xmlSecErrorsSafeString(id->resultNodeNs));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewNs",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "ns=%s",
+ xmlSecErrorsSafeString(id->resultNodeNs));
xmlFreeNode(respNode);
return(NULL);
}
@@ -3740,25 +3740,25 @@ xmlSecXkmsServerRequestNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsServerC
} else {
respNode = xmlSecAddChild(node, id->resultNodeName, id->resultNodeNs);
if(respNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(id->resultNodeName));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(id->resultNodeName));
return(NULL);
}
}
if(id->writeNode != NULL) {
- ret = (id->writeNode)(id, ctx, respNode);
- if(ret < 0) {
+ ret = (id->writeNode)(id, ctx, respNode);
+ if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "writeNode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(id->resultNodeName));
+ NULL,
+ "writeNode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(id->resultNodeName));
xmlFreeNode(respNode);
return(NULL);
}
@@ -3769,8 +3769,8 @@ xmlSecXkmsServerRequestNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsServerC
/**
* xmlSecXkmsServerRequestDebugDump:
- * @id: the ServerRequest class.
- * @output: the output file.
+ * @id: the ServerRequest class.
+ * @output: the output file.
*
* Writes debug information about @id into the @output.
*/
@@ -3784,8 +3784,8 @@ xmlSecXkmsServerRequestDebugDump(xmlSecXkmsServerRequestId id, FILE* output) {
/**
* xmlSecXkmsServerRequestDebugXmlDump:
- * @id: the ServerRequest class.
- * @output: the output file.
+ * @id: the ServerRequest class.
+ * @output: the output file.
*
* Writes debug information about @id into the @output in XML format.
*/
@@ -3806,13 +3806,13 @@ xmlSecXkmsServerRequestDebugXmlDump(xmlSecXkmsServerRequestId id, FILE* output)
************************************************************************/
static xmlSecPtrListKlass xmlSecXkmsServerRequestIdListKlass = {
BAD_CAST "xkms-server-request-ids-list",
- NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
- NULL, /* xmlSecPtrDestroyItemMethod destroyItem; */
- (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsServerRequestDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
- (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsServerRequestDebugXmlDump, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
+ NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
+ NULL, /* xmlSecPtrDestroyItemMethod destroyItem; */
+ (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsServerRequestDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
+ (xmlSecPtrDebugDumpItemMethod)xmlSecXkmsServerRequestDebugXmlDump, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
};
-xmlSecPtrListId
+xmlSecPtrListId
xmlSecXkmsServerRequestIdListGetKlass(void) {
return(&xmlSecXkmsServerRequestIdListKlass);
}
@@ -3826,9 +3826,9 @@ xmlSecXkmsServerRequestIdListFind(xmlSecPtrListPtr list, xmlSecXkmsServerRequest
size = xmlSecPtrListGetSize(list);
for(i = 0; i < size; ++i) {
- if((xmlSecXkmsServerRequestId)xmlSecPtrListGetItem(list, i) == id) {
- return(1);
- }
+ if((xmlSecXkmsServerRequestId)xmlSecPtrListGetItem(list, i) == id) {
+ return(1);
+ }
}
return(0);
}
@@ -3843,10 +3843,10 @@ xmlSecXkmsServerRequestIdListFindByName(xmlSecPtrListPtr list, const xmlChar* na
size = xmlSecPtrListGetSize(list);
for(i = 0; i < size; ++i) {
- id = (xmlSecXkmsServerRequestId)xmlSecPtrListGetItem(list, i);
- if((id != xmlSecXkmsServerRequestIdUnknown) && xmlStrEqual(id->name, name)) {
- return(id);
- }
+ id = (xmlSecXkmsServerRequestId)xmlSecPtrListGetItem(list, i);
+ if((id != xmlSecXkmsServerRequestIdUnknown) && xmlStrEqual(id->name, name)) {
+ return(id);
+ }
}
return(xmlSecXkmsServerRequestIdUnknown);
}
@@ -3861,12 +3861,12 @@ xmlSecXkmsServerRequestIdListFindByNode(xmlSecPtrListPtr list, xmlNodePtr node)
size = xmlSecPtrListGetSize(list);
for(i = 0; i < size; ++i) {
- id = (xmlSecXkmsServerRequestId)xmlSecPtrListGetItem(list, i);
- if((id != xmlSecXkmsServerRequestIdUnknown) &&
+ id = (xmlSecXkmsServerRequestId)xmlSecPtrListGetItem(list, i);
+ if((id != xmlSecXkmsServerRequestIdUnknown) &&
xmlSecCheckNodeName(node, id->requestNodeName, id->requestNodeNs)) {
- return(id);
- }
+ return(id);
+ }
}
return(xmlSecXkmsServerRequestIdUnknown);
}
@@ -3883,20 +3883,20 @@ xmlSecXkmsServerRequestIdListFindByNode(xmlSecPtrListPtr list, xmlNodePtr node)
* Result response
*
*******************************************************************/
-static int xmlSecXkmsServerRequestResultNodeWrite (xmlSecXkmsServerRequestId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
+static int xmlSecXkmsServerRequestResultNodeWrite (xmlSecXkmsServerRequestId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestResultKlass = {
- xmlSecXkmsServerRequestResultName, /* const xmlChar* name; */
- NULL, /* const xmlChar* requestNodeName; */
- NULL, /* const xmlChar* requestNodeNs; */
- xmlSecNodeResult, /* const xmlChar* responseNodeName; */
- xmlSecXkmsNs, /* const xmlChar* responseNodeNs; */
+ xmlSecXkmsServerRequestResultName, /* const xmlChar* name; */
+ NULL, /* const xmlChar* requestNodeName; */
+ NULL, /* const xmlChar* requestNodeNs; */
+ xmlSecNodeResult, /* const xmlChar* responseNodeName; */
+ xmlSecXkmsNs, /* const xmlChar* responseNodeNs; */
0, /* xmlSecBitMask flags; */
- NULL, /* xmlSecXkmsServerRequestNodeReadMethod readNode; */
- xmlSecXkmsServerRequestResultNodeWrite, /* xmlSecXkmsServerRequestNodeWriteMethod writeNode; */
- NULL, /* xmlSecXkmsServerRequestExecuteMethod execute; */
+ NULL, /* xmlSecXkmsServerRequestNodeReadMethod readNode; */
+ xmlSecXkmsServerRequestResultNodeWrite, /* xmlSecXkmsServerRequestNodeWriteMethod writeNode; */
+ NULL, /* xmlSecXkmsServerRequestExecuteMethod execute; */
NULL, /* void* reserved1; */
NULL /* void* reserved2; */
};
@@ -3908,7 +3908,7 @@ static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestResultKlass = {
*
* Returns: Result response klass.
*/
-xmlSecXkmsServerRequestId
+xmlSecXkmsServerRequestId
xmlSecXkmsServerRequestResultGetKlass(void) {
return(&xmlSecXkmsServerRequestResultKlass);
}
@@ -3923,26 +3923,26 @@ xmlSecXkmsServerRequestResultNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsS
/* set missing parameters (if any) */
if(ctx->service == NULL) {
- ctx->service = xmlStrdup((ctx->expectedService != NULL) ? ctx->expectedService : BAD_CAST "");
- if(ctx->service == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlStrdup",
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ctx->service = xmlStrdup((ctx->expectedService != NULL) ? ctx->expectedService : BAD_CAST "");
+ if(ctx->service == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlStrdup",
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
/* first write the "parent" type */
ret = xmlSecXkmsServerCtxResultTypeNodeWrite(ctx, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxResultTypeNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxResultTypeNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -3953,23 +3953,23 @@ xmlSecXkmsServerRequestResultNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsS
* StatusRequest/StatusResponse
*
*******************************************************************/
-static int xmlSecXkmsServerRequestStatusNodeRead (xmlSecXkmsServerRequestId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-static int xmlSecXkmsServerRequestStatusNodeWrite (xmlSecXkmsServerRequestId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
+static int xmlSecXkmsServerRequestStatusNodeRead (xmlSecXkmsServerRequestId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+static int xmlSecXkmsServerRequestStatusNodeWrite (xmlSecXkmsServerRequestId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestStatusKlass = {
- xmlSecXkmsServerRequestStatusName, /* const xmlChar* name; */
- xmlSecNodeStatusRequest, /* const xmlChar* requestNodeName; */
- xmlSecXkmsNs, /* const xmlChar* requestNodeNs; */
- xmlSecNodeStatusResult, /* const xmlChar* responseNodeName; */
- xmlSecXkmsNs, /* const xmlChar* responseNodeNs; */
+ xmlSecXkmsServerRequestStatusName, /* const xmlChar* name; */
+ xmlSecNodeStatusRequest, /* const xmlChar* requestNodeName; */
+ xmlSecXkmsNs, /* const xmlChar* requestNodeNs; */
+ xmlSecNodeStatusResult, /* const xmlChar* responseNodeName; */
+ xmlSecXkmsNs, /* const xmlChar* responseNodeNs; */
0, /* xmlSecBitMask flags; */
- xmlSecXkmsServerRequestStatusNodeRead, /* xmlSecXkmsServerRequestNodeReadMethod readNode; */
- xmlSecXkmsServerRequestStatusNodeWrite, /* xmlSecXkmsServerRequestNodeWriteMethod writeNode; */
- NULL, /* xmlSecXkmsServerRequestExecuteMethod execute; */
+ xmlSecXkmsServerRequestStatusNodeRead, /* xmlSecXkmsServerRequestNodeReadMethod readNode; */
+ xmlSecXkmsServerRequestStatusNodeWrite, /* xmlSecXkmsServerRequestNodeWriteMethod writeNode; */
+ NULL, /* xmlSecXkmsServerRequestExecuteMethod execute; */
NULL, /* void* reserved1; */
NULL /* void* reserved2; */
};
@@ -3981,7 +3981,7 @@ static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestStatusKlass = {
*
* Returns: StatusRequest klass.
*/
-xmlSecXkmsServerRequestId
+xmlSecXkmsServerRequestId
xmlSecXkmsServerRequestStatusGetKlass(void) {
return(&xmlSecXkmsServerRequestStatusKlass);
}
@@ -4022,22 +4022,22 @@ xmlSecXkmsServerRequestStatusNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsSe
/* first read "parent" type */
ret = xmlSecXkmsServerCtxPendingRequestNodeRead(ctx, &cur);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxPendingRequestNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxPendingRequestNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* check that there is nothing after the last node */
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -4079,12 +4079,12 @@ xmlSecXkmsServerRequestStatusNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsS
/* first write the "parent" type */
ret = xmlSecXkmsServerCtxResultTypeNodeWrite(ctx, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxResultTypeNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxResultTypeNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* todo: add optional StatusResult attributes */
@@ -4096,25 +4096,25 @@ xmlSecXkmsServerRequestStatusNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsS
* CompoundRequest/CompoundResponse
*
*******************************************************************/
-static int xmlSecXkmsServerRequestCompoundNodeRead (xmlSecXkmsServerRequestId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-static int xmlSecXkmsServerRequestCompoundNodeWrite(xmlSecXkmsServerRequestId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-static int xmlSecXkmsServerRequestCompoundExecute (xmlSecXkmsServerRequestId id,
- xmlSecXkmsServerCtxPtr ctx);
+static int xmlSecXkmsServerRequestCompoundNodeRead (xmlSecXkmsServerRequestId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+static int xmlSecXkmsServerRequestCompoundNodeWrite(xmlSecXkmsServerRequestId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+static int xmlSecXkmsServerRequestCompoundExecute (xmlSecXkmsServerRequestId id,
+ xmlSecXkmsServerCtxPtr ctx);
static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestCompoundKlass = {
- xmlSecXkmsServerRequestCompoundName, /* const xmlChar* name; */
- xmlSecNodeCompoundRequest, /* const xmlChar* requestNodeName; */
- xmlSecXkmsNs, /* const xmlChar* requestNodeNs; */
- xmlSecNodeCompoundResult, /* const xmlChar* responseNodeName; */
- xmlSecXkmsNs, /* const xmlChar* responseNodeNs; */
+ xmlSecXkmsServerRequestCompoundName, /* const xmlChar* name; */
+ xmlSecNodeCompoundRequest, /* const xmlChar* requestNodeName; */
+ xmlSecXkmsNs, /* const xmlChar* requestNodeNs; */
+ xmlSecNodeCompoundResult, /* const xmlChar* responseNodeName; */
+ xmlSecXkmsNs, /* const xmlChar* responseNodeNs; */
0, /* xmlSecBitMask flags; */
- xmlSecXkmsServerRequestCompoundNodeRead, /* xmlSecXkmsServerRequestNodeReadMethod readNode; */
- xmlSecXkmsServerRequestCompoundNodeWrite, /* xmlSecXkmsServerRequestNodeWriteMethod writeNode; */
- xmlSecXkmsServerRequestCompoundExecute, /* xmlSecXkmsServerRequestExecuteMethod execute; */
+ xmlSecXkmsServerRequestCompoundNodeRead, /* xmlSecXkmsServerRequestNodeReadMethod readNode; */
+ xmlSecXkmsServerRequestCompoundNodeWrite, /* xmlSecXkmsServerRequestNodeWriteMethod writeNode; */
+ xmlSecXkmsServerRequestCompoundExecute, /* xmlSecXkmsServerRequestExecuteMethod execute; */
NULL, /* void* reserved1; */
NULL /* void* reserved2; */
};
@@ -4126,7 +4126,7 @@ static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestCompoundKlass = {
*
* Returns: CompoundRequest klass.
*/
-xmlSecXkmsServerRequestId
+xmlSecXkmsServerRequestId
xmlSecXkmsServerRequestCompoundGetKlass(void) {
return(&xmlSecXkmsServerRequestCompoundKlass);
}
@@ -4185,31 +4185,31 @@ xmlSecXkmsServerRequestCompoundNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkms
/* first read "parent" type */
ret = xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(ctx, &cur);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxRequestAbstractTypeNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxRequestAbstractTypeNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* create list for compound requests */
xmlSecAssert2(ctx->compoundRequestContexts == NULL, -1);
ctx->compoundRequestContexts = xmlSecPtrListCreate(xmlSecXkmsServerCtxPtrListId);
if(ctx->compoundRequestContexts == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* get the list of enabled or all request klasses */
if(xmlSecPtrListGetSize(&(ctx->enabledServerRequestIds)) > 0) {
- serverRequestIdsList = &(ctx->enabledServerRequestIds);
+ serverRequestIdsList = &(ctx->enabledServerRequestIds);
} else {
- serverRequestIdsList = xmlSecXkmsServerRequestIdsGet();
+ serverRequestIdsList = xmlSecXkmsServerRequestIdsGet();
}
xmlSecAssert2(serverRequestIdsList != NULL, -1);
@@ -4220,35 +4220,35 @@ xmlSecXkmsServerRequestCompoundNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkms
ctxChild = xmlSecXkmsServerCtxCreate(ctx->keyInfoReadCtx.keysMngr);
if(ctxChild == NULL) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ NULL,
+ "xmlSecXkmsServerCtxCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* copy all settings from us */
ret = xmlSecXkmsServerCtxCopyUserPref(ctxChild, ctx);
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxCopyUserPref",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlSecXkmsServerCtxCopyUserPref",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
xmlSecXkmsServerCtxDestroy(ctxChild);
- return(-1);
+ return(-1);
}
/* add it to the list */
ret = xmlSecPtrListAdd(ctx->compoundRequestContexts, ctxChild);
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ NULL,
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
xmlSecXkmsServerCtxDestroy(ctxChild);
- return(-1);
+ return(-1);
}
/* and now process request from current node */
@@ -4256,37 +4256,37 @@ xmlSecXkmsServerRequestCompoundNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkms
if((ctxChild->requestId == xmlSecXkmsServerRequestIdUnknown) ||
((ctxChild->requestId->flags & XMLSEC_XKMS_SERVER_REQUEST_KLASS_ALLOWED_IN_COUMPOUND) == 0)) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerRequestIdListFindByNode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(node->name));
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorMessageNotSupported);
- return(-1);
+ NULL,
+ "xmlSecXkmsServerRequestIdListFindByNode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(node->name));
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorMessageNotSupported);
+ return(-1);
}
ret = xmlSecXkmsServerRequestNodeRead(ctxChild->requestId, ctxChild, cur);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerRequestNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "request=%s",
- xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(ctxChild->requestId)));
- xmlSecXkmsServerCtxSetResult(ctxChild, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerRequestNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "request=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(ctxChild->requestId)));
+ xmlSecXkmsServerCtxSetResult(ctxChild, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
+ return(-1);
}
cur = xmlSecGetNextElementNode(cur->next);
}
/* check that there is nothing after the last node */
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -4347,30 +4347,30 @@ xmlSecXkmsServerRequestCompoundNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkm
ctxChild = (xmlSecXkmsServerCtxPtr)xmlSecPtrListGetItem(ctx->compoundRequestContexts, pos);
if(ctxChild == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListGetItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListGetItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ if(ctxChild->resultMajor != xmlSecXkmsResultMajorSuccess) {
+ xmlSecXkmsServerCtxSetResult(ctx, ctxChild->resultMajor, ctxChild->resultMinor);
+ break;
}
-
- if(ctxChild->resultMajor != xmlSecXkmsResultMajorSuccess) {
- xmlSecXkmsServerCtxSetResult(ctx, ctxChild->resultMajor, ctxChild->resultMinor);
- break;
- }
- }
+ }
}
/* first write the "parent" type */
ret = xmlSecXkmsServerCtxResultTypeNodeWrite(ctx, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxResultTypeNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxResultTypeNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* write compound result */
@@ -4383,34 +4383,34 @@ xmlSecXkmsServerRequestCompoundNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkm
ctxChild = (xmlSecXkmsServerCtxPtr)xmlSecPtrListGetItem(ctx->compoundRequestContexts, pos);
if(ctxChild == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListGetItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListGetItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecXkmsServerRequestNodeWrite(ctxChild->requestId, ctxChild, node->doc, node);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerRequestNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "request=%s",
- xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(ctxChild->requestId)));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerRequestNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "request=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(ctxChild->requestId)));
return(-1);
}
if(xmlSecAddChildNode(node, cur) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChildNode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChildNode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
xmlFreeNode(cur);
return(-1);
- }
+ }
}
}
@@ -4432,25 +4432,25 @@ xmlSecXkmsServerRequestCompoundExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsS
ctxChild = (xmlSecXkmsServerCtxPtr)xmlSecPtrListGetItem(ctx->compoundRequestContexts, pos);
if(ctxChild == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListGetItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
- continue;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListGetItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorReceiver, xmlSecXkmsResultMinorFailure);
+ continue;
}
ret = xmlSecXkmsServerRequestExecute(ctxChild->requestId, ctxChild);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerRequestExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "request=%s",
- xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(ctxChild->requestId)));
- xmlSecXkmsServerCtxSetResult(ctxChild, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
- continue;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerRequestExecute",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "request=%s",
+ xmlSecErrorsSafeString(xmlSecXkmsServerRequestKlassGetName(ctxChild->requestId)));
+ xmlSecXkmsServerCtxSetResult(ctxChild, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorFailure);
+ continue;
}
}
}
@@ -4464,25 +4464,25 @@ xmlSecXkmsServerRequestCompoundExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsS
* LocateRequest/LocateResponse
*
*******************************************************************/
-static int xmlSecXkmsServerRequestLocateNodeRead (xmlSecXkmsServerRequestId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-static int xmlSecXkmsServerRequestLocateNodeWrite (xmlSecXkmsServerRequestId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-static int xmlSecXkmsServerRequestLocateExecute (xmlSecXkmsServerRequestId id,
- xmlSecXkmsServerCtxPtr ctx);
+static int xmlSecXkmsServerRequestLocateNodeRead (xmlSecXkmsServerRequestId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+static int xmlSecXkmsServerRequestLocateNodeWrite (xmlSecXkmsServerRequestId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+static int xmlSecXkmsServerRequestLocateExecute (xmlSecXkmsServerRequestId id,
+ xmlSecXkmsServerCtxPtr ctx);
static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestLocateKlass = {
- xmlSecXkmsServerRequestLocateName, /* const xmlChar* name; */
- xmlSecNodeLocateRequest, /* const xmlChar* requestNodeName; */
- xmlSecXkmsNs, /* const xmlChar* requestNodeNs; */
- xmlSecNodeLocateResult, /* const xmlChar* responseNodeName; */
- xmlSecXkmsNs, /* const xmlChar* responseNodeNs; */
+ xmlSecXkmsServerRequestLocateName, /* const xmlChar* name; */
+ xmlSecNodeLocateRequest, /* const xmlChar* requestNodeName; */
+ xmlSecXkmsNs, /* const xmlChar* requestNodeNs; */
+ xmlSecNodeLocateResult, /* const xmlChar* responseNodeName; */
+ xmlSecXkmsNs, /* const xmlChar* responseNodeNs; */
XMLSEC_XKMS_SERVER_REQUEST_KLASS_ALLOWED_IN_COUMPOUND, /* xmlSecBitMask flags; */
- xmlSecXkmsServerRequestLocateNodeRead, /* xmlSecXkmsServerRequestNodeReadMethod readNode; */
- xmlSecXkmsServerRequestLocateNodeWrite, /* xmlSecXkmsServerRequestNodeWriteMethod writeNode; */
- xmlSecXkmsServerRequestLocateExecute, /* xmlSecXkmsServerRequestExecuteMethod execute; */
+ xmlSecXkmsServerRequestLocateNodeRead, /* xmlSecXkmsServerRequestNodeReadMethod readNode; */
+ xmlSecXkmsServerRequestLocateNodeWrite, /* xmlSecXkmsServerRequestNodeWriteMethod writeNode; */
+ xmlSecXkmsServerRequestLocateExecute, /* xmlSecXkmsServerRequestExecuteMethod execute; */
NULL, /* void* reserved1; */
NULL /* void* reserved2; */
};
@@ -4494,7 +4494,7 @@ static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestLocateKlass = {
*
* Returns: LocateRequest klass.
*/
-xmlSecXkmsServerRequestId
+xmlSecXkmsServerRequestId
xmlSecXkmsServerRequestLocateGetKlass(void) {
return(&xmlSecXkmsServerRequestLocateKlass);
}
@@ -4546,45 +4546,45 @@ xmlSecXkmsServerRequestLocateNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsSe
/* first read "parent" type */
ret = xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(ctx, &cur);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxRequestAbstractTypeNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxRequestAbstractTypeNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* now read required <xkms:QueryKeyBinding/> node */
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeQueryKeyBinding, xmlSecXkmsNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeQueryKeyBinding));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeQueryKeyBinding));
+ return(-1);
}
/* read <xkms:QueryKeyBinding/> node */
ret = xmlSecXkmsServerCtxQueryKeyBindingNodeRead(ctx, cur);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxQueryKeyBindingNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxQueryKeyBindingNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecGetNextElementNode(cur->next);
/* check that there is nothing after the last node */
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -4612,13 +4612,13 @@ xmlSecXkmsServerRequestLocateNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsSe
* <element name="LocateResult" type="xkms:LocateResultType"/>
* <complexType name="LocateResultType">
* <complexContent>
- * <extension base="xkms:ResultType">
- * <sequence>
- * <element ref="xkms:UnverifiedKeyBinding" minOccurs="0"
- * maxOccurs="unbounded"/>
- * </sequence>
- * </extension>
- * </complexContent>
+ * <extension base="xkms:ResultType">
+ * <sequence>
+ * <element ref="xkms:UnverifiedKeyBinding" minOccurs="0"
+ * maxOccurs="unbounded"/>
+ * </sequence>
+ * </extension>
+ * </complexContent>
* </complexType>
* <!-- /LocateResult -->
*/
@@ -4636,42 +4636,42 @@ xmlSecXkmsServerRequestLocateNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkmsS
/* first write the "parent" type */
ret = xmlSecXkmsServerCtxResultTypeNodeWrite(ctx, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxResultTypeNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxResultTypeNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* write keys in <xkms:UnverifiedKeyBinding> nodes */
size = xmlSecPtrListGetSize(&(ctx->keys));
for(pos = 0; pos < size; ++pos) {
- key = (xmlSecKeyPtr)xmlSecPtrListGetItem(&(ctx->keys), pos);
- if(key == NULL) {
- continue;
- }
+ key = (xmlSecKeyPtr)xmlSecPtrListGetItem(&(ctx->keys), pos);
+ if(key == NULL) {
+ continue;
+ }
- cur = xmlSecAddChild(node, xmlSecNodeUnverifiedKeyBinding, xmlSecXkmsNs);
- if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeUnverifiedKeyBinding));
- return(-1);
- }
-
- ret = xmlSecXkmsServerCtxUnverifiedKeyBindingNodeWrite(ctx, cur, key);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxUnverifiedKeyBindingNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ cur = xmlSecAddChild(node, xmlSecNodeUnverifiedKeyBinding, xmlSecXkmsNs);
+ if(cur == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeUnverifiedKeyBinding));
+ return(-1);
+ }
+
+ ret = xmlSecXkmsServerCtxUnverifiedKeyBindingNodeWrite(ctx, cur, key);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxUnverifiedKeyBindingNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
return(0);
@@ -4687,29 +4687,29 @@ xmlSecXkmsServerRequestLocateExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsSer
/* now we are ready to search for key */
if((ctx->keyInfoReadCtx.keysMngr != NULL) && (ctx->keyInfoReadCtx.keysMngr->getKey != NULL)) {
- /* todo: set parameters to locate but not validate the key */
- key = (ctx->keyInfoReadCtx.keysMngr->getKey)(ctx->keyInfoNode, &(ctx->keyInfoReadCtx));
+ /* todo: set parameters to locate but not validate the key */
+ key = (ctx->keyInfoReadCtx.keysMngr->getKey)(ctx->keyInfoNode, &(ctx->keyInfoReadCtx));
}
/* check that we got what we needed */
if((key == NULL) || (!xmlSecKeyMatch(key, NULL, &(ctx->keyInfoReadCtx.keyReq)))) {
- if(key != NULL) {
- xmlSecKeyDestroy(key);
- }
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorNoMatch);
- return(-1);
+ if(key != NULL) {
+ xmlSecKeyDestroy(key);
+ }
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorNoMatch);
+ return(-1);
}
xmlSecAssert2(key != NULL, -1);
ret = xmlSecPtrListAdd(&(ctx->keys), key);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(key);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(key);
+ return(-1);
}
return(0);
@@ -4721,25 +4721,25 @@ xmlSecXkmsServerRequestLocateExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsSer
* ValidateRequest/ValidateResponse
*
*******************************************************************/
-static int xmlSecXkmsServerRequestValidateNodeRead (xmlSecXkmsServerRequestId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-static int xmlSecXkmsServerRequestValidateNodeWrite(xmlSecXkmsServerRequestId id,
- xmlSecXkmsServerCtxPtr ctx,
- xmlNodePtr node);
-static int xmlSecXkmsServerRequestValidateExecute (xmlSecXkmsServerRequestId id,
- xmlSecXkmsServerCtxPtr ctx);
+static int xmlSecXkmsServerRequestValidateNodeRead (xmlSecXkmsServerRequestId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+static int xmlSecXkmsServerRequestValidateNodeWrite(xmlSecXkmsServerRequestId id,
+ xmlSecXkmsServerCtxPtr ctx,
+ xmlNodePtr node);
+static int xmlSecXkmsServerRequestValidateExecute (xmlSecXkmsServerRequestId id,
+ xmlSecXkmsServerCtxPtr ctx);
static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestValidateKlass = {
- xmlSecXkmsServerRequestValidateName, /* const xmlChar* name; */
- xmlSecNodeValidateRequest, /* const xmlChar* requestNodeName; */
- xmlSecXkmsNs, /* const xmlChar* requestNodeNs; */
- xmlSecNodeValidateResult, /* const xmlChar* responseNodeName; */
- xmlSecXkmsNs, /* const xmlChar* responseNodeNs; */
+ xmlSecXkmsServerRequestValidateName, /* const xmlChar* name; */
+ xmlSecNodeValidateRequest, /* const xmlChar* requestNodeName; */
+ xmlSecXkmsNs, /* const xmlChar* requestNodeNs; */
+ xmlSecNodeValidateResult, /* const xmlChar* responseNodeName; */
+ xmlSecXkmsNs, /* const xmlChar* responseNodeNs; */
XMLSEC_XKMS_SERVER_REQUEST_KLASS_ALLOWED_IN_COUMPOUND, /* xmlSecBitMask flags; */
- xmlSecXkmsServerRequestValidateNodeRead, /* xmlSecXkmsServerRequestNodeReadMethod readNode; */
- xmlSecXkmsServerRequestValidateNodeWrite, /* xmlSecXkmsServerRequestNodeWriteMethod writeNode; */
- xmlSecXkmsServerRequestValidateExecute, /* xmlSecXkmsServerRequestExecuteMethod execute; */
+ xmlSecXkmsServerRequestValidateNodeRead, /* xmlSecXkmsServerRequestNodeReadMethod readNode; */
+ xmlSecXkmsServerRequestValidateNodeWrite, /* xmlSecXkmsServerRequestNodeWriteMethod writeNode; */
+ xmlSecXkmsServerRequestValidateExecute, /* xmlSecXkmsServerRequestExecuteMethod execute; */
NULL, /* void* reserved1; */
NULL /* void* reserved2; */
};
@@ -4751,7 +4751,7 @@ static xmlSecXkmsServerRequestKlass xmlSecXkmsServerRequestValidateKlass = {
*
* Returns: ValidateRequest klass.
*/
-xmlSecXkmsServerRequestId
+xmlSecXkmsServerRequestId
xmlSecXkmsServerRequestValidateGetKlass(void) {
return(&xmlSecXkmsServerRequestValidateKlass);
}
@@ -4784,10 +4784,10 @@ xmlSecXkmsServerRequestValidateGetKlass(void) {
* <sequence>
* <element ref="xkms:QueryKeyBinding"/>
* </sequence>
- * </extension>
+ * </extension>
* </complexContent>
* </complexType>
- * <!-- /ValidateRequest -->
+ * <!-- /ValidateRequest -->
*/
static int
xmlSecXkmsServerRequestValidateNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkmsServerCtxPtr ctx, xmlNodePtr node) {
@@ -4803,45 +4803,45 @@ xmlSecXkmsServerRequestValidateNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkms
/* first read "parent" type */
ret = xmlSecXkmsServerCtxRequestAbstractTypeNodeRead(ctx, &cur);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxRequestAbstractTypeNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxRequestAbstractTypeNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* now read required <xkms:QueryKeyBinding/> node */
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeQueryKeyBinding, xmlSecXkmsNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeQueryKeyBinding));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeQueryKeyBinding));
+ return(-1);
}
/* read <xkms:QueryKeyBinding/> node */
ret = xmlSecXkmsServerCtxQueryKeyBindingNodeRead(ctx, cur);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxQueryKeyBindingNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxQueryKeyBindingNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecGetNextElementNode(cur->next);
/* check that there is nothing after the last node */
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -4878,7 +4878,7 @@ xmlSecXkmsServerRequestValidateNodeRead(xmlSecXkmsServerRequestId id, xmlSecXkms
* <extension base="xkms:ResultType">
* <sequence>
* <element ref="xkms:KeyBinding" minOccurs="0"
- * maxOccurs="unbounded"/>
+ * maxOccurs="unbounded"/>
* </sequence>
* </extension>
* </complexContent>
@@ -4899,42 +4899,42 @@ xmlSecXkmsServerRequestValidateNodeWrite(xmlSecXkmsServerRequestId id, xmlSecXkm
/* first write the "parent" type */
ret = xmlSecXkmsServerCtxResultTypeNodeWrite(ctx, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxResultTypeNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxResultTypeNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* write keys in <xkms:UnverifiedKeyBinding> nodes */
size = xmlSecPtrListGetSize(&(ctx->keys));
for(pos = 0; pos < size; ++pos) {
- key = (xmlSecKeyPtr)xmlSecPtrListGetItem(&(ctx->keys), pos);
- if(key == NULL) {
- continue;
- }
+ key = (xmlSecKeyPtr)xmlSecPtrListGetItem(&(ctx->keys), pos);
+ if(key == NULL) {
+ continue;
+ }
- cur = xmlSecAddChild(node, xmlSecNodeUnverifiedKeyBinding, xmlSecXkmsNs);
- if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeUnverifiedKeyBinding));
- return(-1);
- }
-
- ret = xmlSecXkmsServerCtxKeyBindingNodeWrite(ctx, cur, key);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerCtxKeyBindingNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ cur = xmlSecAddChild(node, xmlSecNodeUnverifiedKeyBinding, xmlSecXkmsNs);
+ if(cur == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeUnverifiedKeyBinding));
+ return(-1);
+ }
+
+ ret = xmlSecXkmsServerCtxKeyBindingNodeWrite(ctx, cur, key);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerCtxKeyBindingNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
return(0);
@@ -4950,28 +4950,28 @@ xmlSecXkmsServerRequestValidateExecute(xmlSecXkmsServerRequestId id, xmlSecXkmsS
/* now we are ready to search for key */
if((ctx->keyInfoReadCtx.keysMngr != NULL) && (ctx->keyInfoReadCtx.keysMngr->getKey != NULL)) {
- key = (ctx->keyInfoReadCtx.keysMngr->getKey)(ctx->keyInfoNode, &(ctx->keyInfoReadCtx));
+ key = (ctx->keyInfoReadCtx.keysMngr->getKey)(ctx->keyInfoNode, &(ctx->keyInfoReadCtx));
}
/* check that we got what we needed */
if((key == NULL) || (!xmlSecKeyMatch(key, NULL, &(ctx->keyInfoReadCtx.keyReq)))) {
- if(key != NULL) {
- xmlSecKeyDestroy(key);
- }
- xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorNoMatch);
- return(-1);
+ if(key != NULL) {
+ xmlSecKeyDestroy(key);
+ }
+ xmlSecXkmsServerCtxSetResult(ctx, xmlSecXkmsResultMajorSender, xmlSecXkmsResultMinorNoMatch);
+ return(-1);
}
xmlSecAssert2(key != NULL, -1);
ret = xmlSecPtrListAdd(&(ctx->keys), key);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecKeyDestroy(key);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecKeyDestroy(key);
+ return(-1);
}
return(0);
diff --git a/src/xmldsig.c b/src/xmldsig.c
index cbd825e..b5fc54e 100644
--- a/src/xmldsig.c
+++ b/src/xmldsig.c
@@ -36,23 +36,23 @@
* xmlSecDSigCtx
*
*************************************************************************/
-static int xmlSecDSigCtxProcessSignatureNode (xmlSecDSigCtxPtr dsigCtx,
- xmlNodePtr node);
-static int xmlSecDSigCtxProcessSignedInfoNode (xmlSecDSigCtxPtr dsigCtx,
- xmlNodePtr node);
-static int xmlSecDSigCtxProcessKeyInfoNode (xmlSecDSigCtxPtr dsigCtx,
- xmlNodePtr node);
-static int xmlSecDSigCtxProcessObjectNode (xmlSecDSigCtxPtr dsigCtx,
- xmlNodePtr node);
-static int xmlSecDSigCtxProcessManifestNode (xmlSecDSigCtxPtr dsigCtx,
- xmlNodePtr node);
+static int xmlSecDSigCtxProcessSignatureNode (xmlSecDSigCtxPtr dsigCtx,
+ xmlNodePtr node);
+static int xmlSecDSigCtxProcessSignedInfoNode (xmlSecDSigCtxPtr dsigCtx,
+ xmlNodePtr node);
+static int xmlSecDSigCtxProcessKeyInfoNode (xmlSecDSigCtxPtr dsigCtx,
+ xmlNodePtr node);
+static int xmlSecDSigCtxProcessObjectNode (xmlSecDSigCtxPtr dsigCtx,
+ xmlNodePtr node);
+static int xmlSecDSigCtxProcessManifestNode (xmlSecDSigCtxPtr dsigCtx,
+ xmlNodePtr node);
/* The ID attribute in XMLDSig is 'Id' */
-static const xmlChar* xmlSecDSigIds[] = { xmlSecAttrId, NULL };
+static const xmlChar* xmlSecDSigIds[] = { xmlSecAttrId, NULL };
/**
* xmlSecDSigCtxCreate:
- * @keysMngr: the pointer to keys manager.
+ * @keysMngr: the pointer to keys manager.
*
* Creates <dsig:Signature/> element processing context.
* The caller is responsible for destroying returend object by calling
@@ -61,38 +61,38 @@ static const xmlChar* xmlSecDSigIds[] = { xmlSecAttrId, NULL };
* Returns: pointer to newly allocated context object or NULL if an error
* occurs.
*/
-xmlSecDSigCtxPtr
+xmlSecDSigCtxPtr
xmlSecDSigCtxCreate(xmlSecKeysMngrPtr keysMngr) {
xmlSecDSigCtxPtr dsigCtx;
int ret;
dsigCtx = (xmlSecDSigCtxPtr) xmlMalloc(sizeof(xmlSecDSigCtx));
if(dsigCtx == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "sizeof(xmlSecDSigCtx)=%d",
- sizeof(xmlSecDSigCtx));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "sizeof(xmlSecDSigCtx)=%d",
+ sizeof(xmlSecDSigCtx));
+ return(NULL);
}
ret = xmlSecDSigCtxInitialize(dsigCtx, keysMngr);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecDSigCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecDSigCtxDestroy(dsigCtx);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecDSigCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecDSigCtxDestroy(dsigCtx);
+ return(NULL);
}
return(dsigCtx);
}
/**
* xmlSecDSigCtxDestroy:
- * @dsigCtx: the pointer to <dsig:Signature/> processing context.
+ * @dsigCtx: the pointer to <dsig:Signature/> processing context.
*
* Destroy context object created with #xmlSecDSigCtxCreate function.
*/
@@ -106,8 +106,8 @@ xmlSecDSigCtxDestroy(xmlSecDSigCtxPtr dsigCtx) {
/**
* xmlSecDSigCtxInitialize:
- * @dsigCtx: the pointer to <dsig:Signature/> processing context.
- * @keysMngr: the pointer to keys manager.
+ * @dsigCtx: the pointer to <dsig:Signature/> processing context.
+ * @keysMngr: the pointer to keys manager.
*
* Initializes <dsig:Signature/> element processing context.
* The caller is responsible for cleaing up returend object by calling
@@ -126,23 +126,23 @@ xmlSecDSigCtxInitialize(xmlSecDSigCtxPtr dsigCtx, xmlSecKeysMngrPtr keysMngr) {
/* initialize key info */
ret = xmlSecKeyInfoCtxInitialize(&(dsigCtx->keyInfoReadCtx), keysMngr);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyInfoCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyInfoCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
dsigCtx->keyInfoReadCtx.mode = xmlSecKeyInfoModeRead;
ret = xmlSecKeyInfoCtxInitialize(&(dsigCtx->keyInfoWriteCtx), keysMngr);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyInfoCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyInfoCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
dsigCtx->keyInfoWriteCtx.mode = xmlSecKeyInfoModeWrite;
/* it's not wise to write private key :) */
@@ -151,19 +151,19 @@ xmlSecDSigCtxInitialize(xmlSecDSigCtxPtr dsigCtx, xmlSecKeysMngrPtr keysMngr) {
/* initializes transforms dsigCtx */
ret = xmlSecTransformCtxInitialize(&(dsigCtx->transformCtx));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* references lists from SignedInfo and Manifest elements */
xmlSecPtrListInitialize(&(dsigCtx->signedInfoReferences),
- xmlSecDSigReferenceCtxListId);
+ xmlSecDSigReferenceCtxListId);
xmlSecPtrListInitialize(&(dsigCtx->manifestReferences),
- xmlSecDSigReferenceCtxListId);
+ xmlSecDSigReferenceCtxListId);
dsigCtx->enabledReferenceUris = xmlSecTransformUriTypeAny;
return(0);
@@ -171,7 +171,7 @@ xmlSecDSigCtxInitialize(xmlSecDSigCtxPtr dsigCtx, xmlSecKeysMngrPtr keysMngr) {
/**
* xmlSecDSigCtxFinalize:
- * @dsigCtx: the pointer to <dsig:Signature/> processing context.
+ * @dsigCtx: the pointer to <dsig:Signature/> processing context.
*
* Cleans up @dsigCtx object initialized with #xmlSecDSigCtxInitialize function.
*/
@@ -186,21 +186,21 @@ xmlSecDSigCtxFinalize(xmlSecDSigCtxPtr dsigCtx) {
xmlSecPtrListFinalize(&(dsigCtx->manifestReferences));
if(dsigCtx->enabledReferenceTransforms != NULL) {
- xmlSecPtrListDestroy(dsigCtx->enabledReferenceTransforms);
+ xmlSecPtrListDestroy(dsigCtx->enabledReferenceTransforms);
}
if(dsigCtx->signKey != NULL) {
- xmlSecKeyDestroy(dsigCtx->signKey);
+ xmlSecKeyDestroy(dsigCtx->signKey);
}
if(dsigCtx->id != NULL) {
- xmlFree(dsigCtx->id);
- }
+ xmlFree(dsigCtx->id);
+ }
memset(dsigCtx, 0, sizeof(xmlSecDSigCtx));
}
/**
* xmlSecDSigCtxEnableReferenceTransform:
- * @dsigCtx: the pointer to <dsig:Signature/> processing context.
- * @transformId: the transform klass.
+ * @dsigCtx: the pointer to <dsig:Signature/> processing context.
+ * @transformId: the transform klass.
*
* Enables @transformId for <dsig:Reference/> elements processing.
*
@@ -215,33 +215,33 @@ xmlSecDSigCtxEnableReferenceTransform(xmlSecDSigCtxPtr dsigCtx, xmlSecTransformI
xmlSecAssert2(transformId != xmlSecTransformIdUnknown, -1);
if(dsigCtx->enabledReferenceTransforms == NULL) {
- dsigCtx->enabledReferenceTransforms = xmlSecPtrListCreate(xmlSecTransformIdListId);
- if(dsigCtx->enabledReferenceTransforms == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- }
-
+ dsigCtx->enabledReferenceTransforms = xmlSecPtrListCreate(xmlSecTransformIdListId);
+ if(dsigCtx->enabledReferenceTransforms == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ }
+
ret = xmlSecPtrListAdd(dsigCtx->enabledReferenceTransforms, (void*)transformId);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
/**
* xmlSecDSigCtxEnableSignatureTransform:
- * @dsigCtx: the pointer to <dsig:Signature/> processing context.
- * @transformId: the transform klass.
+ * @dsigCtx: the pointer to <dsig:Signature/> processing context.
+ * @transformId: the transform klass.
*
* Enables @transformId for <dsig:SignedInfo/> element processing.
*
@@ -258,7 +258,7 @@ xmlSecDSigCtxEnableSignatureTransform(xmlSecDSigCtxPtr dsigCtx, xmlSecTransformI
/**
* xmlSecDSigCtxGetPreSignBuffer:
- * @dsigCtx: the pointer to <dsig:Signature/> processing context.
+ * @dsigCtx: the pointer to <dsig:Signature/> processing context.
*
* Gets pointer to the buffer with serialized <dsig:SignedInfo/> element
* just before signature claculation (valid if and only if
@@ -271,13 +271,13 @@ xmlSecDSigCtxGetPreSignBuffer(xmlSecDSigCtxPtr dsigCtx) {
xmlSecAssert2(dsigCtx != NULL, NULL);
return((dsigCtx->preSignMemBufMethod != NULL) ?
- xmlSecTransformMemBufGetBuffer(dsigCtx->preSignMemBufMethod) : NULL);
+ xmlSecTransformMemBufGetBuffer(dsigCtx->preSignMemBufMethod) : NULL);
}
/**
* xmlSecDSigCtxSign:
- * @dsigCtx: the pointer to <dsig:Signature/> processing context.
- * @tmpl: the pointer to <dsig:Signature/> node with signature template.
+ * @dsigCtx: the pointer to <dsig:Signature/> processing context.
+ * @tmpl: the pointer to <dsig:Signature/> node with signature template.
*
* Signs the data as described in @tmpl node.
*
@@ -293,43 +293,43 @@ xmlSecDSigCtxSign(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr tmpl) {
xmlSecAssert2(tmpl->doc != NULL, -1);
/* add ids for Signature nodes */
- dsigCtx->operation = xmlSecTransformOperationSign;
- dsigCtx->status = xmlSecDSigStatusUnknown;
+ dsigCtx->operation = xmlSecTransformOperationSign;
+ dsigCtx->status = xmlSecDSigStatusUnknown;
xmlSecAddIDs(tmpl->doc, tmpl, xmlSecDSigIds);
/* read signature template */
ret = xmlSecDSigCtxProcessSignatureNode(dsigCtx, tmpl);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecDSigCtxSigantureProcessNode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecDSigCtxSigantureProcessNode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
xmlSecAssert2(dsigCtx->signMethod != NULL, -1);
xmlSecAssert2(dsigCtx->signValueNode != NULL, -1);
/* references processing might change the status */
if(dsigCtx->status != xmlSecDSigStatusUnknown) {
- return(0);
+ return(0);
}
/* check what we've got */
dsigCtx->result = dsigCtx->transformCtx.result;
if((dsigCtx->result == NULL) || (xmlSecBufferGetData(dsigCtx->result) == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_RESULT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_RESULT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* write signed data to xml */
xmlNodeSetContentLen(dsigCtx->signValueNode,
- xmlSecBufferGetData(dsigCtx->result),
- xmlSecBufferGetSize(dsigCtx->result));
+ xmlSecBufferGetData(dsigCtx->result),
+ xmlSecBufferGetSize(dsigCtx->result));
/* set success status and we are done */
dsigCtx->status = xmlSecDSigStatusSucceeded;
@@ -338,8 +338,8 @@ xmlSecDSigCtxSign(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr tmpl) {
/**
* xmlSecDSigCtxVerify:
- * @dsigCtx: the pointer to <dsig:Signature/> processing context.
- * @node: the pointer with <dsig:Signature/> node.
+ * @dsigCtx: the pointer to <dsig:Signature/> processing context.
+ * @node: the pointer with <dsig:Signature/> node.
*
* Vaidates signature in the @node. The verification result is returned
* in #status member of the @dsigCtx object.
@@ -356,38 +356,38 @@ xmlSecDSigCtxVerify(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
xmlSecAssert2(node->doc != NULL, -1);
/* add ids for Signature nodes */
- dsigCtx->operation = xmlSecTransformOperationVerify;
- dsigCtx->status = xmlSecDSigStatusUnknown;
+ dsigCtx->operation = xmlSecTransformOperationVerify;
+ dsigCtx->status = xmlSecDSigStatusUnknown;
xmlSecAddIDs(node->doc, node, xmlSecDSigIds);
/* read siganture info */
ret = xmlSecDSigCtxProcessSignatureNode(dsigCtx, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecDSigCtxSigantureProcessNode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecDSigCtxSigantureProcessNode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
xmlSecAssert2(dsigCtx->signMethod != NULL, -1);
xmlSecAssert2(dsigCtx->signValueNode != NULL, -1);
/* references processing might change the status */
if(dsigCtx->status != xmlSecDSigStatusUnknown) {
- return(0);
+ return(0);
}
/* verify SignatureValue node content */
ret = xmlSecTransformVerifyNodeContent(dsigCtx->signMethod, dsigCtx->signValueNode,
- &(dsigCtx->transformCtx));
+ &(dsigCtx->transformCtx));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformVerifyNodeContent",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformVerifyNodeContent",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* set status and we are done */
@@ -424,7 +424,7 @@ xmlSecDSigCtxVerify(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
* the entire text of the start and end tags of the SignedInfo element
* as well as all descendant markup and character data (i.e., the text)
* between those tags. Use of text based canonicalization of SignedInfo
- * is NOT RECOMMENDED.
+ * is NOT RECOMMENDED.
*
* =================================
* we do not support any non XML based C14N
@@ -466,13 +466,13 @@ xmlSecDSigCtxProcessSignatureNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
xmlSecAssert2(node != NULL, -1);
if(!xmlSecCheckNodeName(node, xmlSecNodeSignature, xmlSecDSigNs)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "expected=%s",
- xmlSecErrorsSafeString(xmlSecNodeSignature));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "expected=%s",
+ xmlSecErrorsSafeString(xmlSecNodeSignature));
+ return(-1);
}
/* read node data */
@@ -482,12 +482,12 @@ xmlSecDSigCtxProcessSignatureNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
/* first node is required SignedInfo */
cur = xmlSecGetNextElementNode(node->children);
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeSignedInfo, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "expected=%s",
- xmlSecErrorsSafeString(xmlSecNodeSignedInfo));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "expected=%s",
+ xmlSecErrorsSafeString(xmlSecNodeSignedInfo));
return(-1);
}
signedInfoNode = cur;
@@ -495,65 +495,65 @@ xmlSecDSigCtxProcessSignatureNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
/* next node is required SignatureValue */
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeSignatureValue, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "expected=%s",
- xmlSecErrorsSafeString(xmlSecNodeSignatureValue));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "expected=%s",
+ xmlSecErrorsSafeString(xmlSecNodeSignatureValue));
+ return(-1);
}
dsigCtx->signValueNode = cur;
cur = xmlSecGetNextElementNode(cur->next);
/* next node is optional KeyInfo */
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeKeyInfo, xmlSecDSigNs))) {
- keyInfoNode = cur;
- cur = xmlSecGetNextElementNode(cur->next);
+ keyInfoNode = cur;
+ cur = xmlSecGetNextElementNode(cur->next);
} else {
- keyInfoNode = NULL;
+ keyInfoNode = NULL;
}
/* next nodes are optional Object nodes */
while((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeObject, xmlSecDSigNs))) {
- /* read manifests from objects */
- if((dsigCtx->flags & XMLSEC_DSIG_FLAGS_IGNORE_MANIFESTS) == 0) {
- ret = xmlSecDSigCtxProcessObjectNode(dsigCtx, cur);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecDSigCtxProcessObjectNode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- }
- cur = xmlSecGetNextElementNode(cur->next);
+ /* read manifests from objects */
+ if((dsigCtx->flags & XMLSEC_DSIG_FLAGS_IGNORE_MANIFESTS) == 0) {
+ ret = xmlSecDSigCtxProcessObjectNode(dsigCtx, cur);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecDSigCtxProcessObjectNode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ }
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* if there is something left than it's an error */
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* now validated all the references and prepare transform */
ret = xmlSecDSigCtxProcessSignedInfoNode(dsigCtx, signedInfoNode);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecDSigCtxProcessSignedInfoNode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecDSigCtxProcessSignedInfoNode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
/* references processing might change the status */
if(dsigCtx->status != xmlSecDSigStatusUnknown) {
- return(0);
+ return(0);
}
/* as the result, we should have sign and c14n methods set */
@@ -562,72 +562,72 @@ xmlSecDSigCtxProcessSignatureNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
ret = xmlSecDSigCtxProcessKeyInfoNode(dsigCtx, keyInfoNode);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecDSigCtxProcessKeyInfoNode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecDSigCtxProcessKeyInfoNode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
/* as the result, we should have a key */
xmlSecAssert2(dsigCtx->signKey != NULL, -1);
/* if we need to write result to xml node then we need base64 encode result */
- if(dsigCtx->operation == xmlSecTransformOperationSign) {
- xmlSecTransformPtr base64Encode;
-
- /* we need to add base64 encode transform */
- base64Encode = xmlSecTransformCtxCreateAndAppend(&(dsigCtx->transformCtx),
- xmlSecTransformBase64Id);
- if(base64Encode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxCreateAndAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- base64Encode->operation = xmlSecTransformOperationEncode;
+ if(dsigCtx->operation == xmlSecTransformOperationSign) {
+ xmlSecTransformPtr base64Encode;
+
+ /* we need to add base64 encode transform */
+ base64Encode = xmlSecTransformCtxCreateAndAppend(&(dsigCtx->transformCtx),
+ xmlSecTransformBase64Id);
+ if(base64Encode == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxCreateAndAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ base64Encode->operation = xmlSecTransformOperationEncode;
}
firstType = xmlSecTransformGetDataType(dsigCtx->transformCtx.first,
- xmlSecTransformModePush,
- &(dsigCtx->transformCtx));
+ xmlSecTransformModePush,
+ &(dsigCtx->transformCtx));
if((firstType & xmlSecTransformDataTypeXml) != 0) {
- xmlSecNodeSetPtr nodeset = NULL;
+ xmlSecNodeSetPtr nodeset = NULL;
- xmlSecAssert2(signedInfoNode != NULL, -1);
+ xmlSecAssert2(signedInfoNode != NULL, -1);
nodeset = xmlSecNodeSetGetChildren(signedInfoNode->doc, signedInfoNode, 1, 0);
- if(nodeset == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNodeSetGetChildren",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(signedInfoNode)));
- return(-1);
- }
-
- /* calculate the signature */
- ret = xmlSecTransformCtxXmlExecute(&(dsigCtx->transformCtx), nodeset);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxXmlExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecNodeSetDestroy(nodeset);
- return(-1);
- }
- xmlSecNodeSetDestroy(nodeset);
+ if(nodeset == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNodeSetGetChildren",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(signedInfoNode)));
+ return(-1);
+ }
+
+ /* calculate the signature */
+ ret = xmlSecTransformCtxXmlExecute(&(dsigCtx->transformCtx), nodeset);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxXmlExecute",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecNodeSetDestroy(nodeset);
+ return(-1);
+ }
+ xmlSecNodeSetDestroy(nodeset);
} else {
- /* TODO */
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "the binary c14n transforms are not supported yet",
- XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ /* TODO */
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "the binary c14n transforms are not supported yet",
+ XMLSEC_ERRORS_R_NOT_IMPLEMENTED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
@@ -672,7 +672,7 @@ xmlSecDSigCtxProcessSignedInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
xmlNodePtr cur;
int ret;
- xmlSecAssert2(dsigCtx != NULL, -1);
+ xmlSecAssert2(dsigCtx != NULL, -1);
xmlSecAssert2(dsigCtx->status == xmlSecDSigStatusUnknown, -1);
xmlSecAssert2(dsigCtx->signMethod == NULL, -1);
xmlSecAssert2(dsigCtx->c14nMethod == NULL, -1);
@@ -683,159 +683,159 @@ xmlSecDSigCtxProcessSignedInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
/* first node is required CanonicalizationMethod. */
cur = xmlSecGetNextElementNode(node->children);
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeCanonicalizationMethod, xmlSecDSigNs))) {
- dsigCtx->c14nMethod = xmlSecTransformCtxNodeRead(&(dsigCtx->transformCtx),
- cur, xmlSecTransformUsageC14NMethod);
- if(dsigCtx->c14nMethod == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
- }
+ dsigCtx->c14nMethod = xmlSecTransformCtxNodeRead(&(dsigCtx->transformCtx),
+ cur, xmlSecTransformUsageC14NMethod);
+ if(dsigCtx->c14nMethod == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
+ }
} else if(dsigCtx->defC14NMethodId != xmlSecTransformIdUnknown) {
- /* the dsig spec does require CanonicalizationMethod node
- * to be present but in some case it application might decide to
- * minimize traffic */
- dsigCtx->c14nMethod = xmlSecTransformCtxCreateAndAppend(&(dsigCtx->transformCtx),
- dsigCtx->defC14NMethodId);
- if(dsigCtx->c14nMethod == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ /* the dsig spec does require CanonicalizationMethod node
+ * to be present but in some case it application might decide to
+ * minimize traffic */
+ dsigCtx->c14nMethod = xmlSecTransformCtxCreateAndAppend(&(dsigCtx->transformCtx),
+ dsigCtx->defC14NMethodId);
+ if(dsigCtx->c14nMethod == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "CanonicalizationMethod",
- XMLSEC_ERRORS_R_INVALID_NODE,
- "expected=%s",
- xmlSecErrorsSafeString(xmlSecNodeCanonicalizationMethod));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "CanonicalizationMethod",
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "expected=%s",
+ xmlSecErrorsSafeString(xmlSecNodeCanonicalizationMethod));
+ return(-1);
}
/* insert membuf if requested */
if((dsigCtx->flags & XMLSEC_DSIG_FLAGS_STORE_SIGNATURE) != 0) {
- xmlSecAssert2(dsigCtx->preSignMemBufMethod == NULL, -1);
- dsigCtx->preSignMemBufMethod = xmlSecTransformCtxCreateAndAppend(&(dsigCtx->transformCtx),
- xmlSecTransformMemBufId);
- if(dsigCtx->preSignMemBufMethod == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxCreateAndAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformMemBufId)));
- }
+ xmlSecAssert2(dsigCtx->preSignMemBufMethod == NULL, -1);
+ dsigCtx->preSignMemBufMethod = xmlSecTransformCtxCreateAndAppend(&(dsigCtx->transformCtx),
+ xmlSecTransformMemBufId);
+ if(dsigCtx->preSignMemBufMethod == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxCreateAndAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformMemBufId)));
+ }
}
/* next node is required SignatureMethod. */
cur = xmlSecGetNextElementNode( ((cur != NULL) ? cur->next : node->children) );
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeSignatureMethod, xmlSecDSigNs))) {
- dsigCtx->signMethod = xmlSecTransformCtxNodeRead(&(dsigCtx->transformCtx),
- cur, xmlSecTransformUsageSignatureMethod);
- if(dsigCtx->signMethod == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
- }
+ dsigCtx->signMethod = xmlSecTransformCtxNodeRead(&(dsigCtx->transformCtx),
+ cur, xmlSecTransformUsageSignatureMethod);
+ if(dsigCtx->signMethod == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
+ }
} else if(dsigCtx->defSignMethodId != xmlSecTransformIdUnknown) {
- /* the dsig spec does require SignatureMethod node
- * to be present but in some case it application might decide to
- * minimize traffic */
- dsigCtx->signMethod = xmlSecTransformCtxCreateAndAppend(&(dsigCtx->transformCtx),
- dsigCtx->defSignMethodId);
- if(dsigCtx->signMethod == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ /* the dsig spec does require SignatureMethod node
+ * to be present but in some case it application might decide to
+ * minimize traffic */
+ dsigCtx->signMethod = xmlSecTransformCtxCreateAndAppend(&(dsigCtx->transformCtx),
+ dsigCtx->defSignMethodId);
+ if(dsigCtx->signMethod == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "expected=%s",
- xmlSecErrorsSafeString(xmlSecNodeSignatureMethod));
- return(-1);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "expected=%s",
+ xmlSecErrorsSafeString(xmlSecNodeSignatureMethod));
+ return(-1);
+ }
dsigCtx->signMethod->operation = dsigCtx->operation;
/* calculate references */
cur = xmlSecGetNextElementNode(cur->next);
while((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeReference, xmlSecDSigNs))) {
/* create reference */
- dsigRefCtx = xmlSecDSigReferenceCtxCreate(dsigCtx, xmlSecDSigReferenceOriginSignedInfo);
- if(dsigRefCtx == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecDSigReferenceCtxCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- /* add to the list */
- ret = xmlSecPtrListAdd(&(dsigCtx->signedInfoReferences), dsigRefCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecDSigReferenceCtxDestroy(dsigRefCtx);
- return(-1);
- }
-
- /* process */
- ret = xmlSecDSigReferenceCtxProcessNode(dsigRefCtx, cur);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecDSigReferenceCtxProcessNode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
- }
-
- /* bail out if next Reference processing failed */
- if(dsigRefCtx->status != xmlSecDSigStatusSucceeded) {
- dsigCtx->status = xmlSecDSigStatusInvalid;
- return(0);
- }
- cur = xmlSecGetNextElementNode(cur->next);
+ dsigRefCtx = xmlSecDSigReferenceCtxCreate(dsigCtx, xmlSecDSigReferenceOriginSignedInfo);
+ if(dsigRefCtx == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecDSigReferenceCtxCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ /* add to the list */
+ ret = xmlSecPtrListAdd(&(dsigCtx->signedInfoReferences), dsigRefCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecDSigReferenceCtxDestroy(dsigRefCtx);
+ return(-1);
+ }
+
+ /* process */
+ ret = xmlSecDSigReferenceCtxProcessNode(dsigRefCtx, cur);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecDSigReferenceCtxProcessNode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
+ }
+
+ /* bail out if next Reference processing failed */
+ if(dsigRefCtx->status != xmlSecDSigStatusSucceeded) {
+ dsigCtx->status = xmlSecDSigStatusInvalid;
+ return(0);
+ }
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* check that we have at least one Reference */
if(xmlSecPtrListGetSize(&(dsigCtx->signedInfoReferences)) == 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_DSIG_NO_REFERENCES,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_DSIG_NO_REFERENCES,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* if there is something left than it's an error */
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
@@ -850,55 +850,55 @@ xmlSecDSigCtxProcessKeyInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
/* set key requirements */
ret = xmlSecTransformSetKeyReq(dsigCtx->signMethod, &(dsigCtx->keyInfoReadCtx.keyReq));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformSetKeyReq",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformGetName(dsigCtx->signMethod)));
- return(-1);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformSetKeyReq",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformGetName(dsigCtx->signMethod)));
+ return(-1);
+ }
/* ignore <dsig:KeyInfo /> if there is the key is already set */
/* todo: throw an error if key is set and node != NULL? */
if((dsigCtx->signKey == NULL) && (dsigCtx->keyInfoReadCtx.keysMngr != NULL)
- && (dsigCtx->keyInfoReadCtx.keysMngr->getKey != NULL)) {
- dsigCtx->signKey = (dsigCtx->keyInfoReadCtx.keysMngr->getKey)(node, &(dsigCtx->keyInfoReadCtx));
+ && (dsigCtx->keyInfoReadCtx.keysMngr->getKey != NULL)) {
+ dsigCtx->signKey = (dsigCtx->keyInfoReadCtx.keysMngr->getKey)(node, &(dsigCtx->keyInfoReadCtx));
}
/* check that we have exactly what we want */
if((dsigCtx->signKey == NULL) || (!xmlSecKeyMatch(dsigCtx->signKey, NULL, &(dsigCtx->keyInfoReadCtx.keyReq)))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_KEY_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_KEY_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* set the key to the transform */
ret = xmlSecTransformSetKey(dsigCtx->signMethod, dsigCtx->signKey);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformSetKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformGetName(dsigCtx->signMethod)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformSetKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformGetName(dsigCtx->signMethod)));
+ return(-1);
}
/* if we are signing document, update <dsig:KeyInfo/> node */
- if((node != NULL) && (dsigCtx->operation == xmlSecTransformOperationSign)) {
- ret = xmlSecKeyInfoNodeWrite(node, dsigCtx->signKey, &(dsigCtx->keyInfoWriteCtx));
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyInfoNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ if((node != NULL) && (dsigCtx->operation == xmlSecTransformOperationSign)) {
+ ret = xmlSecKeyInfoNodeWrite(node, dsigCtx->signKey, &(dsigCtx->keyInfoWriteCtx));
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyInfoNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
return(0);
@@ -906,7 +906,7 @@ xmlSecDSigCtxProcessKeyInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
/**
* xmlSecDSigCtxProcessObjectNode:
- *
+ *
* The Object Element (http://www.w3.org/TR/xmldsig-core/#sec-Object)
*
* Object is an optional element that may occur one or more times. When
@@ -924,9 +924,9 @@ xmlSecDSigCtxProcessKeyInfoNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
* <attribute name="MimeType" type="string" use="optional"/>
* <attribute name="Encoding" type="anyURI" use="optional"/>
* </complexType>
- *
+ *
* DTD:
- *
+ *
* <!ELEMENT Object (#PCDATA|Signature|SignatureProperties|Manifest %Object.ANY;)* >
* <!ATTLIST Object Id ID #IMPLIED
* MimeType CDATA #IMPLIED
@@ -937,25 +937,25 @@ xmlSecDSigCtxProcessObjectNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
xmlNodePtr cur;
int ret;
- xmlSecAssert2(dsigCtx != NULL, -1);
+ xmlSecAssert2(dsigCtx != NULL, -1);
xmlSecAssert2(dsigCtx->status == xmlSecDSigStatusUnknown, -1);
xmlSecAssert2(node != NULL, -1);
/* we care about Manifest nodes only; ignore everything else */
cur = xmlSecGetNextElementNode(node->children);
while(cur != NULL) {
- if(xmlSecCheckNodeName(cur, xmlSecNodeManifest, xmlSecDSigNs)) {
- ret = xmlSecDSigCtxProcessManifestNode(dsigCtx, cur);
- if(ret < 0){
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecDSigCtxProcessManifestNode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- }
- cur = xmlSecGetNextElementNode(cur->next);
+ if(xmlSecCheckNodeName(cur, xmlSecNodeManifest, xmlSecDSigNs)) {
+ ret = xmlSecDSigCtxProcessManifestNode(dsigCtx, cur);
+ if(ret < 0){
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecDSigCtxProcessManifestNode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ }
+ cur = xmlSecGetNextElementNode(cur->next);
}
return(0);
}
@@ -984,7 +984,7 @@ xmlSecDSigCtxProcessObjectNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
* </sequence>
* <attribute name="Id" type="ID" use="optional"/>
* </complexType>
- *
+ *
* DTD:
*
* <!ELEMENT Manifest (Reference+) >
@@ -996,7 +996,7 @@ xmlSecDSigCtxProcessManifestNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
xmlNodePtr cur;
int ret;
- xmlSecAssert2(dsigCtx != NULL, -1);
+ xmlSecAssert2(dsigCtx != NULL, -1);
xmlSecAssert2(dsigCtx->status == xmlSecDSigStatusUnknown, -1);
xmlSecAssert2(node != NULL, -1);
@@ -1004,61 +1004,61 @@ xmlSecDSigCtxProcessManifestNode(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr node) {
cur = xmlSecGetNextElementNode(node->children);
while((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeReference, xmlSecDSigNs))) {
/* create reference */
- dsigRefCtx = xmlSecDSigReferenceCtxCreate(dsigCtx, xmlSecDSigReferenceOriginManifest);
- if(dsigRefCtx == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecDSigReferenceCtxCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- /* add to the list */
- ret = xmlSecPtrListAdd(&(dsigCtx->manifestReferences), dsigRefCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecDSigReferenceCtxDestroy(dsigRefCtx);
- return(-1);
- }
-
- /* process */
- ret = xmlSecDSigReferenceCtxProcessNode(dsigRefCtx, cur);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecDSigReferenceCtxProcessNode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
- }
-
- /* we don;t care if Reference processing failed because
- * it's Manifest node */
- cur = xmlSecGetNextElementNode(cur->next);
+ dsigRefCtx = xmlSecDSigReferenceCtxCreate(dsigCtx, xmlSecDSigReferenceOriginManifest);
+ if(dsigRefCtx == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecDSigReferenceCtxCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ /* add to the list */
+ ret = xmlSecPtrListAdd(&(dsigCtx->manifestReferences), dsigRefCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecDSigReferenceCtxDestroy(dsigRefCtx);
+ return(-1);
+ }
+
+ /* process */
+ ret = xmlSecDSigReferenceCtxProcessNode(dsigRefCtx, cur);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecDSigReferenceCtxProcessNode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
+ }
+
+ /* we don;t care if Reference processing failed because
+ * it's Manifest node */
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* we should have nothing else here */
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
/**
* xmlSecDSigCtxDebugDump:
- * @dsigCtx: the pointer to <dsig:Signature/> processing context.
- * @output: the pointer to output FILE.
+ * @dsigCtx: the pointer to <dsig:Signature/> processing context.
+ * @output: the pointer to output FILE.
*
* Prints the debug information about @dsigCtx to @output.
*/
@@ -1068,26 +1068,26 @@ xmlSecDSigCtxDebugDump(xmlSecDSigCtxPtr dsigCtx, FILE* output) {
xmlSecAssert(output != NULL);
if(dsigCtx->operation == xmlSecTransformOperationSign) {
- fprintf(output, "= SIGNATURE CONTEXT\n");
+ fprintf(output, "= SIGNATURE CONTEXT\n");
} else {
- fprintf(output, "= VERIFICATION CONTEXT\n");
+ fprintf(output, "= VERIFICATION CONTEXT\n");
}
switch(dsigCtx->status) {
- case xmlSecDSigStatusUnknown:
- fprintf(output, "== Status: unknown\n");
- break;
- case xmlSecDSigStatusSucceeded:
- fprintf(output, "== Status: succeeded\n");
- break;
- case xmlSecDSigStatusInvalid:
- fprintf(output, "== Status: invalid\n");
- break;
+ case xmlSecDSigStatusUnknown:
+ fprintf(output, "== Status: unknown\n");
+ break;
+ case xmlSecDSigStatusSucceeded:
+ fprintf(output, "== Status: succeeded\n");
+ break;
+ case xmlSecDSigStatusInvalid:
+ fprintf(output, "== Status: invalid\n");
+ break;
}
fprintf(output, "== flags: 0x%08x\n", dsigCtx->flags);
fprintf(output, "== flags2: 0x%08x\n", dsigCtx->flags2);
if(dsigCtx->id != NULL) {
- fprintf(output, "== Id: \"%s\"\n", dsigCtx->id);
+ fprintf(output, "== Id: \"%s\"\n", dsigCtx->id);
}
fprintf(output, "== Key Info Read Ctx:\n");
@@ -1100,12 +1100,12 @@ xmlSecDSigCtxDebugDump(xmlSecDSigCtxPtr dsigCtx, FILE* output) {
if(dsigCtx->signMethod != NULL) {
fprintf(output, "== Signature Method:\n");
- xmlSecTransformDebugDump(dsigCtx->signMethod, output);
+ xmlSecTransformDebugDump(dsigCtx->signMethod, output);
}
if(dsigCtx->signKey != NULL) {
fprintf(output, "== Signature Key:\n");
- xmlSecKeyDebugDump(dsigCtx->signKey, output);
+ xmlSecKeyDebugDump(dsigCtx->signKey, output);
}
fprintf(output, "== SignedInfo References List:\n");
@@ -1117,28 +1117,28 @@ xmlSecDSigCtxDebugDump(xmlSecDSigCtxPtr dsigCtx, FILE* output) {
if((dsigCtx->result != NULL) &&
(xmlSecBufferGetData(dsigCtx->result) != NULL)) {
- fprintf(output, "== Result - start buffer:\n");
- fwrite(xmlSecBufferGetData(dsigCtx->result),
- xmlSecBufferGetSize(dsigCtx->result),
- 1, output);
- fprintf(output, "\n== Result - end buffer\n");
+ fprintf(output, "== Result - start buffer:\n");
+ fwrite(xmlSecBufferGetData(dsigCtx->result),
+ xmlSecBufferGetSize(dsigCtx->result),
+ 1, output);
+ fprintf(output, "\n== Result - end buffer\n");
}
if(((dsigCtx->flags & XMLSEC_DSIG_FLAGS_STORE_SIGNATURE) != 0) &&
(xmlSecDSigCtxGetPreSignBuffer(dsigCtx) != NULL) &&
(xmlSecBufferGetData(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)) != NULL)) {
- fprintf(output, "== PreSigned data - start buffer:\n");
- fwrite(xmlSecBufferGetData(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)),
- xmlSecBufferGetSize(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)),
- 1, output);
- fprintf(output, "\n== PreSigned data - end buffer\n");
+ fprintf(output, "== PreSigned data - start buffer:\n");
+ fwrite(xmlSecBufferGetData(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)),
+ xmlSecBufferGetSize(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)),
+ 1, output);
+ fprintf(output, "\n== PreSigned data - end buffer\n");
}
}
/**
* xmlSecDSigCtxDebugXmlDump:
- * @dsigCtx: the pointer to <dsig:Signature/> processing context.
- * @output: the pointer to output FILE.
+ * @dsigCtx: the pointer to <dsig:Signature/> processing context.
+ * @output: the pointer to output FILE.
*
* Prints the debug information about @dsigCtx to @output in XML format.
*/
@@ -1148,20 +1148,20 @@ xmlSecDSigCtxDebugXmlDump(xmlSecDSigCtxPtr dsigCtx, FILE* output) {
xmlSecAssert(output != NULL);
if(dsigCtx->operation == xmlSecTransformOperationSign) {
- fprintf(output, "<SignatureContext \n");
+ fprintf(output, "<SignatureContext \n");
} else {
- fprintf(output, "<VerificationContext \n");
+ fprintf(output, "<VerificationContext \n");
}
switch(dsigCtx->status) {
- case xmlSecDSigStatusUnknown:
- fprintf(output, "status=\"unknown\" >\n");
- break;
- case xmlSecDSigStatusSucceeded:
- fprintf(output, "status=\"succeeded\" >\n");
- break;
- case xmlSecDSigStatusInvalid:
- fprintf(output, "status=\"invalid\" >\n");
- break;
+ case xmlSecDSigStatusUnknown:
+ fprintf(output, "status=\"unknown\" >\n");
+ break;
+ case xmlSecDSigStatusSucceeded:
+ fprintf(output, "status=\"succeeded\" >\n");
+ break;
+ case xmlSecDSigStatusInvalid:
+ fprintf(output, "status=\"invalid\" >\n");
+ break;
}
fprintf(output, "<Flags>%08x</Flags>\n", dsigCtx->flags);
@@ -1185,13 +1185,13 @@ xmlSecDSigCtxDebugXmlDump(xmlSecDSigCtxPtr dsigCtx, FILE* output) {
if(dsigCtx->signMethod != NULL) {
fprintf(output, "<SignatureMethod>\n");
- xmlSecTransformDebugXmlDump(dsigCtx->signMethod, output);
+ xmlSecTransformDebugXmlDump(dsigCtx->signMethod, output);
fprintf(output, "</SignatureMethod>\n");
}
if(dsigCtx->signKey != NULL) {
fprintf(output, "<SignatureKey>\n");
- xmlSecKeyDebugXmlDump(dsigCtx->signKey, output);
+ xmlSecKeyDebugXmlDump(dsigCtx->signKey, output);
fprintf(output, "</SignatureKey>\n");
}
@@ -1206,27 +1206,27 @@ xmlSecDSigCtxDebugXmlDump(xmlSecDSigCtxPtr dsigCtx, FILE* output) {
if((dsigCtx->result != NULL) &&
(xmlSecBufferGetData(dsigCtx->result) != NULL)) {
- fprintf(output, "<Result>");
- fwrite(xmlSecBufferGetData(dsigCtx->result),
- xmlSecBufferGetSize(dsigCtx->result),
- 1, output);
- fprintf(output, "</Result>\n");
+ fprintf(output, "<Result>");
+ fwrite(xmlSecBufferGetData(dsigCtx->result),
+ xmlSecBufferGetSize(dsigCtx->result),
+ 1, output);
+ fprintf(output, "</Result>\n");
}
if(((dsigCtx->flags & XMLSEC_DSIG_FLAGS_STORE_SIGNATURE) != 0) &&
(xmlSecDSigCtxGetPreSignBuffer(dsigCtx) != NULL) &&
(xmlSecBufferGetData(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)) != NULL)) {
- fprintf(output, "<PreSignedData>");
- fwrite(xmlSecBufferGetData(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)),
- xmlSecBufferGetSize(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)),
- 1, output);
- fprintf(output, "</PreSignedData>\n");
+ fprintf(output, "<PreSignedData>");
+ fwrite(xmlSecBufferGetData(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)),
+ xmlSecBufferGetSize(xmlSecDSigCtxGetPreSignBuffer(dsigCtx)),
+ 1, output);
+ fprintf(output, "</PreSignedData>\n");
}
if(dsigCtx->operation == xmlSecTransformOperationSign) {
- fprintf(output, "</SignatureContext>\n");
+ fprintf(output, "</SignatureContext>\n");
} else {
- fprintf(output, "</VerificationContext>\n");
+ fprintf(output, "</VerificationContext>\n");
}
}
@@ -1237,8 +1237,8 @@ xmlSecDSigCtxDebugXmlDump(xmlSecDSigCtxPtr dsigCtx, FILE* output) {
*************************************************************************/
/**
* xmlSecDSigReferenceCtxCreate:
- * @dsigCtx: the pointer to parent <dsig:Signature/> node processing context.
- * @origin: the reference origin (<dsig:SignedInfo/> or <dsig:Manifest/> node).
+ * @dsigCtx: the pointer to parent <dsig:Signature/> node processing context.
+ * @origin: the reference origin (<dsig:SignedInfo/> or <dsig:Manifest/> node).
*
* Creates new <dsig:Reference/> element processing context. Caller is responsible
* for destroying the returned context by calling #xmlSecDSigReferenceCtxDestroy
@@ -1246,7 +1246,7 @@ xmlSecDSigCtxDebugXmlDump(xmlSecDSigCtxPtr dsigCtx, FILE* output) {
*
* Returns: pointer to newly created context or NULL if an error occurs.
*/
-xmlSecDSigReferenceCtxPtr
+xmlSecDSigReferenceCtxPtr
xmlSecDSigReferenceCtxCreate(xmlSecDSigCtxPtr dsigCtx, xmlSecDSigReferenceOrigin origin) {
xmlSecDSigReferenceCtxPtr dsigRefCtx;
int ret;
@@ -1255,31 +1255,31 @@ xmlSecDSigReferenceCtxCreate(xmlSecDSigCtxPtr dsigCtx, xmlSecDSigReferenceOrigin
dsigRefCtx = (xmlSecDSigReferenceCtxPtr) xmlMalloc(sizeof(xmlSecDSigReferenceCtx));
if(dsigRefCtx == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "sizeof(xmlSecDSigReferenceCtx)=%d",
- sizeof(xmlSecDSigReferenceCtx));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "sizeof(xmlSecDSigReferenceCtx)=%d",
+ sizeof(xmlSecDSigReferenceCtx));
+ return(NULL);
}
ret = xmlSecDSigReferenceCtxInitialize(dsigRefCtx, dsigCtx, origin);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecDSigReferenceCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecDSigReferenceCtxDestroy(dsigRefCtx);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecDSigReferenceCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecDSigReferenceCtxDestroy(dsigRefCtx);
+ return(NULL);
}
return(dsigRefCtx);
}
/**
* xmlSecDSigReferenceCtxDestroy:
- * @dsigRefCtx: the pointer to <dsig:Reference/> element processing context.
+ * @dsigRefCtx: the pointer to <dsig:Reference/> element processing context.
*
* Destroy context object created with #xmlSecDSigReferenceCtxCreate function.
*/
@@ -1293,9 +1293,9 @@ xmlSecDSigReferenceCtxDestroy(xmlSecDSigReferenceCtxPtr dsigRefCtx) {
/**
* xmlSecDSigReferenceCtxInitialize:
- * @dsigRefCtx: the pointer to <dsig:Reference/> element processing context.
- * @dsigCtx: the pointer to parent <dsig:Signature/> node processing context.
- * @origin: the reference origin (<dsig:SignedInfo/> or <dsig:Manifest/> node).
+ * @dsigRefCtx: the pointer to <dsig:Reference/> element processing context.
+ * @dsigCtx: the pointer to parent <dsig:Signature/> node processing context.
+ * @origin: the reference origin (<dsig:SignedInfo/> or <dsig:Manifest/> node).
*
* Initializes new <dsig:Reference/> element processing context. Caller is responsible
* for cleaning up the returned context by calling #xmlSecDSigReferenceCtxFinalize
@@ -1305,7 +1305,7 @@ xmlSecDSigReferenceCtxDestroy(xmlSecDSigReferenceCtxPtr dsigRefCtx) {
*/
int
xmlSecDSigReferenceCtxInitialize(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlSecDSigCtxPtr dsigCtx,
- xmlSecDSigReferenceOrigin origin) {
+ xmlSecDSigReferenceOrigin origin) {
int ret;
xmlSecAssert2(dsigCtx != NULL, -1);
@@ -1319,39 +1319,39 @@ xmlSecDSigReferenceCtxInitialize(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlSecDSi
/* initializes transforms dsigRefCtx */
ret = xmlSecTransformCtxInitialize(&(dsigRefCtx->transformCtx));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* copy enabled transforms */
if(dsigCtx->enabledReferenceTransforms != NULL) {
- ret = xmlSecPtrListCopy(&(dsigRefCtx->transformCtx.enabledTransforms),
- dsigCtx->enabledReferenceTransforms);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListCopy",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ret = xmlSecPtrListCopy(&(dsigRefCtx->transformCtx.enabledTransforms),
+ dsigCtx->enabledReferenceTransforms);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListCopy",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
dsigRefCtx->transformCtx.preExecCallback = dsigCtx->referencePreExecuteCallback;
dsigRefCtx->transformCtx.enabledUris = dsigCtx->enabledReferenceUris;
if((dsigCtx->flags & XMLSEC_DSIG_FLAGS_USE_VISA3D_HACK) != 0) {
- dsigRefCtx->transformCtx.flags |= XMLSEC_TRANSFORMCTX_FLAGS_USE_VISA3D_HACK;
+ dsigRefCtx->transformCtx.flags |= XMLSEC_TRANSFORMCTX_FLAGS_USE_VISA3D_HACK;
}
return(0);
}
/**
* xmlSecDSigReferenceCtxFinalize:
- * @dsigRefCtx: the pointer to <dsig:Reference/> element processing context.
+ * @dsigRefCtx: the pointer to <dsig:Reference/> element processing context.
*
* Cleans up context object created with #xmlSecDSigReferenceCtxInitialize function.
*/
@@ -1361,20 +1361,20 @@ xmlSecDSigReferenceCtxFinalize(xmlSecDSigReferenceCtxPtr dsigRefCtx) {
xmlSecTransformCtxFinalize(&(dsigRefCtx->transformCtx));
if(dsigRefCtx->id != NULL) {
- xmlFree(dsigRefCtx->id);
- }
+ xmlFree(dsigRefCtx->id);
+ }
if(dsigRefCtx->uri != NULL) {
- xmlFree(dsigRefCtx->uri);
- }
+ xmlFree(dsigRefCtx->uri);
+ }
if(dsigRefCtx->type != NULL) {
- xmlFree(dsigRefCtx->type);
- }
+ xmlFree(dsigRefCtx->type);
+ }
memset(dsigRefCtx, 0, sizeof(xmlSecDSigReferenceCtx));
}
/**
* xmlSecDSigReferenceCtxGetPreDigestBuffer:
- * @dsigRefCtx: the pointer to <dsig:Reference/> element processing context.
+ * @dsigRefCtx: the pointer to <dsig:Reference/> element processing context.
*
* Gets the results of <dsig:Reference/> node processing just before digesting
* (valid only if #XMLSEC_DSIG_FLAGS_STORE_SIGNEDINFO_REFERENCES or
@@ -1388,13 +1388,13 @@ xmlSecDSigReferenceCtxGetPreDigestBuffer(xmlSecDSigReferenceCtxPtr dsigRefCtx) {
xmlSecAssert2(dsigRefCtx != NULL, NULL);
return((dsigRefCtx->preDigestMemBufMethod != NULL) ?
- xmlSecTransformMemBufGetBuffer(dsigRefCtx->preDigestMemBufMethod) : NULL);
+ xmlSecTransformMemBufGetBuffer(dsigRefCtx->preDigestMemBufMethod) : NULL);
}
/**
* xmlSecDSigReferenceCtxProcessNode:
- * @dsigRefCtx: the pointer to <dsig:Reference/> element processing context.
- * @node: the pointer to <dsig:Reference/> node.
+ * @dsigRefCtx: the pointer to <dsig:Reference/> element processing context.
+ * @node: the pointer to <dsig:Reference/> node.
* The Reference Element (http://www.w3.org/TR/xmldsig-core/#sec-Reference)
*
@@ -1436,183 +1436,183 @@ xmlSecDSigReferenceCtxProcessNode(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlNodeP
/* set start URI (and check that it is enabled!) */
ret = xmlSecTransformCtxSetUri(transformCtx, dsigRefCtx->uri, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxSetUri",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "uri=%s",
- xmlSecErrorsSafeString(dsigRefCtx->uri));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxSetUri",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "uri=%s",
+ xmlSecErrorsSafeString(dsigRefCtx->uri));
+ return(-1);
}
/* first is optional Transforms node */
cur = xmlSecGetNextElementNode(node->children);
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeTransforms, xmlSecDSigNs))) {
- ret = xmlSecTransformCtxNodesListRead(transformCtx,
- cur, xmlSecTransformUsageDSigTransform);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxNodesListRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
- }
+ ret = xmlSecTransformCtxNodesListRead(transformCtx,
+ cur, xmlSecTransformUsageDSigTransform);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxNodesListRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
+ }
- cur = xmlSecGetNextElementNode(cur->next);
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* insert membuf if requested */
if(((dsigRefCtx->origin == xmlSecDSigReferenceOriginSignedInfo) &&
- ((dsigRefCtx->dsigCtx->flags & XMLSEC_DSIG_FLAGS_STORE_SIGNEDINFO_REFERENCES) != 0)) ||
+ ((dsigRefCtx->dsigCtx->flags & XMLSEC_DSIG_FLAGS_STORE_SIGNEDINFO_REFERENCES) != 0)) ||
((dsigRefCtx->origin == xmlSecDSigReferenceOriginManifest) &&
- ((dsigRefCtx->dsigCtx->flags & XMLSEC_DSIG_FLAGS_STORE_MANIFEST_REFERENCES) != 0))) {
-
- xmlSecAssert2(dsigRefCtx->preDigestMemBufMethod == NULL, -1);
- dsigRefCtx->preDigestMemBufMethod = xmlSecTransformCtxCreateAndAppend(
- transformCtx,
- xmlSecTransformMemBufId);
- if(dsigRefCtx->preDigestMemBufMethod == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxCreateAndAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformMemBufId)));
- return(-1);
- }
+ ((dsigRefCtx->dsigCtx->flags & XMLSEC_DSIG_FLAGS_STORE_MANIFEST_REFERENCES) != 0))) {
+
+ xmlSecAssert2(dsigRefCtx->preDigestMemBufMethod == NULL, -1);
+ dsigRefCtx->preDigestMemBufMethod = xmlSecTransformCtxCreateAndAppend(
+ transformCtx,
+ xmlSecTransformMemBufId);
+ if(dsigRefCtx->preDigestMemBufMethod == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxCreateAndAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformMemBufId)));
+ return(-1);
+ }
}
/* next node is required DigestMethod. */
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDigestMethod, xmlSecDSigNs))) {
- dsigRefCtx->digestMethod = xmlSecTransformCtxNodeRead(&(dsigRefCtx->transformCtx),
- cur, xmlSecTransformUsageDigestMethod);
- if(dsigRefCtx->digestMethod == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
- }
-
- cur = xmlSecGetNextElementNode(cur->next);
+ dsigRefCtx->digestMethod = xmlSecTransformCtxNodeRead(&(dsigRefCtx->transformCtx),
+ cur, xmlSecTransformUsageDigestMethod);
+ if(dsigRefCtx->digestMethod == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
+ }
+
+ cur = xmlSecGetNextElementNode(cur->next);
} else if(dsigRefCtx->dsigCtx->defSignMethodId != xmlSecTransformIdUnknown) {
- /* the dsig spec does require DigestMethod node
- * to be present but in some case it application might decide to
- * minimize traffic */
- dsigRefCtx->digestMethod = xmlSecTransformCtxCreateAndAppend(&(dsigRefCtx->transformCtx),
- dsigRefCtx->dsigCtx->defSignMethodId);
- if(dsigRefCtx->digestMethod == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ /* the dsig spec does require DigestMethod node
+ * to be present but in some case it application might decide to
+ * minimize traffic */
+ dsigRefCtx->digestMethod = xmlSecTransformCtxCreateAndAppend(&(dsigRefCtx->transformCtx),
+ dsigRefCtx->dsigCtx->defSignMethodId);
+ if(dsigRefCtx->digestMethod == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "expected=%s",
- xmlSecErrorsSafeString(xmlSecNodeDigestMethod));
- return(-1);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "expected=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDigestMethod));
+ return(-1);
+ }
dsigRefCtx->digestMethod->operation = dsigRefCtx->dsigCtx->operation;
/* last node is required DigestValue */
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeDigestValue, xmlSecDSigNs))) {
- digestValueNode = cur;
- cur = xmlSecGetNextElementNode(cur->next);
+ digestValueNode = cur;
+ cur = xmlSecGetNextElementNode(cur->next);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeDigestValue));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeDigestValue));
+ return(-1);
}
/* if we have something else then it's an error */
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* if we need to write result to xml node then we need base64 encode result */
- if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) {
- xmlSecTransformPtr base64Encode;
-
- /* we need to add base64 encode transform */
- base64Encode = xmlSecTransformCtxCreateAndAppend(transformCtx, xmlSecTransformBase64Id);
- if(base64Encode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxCreateAndAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- base64Encode->operation = xmlSecTransformOperationEncode;
+ if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) {
+ xmlSecTransformPtr base64Encode;
+
+ /* we need to add base64 encode transform */
+ base64Encode = xmlSecTransformCtxCreateAndAppend(transformCtx, xmlSecTransformBase64Id);
+ if(base64Encode == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxCreateAndAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ base64Encode->operation = xmlSecTransformOperationEncode;
}
/* finally get transforms results */
ret = xmlSecTransformCtxExecute(transformCtx, node->doc);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxExecute",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
dsigRefCtx->result = transformCtx->result;
- if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) {
- if((dsigRefCtx->result == NULL) || (xmlSecBufferGetData(dsigRefCtx->result) == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- /* write signed data to xml */
- xmlNodeSetContentLen(digestValueNode,
- xmlSecBufferGetData(dsigRefCtx->result),
- xmlSecBufferGetSize(dsigRefCtx->result));
+ if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) {
+ if((dsigRefCtx->result == NULL) || (xmlSecBufferGetData(dsigRefCtx->result) == NULL)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxExecute",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ /* write signed data to xml */
+ xmlNodeSetContentLen(digestValueNode,
+ xmlSecBufferGetData(dsigRefCtx->result),
+ xmlSecBufferGetSize(dsigRefCtx->result));
- /* set success status and we are done */
- dsigRefCtx->status = xmlSecDSigStatusSucceeded;
+ /* set success status and we are done */
+ dsigRefCtx->status = xmlSecDSigStatusSucceeded;
} else {
- /* verify SignatureValue node content */
- ret = xmlSecTransformVerifyNodeContent(dsigRefCtx->digestMethod,
- digestValueNode, transformCtx);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformVerifyNodeContent",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ /* verify SignatureValue node content */
+ ret = xmlSecTransformVerifyNodeContent(dsigRefCtx->digestMethod,
+ digestValueNode, transformCtx);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformVerifyNodeContent",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
/* set status and we are done */
- if(dsigRefCtx->digestMethod->status == xmlSecTransformStatusOk) {
- dsigRefCtx->status = xmlSecDSigStatusSucceeded;
- } else {
- dsigRefCtx->status = xmlSecDSigStatusInvalid;
- }
+ if(dsigRefCtx->digestMethod->status == xmlSecTransformStatusOk) {
+ dsigRefCtx->status = xmlSecDSigStatusSucceeded;
+ } else {
+ dsigRefCtx->status = xmlSecDSigStatusInvalid;
+ }
}
return(0);
@@ -1620,8 +1620,8 @@ xmlSecDSigReferenceCtxProcessNode(xmlSecDSigReferenceCtxPtr dsigRefCtx, xmlNodeP
/**
* xmlSecDSigReferenceCtxDebugDump:
- * @dsigRefCtx: the pointer to <dsig:Reference/> element processing context.
- * @output: the pointer to output FILE.
+ * @dsigRefCtx: the pointer to <dsig:Reference/> element processing context.
+ * @output: the pointer to output FILE.
*
* Prints debug information about @dsigRefCtx to @output.
*/
@@ -1632,29 +1632,29 @@ xmlSecDSigReferenceCtxDebugDump(xmlSecDSigReferenceCtxPtr dsigRefCtx, FILE* outp
xmlSecAssert(output != NULL);
if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) {
- fprintf(output, "= REFERENCE CALCULATION CONTEXT\n");
+ fprintf(output, "= REFERENCE CALCULATION CONTEXT\n");
} else {
- fprintf(output, "= REFERENCE VERIFICATION CONTEXT\n");
+ fprintf(output, "= REFERENCE VERIFICATION CONTEXT\n");
}
switch(dsigRefCtx->status) {
- case xmlSecDSigStatusUnknown:
- fprintf(output, "== Status: unknown\n");
- break;
- case xmlSecDSigStatusSucceeded:
- fprintf(output, "== Status: succeeded\n");
- break;
- case xmlSecDSigStatusInvalid:
- fprintf(output, "== Status: invalid\n");
- break;
+ case xmlSecDSigStatusUnknown:
+ fprintf(output, "== Status: unknown\n");
+ break;
+ case xmlSecDSigStatusSucceeded:
+ fprintf(output, "== Status: succeeded\n");
+ break;
+ case xmlSecDSigStatusInvalid:
+ fprintf(output, "== Status: invalid\n");
+ break;
}
if(dsigRefCtx->id != NULL) {
- fprintf(output, "== Id: \"%s\"\n", dsigRefCtx->id);
+ fprintf(output, "== Id: \"%s\"\n", dsigRefCtx->id);
}
if(dsigRefCtx->uri != NULL) {
- fprintf(output, "== URI: \"%s\"\n", dsigRefCtx->uri);
+ fprintf(output, "== URI: \"%s\"\n", dsigRefCtx->uri);
}
if(dsigRefCtx->type != NULL) {
- fprintf(output, "== Type: \"%s\"\n", dsigRefCtx->type);
+ fprintf(output, "== Type: \"%s\"\n", dsigRefCtx->type);
}
fprintf(output, "== Reference Transform Ctx:\n");
@@ -1662,34 +1662,34 @@ xmlSecDSigReferenceCtxDebugDump(xmlSecDSigReferenceCtxPtr dsigRefCtx, FILE* outp
if(dsigRefCtx->digestMethod != NULL) {
fprintf(output, "== Digest Method:\n");
- xmlSecTransformDebugDump(dsigRefCtx->digestMethod, output);
+ xmlSecTransformDebugDump(dsigRefCtx->digestMethod, output);
}
if((xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx) != NULL) &&
(xmlSecBufferGetData(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)) != NULL)) {
- fprintf(output, "== PreDigest data - start buffer:\n");
- fwrite(xmlSecBufferGetData(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)),
- xmlSecBufferGetSize(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)),
- 1, output);
- fprintf(output, "\n== PreDigest data - end buffer\n");
+ fprintf(output, "== PreDigest data - start buffer:\n");
+ fwrite(xmlSecBufferGetData(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)),
+ xmlSecBufferGetSize(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)),
+ 1, output);
+ fprintf(output, "\n== PreDigest data - end buffer\n");
}
if((dsigRefCtx->result != NULL) &&
(xmlSecBufferGetData(dsigRefCtx->result) != NULL)) {
- fprintf(output, "== Result - start buffer:\n");
- fwrite(xmlSecBufferGetData(dsigRefCtx->result),
- xmlSecBufferGetSize(dsigRefCtx->result), 1,
- output);
- fprintf(output, "\n== Result - end buffer\n");
+ fprintf(output, "== Result - start buffer:\n");
+ fwrite(xmlSecBufferGetData(dsigRefCtx->result),
+ xmlSecBufferGetSize(dsigRefCtx->result), 1,
+ output);
+ fprintf(output, "\n== Result - end buffer\n");
}
}
/**
* xmlSecDSigReferenceCtxDebugXmlDump:
- * @dsigRefCtx: the pointer to <dsig:Reference/> element processing context.
- * @output: the pointer to output FILE.
+ * @dsigRefCtx: the pointer to <dsig:Reference/> element processing context.
+ * @output: the pointer to output FILE.
*
* Prints debug information about @dsigRefCtx to @output in output format.
*/
@@ -1700,20 +1700,20 @@ xmlSecDSigReferenceCtxDebugXmlDump(xmlSecDSigReferenceCtxPtr dsigRefCtx, FILE* o
xmlSecAssert(output != NULL);
if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) {
- fprintf(output, "<ReferenceCalculationContext ");
+ fprintf(output, "<ReferenceCalculationContext ");
} else {
- fprintf(output, "<ReferenceVerificationContext ");
+ fprintf(output, "<ReferenceVerificationContext ");
}
switch(dsigRefCtx->status) {
- case xmlSecDSigStatusUnknown:
- fprintf(output, "status=\"unknown\" >\n");
- break;
- case xmlSecDSigStatusSucceeded:
- fprintf(output, "status=\"succeeded\" >\n");
- break;
- case xmlSecDSigStatusInvalid:
- fprintf(output, "status=\"invalid\" >\n");
- break;
+ case xmlSecDSigStatusUnknown:
+ fprintf(output, "status=\"unknown\" >\n");
+ break;
+ case xmlSecDSigStatusSucceeded:
+ fprintf(output, "status=\"succeeded\" >\n");
+ break;
+ case xmlSecDSigStatusInvalid:
+ fprintf(output, "status=\"invalid\" >\n");
+ break;
}
fprintf(output, "<Id>");
@@ -1734,33 +1734,33 @@ xmlSecDSigReferenceCtxDebugXmlDump(xmlSecDSigReferenceCtxPtr dsigRefCtx, FILE* o
if(dsigRefCtx->digestMethod != NULL) {
fprintf(output, "<DigestMethod>\n");
- xmlSecTransformDebugXmlDump(dsigRefCtx->digestMethod, output);
+ xmlSecTransformDebugXmlDump(dsigRefCtx->digestMethod, output);
fprintf(output, "</DigestMethod>\n");
}
if((dsigRefCtx->result != NULL) &&
(xmlSecBufferGetData(dsigRefCtx->result) != NULL)) {
- fprintf(output, "<Result>");
- fwrite(xmlSecBufferGetData(dsigRefCtx->result),
- xmlSecBufferGetSize(dsigRefCtx->result), 1,
- output);
- fprintf(output, "</Result>\n");
+ fprintf(output, "<Result>");
+ fwrite(xmlSecBufferGetData(dsigRefCtx->result),
+ xmlSecBufferGetSize(dsigRefCtx->result), 1,
+ output);
+ fprintf(output, "</Result>\n");
}
if((xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx) != NULL) &&
(xmlSecBufferGetData(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)) != NULL)) {
- fprintf(output, "<PreDigestData>");
- fwrite(xmlSecBufferGetData(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)),
- xmlSecBufferGetSize(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)),
- 1, output);
- fprintf(output, "</PreDigestData>\n");
+ fprintf(output, "<PreDigestData>");
+ fwrite(xmlSecBufferGetData(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)),
+ xmlSecBufferGetSize(xmlSecDSigReferenceCtxGetPreDigestBuffer(dsigRefCtx)),
+ 1, output);
+ fprintf(output, "</PreDigestData>\n");
}
if(dsigRefCtx->dsigCtx->operation == xmlSecTransformOperationSign) {
- fprintf(output, "</ReferenceCalculationContext>\n");
+ fprintf(output, "</ReferenceCalculationContext>\n");
} else {
- fprintf(output, "</ReferenceVerificationContext>\n");
+ fprintf(output, "</ReferenceVerificationContext>\n");
}
}
@@ -1772,10 +1772,10 @@ xmlSecDSigReferenceCtxDebugXmlDump(xmlSecDSigReferenceCtxPtr dsigRefCtx, FILE* o
*************************************************************************/
static xmlSecPtrListKlass xmlSecDSigReferenceCtxListKlass = {
BAD_CAST "dsig-reference-list",
- NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
- (xmlSecPtrDestroyItemMethod)xmlSecDSigReferenceCtxDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */
- (xmlSecPtrDebugDumpItemMethod)xmlSecDSigReferenceCtxDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
- (xmlSecPtrDebugDumpItemMethod)xmlSecDSigReferenceCtxDebugXmlDump, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
+ NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
+ (xmlSecPtrDestroyItemMethod)xmlSecDSigReferenceCtxDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */
+ (xmlSecPtrDebugDumpItemMethod)xmlSecDSigReferenceCtxDebugDump, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
+ (xmlSecPtrDebugDumpItemMethod)xmlSecDSigReferenceCtxDebugXmlDump, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
};
/**
diff --git a/src/xmlenc.c b/src/xmlenc.c
index cd226a5..837870f 100644
--- a/src/xmlenc.c
+++ b/src/xmlenc.c
@@ -30,21 +30,21 @@
#include <xmlsec/xmlenc.h>
#include <xmlsec/errors.h>
-static int xmlSecEncCtxEncDataNodeRead (xmlSecEncCtxPtr encCtx,
- xmlNodePtr node);
-static int xmlSecEncCtxEncDataNodeWrite (xmlSecEncCtxPtr encCtx);
-static int xmlSecEncCtxCipherDataNodeRead (xmlSecEncCtxPtr encCtx,
- xmlNodePtr node);
-static int xmlSecEncCtxCipherReferenceNodeRead (xmlSecEncCtxPtr encCtx,
- xmlNodePtr node);
+static int xmlSecEncCtxEncDataNodeRead (xmlSecEncCtxPtr encCtx,
+ xmlNodePtr node);
+static int xmlSecEncCtxEncDataNodeWrite (xmlSecEncCtxPtr encCtx);
+static int xmlSecEncCtxCipherDataNodeRead (xmlSecEncCtxPtr encCtx,
+ xmlNodePtr node);
+static int xmlSecEncCtxCipherReferenceNodeRead (xmlSecEncCtxPtr encCtx,
+ xmlNodePtr node);
/* The ID attribute in XMLEnc is 'Id' */
-static const xmlChar* xmlSecEncIds[] = { BAD_CAST "Id", NULL };
+static const xmlChar* xmlSecEncIds[] = { BAD_CAST "Id", NULL };
/**
* xmlSecEncCtxCreate:
- * @keysMngr: the pointer to keys manager.
+ * @keysMngr: the pointer to keys manager.
*
* Creates <enc:EncryptedData/> element processing context.
* The caller is responsible for destroying returend object by calling
@@ -53,38 +53,38 @@ static const xmlChar* xmlSecEncIds[] = { BAD_CAST "Id", NULL };
* Returns: pointer to newly allocated context object or NULL if an error
* occurs.
*/
-xmlSecEncCtxPtr
+xmlSecEncCtxPtr
xmlSecEncCtxCreate(xmlSecKeysMngrPtr keysMngr) {
xmlSecEncCtxPtr encCtx;
int ret;
encCtx = (xmlSecEncCtxPtr) xmlMalloc(sizeof(xmlSecEncCtx));
if(encCtx == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "sizeof(xmlSecEncCtx)=%d",
- sizeof(xmlSecEncCtx));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "sizeof(xmlSecEncCtx)=%d",
+ sizeof(xmlSecEncCtx));
+ return(NULL);
}
ret = xmlSecEncCtxInitialize(encCtx, keysMngr);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecEncCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecEncCtxDestroy(encCtx);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecEncCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecEncCtxDestroy(encCtx);
+ return(NULL);
}
return(encCtx);
}
/**
* xmlSecEncCtxDestroy:
- * @encCtx: the pointer to <enc:EncryptedData/> processing context.
+ * @encCtx: the pointer to <enc:EncryptedData/> processing context.
*
* Destroy context object created with #xmlSecEncCtxCreate function.
*/
@@ -98,8 +98,8 @@ xmlSecEncCtxDestroy(xmlSecEncCtxPtr encCtx) {
/**
* xmlSecEncCtxInitialize:
- * @encCtx: the pointer to <enc:EncryptedData/> processing context.
- * @keysMngr: the pointer to keys manager.
+ * @encCtx: the pointer to <enc:EncryptedData/> processing context.
+ * @keysMngr: the pointer to keys manager.
*
* Initializes <enc:EncryptedData/> element processing context.
* The caller is responsible for cleaing up returend object by calling
@@ -118,23 +118,23 @@ xmlSecEncCtxInitialize(xmlSecEncCtxPtr encCtx, xmlSecKeysMngrPtr keysMngr) {
/* initialize key info */
ret = xmlSecKeyInfoCtxInitialize(&(encCtx->keyInfoReadCtx), keysMngr);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyInfoCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyInfoCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
encCtx->keyInfoReadCtx.mode = xmlSecKeyInfoModeRead;
ret = xmlSecKeyInfoCtxInitialize(&(encCtx->keyInfoWriteCtx), keysMngr);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyInfoCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyInfoCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
encCtx->keyInfoWriteCtx.mode = xmlSecKeyInfoModeWrite;
/* it's not wise to write private key :) */
@@ -143,12 +143,12 @@ xmlSecEncCtxInitialize(xmlSecEncCtxPtr encCtx, xmlSecKeysMngrPtr keysMngr) {
/* initializes transforms encCtx */
ret = xmlSecTransformCtxInitialize(&(encCtx->transformCtx));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -156,7 +156,7 @@ xmlSecEncCtxInitialize(xmlSecEncCtxPtr encCtx, xmlSecKeysMngrPtr keysMngr) {
/**
* xmlSecEncCtxFinalize:
- * @encCtx: the pointer to <enc:EncryptedData/> processing context.
+ * @encCtx: the pointer to <enc:EncryptedData/> processing context.
*
* Cleans up @encCtx object.
*/
@@ -175,7 +175,7 @@ xmlSecEncCtxFinalize(xmlSecEncCtxPtr encCtx) {
/**
* xmlSecEncCtxReset:
- * @encCtx: the pointer to <enc:EncryptedData/> processing context.
+ * @encCtx: the pointer to <enc:EncryptedData/> processing context.
*
* Resets @encCtx object, user settings are not touched.
*/
@@ -187,60 +187,60 @@ xmlSecEncCtxReset(xmlSecEncCtxPtr encCtx) {
xmlSecKeyInfoCtxReset(&(encCtx->keyInfoReadCtx));
xmlSecKeyInfoCtxReset(&(encCtx->keyInfoWriteCtx));
- encCtx->operation = xmlSecTransformOperationNone;
- encCtx->result = NULL;
+ encCtx->operation = xmlSecTransformOperationNone;
+ encCtx->result = NULL;
encCtx->resultBase64Encoded = 0;
- encCtx->resultReplaced = 0;
- encCtx->encMethod = NULL;
+ encCtx->resultReplaced = 0;
+ encCtx->encMethod = NULL;
if (encCtx->replacedNodeList != NULL) {
- xmlFreeNodeList(encCtx->replacedNodeList);
- encCtx->replacedNodeList = NULL;
+ xmlFreeNodeList(encCtx->replacedNodeList);
+ encCtx->replacedNodeList = NULL;
}
if(encCtx->encKey != NULL) {
- xmlSecKeyDestroy(encCtx->encKey);
- encCtx->encKey = NULL;
+ xmlSecKeyDestroy(encCtx->encKey);
+ encCtx->encKey = NULL;
}
if(encCtx->id != NULL) {
- xmlFree(encCtx->id);
- encCtx->id = NULL;
- }
+ xmlFree(encCtx->id);
+ encCtx->id = NULL;
+ }
if(encCtx->type != NULL) {
- xmlFree(encCtx->type);
- encCtx->type = NULL;
+ xmlFree(encCtx->type);
+ encCtx->type = NULL;
}
if(encCtx->mimeType != NULL) {
- xmlFree(encCtx->mimeType);
- encCtx->mimeType = NULL;
+ xmlFree(encCtx->mimeType);
+ encCtx->mimeType = NULL;
}
if(encCtx->encoding != NULL) {
- xmlFree(encCtx->encoding);
- encCtx->encoding = NULL;
- }
+ xmlFree(encCtx->encoding);
+ encCtx->encoding = NULL;
+ }
if(encCtx->recipient != NULL) {
- xmlFree(encCtx->recipient);
- encCtx->recipient = NULL;
+ xmlFree(encCtx->recipient);
+ encCtx->recipient = NULL;
}
if(encCtx->carriedKeyName != NULL) {
- xmlFree(encCtx->carriedKeyName);
- encCtx->carriedKeyName = NULL;
+ xmlFree(encCtx->carriedKeyName);
+ encCtx->carriedKeyName = NULL;
}
encCtx->encDataNode = encCtx->encMethodNode =
- encCtx->keyInfoNode = encCtx->cipherValueNode = NULL;
+ encCtx->keyInfoNode = encCtx->cipherValueNode = NULL;
}
/**
* xmlSecEncCtxCopyUserPref:
- * @dst: the pointer to destination context.
- * @src: the pointer to source context.
+ * @dst: the pointer to destination context.
+ * @src: the pointer to source context.
*
* Copies user preference from @src context to @dst.
*
@@ -253,40 +253,40 @@ xmlSecEncCtxCopyUserPref(xmlSecEncCtxPtr dst, xmlSecEncCtxPtr src) {
xmlSecAssert2(dst != NULL, -1);
xmlSecAssert2(src != NULL, -1);
- dst->userData = src->userData;
- dst->flags = src->flags;
- dst->flags2 = src->flags2;
+ dst->userData = src->userData;
+ dst->flags = src->flags;
+ dst->flags2 = src->flags2;
dst->defEncMethodId = src->defEncMethodId;
- dst->mode = src->mode;
+ dst->mode = src->mode;
ret = xmlSecTransformCtxCopyUserPref(&(dst->transformCtx), &(src->transformCtx));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxCopyUserPref",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxCopyUserPref",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecKeyInfoCtxCopyUserPref(&(dst->keyInfoReadCtx), &(src->keyInfoReadCtx));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyInfoCtxCopyUserPref",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyInfoCtxCopyUserPref",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecKeyInfoCtxCopyUserPref(&(dst->keyInfoWriteCtx), &(src->keyInfoWriteCtx));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyInfoCtxCopyUserPref",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyInfoCtxCopyUserPref",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -294,10 +294,10 @@ xmlSecEncCtxCopyUserPref(xmlSecEncCtxPtr dst, xmlSecEncCtxPtr src) {
/**
* xmlSecEncCtxBinaryEncrypt:
- * @encCtx: the pointer to <enc:EncryptedData/> processing context.
- * @tmpl: the pointer to <enc:EncryptedData/> template node.
- * @data: the pointer for binary buffer.
- * @dataSize: the @data buffer size.
+ * @encCtx: the pointer to <enc:EncryptedData/> processing context.
+ * @tmpl: the pointer to <enc:EncryptedData/> template node.
+ * @data: the pointer for binary buffer.
+ * @dataSize: the @data buffer size.
*
* Encrypts @data according to template @tmpl.
*
@@ -305,7 +305,7 @@ xmlSecEncCtxCopyUserPref(xmlSecEncCtxPtr dst, xmlSecEncCtxPtr src) {
*/
int
xmlSecEncCtxBinaryEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl,
- const xmlSecByte* data, xmlSecSize dataSize) {
+ const xmlSecByte* data, xmlSecSize dataSize) {
int ret;
xmlSecAssert2(encCtx != NULL, -1);
@@ -320,23 +320,23 @@ xmlSecEncCtxBinaryEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl,
/* read the template and set encryption method, key, etc. */
ret = xmlSecEncCtxEncDataNodeRead(encCtx, tmpl);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecEncCtxEncDataNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecEncCtxEncDataNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecTransformCtxBinaryExecute(&(encCtx->transformCtx), data, dataSize);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxBinaryExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "dataSize=%d",
- dataSize);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxBinaryExecute",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "dataSize=%d",
+ dataSize);
+ return(-1);
}
encCtx->result = encCtx->transformCtx.result;
@@ -344,21 +344,21 @@ xmlSecEncCtxBinaryEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl,
ret = xmlSecEncCtxEncDataNodeWrite(encCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecEncCtxEncDataNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecEncCtxEncDataNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
/**
* xmlSecEncCtxXmlEncrypt:
- * @encCtx: the pointer to <enc:EncryptedData/> processing context.
- * @tmpl: the pointer to <enc:EncryptedData/> template node.
- * @node: the pointer to node for encryption.
+ * @encCtx: the pointer to <enc:EncryptedData/> processing context.
+ * @tmpl: the pointer to <enc:EncryptedData/> template node.
+ * @node: the pointer to node for encryption.
*
* Encrypts @node according to template @tmpl. If requested, @node is replaced
* with result <enc:EncryptedData/> node.
@@ -383,67 +383,67 @@ xmlSecEncCtxXmlEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, xmlNodePtr node)
/* read the template and set encryption method, key, etc. */
ret = xmlSecEncCtxEncDataNodeRead(encCtx, tmpl);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecEncCtxEncDataNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecEncCtxEncDataNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecTransformCtxPrepare(&(encCtx->transformCtx), xmlSecTransformDataTypeBin);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxPrepare",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "type=bin");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxPrepare",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "type=bin");
+ return(-1);
}
xmlSecAssert2(encCtx->transformCtx.first != NULL, -1);
output = xmlSecTransformCreateOutputBuffer(encCtx->transformCtx.first,
- &(encCtx->transformCtx));
+ &(encCtx->transformCtx));
if(output == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(encCtx->transformCtx.first)),
- "xmlSecTransformCreateOutputBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(encCtx->transformCtx.first)),
+ "xmlSecTransformCreateOutputBuffer",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* push data thru */
if((encCtx->type != NULL) && xmlStrEqual(encCtx->type, xmlSecTypeEncElement)) {
- /* get the content of the node */
- xmlNodeDumpOutput(output, node->doc, node, 0, 0, NULL);
+ /* get the content of the node */
+ xmlNodeDumpOutput(output, node->doc, node, 0, 0, NULL);
} else if((encCtx->type != NULL) && xmlStrEqual(encCtx->type, xmlSecTypeEncContent)) {
- xmlNodePtr cur;
+ xmlNodePtr cur;
- /* get the content of the nodes childs */
- for(cur = node->children; cur != NULL; cur = cur->next) {
- xmlNodeDumpOutput(output, node->doc, cur, 0, 0, NULL);
- }
+ /* get the content of the nodes childs */
+ for(cur = node->children; cur != NULL; cur = cur->next) {
+ xmlNodeDumpOutput(output, node->doc, cur, 0, 0, NULL);
+ }
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_TYPE,
- "type=%s",
- xmlSecErrorsSafeString(encCtx->type));
- xmlOutputBufferClose(output);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TYPE,
+ "type=%s",
+ xmlSecErrorsSafeString(encCtx->type));
+ xmlOutputBufferClose(output);
+ return(-1);
}
/* close the buffer and flush everything */
ret = xmlOutputBufferClose(output);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlOutputBufferClose",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlOutputBufferClose",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
encCtx->result = encCtx->transformCtx.result;
@@ -451,12 +451,12 @@ xmlSecEncCtxXmlEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, xmlNodePtr node)
ret = xmlSecEncCtxEncDataNodeWrite(encCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecEncCtxEncDataNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecEncCtxEncDataNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* now we need to update our original document */
@@ -477,61 +477,61 @@ xmlSecEncCtxXmlEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, xmlNodePtr node)
ret = xmlSecReplaceNode(node, tmpl);
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecReplaceNode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
+ NULL,
+ "xmlSecReplaceNode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
return(-1);
}
}
- encCtx->resultReplaced = 1;
+ encCtx->resultReplaced = 1;
} else if((encCtx->type != NULL) && xmlStrEqual(encCtx->type, xmlSecTypeEncContent)) {
/* check if we need to return the replaced node */
if((encCtx->flags & XMLSEC_ENC_RETURN_REPLACED_NODE) != 0) {
ret = xmlSecReplaceContentAndReturn(node, tmpl, &(encCtx->replacedNodeList));
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecReplaceContentAndReturn",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
+ NULL,
+ "xmlSecReplaceContentAndReturn",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
return(-1);
}
} else {
ret = xmlSecReplaceContent(node, tmpl);
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecReplaceContent",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
+ NULL,
+ "xmlSecReplaceContent",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
return(-1);
}
}
- encCtx->resultReplaced = 1;
+ encCtx->resultReplaced = 1;
} else {
- /* we should've catached this error before */
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_TYPE,
- "type=%s",
- xmlSecErrorsSafeString(encCtx->type));
- return(-1);
+ /* we should've catached this error before */
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_TYPE,
+ "type=%s",
+ xmlSecErrorsSafeString(encCtx->type));
+ return(-1);
}
return(0);
}
/**
* xmlSecEncCtxUriEncrypt:
- * @encCtx: the pointer to <enc:EncryptedData/> processing context.
- * @tmpl: the pointer to <enc:EncryptedData/> template node.
- * @uri: the URI.
+ * @encCtx: the pointer to <enc:EncryptedData/> processing context.
+ * @tmpl: the pointer to <enc:EncryptedData/> template node.
+ * @uri: the URI.
*
* Encrypts data from @uri according to template @tmpl.
*
@@ -553,35 +553,35 @@ xmlSecEncCtxUriEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, const xmlChar *u
/* we need to add input uri transform first */
ret = xmlSecTransformCtxSetUri(&(encCtx->transformCtx), uri, tmpl);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxSetUri",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "uri=%s",
- xmlSecErrorsSafeString(uri));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxSetUri",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "uri=%s",
+ xmlSecErrorsSafeString(uri));
+ return(-1);
}
/* read the template and set encryption method, key, etc. */
ret = xmlSecEncCtxEncDataNodeRead(encCtx, tmpl);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecEncCtxEncDataNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecEncCtxEncDataNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* encrypt the data */
ret = xmlSecTransformCtxExecute(&(encCtx->transformCtx), tmpl->doc);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxExecute",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
encCtx->result = encCtx->transformCtx.result;
@@ -589,12 +589,12 @@ xmlSecEncCtxUriEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, const xmlChar *u
ret = xmlSecEncCtxEncDataNodeWrite(encCtx);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecEncCtxEncDataNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecEncCtxEncDataNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
@@ -602,8 +602,8 @@ xmlSecEncCtxUriEncrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr tmpl, const xmlChar *u
/**
* xmlSecEncCtxDecrypt:
- * @encCtx: the pointer to <enc:EncryptedData/> processing context.
- * @node: the pointer to <enc:EncryptedData/> node.
+ * @encCtx: the pointer to <enc:EncryptedData/> processing context.
+ * @node: the pointer to <enc:EncryptedData/> node.
*
* Decrypts @node and if necessary replaces @node with decrypted data.
*
@@ -620,70 +620,70 @@ xmlSecEncCtxDecrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
/* decrypt */
buffer = xmlSecEncCtxDecryptToBuffer(encCtx, node);
if(buffer == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecEncCtxDecryptToBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecEncCtxDecryptToBuffer",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* replace original node if requested */
if((encCtx->type != NULL) && xmlStrEqual(encCtx->type, xmlSecTypeEncElement)) {
/* check if we need to return the replaced node */
if((encCtx->flags & XMLSEC_ENC_RETURN_REPLACED_NODE) != 0) {
- ret = xmlSecReplaceNodeBufferAndReturn(node, xmlSecBufferGetData(buffer), xmlSecBufferGetSize(buffer), &(encCtx->replacedNodeList));
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecReplaceNodeBufferAndReturn",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
- return(-1);
- }
+ ret = xmlSecReplaceNodeBufferAndReturn(node, xmlSecBufferGetData(buffer), xmlSecBufferGetSize(buffer), &(encCtx->replacedNodeList));
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecReplaceNodeBufferAndReturn",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
+ return(-1);
+ }
} else {
- ret = xmlSecReplaceNodeBuffer(node, xmlSecBufferGetData(buffer), xmlSecBufferGetSize(buffer));
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecReplaceNodeBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
- return(-1);
- }
+ ret = xmlSecReplaceNodeBuffer(node, xmlSecBufferGetData(buffer), xmlSecBufferGetSize(buffer));
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecReplaceNodeBuffer",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
+ return(-1);
+ }
}
- encCtx->resultReplaced = 1;
+ encCtx->resultReplaced = 1;
} else if((encCtx->type != NULL) && xmlStrEqual(encCtx->type, xmlSecTypeEncContent)) {
/* replace the node with the buffer */
/* check if we need to return the replaced node */
if((encCtx->flags & XMLSEC_ENC_RETURN_REPLACED_NODE) != 0) {
- ret = xmlSecReplaceNodeBufferAndReturn(node, xmlSecBufferGetData(buffer), xmlSecBufferGetSize(buffer), &(encCtx->replacedNodeList));
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecReplaceNodeBufferAndReturn",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
- return(-1);
- }
+ ret = xmlSecReplaceNodeBufferAndReturn(node, xmlSecBufferGetData(buffer), xmlSecBufferGetSize(buffer), &(encCtx->replacedNodeList));
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecReplaceNodeBufferAndReturn",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
+ return(-1);
+ }
} else {
ret = xmlSecReplaceNodeBuffer(node, xmlSecBufferGetData(buffer), xmlSecBufferGetSize(buffer));
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecReplaceNodeBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
- return(-1);
- }
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecReplaceNodeBuffer",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)));
+ return(-1);
+ }
}
- encCtx->resultReplaced = 1;
+ encCtx->resultReplaced = 1;
}
return(0);
@@ -691,8 +691,8 @@ xmlSecEncCtxDecrypt(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
/**
* xmlSecEncCtxDecryptToBuffer:
- * @encCtx: the pointer to <enc:EncryptedData/> processing context.
- * @node: the pointer to <enc:EncryptedData/> node.
+ * @encCtx: the pointer to <enc:EncryptedData/> processing context.
+ * @node: the pointer to <enc:EncryptedData/> node.
*
* Decrypts @node data to the @encCtx buffer.
*
@@ -712,12 +712,12 @@ xmlSecEncCtxDecryptToBuffer(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
ret = xmlSecEncCtxEncDataNodeRead(encCtx, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecEncCtxEncDataNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecEncCtxEncDataNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
/* decrypt the data */
@@ -725,42 +725,42 @@ xmlSecEncCtxDecryptToBuffer(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
xmlChar* data = NULL;
xmlSecSize dataSize = 0;
- data = xmlNodeGetContent(encCtx->cipherValueNode);
- if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(encCtx->cipherValueNode)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
- dataSize = xmlStrlen(data);
+ data = xmlNodeGetContent(encCtx->cipherValueNode);
+ if(data == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(encCtx->cipherValueNode)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+ dataSize = xmlStrlen(data);
ret = xmlSecTransformCtxBinaryExecute(&(encCtx->transformCtx), data, dataSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxBinaryExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- if(data != NULL) {
- xmlFree(data);
- }
- return(NULL);
- }
- if(data != NULL) {
- xmlFree(data);
- }
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxBinaryExecute",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ if(data != NULL) {
+ xmlFree(data);
+ }
+ return(NULL);
+ }
+ if(data != NULL) {
+ xmlFree(data);
+ }
} else {
ret = xmlSecTransformCtxExecute(&(encCtx->transformCtx), node->doc);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxBinaryExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxBinaryExecute",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
}
encCtx->result = encCtx->transformCtx.result;
@@ -779,28 +779,28 @@ xmlSecEncCtxEncDataNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
xmlSecAssert2(node != NULL, -1);
switch(encCtx->mode) {
- case xmlEncCtxModeEncryptedData:
- if(!xmlSecCheckNodeName(node, xmlSecNodeEncryptedData, xmlSecEncNs)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "expected=%s",
- xmlSecErrorsSafeString(xmlSecNodeEncryptedData));
- return(-1);
- }
- break;
- case xmlEncCtxModeEncryptedKey:
- if(!xmlSecCheckNodeName(node, xmlSecNodeEncryptedKey, xmlSecEncNs)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "expected=%s",
- xmlSecErrorsSafeString(xmlSecNodeEncryptedKey));
- return(-1);
- }
- break;
+ case xmlEncCtxModeEncryptedData:
+ if(!xmlSecCheckNodeName(node, xmlSecNodeEncryptedData, xmlSecEncNs)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "expected=%s",
+ xmlSecErrorsSafeString(xmlSecNodeEncryptedData));
+ return(-1);
+ }
+ break;
+ case xmlEncCtxModeEncryptedKey:
+ if(!xmlSecCheckNodeName(node, xmlSecNodeEncryptedKey, xmlSecEncNs)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "expected=%s",
+ xmlSecErrorsSafeString(xmlSecNodeEncryptedKey));
+ return(-1);
+ }
+ break;
}
/* first read node data */
@@ -816,180 +816,180 @@ xmlSecEncCtxEncDataNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
encCtx->mimeType = xmlGetProp(node, xmlSecAttrMimeType);
encCtx->encoding = xmlGetProp(node, xmlSecAttrEncoding);
if(encCtx->mode == xmlEncCtxModeEncryptedKey) {
- encCtx->recipient = xmlGetProp(node, xmlSecAttrRecipient);
- /* todo: check recipient? */
+ encCtx->recipient = xmlGetProp(node, xmlSecAttrRecipient);
+ /* todo: check recipient? */
}
cur = xmlSecGetNextElementNode(node->children);
/* first node is optional EncryptionMethod, we'll read it later */
xmlSecAssert2(encCtx->encMethodNode == NULL, -1);
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeEncryptionMethod, xmlSecEncNs))) {
- encCtx->encMethodNode = cur;
+ encCtx->encMethodNode = cur;
cur = xmlSecGetNextElementNode(cur->next);
}
/* next node is optional KeyInfo, we'll process it later */
xmlSecAssert2(encCtx->keyInfoNode == NULL, -1);
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeKeyInfo, xmlSecDSigNs))) {
- encCtx->keyInfoNode = cur;
- cur = xmlSecGetNextElementNode(cur->next);
+ encCtx->keyInfoNode = cur;
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* next is required CipherData node */
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeCipherData, xmlSecEncNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeCipherData));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeCipherData));
+ return(-1);
}
ret = xmlSecEncCtxCipherDataNodeRead(encCtx, cur);
if(ret < 0) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecEncCtxCipherDataNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ NULL,
+ "xmlSecEncCtxCipherDataNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = xmlSecGetNextElementNode(cur->next);
/* next is optional EncryptionProperties node (we simply ignore it) */
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeEncryptionProperties, xmlSecEncNs))) {
- cur = xmlSecGetNextElementNode(cur->next);
+ cur = xmlSecGetNextElementNode(cur->next);
}
/* there are more possible nodes for the <EncryptedKey> node */
if(encCtx->mode == xmlEncCtxModeEncryptedKey) {
- /* next is optional ReferenceList node (we simply ignore it) */
+ /* next is optional ReferenceList node (we simply ignore it) */
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeReferenceList, xmlSecEncNs))) {
- cur = xmlSecGetNextElementNode(cur->next);
- }
+ cur = xmlSecGetNextElementNode(cur->next);
+ }
/* next is optional CarriedKeyName node (we simply ignore it) */
- if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeCarriedKeyName, xmlSecEncNs))) {
- encCtx->carriedKeyName = xmlNodeGetContent(cur);
- if(encCtx->carriedKeyName == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeCipherData));
- return(-1);
- }
- /* TODO: decode the name? */
- cur = xmlSecGetNextElementNode(cur->next);
- }
+ if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeCarriedKeyName, xmlSecEncNs))) {
+ encCtx->carriedKeyName = xmlNodeGetContent(cur);
+ if(encCtx->carriedKeyName == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeCipherData));
+ return(-1);
+ }
+ /* TODO: decode the name? */
+ cur = xmlSecGetNextElementNode(cur->next);
+ }
}
/* if there is something left than it's an error */
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* now read the encryption method node */
xmlSecAssert2(encCtx->encMethod == NULL, -1);
if(encCtx->encMethodNode != NULL) {
- encCtx->encMethod = xmlSecTransformCtxNodeRead(&(encCtx->transformCtx), encCtx->encMethodNode,
- xmlSecTransformUsageEncryptionMethod);
- if(encCtx->encMethod == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(encCtx->encMethodNode)));
- return(-1);
- }
+ encCtx->encMethod = xmlSecTransformCtxNodeRead(&(encCtx->transformCtx), encCtx->encMethodNode,
+ xmlSecTransformUsageEncryptionMethod);
+ if(encCtx->encMethod == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(encCtx->encMethodNode)));
+ return(-1);
+ }
} else if(encCtx->defEncMethodId != xmlSecTransformIdUnknown) {
- encCtx->encMethod = xmlSecTransformCtxCreateAndAppend(&(encCtx->transformCtx),
- encCtx->defEncMethodId);
- if(encCtx->encMethod == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ encCtx->encMethod = xmlSecTransformCtxCreateAndAppend(&(encCtx->transformCtx),
+ encCtx->defEncMethodId);
+ if(encCtx->encMethod == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "encryption method not specified");
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "encryption method not specified");
+ return(-1);
}
encCtx->encMethod->operation = encCtx->operation;
/* we have encryption method, find key */
ret = xmlSecTransformSetKeyReq(encCtx->encMethod, &(encCtx->keyInfoReadCtx.keyReq));
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformSetKeyReq",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformGetName(encCtx->encMethod)));
- return(-1);
- }
-
- /* TODO: KeyInfo node != NULL and encKey != NULL */
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformSetKeyReq",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformGetName(encCtx->encMethod)));
+ return(-1);
+ }
+
+ /* TODO: KeyInfo node != NULL and encKey != NULL */
if((encCtx->encKey == NULL) && (encCtx->keyInfoReadCtx.keysMngr != NULL)
- && (encCtx->keyInfoReadCtx.keysMngr->getKey != NULL)) {
- encCtx->encKey = (encCtx->keyInfoReadCtx.keysMngr->getKey)(encCtx->keyInfoNode,
- &(encCtx->keyInfoReadCtx));
+ && (encCtx->keyInfoReadCtx.keysMngr->getKey != NULL)) {
+ encCtx->encKey = (encCtx->keyInfoReadCtx.keysMngr->getKey)(encCtx->keyInfoNode,
+ &(encCtx->keyInfoReadCtx));
}
/* check that we have exactly what we want */
if((encCtx->encKey == NULL) ||
(!xmlSecKeyMatch(encCtx->encKey, NULL, &(encCtx->keyInfoReadCtx.keyReq)))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_KEY_NOT_FOUND,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_KEY_NOT_FOUND,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
/* set the key to the transform */
ret = xmlSecTransformSetKey(encCtx->encMethod, encCtx->encKey);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformSetKey",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "transform=%s",
- xmlSecErrorsSafeString(xmlSecTransformGetName(encCtx->encMethod)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformSetKey",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "transform=%s",
+ xmlSecErrorsSafeString(xmlSecTransformGetName(encCtx->encMethod)));
+ return(-1);
}
/* if we need to write result to xml node then we need base64 encode it */
- if((encCtx->operation == xmlSecTransformOperationEncrypt) && (encCtx->cipherValueNode != NULL)) {
- xmlSecTransformPtr base64Encode;
-
- /* we need to add base64 encode transform */
- base64Encode = xmlSecTransformCtxCreateAndAppend(&(encCtx->transformCtx), xmlSecTransformBase64Id);
- if(base64Encode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxCreateAndAppend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- base64Encode->operation = xmlSecTransformOperationEncode;
- encCtx->resultBase64Encoded = 1;
+ if((encCtx->operation == xmlSecTransformOperationEncrypt) && (encCtx->cipherValueNode != NULL)) {
+ xmlSecTransformPtr base64Encode;
+
+ /* we need to add base64 encode transform */
+ base64Encode = xmlSecTransformCtxCreateAndAppend(&(encCtx->transformCtx), xmlSecTransformBase64Id);
+ if(base64Encode == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxCreateAndAppend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ base64Encode->operation = xmlSecTransformOperationEncode;
+ encCtx->resultBase64Encoded = 1;
}
return(0);
@@ -1004,26 +1004,26 @@ xmlSecEncCtxEncDataNodeWrite(xmlSecEncCtxPtr encCtx) {
xmlSecAssert2(encCtx->encKey != NULL, -1);
/* write encrypted data to xml (if requested) */
- if(encCtx->cipherValueNode != NULL) {
- xmlSecAssert2(xmlSecBufferGetData(encCtx->result) != NULL, -1);
+ if(encCtx->cipherValueNode != NULL) {
+ xmlSecAssert2(xmlSecBufferGetData(encCtx->result) != NULL, -1);
- xmlNodeSetContentLen(encCtx->cipherValueNode,
- xmlSecBufferGetData(encCtx->result),
- xmlSecBufferGetSize(encCtx->result));
- encCtx->resultReplaced = 1;
+ xmlNodeSetContentLen(encCtx->cipherValueNode,
+ xmlSecBufferGetData(encCtx->result),
+ xmlSecBufferGetSize(encCtx->result));
+ encCtx->resultReplaced = 1;
}
/* update <enc:KeyInfo/> node */
if(encCtx->keyInfoNode != NULL) {
- ret = xmlSecKeyInfoNodeWrite(encCtx->keyInfoNode, encCtx->encKey, &(encCtx->keyInfoWriteCtx));
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyInfoNodeWrite",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ ret = xmlSecKeyInfoNodeWrite(encCtx->keyInfoNode, encCtx->encKey, &(encCtx->keyInfoWriteCtx));
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyInfoNodeWrite",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
}
return(0);
@@ -1043,46 +1043,46 @@ xmlSecEncCtxCipherDataNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
xmlSecAssert2(encCtx->cipherValueNode == NULL, -1);
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeCipherValue, xmlSecEncNs))) {
/* don't need data from CipherData node when we are encrypting */
- if(encCtx->operation == xmlSecTransformOperationDecrypt) {
- xmlSecTransformPtr base64Decode;
-
- /* we need to add base64 decode transform */
- base64Decode = xmlSecTransformCtxCreateAndPrepend(&(encCtx->transformCtx), xmlSecTransformBase64Id);
- if(base64Decode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxCreateAndPrepend",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
- }
- encCtx->cipherValueNode = cur;
+ if(encCtx->operation == xmlSecTransformOperationDecrypt) {
+ xmlSecTransformPtr base64Decode;
+
+ /* we need to add base64 decode transform */
+ base64Decode = xmlSecTransformCtxCreateAndPrepend(&(encCtx->transformCtx), xmlSecTransformBase64Id);
+ if(base64Decode == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxCreateAndPrepend",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+ }
+ encCtx->cipherValueNode = cur;
cur = xmlSecGetNextElementNode(cur->next);
} else if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeCipherReference, xmlSecEncNs))) {
/* don't need data from CipherReference node when we are encrypting */
- if(encCtx->operation == xmlSecTransformOperationDecrypt) {
- ret = xmlSecEncCtxCipherReferenceNodeRead(encCtx, cur);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecEncCtxCipherReferenceNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
- }
- }
+ if(encCtx->operation == xmlSecTransformOperationDecrypt) {
+ ret = xmlSecEncCtxCipherReferenceNodeRead(encCtx, cur);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecEncCtxCipherReferenceNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
+ }
+ }
cur = xmlSecGetNextElementNode(cur->next);
}
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
@@ -1100,51 +1100,51 @@ xmlSecEncCtxCipherReferenceNodeRead(xmlSecEncCtxPtr encCtx, xmlNodePtr node) {
uri = xmlGetProp(node, xmlSecAttrURI);
ret = xmlSecTransformCtxSetUri(&(encCtx->transformCtx), uri, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxSetUri",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "uri=%s",
- xmlSecErrorsSafeString(uri));
- xmlFree(uri);
- return(-1);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxSetUri",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "uri=%s",
+ xmlSecErrorsSafeString(uri));
+ xmlFree(uri);
+ return(-1);
+ }
xmlFree(uri);
cur = xmlSecGetNextElementNode(node->children);
/* the only one node is optional Transforms node */
if((cur != NULL) && (xmlSecCheckNodeName(cur, xmlSecNodeTransforms, xmlSecEncNs))) {
- ret = xmlSecTransformCtxNodesListRead(&(encCtx->transformCtx), cur,
- xmlSecTransformUsageDSigTransform);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformCtxNodesListRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(encCtx->encMethodNode)));
- return(-1);
- }
+ ret = xmlSecTransformCtxNodesListRead(&(encCtx->transformCtx), cur,
+ xmlSecTransformUsageDSigTransform);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformCtxNodesListRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(encCtx->encMethodNode)));
+ return(-1);
+ }
cur = xmlSecGetNextElementNode(cur->next);
}
/* if there is something left than it's an error */
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
/**
* xmlSecEncCtxDebugDump:
- * @encCtx: the pointer to <enc:EncryptedData/> processing context.
- * @output: the pointer to output FILE.
+ * @encCtx: the pointer to <enc:EncryptedData/> processing context.
+ * @output: the pointer to output FILE.
*
* Prints the debug information about @encCtx to @output.
*/
@@ -1154,44 +1154,44 @@ xmlSecEncCtxDebugDump(xmlSecEncCtxPtr encCtx, FILE* output) {
xmlSecAssert(output != NULL);
switch(encCtx->mode) {
- case xmlEncCtxModeEncryptedData:
- if(encCtx->operation == xmlSecTransformOperationEncrypt) {
- fprintf(output, "= DATA ENCRYPTION CONTEXT\n");
- } else {
- fprintf(output, "= DATA DECRYPTION CONTEXT\n");
- }
- break;
- case xmlEncCtxModeEncryptedKey:
- if(encCtx->operation == xmlSecTransformOperationEncrypt) {
- fprintf(output, "= KEY ENCRYPTION CONTEXT\n");
- } else {
- fprintf(output, "= KEY DECRYPTION CONTEXT\n");
- }
- break;
+ case xmlEncCtxModeEncryptedData:
+ if(encCtx->operation == xmlSecTransformOperationEncrypt) {
+ fprintf(output, "= DATA ENCRYPTION CONTEXT\n");
+ } else {
+ fprintf(output, "= DATA DECRYPTION CONTEXT\n");
+ }
+ break;
+ case xmlEncCtxModeEncryptedKey:
+ if(encCtx->operation == xmlSecTransformOperationEncrypt) {
+ fprintf(output, "= KEY ENCRYPTION CONTEXT\n");
+ } else {
+ fprintf(output, "= KEY DECRYPTION CONTEXT\n");
+ }
+ break;
}
fprintf(output, "== Status: %s\n",
- (encCtx->resultReplaced) ? "replaced" : "not-replaced" );
+ (encCtx->resultReplaced) ? "replaced" : "not-replaced" );
fprintf(output, "== flags: 0x%08x\n", encCtx->flags);
fprintf(output, "== flags2: 0x%08x\n", encCtx->flags2);
if(encCtx->id != NULL) {
- fprintf(output, "== Id: \"%s\"\n", encCtx->id);
+ fprintf(output, "== Id: \"%s\"\n", encCtx->id);
}
if(encCtx->type != NULL) {
- fprintf(output, "== Type: \"%s\"\n", encCtx->type);
+ fprintf(output, "== Type: \"%s\"\n", encCtx->type);
}
if(encCtx->mimeType != NULL) {
- fprintf(output, "== MimeType: \"%s\"\n", encCtx->mimeType);
+ fprintf(output, "== MimeType: \"%s\"\n", encCtx->mimeType);
}
if(encCtx->encoding != NULL) {
- fprintf(output, "== Encoding: \"%s\"\n", encCtx->encoding);
+ fprintf(output, "== Encoding: \"%s\"\n", encCtx->encoding);
}
if(encCtx->recipient != NULL) {
- fprintf(output, "== Recipient: \"%s\"\n", encCtx->recipient);
+ fprintf(output, "== Recipient: \"%s\"\n", encCtx->recipient);
}
if(encCtx->carriedKeyName != NULL) {
- fprintf(output, "== CarriedKeyName: \"%s\"\n", encCtx->carriedKeyName);
+ fprintf(output, "== CarriedKeyName: \"%s\"\n", encCtx->carriedKeyName);
}
fprintf(output, "== Key Info Read Ctx:\n");
@@ -1205,30 +1205,30 @@ xmlSecEncCtxDebugDump(xmlSecEncCtxPtr encCtx, FILE* output) {
if(encCtx->encMethod != NULL) {
fprintf(output, "== Encryption Method:\n");
- xmlSecTransformDebugDump(encCtx->encMethod, output);
+ xmlSecTransformDebugDump(encCtx->encMethod, output);
}
if(encCtx->encKey != NULL) {
fprintf(output, "== Encryption Key:\n");
- xmlSecKeyDebugDump(encCtx->encKey, output);
+ xmlSecKeyDebugDump(encCtx->encKey, output);
}
if((encCtx->result != NULL) &&
(xmlSecBufferGetData(encCtx->result) != NULL) &&
(encCtx->resultBase64Encoded != 0)) {
- fprintf(output, "== Result - start buffer:\n");
- fwrite(xmlSecBufferGetData(encCtx->result),
- xmlSecBufferGetSize(encCtx->result), 1,
- output);
- fprintf(output, "\n== Result - end buffer\n");
+ fprintf(output, "== Result - start buffer:\n");
+ fwrite(xmlSecBufferGetData(encCtx->result),
+ xmlSecBufferGetSize(encCtx->result), 1,
+ output);
+ fprintf(output, "\n== Result - end buffer\n");
}
}
/**
* xmlSecEncCtxDebugXmlDump:
- * @encCtx: the pointer to <enc:EncryptedData/> processing context.
- * @output: the pointer to output FILE.
+ * @encCtx: the pointer to <enc:EncryptedData/> processing context.
+ * @output: the pointer to output FILE.
*
* Prints the debug information about @encCtx to @output in XML format.
*/
@@ -1238,20 +1238,20 @@ xmlSecEncCtxDebugXmlDump(xmlSecEncCtxPtr encCtx, FILE* output) {
xmlSecAssert(output != NULL);
switch(encCtx->mode) {
- case xmlEncCtxModeEncryptedData:
- if(encCtx->operation == xmlSecTransformOperationEncrypt) {
- fprintf(output, "<DataEncryptionContext ");
- } else {
- fprintf(output, "<DataDecryptionContext ");
- }
- break;
- case xmlEncCtxModeEncryptedKey:
- if(encCtx->operation == xmlSecTransformOperationEncrypt) {
- fprintf(output, "<KeyEncryptionContext ");
- } else {
- fprintf(output, "<KeyDecryptionContext ");
- }
- break;
+ case xmlEncCtxModeEncryptedData:
+ if(encCtx->operation == xmlSecTransformOperationEncrypt) {
+ fprintf(output, "<DataEncryptionContext ");
+ } else {
+ fprintf(output, "<DataDecryptionContext ");
+ }
+ break;
+ case xmlEncCtxModeEncryptedKey:
+ if(encCtx->operation == xmlSecTransformOperationEncrypt) {
+ fprintf(output, "<KeyEncryptionContext ");
+ } else {
+ fprintf(output, "<KeyDecryptionContext ");
+ }
+ break;
}
fprintf(output, "status=\"%s\" >\n", (encCtx->resultReplaced) ? "replaced" : "not-replaced" );
@@ -1296,13 +1296,13 @@ xmlSecEncCtxDebugXmlDump(xmlSecEncCtxPtr encCtx, FILE* output) {
if(encCtx->encMethod != NULL) {
fprintf(output, "<EncryptionMethod>\n");
- xmlSecTransformDebugXmlDump(encCtx->encMethod, output);
+ xmlSecTransformDebugXmlDump(encCtx->encMethod, output);
fprintf(output, "</EncryptionMethod>\n");
}
if(encCtx->encKey != NULL) {
fprintf(output, "<EncryptionKey>\n");
- xmlSecKeyDebugXmlDump(encCtx->encKey, output);
+ xmlSecKeyDebugXmlDump(encCtx->encKey, output);
fprintf(output, "</EncryptionKey>\n");
}
@@ -1310,28 +1310,28 @@ xmlSecEncCtxDebugXmlDump(xmlSecEncCtxPtr encCtx, FILE* output) {
(xmlSecBufferGetData(encCtx->result) != NULL) &&
(encCtx->resultBase64Encoded != 0)) {
- fprintf(output, "<Result>");
- fwrite(xmlSecBufferGetData(encCtx->result),
- xmlSecBufferGetSize(encCtx->result), 1,
- output);
- fprintf(output, "</Result>\n");
+ fprintf(output, "<Result>");
+ fwrite(xmlSecBufferGetData(encCtx->result),
+ xmlSecBufferGetSize(encCtx->result), 1,
+ output);
+ fprintf(output, "</Result>\n");
}
switch(encCtx->mode) {
- case xmlEncCtxModeEncryptedData:
- if(encCtx->operation == xmlSecTransformOperationEncrypt) {
- fprintf(output, "</DataEncryptionContext>\n");
- } else {
- fprintf(output, "</DataDecryptionContext>\n");
- }
- break;
- case xmlEncCtxModeEncryptedKey:
- if(encCtx->operation == xmlSecTransformOperationEncrypt) {
- fprintf(output, "</KeyEncryptionContext>\n");
- } else {
- fprintf(output, "</KeyDecryptionContext>\n");
- }
- break;
+ case xmlEncCtxModeEncryptedData:
+ if(encCtx->operation == xmlSecTransformOperationEncrypt) {
+ fprintf(output, "</DataEncryptionContext>\n");
+ } else {
+ fprintf(output, "</DataDecryptionContext>\n");
+ }
+ break;
+ case xmlEncCtxModeEncryptedKey:
+ if(encCtx->operation == xmlSecTransformOperationEncrypt) {
+ fprintf(output, "</KeyEncryptionContext>\n");
+ } else {
+ fprintf(output, "</KeyDecryptionContext>\n");
+ }
+ break;
}
}
diff --git a/src/xmlsec.c b/src/xmlsec.c
index 3baa81a..a1b25d4 100644
--- a/src/xmlsec.c
+++ b/src/xmlsec.c
@@ -39,49 +39,49 @@ xmlSecInit(void) {
#ifndef XMLSEC_NO_CRYPTO_DYNAMIC_LOADING
if(xmlSecCryptoDLInit() < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoDLInit",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCryptoDLInit",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
#endif /* XMLSEC_NO_CRYPTO_DYNAMIC_LOADING */
if(xmlSecKeyDataIdsInit() < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecKeyDataIdsInit",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecKeyDataIdsInit",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if(xmlSecTransformIdsInit() < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecTransformIdsInit",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecTransformIdsInit",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
#ifndef XMLSEC_NO_XKMS
if(xmlSecXkmsRespondWithIdsInit() < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsRespondWithIdsInit",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsRespondWithIdsInit",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if(xmlSecXkmsServerRequestIdsInit() < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXkmsServerRequestIdsInit",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXkmsServerRequestIdsInit",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
#endif /* XMLSEC_NO_XKMS */
@@ -111,12 +111,12 @@ xmlSecShutdown(void) {
#ifndef XMLSEC_NO_CRYPTO_DYNAMIC_LOADING
if(xmlSecCryptoDLShutdown() < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecCryptoDLShutdown",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- res = -1;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecCryptoDLShutdown",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ res = -1;
}
#endif /* XMLSEC_NO_CRYPTO_DYNAMIC_LOADING */
@@ -127,10 +127,10 @@ xmlSecShutdown(void) {
/**
* xmlSecCheckVersionExt:
- * @major: the major version number.
- * @minor: the minor version number.
- * @subminor: the subminor version number.
- * @mode: the version check mode.
+ * @major: the major version number.
+ * @minor: the minor version number.
+ * @subminor: the subminor version number.
+ * @mode: the version check mode.
*
* Checks if the loaded version of xmlsec library could be used.
*
@@ -141,42 +141,42 @@ int
xmlSecCheckVersionExt(int major, int minor, int subminor, xmlSecCheckVersionMode mode) {
/* we always want to have a match for major version number */
if(major != XMLSEC_VERSION_MAJOR) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "expected major version=%d;real major version=%d",
- XMLSEC_VERSION_MAJOR, major);
- return(0);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "expected major version=%d;real major version=%d",
+ XMLSEC_VERSION_MAJOR, major);
+ return(0);
}
switch(mode) {
case xmlSecCheckVersionExactMatch:
- if((minor != XMLSEC_VERSION_MINOR) || (subminor != XMLSEC_VERSION_SUBMINOR)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "mode=exact;expected minor version=%d;real minor version=%d;expected subminor version=%d;real subminor version=%d",
- XMLSEC_VERSION_MINOR, minor,
- XMLSEC_VERSION_SUBMINOR, subminor);
- return(0);
- }
- break;
+ if((minor != XMLSEC_VERSION_MINOR) || (subminor != XMLSEC_VERSION_SUBMINOR)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "mode=exact;expected minor version=%d;real minor version=%d;expected subminor version=%d;real subminor version=%d",
+ XMLSEC_VERSION_MINOR, minor,
+ XMLSEC_VERSION_SUBMINOR, subminor);
+ return(0);
+ }
+ break;
case xmlSecCheckVersionABICompatible:
- if((minor < XMLSEC_VERSION_MINOR) ||
- ((minor == XMLSEC_VERSION_MINOR) &&
- (subminor < XMLSEC_VERSION_SUBMINOR))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "mode=abi compatible;expected minor version=%d;real minor version=%d;expected subminor version=%d;real subminor version=%d",
- XMLSEC_VERSION_MINOR, minor,
- XMLSEC_VERSION_SUBMINOR, subminor);
- return(0);
- }
- break;
+ if((minor < XMLSEC_VERSION_MINOR) ||
+ ((minor == XMLSEC_VERSION_MINOR) &&
+ (subminor < XMLSEC_VERSION_SUBMINOR))) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "mode=abi compatible;expected minor version=%d;real minor version=%d;expected subminor version=%d;real subminor version=%d",
+ XMLSEC_VERSION_MINOR, minor,
+ XMLSEC_VERSION_SUBMINOR, subminor);
+ return(0);
+ }
+ break;
}
return(1);
diff --git a/src/xmltree.c b/src/xmltree.c
index 96ea53c..b7d9cd0 100644
--- a/src/xmltree.c
+++ b/src/xmltree.c
@@ -29,9 +29,9 @@
/**
* xmlSecFindChild:
- * @parent: the pointer to XML node.
- * @name: the name.
- * @ns: the namespace href (may be NULL).
+ * @parent: the pointer to XML node.
+ * @name: the name.
+ * @ns: the namespace href (may be NULL).
*
* Searches a direct child of the @parent node having given name and
* namespace href.
@@ -49,20 +49,20 @@ xmlSecFindChild(const xmlNodePtr parent, const xmlChar *name, const xmlChar *ns)
cur = parent->children;
while(cur != NULL) {
if(cur->type == XML_ELEMENT_NODE) {
- if(xmlSecCheckNodeName(cur, name, ns)) {
- return(cur);
- }
- }
- cur = cur->next;
+ if(xmlSecCheckNodeName(cur, name, ns)) {
+ return(cur);
+ }
+ }
+ cur = cur->next;
}
return(NULL);
}
/**
* xmlSecFindParent:
- * @cur: the pointer to an XML node.
- * @name: the name.
- * @ns: the namespace href (may be NULL).
+ * @cur: the pointer to an XML node.
+ * @name: the name.
+ * @ns: the namespace href (may be NULL).
*
* Searches the ancestors axis of the @cur node for a node having given name
* and namespace href.
@@ -76,18 +76,18 @@ xmlSecFindParent(const xmlNodePtr cur, const xmlChar *name, const xmlChar *ns) {
xmlSecAssert2(name != NULL, NULL);
if(xmlSecCheckNodeName(cur, name, ns)) {
- return(cur);
+ return(cur);
} else if(cur->parent != NULL) {
- return(xmlSecFindParent(cur->parent, name, ns));
+ return(xmlSecFindParent(cur->parent, name, ns));
}
return(NULL);
}
/**
* xmlSecFindNode:
- * @parent: the pointer to XML node.
- * @name: the name.
- * @ns: the namespace href (may be NULL).
+ * @parent: the pointer to XML node.
+ * @name: the name.
+ * @ns: the namespace href (may be NULL).
*
* Searches all children of the @parent node having given name and
* namespace href.
@@ -95,7 +95,7 @@ xmlSecFindParent(const xmlNodePtr cur, const xmlChar *name, const xmlChar *ns) {
* Returns: the pointer to the found node or NULL if an error occurs or
* node is not found.
*/
-xmlNodePtr
+xmlNodePtr
xmlSecFindNode(const xmlNodePtr parent, const xmlChar *name, const xmlChar *ns) {
xmlNodePtr cur;
xmlNodePtr ret;
@@ -105,22 +105,22 @@ xmlSecFindNode(const xmlNodePtr parent, const xmlChar *name, const xmlChar *ns)
cur = parent;
while(cur != NULL) {
if((cur->type == XML_ELEMENT_NODE) && xmlSecCheckNodeName(cur, name, ns)) {
- return(cur);
- }
- if(cur->children != NULL) {
- ret = xmlSecFindNode(cur->children, name, ns);
- if(ret != NULL) {
- return(ret);
- }
- }
- cur = cur->next;
+ return(cur);
+ }
+ if(cur->children != NULL) {
+ ret = xmlSecFindNode(cur->children, name, ns);
+ if(ret != NULL) {
+ return(ret);
+ }
+ }
+ cur = cur->next;
}
return(NULL);
}
/**
* xmlSecGetNodeNsHref:
- * @cur: the pointer to node.
+ * @cur: the pointer to node.
*
* Get's node's namespace href.
*
@@ -134,23 +134,23 @@ xmlSecGetNodeNsHref(const xmlNodePtr cur) {
/* do we have a namespace in the node? */
if(cur->ns != NULL) {
- return(cur->ns->href);
+ return(cur->ns->href);
}
/* search for default namespace */
ns = xmlSearchNs(cur->doc, cur, NULL);
if(ns != NULL) {
- return(ns->href);
+ return(ns->href);
}
-
+
return(NULL);
}
/**
* xmlSecCheckNodeName:
- * @cur: the pointer to an XML node.
- * @name: the name,
- * @ns: the namespace href.
+ * @cur: the pointer to an XML node.
+ * @name: the name,
+ * @ns: the namespace href.
*
* Checks that the node has a given name and a given namespace href.
*
@@ -161,20 +161,20 @@ xmlSecCheckNodeName(const xmlNodePtr cur, const xmlChar *name, const xmlChar *ns
xmlSecAssert2(cur != NULL, 0);
return(xmlStrEqual(cur->name, name) &&
- xmlStrEqual(xmlSecGetNodeNsHref(cur), ns));
+ xmlStrEqual(xmlSecGetNodeNsHref(cur), ns));
}
/**
* xmlSecAddChild:
- * @parent: the pointer to an XML node.
- * @name: the new node name.
- * @ns: the new node namespace.
+ * @parent: the pointer to an XML node.
+ * @name: the new node name.
+ * @ns: the new node namespace.
*
* Adds a child to the node @parent with given @name and namespace @ns.
*
* Returns: pointer to the new node or NULL if an error occurs.
*/
-xmlNodePtr
+xmlNodePtr
xmlSecAddChild(xmlNodePtr parent, const xmlChar *name, const xmlChar *ns) {
xmlNodePtr cur;
xmlNodePtr text;
@@ -184,49 +184,49 @@ xmlSecAddChild(xmlNodePtr parent, const xmlChar *name, const xmlChar *ns) {
if(parent->children == NULL) {
/* TODO: add indents */
- text = xmlNewText(xmlSecStringCR);
- if(text == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewText",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
- xmlAddChild(parent, text);
+ text = xmlNewText(xmlSecStringCR);
+ if(text == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewText",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+ xmlAddChild(parent, text);
}
cur = xmlNewChild(parent, NULL, name, NULL);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewChild",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewChild",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
/* namespaces support */
if(ns != NULL) {
- xmlNsPtr nsPtr;
-
+ xmlNsPtr nsPtr;
+
/* find namespace by href and check that its prefix is not overwritten */
- nsPtr = xmlSearchNsByHref(cur->doc, cur, ns);
- if((nsPtr == NULL) || (xmlSearchNs(cur->doc, cur, nsPtr->prefix) != nsPtr)) {
- nsPtr = xmlNewNs(cur, ns, NULL);
- }
- xmlSetNs(cur, nsPtr);
+ nsPtr = xmlSearchNsByHref(cur->doc, cur, ns);
+ if((nsPtr == NULL) || (xmlSearchNs(cur->doc, cur, nsPtr->prefix) != nsPtr)) {
+ nsPtr = xmlNewNs(cur, ns, NULL);
+ }
+ xmlSetNs(cur, nsPtr);
}
/* TODO: add indents */
text = xmlNewText(xmlSecStringCR);
- if(text == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewText",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ if(text == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewText",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
xmlAddChild(parent, text);
@@ -235,14 +235,14 @@ xmlSecAddChild(xmlNodePtr parent, const xmlChar *name, const xmlChar *ns) {
/**
* xmlSecAddChildNode:
- * @parent: the pointer to an XML node.
- * @child: the new node.
+ * @parent: the pointer to an XML node.
+ * @child: the new node.
*
* Adds @child node to the @parent node.
*
* Returns: pointer to the new node or NULL if an error occurs.
*/
-xmlNodePtr
+xmlNodePtr
xmlSecAddChildNode(xmlNodePtr parent, xmlNodePtr child) {
xmlNodePtr text;
@@ -251,29 +251,29 @@ xmlSecAddChildNode(xmlNodePtr parent, xmlNodePtr child) {
if(parent->children == NULL) {
/* TODO: add indents */
- text = xmlNewText(xmlSecStringCR);
- if(text == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewText",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
- }
- xmlAddChild(parent, text);
+ text = xmlNewText(xmlSecStringCR);
+ if(text == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewText",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
+ }
+ xmlAddChild(parent, text);
}
xmlAddChild(parent, child);
/* TODO: add indents */
text = xmlNewText(xmlSecStringCR);
- if(text == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewText",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ if(text == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewText",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
xmlAddChild(parent, text);
@@ -282,9 +282,9 @@ xmlSecAddChildNode(xmlNodePtr parent, xmlNodePtr child) {
/**
* xmlSecAddNextSibling
- * @node: the pointer to an XML node.
- * @name: the new node name.
- * @ns: the new node namespace.
+ * @node: the pointer to an XML node.
+ * @name: the new node name.
+ * @ns: the new node namespace.
*
* Adds next sibling to the node @node with given @name and namespace @ns.
*
@@ -300,36 +300,36 @@ xmlSecAddNextSibling(xmlNodePtr node, const xmlChar *name, const xmlChar *ns) {
cur = xmlNewNode(NULL, name);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewNode",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewNode",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
xmlAddNextSibling(node, cur);
/* namespaces support */
if(ns != NULL) {
- xmlNsPtr nsPtr;
-
+ xmlNsPtr nsPtr;
+
/* find namespace by href and check that its prefix is not overwritten */
- nsPtr = xmlSearchNsByHref(cur->doc, cur, ns);
- if((nsPtr == NULL) || (xmlSearchNs(cur->doc, cur, nsPtr->prefix) != nsPtr)) {
- nsPtr = xmlNewNs(cur, ns, NULL);
- }
- xmlSetNs(cur, nsPtr);
+ nsPtr = xmlSearchNsByHref(cur->doc, cur, ns);
+ if((nsPtr == NULL) || (xmlSearchNs(cur->doc, cur, nsPtr->prefix) != nsPtr)) {
+ nsPtr = xmlNewNs(cur, ns, NULL);
+ }
+ xmlSetNs(cur, nsPtr);
}
/* TODO: add indents */
text = xmlNewText(xmlSecStringCR);
- if(text == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewText",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ if(text == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewText",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
xmlAddNextSibling(node, text);
@@ -338,9 +338,9 @@ xmlSecAddNextSibling(xmlNodePtr node, const xmlChar *name, const xmlChar *ns) {
/**
* xmlSecAddPrevSibling
- * @node: the pointer to an XML node.
- * @name: the new node name.
- * @ns: the new node namespace.
+ * @node: the pointer to an XML node.
+ * @name: the new node name.
+ * @ns: the new node namespace.
*
* Adds prev sibling to the node @node with given @name and namespace @ns.
*
@@ -356,36 +356,36 @@ xmlSecAddPrevSibling(xmlNodePtr node, const xmlChar *name, const xmlChar *ns) {
cur = xmlNewNode(NULL, name);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewNode",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewNode",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
xmlAddPrevSibling(node, cur);
/* namespaces support */
if(ns != NULL) {
- xmlNsPtr nsPtr;
-
+ xmlNsPtr nsPtr;
+
/* find namespace by href and check that its prefix is not overwritten */
- nsPtr = xmlSearchNsByHref(cur->doc, cur, ns);
- if((nsPtr == NULL) || (xmlSearchNs(cur->doc, cur, nsPtr->prefix) != nsPtr)) {
- nsPtr = xmlNewNs(cur, ns, NULL);
- }
- xmlSetNs(cur, nsPtr);
+ nsPtr = xmlSearchNsByHref(cur->doc, cur, ns);
+ if((nsPtr == NULL) || (xmlSearchNs(cur->doc, cur, nsPtr->prefix) != nsPtr)) {
+ nsPtr = xmlNewNs(cur, ns, NULL);
+ }
+ xmlSetNs(cur, nsPtr);
}
/* TODO: add indents */
text = xmlNewText(xmlSecStringCR);
- if(text == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewText",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ if(text == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewText",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
xmlAddPrevSibling(node, text);
@@ -394,7 +394,7 @@ xmlSecAddPrevSibling(xmlNodePtr node, const xmlChar *name, const xmlChar *ns) {
/**
* xmlSecGetNextElementNode:
- * @cur: the pointer to an XML node.
+ * @cur: the pointer to an XML node.
*
* Seraches for the next element node.
*
@@ -404,15 +404,15 @@ xmlNodePtr
xmlSecGetNextElementNode(xmlNodePtr cur) {
while((cur != NULL) && (cur->type != XML_ELEMENT_NODE)) {
- cur = cur->next;
+ cur = cur->next;
}
return(cur);
}
/**
* xmlSecReplaceNode:
- * @node: the current node.
- * @newNode: the new node.
+ * @node: the current node.
+ * @newNode: the new node.
*
* Swaps the @node and @newNode in the XML tree.
*
@@ -425,9 +425,9 @@ xmlSecReplaceNode(xmlNodePtr node, xmlNodePtr newNode) {
/**
* xmlSecReplaceNodeAndReturn:
- * @node: the current node.
- * @newNode: the new node.
- * @replaced: the replaced node, or release it if NULL is given
+ * @node: the current node.
+ * @newNode: the new node.
+ * @replaced: the replaced node, or release it if NULL is given
*
* Swaps the @node and @newNode in the XML tree.
*
@@ -443,32 +443,32 @@ xmlSecReplaceNodeAndReturn(xmlNodePtr node, xmlNodePtr newNode, xmlNodePtr* repl
/* fix documents children if necessary first */
if((node->doc != NULL) && (node->doc->children == node)) {
- node->doc->children = node->next;
- restoreRoot = 1;
+ node->doc->children = node->next;
+ restoreRoot = 1;
}
if((newNode->doc != NULL) && (newNode->doc->children == newNode)) {
- newNode->doc->children = newNode->next;
+ newNode->doc->children = newNode->next;
}
oldNode = xmlReplaceNode(node, newNode);
if(oldNode == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
"xmlReplaceNode",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
if(restoreRoot != 0) {
- xmlDocSetRootElement(oldNode->doc, newNode);
+ xmlDocSetRootElement(oldNode->doc, newNode);
}
/* return the old node if requested */
if(replaced != NULL) {
- (*replaced) = oldNode;
+ (*replaced) = oldNode;
} else {
- xmlFreeNode(oldNode);
+ xmlFreeNode(oldNode);
}
return(0);
@@ -476,8 +476,8 @@ xmlSecReplaceNodeAndReturn(xmlNodePtr node, xmlNodePtr newNode, xmlNodePtr* repl
/**
* xmlSecReplaceContent
- * @node: the current node.
- * @newNode: the new node.
+ * @node: the current node.
+ * @newNode: the new node.
*
* Swaps the content of @node and @newNode.
*
@@ -490,9 +490,9 @@ xmlSecReplaceContent(xmlNodePtr node, xmlNodePtr newNode) {
/**
* xmlSecReplaceContentAndReturn
- * @node: the current node.
- * @newNode: the new node.
- * @replaced: the replaced nodes, or release them if NULL is given
+ * @node: the current node.
+ * @newNode: the new node.
+ * @replaced: the replaced nodes, or release them if NULL is given
*
* Swaps the content of @node and @newNode.
*
@@ -514,17 +514,17 @@ xmlSecReplaceContentAndReturn(xmlNodePtr node, xmlNodePtr newNode, xmlNodePtr *r
for(cur = node->children; (cur != NULL); cur = next) {
next = cur->next;
if((*replaced) != NULL) {
- /* n is unlinked in this function */
+ /* n is unlinked in this function */
xmlAddNextSibling(tail, cur);
- tail = cur;
+ tail = cur;
} else {
- /* this is the first node, (*replaced) is the head */
+ /* this is the first node, (*replaced) is the head */
xmlUnlinkNode(cur);
- (*replaced) = tail = cur;
+ (*replaced) = tail = cur;
}
}
} else {
- /* just delete the content */
+ /* just delete the content */
xmlNodeSetContent(node, NULL);
}
@@ -536,9 +536,9 @@ xmlSecReplaceContentAndReturn(xmlNodePtr node, xmlNodePtr newNode, xmlNodePtr *r
/**
* xmlSecReplaceNodeBuffer:
- * @node: the current node.
- * @buffer: the XML data.
- * @size: the XML data size.
+ * @node: the current node.
+ * @buffer: the XML data.
+ * @size: the XML data size.
*
* Swaps the @node and the parsed XML data from the @buffer in the XML tree.
*
@@ -551,10 +551,10 @@ xmlSecReplaceNodeBuffer(xmlNodePtr node, const xmlSecByte *buffer, xmlSecSize si
/**
* xmlSecReplaceNodeBufferAndReturn:
- * @node: the current node.
- * @buffer: the XML data.
- * @size: the XML data size.
- * @replaced: the replaced nodes, or release them if NULL is given
+ * @node: the current node.
+ * @buffer: the XML data.
+ * @size: the XML data size.
+ * @replaced: the replaced nodes, or release them if NULL is given
*
* Swaps the @node and the parsed XML data from the @buffer in the XML tree.
*
@@ -590,9 +590,9 @@ xmlSecReplaceNodeBufferAndReturn(xmlNodePtr node, const xmlSecByte *buffer, xmlS
/* return the old node if requested */
if(replaced != NULL) {
- (*replaced) = node;
+ (*replaced) = node;
} else {
- xmlFreeNode(node);
+ xmlFreeNode(node);
}
return(0);
@@ -600,8 +600,8 @@ xmlSecReplaceNodeBufferAndReturn(xmlNodePtr node, const xmlSecByte *buffer, xmlS
/**
* xmlSecNodeEncodeAndSetContent:
- * @node: the pointer to an XML node.
- * @buffer: the pointer to the node content.
+ * @node: the pointer to an XML node.
+ * @buffer: the pointer to the node content.
*
* Encodes "special" characters in the @buffer and sets the result
* as the node content.
@@ -614,7 +614,7 @@ xmlSecNodeEncodeAndSetContent(xmlNodePtr node, const xmlChar * buffer) {
xmlSecAssert2(node->doc != NULL, -1);
if(buffer != NULL) {
- xmlChar * tmp;
+ xmlChar * tmp;
tmp = xmlEncodeSpecialChars(node->doc, buffer);
if (tmp == NULL) {
@@ -637,14 +637,14 @@ xmlSecNodeEncodeAndSetContent(xmlNodePtr node, const xmlChar * buffer) {
/**
* xmlSecAddIDs:
- * @doc: the pointer to an XML document.
- * @cur: the pointer to an XML node.
- * @ids: the pointer to a NULL terminated list of ID attributes.
+ * @doc: the pointer to an XML document.
+ * @cur: the pointer to an XML node.
+ * @ids: the pointer to a NULL terminated list of ID attributes.
*
* Walks thru all children of the @cur node and adds all attributes
* from the @ids list to the @doc document IDs attributes hash.
*/
-void
+void
xmlSecAddIDs(xmlDocPtr doc, xmlNodePtr cur, const xmlChar** ids) {
xmlNodePtr children = NULL;
@@ -652,52 +652,52 @@ xmlSecAddIDs(xmlDocPtr doc, xmlNodePtr cur, const xmlChar** ids) {
xmlSecAssert(ids != NULL);
if((cur != NULL) && (cur->type == XML_ELEMENT_NODE)) {
- xmlAttrPtr attr;
- xmlAttrPtr tmp;
- int i;
- xmlChar* name;
-
- for(attr = cur->properties; attr != NULL; attr = attr->next) {
- for(i = 0; ids[i] != NULL; ++i) {
- if(xmlStrEqual(attr->name, ids[i])) {
- name = xmlNodeListGetString(doc, attr->children, 1);
- if(name != NULL) {
- tmp = xmlGetID(doc, name);
- if(tmp == NULL) {
- xmlAddID(NULL, doc, name, attr);
- } else if(tmp != attr) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_INVALID_DATA,
- "id=%s already defined",
- xmlSecErrorsSafeString(name));
- }
- xmlFree(name);
- }
- }
- }
- }
-
- children = cur->children;
+ xmlAttrPtr attr;
+ xmlAttrPtr tmp;
+ int i;
+ xmlChar* name;
+
+ for(attr = cur->properties; attr != NULL; attr = attr->next) {
+ for(i = 0; ids[i] != NULL; ++i) {
+ if(xmlStrEqual(attr->name, ids[i])) {
+ name = xmlNodeListGetString(doc, attr->children, 1);
+ if(name != NULL) {
+ tmp = xmlGetID(doc, name);
+ if(tmp == NULL) {
+ xmlAddID(NULL, doc, name, attr);
+ } else if(tmp != attr) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_DATA,
+ "id=%s already defined",
+ xmlSecErrorsSafeString(name));
+ }
+ xmlFree(name);
+ }
+ }
+ }
+ }
+
+ children = cur->children;
} else if(cur == NULL) {
- children = doc->children;
+ children = doc->children;
}
while(children != NULL) {
- if(children->type == XML_ELEMENT_NODE) {
- xmlSecAddIDs(doc, children, ids);
- }
- children = children->next;
+ if(children->type == XML_ELEMENT_NODE) {
+ xmlSecAddIDs(doc, children, ids);
+ }
+ children = children->next;
}
}
/**
* xmlSecGenerateAndAddID:
- * @node: the node to ID attr to.
- * @attrName: the ID attr name.
- * @prefix: the prefix to add to the generated ID (can be NULL).
- * @len: the length of ID.
+ * @node: the node to ID attr to.
+ * @attrName: the ID attr name.
+ * @prefix: the prefix to add to the generated ID (can be NULL).
+ * @len: the length of ID.
*
* Generates a unique ID in the format <@prefix>base64-encoded(@len random bytes)
* and puts it in the attribute @attrName.
@@ -714,32 +714,32 @@ xmlSecGenerateAndAddID(xmlNodePtr node, const xmlChar* attrName, const xmlChar*
/* we will try 5 times before giving up */
for(count = 0; count < 5; count++) {
- id = xmlSecGenerateID(prefix, len);
- if(id == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecGenerateID",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- if((node->doc == NULL) || (xmlGetID(node->doc, id) == NULL)) {
- /* this is a unique ID in the document and we can use it */
- if(xmlSetProp(node, attrName, id) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSetProp",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(id);
- return(-1);
- }
-
- xmlFree(id);
- return(0);
- }
- xmlFree(id);
+ id = xmlSecGenerateID(prefix, len);
+ if(id == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecGenerateID",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ if((node->doc == NULL) || (xmlGetID(node->doc, id) == NULL)) {
+ /* this is a unique ID in the document and we can use it */
+ if(xmlSetProp(node, attrName, id) == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSetProp",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(id);
+ return(-1);
+ }
+
+ xmlFree(id);
+ return(0);
+ }
+ xmlFree(id);
}
return(-1);
@@ -747,8 +747,8 @@ xmlSecGenerateAndAddID(xmlNodePtr node, const xmlChar* attrName, const xmlChar*
/**
* xmlSecGenerateID:
- * @prefix: the prefix to add to the generated ID (can be NULL).
- * @len: the length of ID.
+ * @prefix: the prefix to add to the generated ID (can be NULL).
+ * @len: the length of ID.
*
* Generates a unique ID in the format <@prefix>base64-encoded(@len random bytes).
* The caller is responsible for freeing returned string using @xmlFree function.
@@ -770,84 +770,84 @@ xmlSecGenerateID(const xmlChar* prefix, xmlSecSize len) {
ret = xmlSecBufferInitialize(&buffer, binLen + 1);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
xmlSecAssert2(xmlSecBufferGetData(&buffer) != NULL, NULL);
xmlSecAssert2(xmlSecBufferGetMaxSize(&buffer) >= binLen, NULL);
ret = xmlSecBufferSetSize(&buffer, binLen);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferSetSize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBufferFinalize(&buffer);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferSetSize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBufferFinalize(&buffer);
+ return(NULL);
}
xmlSecAssert2(xmlSecBufferGetSize(&buffer) == binLen, NULL);
/* create random bytes */
for(i = 0; i < binLen; i++) {
- (xmlSecBufferGetData(&buffer)) [i] = (xmlSecByte) (256.0 * rand() / (RAND_MAX + 1.0));
+ (xmlSecBufferGetData(&buffer)) [i] = (xmlSecByte) (256.0 * rand() / (RAND_MAX + 1.0));
}
/* base64 encode random bytes */
res = xmlSecBase64Encode(xmlSecBufferGetData(&buffer), xmlSecBufferGetSize(&buffer), 0);
if((res == NULL) || (xmlStrlen(res) == 0)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBase64Encode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecBufferFinalize(&buffer);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBase64Encode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecBufferFinalize(&buffer);
+ return(NULL);
}
xmlSecBufferFinalize(&buffer);
/* truncate the generated id attribute if needed */
if(xmlStrlen(res) > (int)len) {
- res[len] = '\0';
+ res[len] = '\0';
}
/* we need to cleanup base64 encoded id because ID attr can't have '+' or '/' characters */
for(p = res; (*p) != '\0'; p++) {
- if(((*p) == '+') || ((*p) == '/')) {
- (*p) = '_';
- }
+ if(((*p) == '+') || ((*p) == '/')) {
+ (*p) = '_';
+ }
}
/* add prefix if exist */
if(prefix) {
- xmlChar* tmp;
- xmlSecSize tmpLen;
-
- tmpLen = xmlStrlen(prefix) + xmlStrlen(res) + 1;
- tmp = xmlMalloc(tmpLen + 1);
- if(tmp == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlMalloc",
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFree(res);
- return(NULL);
- }
-
- xmlSecStrPrintf(tmp, tmpLen, BAD_CAST "%s%s", prefix, res);
- xmlFree(res);
- res = tmp;
+ xmlChar* tmp;
+ xmlSecSize tmpLen;
+
+ tmpLen = xmlStrlen(prefix) + xmlStrlen(res) + 1;
+ tmp = xmlMalloc(tmpLen + 1);
+ if(tmp == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlMalloc",
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFree(res);
+ return(NULL);
+ }
+
+ xmlSecStrPrintf(tmp, tmpLen, BAD_CAST "%s%s", prefix, res);
+ xmlFree(res);
+ res = tmp;
} else {
- /* no prefix: check that ID attribute starts from a letter */
- if(!(((res[0] >= 'A') && (res[0] <= 'Z')) ||
- ((res[0] >= 'a') && (res[0] <= 'z')))) {
- res[0] = 'A';
- }
+ /* no prefix: check that ID attribute starts from a letter */
+ if(!(((res[0] >= 'A') && (res[0] <= 'Z')) ||
+ ((res[0] >= 'a') && (res[0] <= 'z')))) {
+ res[0] = 'A';
+ }
}
return(res);
@@ -856,8 +856,8 @@ xmlSecGenerateID(const xmlChar* prefix, xmlSecSize len) {
/**
* xmlSecCreateTree:
- * @rootNodeName: the root node name.
- * @rootNodeNs: the root node namespace (otpional).
+ * @rootNodeName: the root node name.
+ * @rootNodeNs: the root node namespace (otpional).
*
* Creates a new XML tree with one root node @rootNodeName.
*
@@ -874,38 +874,38 @@ xmlSecCreateTree(const xmlChar* rootNodeName, const xmlChar* rootNodeNs) {
/* create doc */
doc = xmlNewDoc(BAD_CAST "1.0");
if(doc == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewDoc",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewDoc",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(NULL);
}
/* create root node */
root = xmlNewDocNode(doc, NULL, rootNodeName, NULL);
if(root == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewDocNode",
- XMLSEC_ERRORS_R_XML_FAILED,
- "node=Keys");
- xmlFreeDoc(doc);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewDocNode",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "node=Keys");
+ xmlFreeDoc(doc);
+ return(NULL);
}
xmlDocSetRootElement(doc, root);
/* and set root node namespace */
ns = xmlNewNs(root, rootNodeNs, NULL);
if(ns == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNewNs",
- XMLSEC_ERRORS_R_XML_FAILED,
- "ns=%s",
- xmlSecErrorsSafeString(rootNodeNs));
- xmlFreeDoc(doc);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNewNs",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "ns=%s",
+ xmlSecErrorsSafeString(rootNodeNs));
+ xmlFreeDoc(doc);
+ return(NULL);
}
xmlSetNs(root, ns);
@@ -914,7 +914,7 @@ xmlSecCreateTree(const xmlChar* rootNodeName, const xmlChar* rootNodeNs) {
/**
* xmlSecIsEmptyNode:
- * @node: the node to check
+ * @node: the node to check
*
* Checks whethere the @node is empty (i.e. has only whitespaces children).
*
@@ -928,12 +928,12 @@ xmlSecIsEmptyNode(xmlNodePtr node) {
xmlSecAssert2(node != NULL, -1);
if(xmlSecGetNextElementNode(node->children) != NULL) {
- return(0);
+ return(0);
}
content = xmlNodeGetContent(node);
if(content == NULL) {
- return(1);
+ return(1);
}
res = xmlSecIsEmptyString(content);
@@ -943,7 +943,7 @@ xmlSecIsEmptyNode(xmlNodePtr node) {
/**
* xmlSecIsEmptyString:
- * @str: the string to check
+ * @str: the string to check
*
* Checks whethere the @str is empty (i.e. has only whitespaces children).
*
@@ -954,9 +954,9 @@ xmlSecIsEmptyString(const xmlChar* str) {
xmlSecAssert2(str != NULL, -1);
for( ;*str != '\0'; ++str) {
- if(!isspace((int)(*str))) {
- return(0);
- }
+ if(!isspace((int)(*str))) {
+ return(0);
+ }
}
return(1);
}
@@ -978,29 +978,29 @@ xmlSecPrintXmlString(FILE * fd, const xmlChar * str) {
xmlChar * encoded_str = NULL;
encoded_str = xmlEncodeSpecialChars(NULL, str);
if(encoded_str == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlEncodeSpecialChars",
- XMLSEC_ERRORS_R_XML_FAILED,
- "string=%s",
- xmlSecErrorsSafeString(str));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlEncodeSpecialChars",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "string=%s",
+ xmlSecErrorsSafeString(str));
+ return(-1);
}
res = fprintf(fd, "%s", (const char*)encoded_str);
- xmlFree(encoded_str);
+ xmlFree(encoded_str);
} else {
res = fprintf(fd, "NULL");
}
if(res < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "fprintf",
- XMLSEC_ERRORS_R_IO_FAILED,
- "res=%d,errno=%d",
- res, errno);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "fprintf",
+ XMLSEC_ERRORS_R_IO_FAILED,
+ "res=%d,errno=%d",
+ res, errno);
+ return(-1);
}
return(res);
}
@@ -1008,9 +1008,9 @@ xmlSecPrintXmlString(FILE * fd, const xmlChar * str) {
/**
* xmlSecGetQName:
- * @node: the context node.
- * @href: the QName href (can be NULL).
- * @local: the QName local part.
+ * @node: the context node.
+ * @href: the QName href (can be NULL).
+ * @local: the QName local part.
*
* Creates QName (prefix:local) from @href and @local in the context of the @node.
* Caller is responsible for freeing returned string with xmlFree.
@@ -1030,39 +1030,39 @@ xmlSecGetQName(xmlNodePtr node, const xmlChar* href, const xmlChar* local) {
ns = xmlSearchNsByHref(node->doc, node, href);
if((ns == NULL) && (href != NULL)) {
xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSearchNsByHref",
- XMLSEC_ERRORS_R_XML_FAILED,
- "node=%s,href=%s",
- xmlSecErrorsSafeString(node->name),
- xmlSecErrorsSafeString(href));
+ NULL,
+ "xmlSearchNsByHref",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "node=%s,href=%s",
+ xmlSecErrorsSafeString(node->name),
+ xmlSecErrorsSafeString(href));
return(NULL);
}
if((ns != NULL) && (ns->prefix != NULL)) {
- xmlSecSize len;
-
+ xmlSecSize len;
+
len = xmlStrlen(local) + xmlStrlen(ns->prefix) + 4;
qname = xmlMalloc(len);
if(qname == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlMalloc",
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(node->name));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlMalloc",
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(node->name));
return(NULL);
}
xmlSecStrPrintf(qname, len, BAD_CAST "%s:%s", ns->prefix, local);
} else {
qname = xmlStrdup(local);
if(qname == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlStrdup",
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(node->name));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlStrdup",
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(node->name));
return(NULL);
}
}
@@ -1147,7 +1147,7 @@ xmlSecQName2IntegerGetInteger(xmlSecQName2IntegerInfoConstPtr info,
*/
int
xmlSecQName2IntegerGetIntegerFromString(xmlSecQName2IntegerInfoConstPtr info,
- xmlNodePtr node, const xmlChar* qname,
+ xmlNodePtr node, const xmlChar* qname,
int* intValue) {
const xmlChar* qnameLocalPart = NULL;
xmlChar* qnamePrefix = NULL;
@@ -1164,14 +1164,14 @@ xmlSecQName2IntegerGetIntegerFromString(xmlSecQName2IntegerInfoConstPtr info,
if(qnameLocalPart != NULL) {
qnamePrefix = xmlStrndup(qname, qnameLocalPart - qname);
if(qnamePrefix == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlStrndup",
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "node=%s,value=%s",
- xmlSecErrorsSafeString(node->name),
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlStrndup",
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "node=%s,value=%s",
+ xmlSecErrorsSafeString(node->name),
xmlSecErrorsSafeString(qname));
- return(-1);
+ return(-1);
}
qnameLocalPart++;
} else {
@@ -1182,35 +1182,35 @@ xmlSecQName2IntegerGetIntegerFromString(xmlSecQName2IntegerInfoConstPtr info,
/* search namespace href */
ns = xmlSearchNs(node->doc, node, qnamePrefix);
if((ns == NULL) && (qnamePrefix != NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSearchNs",
- XMLSEC_ERRORS_R_XML_FAILED,
- "node=%s,qnamePrefix=%s",
- xmlSecErrorsSafeString(node->name),
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSearchNs",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "node=%s,qnamePrefix=%s",
+ xmlSecErrorsSafeString(node->name),
xmlSecErrorsSafeString(qnamePrefix));
if(qnamePrefix != NULL) {
xmlFree(qnamePrefix);
}
- return(-1);
+ return(-1);
}
qnameHref = (ns != NULL) ? ns->href : BAD_CAST NULL;
/* and finally search for integer */
ret = xmlSecQName2IntegerGetInteger(info, qnameHref, qnameLocalPart, intValue);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecQName2IntegerGetInteger",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s,qnameLocalPart=%s,qnameHref=%s",
- xmlSecErrorsSafeString(node->name),
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecQName2IntegerGetInteger",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s,qnameLocalPart=%s,qnameHref=%s",
+ xmlSecErrorsSafeString(node->name),
xmlSecErrorsSafeString(qnameLocalPart),
xmlSecErrorsSafeString(qnameHref));
if(qnamePrefix != NULL) {
xmlFree(qnamePrefix);
}
- return(-1);
+ return(-1);
}
if(qnamePrefix != NULL) {
@@ -1233,7 +1233,7 @@ xmlSecQName2IntegerGetIntegerFromString(xmlSecQName2IntegerInfoConstPtr info,
*/
xmlChar*
xmlSecQName2IntegerGetStringFromInteger(xmlSecQName2IntegerInfoConstPtr info,
- xmlNodePtr node, int intValue) {
+ xmlNodePtr node, int intValue) {
xmlSecQName2IntegerInfoConstPtr qnameInfo;
xmlSecAssert2(info != NULL, NULL);
@@ -1241,12 +1241,12 @@ xmlSecQName2IntegerGetStringFromInteger(xmlSecQName2IntegerInfoConstPtr info,
qnameInfo = xmlSecQName2IntegerGetInfo(info, intValue);
if(qnameInfo == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecQName2IntegerGetInfo",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s,intValue=%d",
- xmlSecErrorsSafeString(node->name),
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecQName2IntegerGetInfo",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s,intValue=%d",
+ xmlSecErrorsSafeString(node->name),
intValue);
return(NULL);
}
@@ -1276,27 +1276,27 @@ xmlSecQName2IntegerNodeRead(xmlSecQName2IntegerInfoConstPtr info, xmlNodePtr nod
content = xmlNodeGetContent(node);
if(content == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNodeGetContent",
- XMLSEC_ERRORS_R_XML_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(node->name));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNodeGetContent",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(node->name));
+ return(-1);
}
/* todo: trim content? */
ret = xmlSecQName2IntegerGetIntegerFromString(info, node, content, intValue);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecQName2IntegerGetIntegerFromString",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s,value=%s",
- xmlSecErrorsSafeString(node->name),
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecQName2IntegerGetIntegerFromString",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s,value=%s",
+ xmlSecErrorsSafeString(node->name),
xmlSecErrorsSafeString(content));
xmlFree(content);
- return(-1);
+ return(-1);
}
xmlFree(content);
@@ -1317,7 +1317,7 @@ xmlSecQName2IntegerNodeRead(xmlSecQName2IntegerInfoConstPtr info, xmlNodePtr nod
*/
int
xmlSecQName2IntegerNodeWrite(xmlSecQName2IntegerInfoConstPtr info, xmlNodePtr node,
- const xmlChar* nodeName, const xmlChar* nodeNs, int intValue) {
+ const xmlChar* nodeName, const xmlChar* nodeNs, int intValue) {
xmlNodePtr cur;
xmlChar* qname = NULL;
@@ -1328,24 +1328,24 @@ xmlSecQName2IntegerNodeWrite(xmlSecQName2IntegerInfoConstPtr info, xmlNodePtr no
/* find and build qname */
qname = xmlSecQName2IntegerGetStringFromInteger(info, node, intValue);
if(qname == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecQName2IntegerGetStringFromInteger",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s,intValue=%d",
- xmlSecErrorsSafeString(node->name),
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecQName2IntegerGetStringFromInteger",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s,intValue=%d",
+ xmlSecErrorsSafeString(node->name),
intValue);
return(-1);
}
cur = xmlSecAddChild(node, nodeName, nodeNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s,intValue=%d",
- xmlSecErrorsSafeString(nodeName),
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s,intValue=%d",
+ xmlSecErrorsSafeString(nodeName),
intValue);
xmlFree(qname);
return(-1);
@@ -1370,7 +1370,7 @@ xmlSecQName2IntegerNodeWrite(xmlSecQName2IntegerInfoConstPtr info, xmlNodePtr no
*/
int
xmlSecQName2IntegerAttributeRead(xmlSecQName2IntegerInfoConstPtr info, xmlNodePtr node,
- const xmlChar* attrName, int* intValue) {
+ const xmlChar* attrName, int* intValue) {
xmlChar* attrValue;
int ret;
@@ -1381,29 +1381,29 @@ xmlSecQName2IntegerAttributeRead(xmlSecQName2IntegerInfoConstPtr info, xmlNodePt
attrValue = xmlGetProp(node, attrName);
if(attrValue == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlGetProp",
- XMLSEC_ERRORS_R_XML_FAILED,
- "node=%s,attrValue=%s",
- xmlSecErrorsSafeString(node->name),
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlGetProp",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "node=%s,attrValue=%s",
+ xmlSecErrorsSafeString(node->name),
xmlSecErrorsSafeString(attrName));
- return(-1);
+ return(-1);
}
/* todo: trim value? */
ret = xmlSecQName2IntegerGetIntegerFromString(info, node, attrValue, intValue);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecQName2IntegerGetIntegerFromString",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s,attrName=%s,attrValue=%s",
- xmlSecErrorsSafeString(node->name),
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecQName2IntegerGetIntegerFromString",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s,attrName=%s,attrValue=%s",
+ xmlSecErrorsSafeString(node->name),
xmlSecErrorsSafeString(attrName),
xmlSecErrorsSafeString(attrValue));
xmlFree(attrValue);
- return(-1);
+ return(-1);
}
xmlFree(attrValue);
@@ -1435,26 +1435,26 @@ xmlSecQName2IntegerAttributeWrite(xmlSecQName2IntegerInfoConstPtr info, xmlNodeP
/* find and build qname */
qname = xmlSecQName2IntegerGetStringFromInteger(info, node, intValue);
if(qname == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecQName2IntegerGetStringFromInteger",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s,attrName=%s,intValue=%d",
- xmlSecErrorsSafeString(node->name),
- xmlSecErrorsSafeString(attrName),
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecQName2IntegerGetStringFromInteger",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s,attrName=%s,intValue=%d",
+ xmlSecErrorsSafeString(node->name),
+ xmlSecErrorsSafeString(attrName),
intValue);
return(-1);
}
attr = xmlSetProp(node, attrName, qname);
if(attr == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChildNode",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s,attrName=%s,intValue=%d",
- xmlSecErrorsSafeString(node->name),
- xmlSecErrorsSafeString(attrName),
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChildNode",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s,attrName=%s,intValue=%d",
+ xmlSecErrorsSafeString(node->name),
+ xmlSecErrorsSafeString(attrName),
intValue);
xmlFree(qname);
return(-1);
@@ -1468,7 +1468,7 @@ xmlSecQName2IntegerAttributeWrite(xmlSecQName2IntegerInfoConstPtr info, xmlNodeP
* xmlSecQName2IntegerDebugDump:
* @info: the qname<->integer mapping information.
* @intValue: the integer value.
- * @name: the value name to print.
+ * @name: the value name to print.
* @output: the pointer to output FILE.
*
* Prints @intValue into @output.
@@ -1494,14 +1494,14 @@ xmlSecQName2IntegerDebugDump(xmlSecQName2IntegerInfoConstPtr info, int intValue,
* xmlSecQName2IntegerDebugXmlDump:
* @info: the qname<->integer mapping information.
* @intValue: the integer value.
- * @name: the value name to print.
+ * @name: the value name to print.
* @output: the pointer to output FILE.
*
* Prints @intValue into @output in XML format.
*/
void
xmlSecQName2IntegerDebugXmlDump(xmlSecQName2IntegerInfoConstPtr info, int intValue,
- const xmlChar* name, FILE* output) {
+ const xmlChar* name, FILE* output) {
xmlSecQName2IntegerInfoConstPtr qnameInfo;
xmlSecAssert(info != NULL);
@@ -1516,7 +1516,7 @@ xmlSecQName2IntegerDebugXmlDump(xmlSecQName2IntegerInfoConstPtr info, int intVal
name);
}
}
-
+
/*************************************************************************
*
@@ -1562,7 +1562,7 @@ xmlSecQName2BitMaskGetInfo(xmlSecQName2BitMaskInfoConstPtr info, xmlSecBitMask m
int
xmlSecQName2BitMaskGetBitMask(xmlSecQName2BitMaskInfoConstPtr info,
const xmlChar* qnameHref, const xmlChar* qnameLocalPart,
- xmlSecBitMask* mask) {
+ xmlSecBitMask* mask) {
unsigned int ii;
xmlSecAssert2(info != NULL, -1);
@@ -1595,7 +1595,7 @@ xmlSecQName2BitMaskGetBitMask(xmlSecQName2BitMaskInfoConstPtr info,
*/
int
xmlSecQName2BitMaskGetBitMaskFromString(xmlSecQName2BitMaskInfoConstPtr info,
- xmlNodePtr node, const xmlChar* qname,
+ xmlNodePtr node, const xmlChar* qname,
xmlSecBitMask* mask) {
const xmlChar* qnameLocalPart = NULL;
xmlChar* qnamePrefix = NULL;
@@ -1612,14 +1612,14 @@ xmlSecQName2BitMaskGetBitMaskFromString(xmlSecQName2BitMaskInfoConstPtr info,
if(qnameLocalPart != NULL) {
qnamePrefix = xmlStrndup(qname, qnameLocalPart - qname);
if(qnamePrefix == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlStrndup",
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "node=%s,value=%s",
- xmlSecErrorsSafeString(node->name),
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlStrndup",
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "node=%s,value=%s",
+ xmlSecErrorsSafeString(node->name),
xmlSecErrorsSafeString(qname));
- return(-1);
+ return(-1);
}
qnameLocalPart++;
} else {
@@ -1630,35 +1630,35 @@ xmlSecQName2BitMaskGetBitMaskFromString(xmlSecQName2BitMaskInfoConstPtr info,
/* search namespace href */
ns = xmlSearchNs(node->doc, node, qnamePrefix);
if((ns == NULL) && (qnamePrefix != NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSearchNs",
- XMLSEC_ERRORS_R_XML_FAILED,
- "node=%s,qnamePrefix=%s",
- xmlSecErrorsSafeString(node->name),
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSearchNs",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "node=%s,qnamePrefix=%s",
+ xmlSecErrorsSafeString(node->name),
xmlSecErrorsSafeString(qnamePrefix));
if(qnamePrefix != NULL) {
xmlFree(qnamePrefix);
}
- return(-1);
+ return(-1);
}
qnameHref = (ns != NULL) ? ns->href : BAD_CAST NULL;
/* and finally search for integer */
ret = xmlSecQName2BitMaskGetBitMask(info, qnameHref, qnameLocalPart, mask);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecQName2BitMaskGetBitMask",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s,qnameLocalPart=%s,qnameHref=%s",
- xmlSecErrorsSafeString(node->name),
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecQName2BitMaskGetBitMask",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s,qnameLocalPart=%s,qnameHref=%s",
+ xmlSecErrorsSafeString(node->name),
xmlSecErrorsSafeString(qnameLocalPart),
xmlSecErrorsSafeString(qnameHref));
if(qnamePrefix != NULL) {
xmlFree(qnamePrefix);
}
- return(-1);
+ return(-1);
}
if(qnamePrefix != NULL) {
@@ -1681,7 +1681,7 @@ xmlSecQName2BitMaskGetBitMaskFromString(xmlSecQName2BitMaskInfoConstPtr info,
*/
xmlChar*
xmlSecQName2BitMaskGetStringFromBitMask(xmlSecQName2BitMaskInfoConstPtr info,
- xmlNodePtr node, xmlSecBitMask mask) {
+ xmlNodePtr node, xmlSecBitMask mask) {
xmlSecQName2BitMaskInfoConstPtr qnameInfo;
xmlSecAssert2(info != NULL, NULL);
@@ -1689,12 +1689,12 @@ xmlSecQName2BitMaskGetStringFromBitMask(xmlSecQName2BitMaskInfoConstPtr info,
qnameInfo = xmlSecQName2BitMaskGetInfo(info, mask);
if(qnameInfo == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecQName2BitMaskGetInfo",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "node=%s,mask=%d",
- xmlSecErrorsSafeString(node->name),
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecQName2BitMaskGetInfo",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "node=%s,mask=%d",
+ xmlSecErrorsSafeString(node->name),
mask);
return(NULL);
}
@@ -1708,8 +1708,8 @@ xmlSecQName2BitMaskGetStringFromBitMask(xmlSecQName2BitMaskInfoConstPtr info,
* @node: the start.
* @nodeName: the mask nodes name.
* @nodeNs: the mask nodes namespace.
- * @stopOnUnknown: if this flag is set then function exits if unknown
- * value was found.
+ * @stopOnUnknown: if this flag is set then function exits if unknown
+ * value was found.
* @mask: the pointer to result mask.
*
* Reads <@nodeNs:@nodeName> elements and puts the result bit mask
@@ -1720,7 +1720,7 @@ xmlSecQName2BitMaskGetStringFromBitMask(xmlSecQName2BitMaskInfoConstPtr info,
*/
int
xmlSecQName2BitMaskNodesRead(xmlSecQName2BitMaskInfoConstPtr info, xmlNodePtr* node,
- const xmlChar* nodeName, const xmlChar* nodeNs,
+ const xmlChar* nodeName, const xmlChar* nodeNs,
int stopOnUnknown, xmlSecBitMask* mask) {
xmlNodePtr cur;
xmlChar* content;
@@ -1736,41 +1736,41 @@ xmlSecQName2BitMaskNodesRead(xmlSecQName2BitMaskInfoConstPtr info, xmlNodePtr* n
while((cur != NULL) && (xmlSecCheckNodeName(cur, nodeName, nodeNs))) {
content = xmlNodeGetContent(cur);
if(content == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlNodeGetContent",
- XMLSEC_ERRORS_R_XML_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(cur->name));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlNodeGetContent",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(cur->name));
+ return(-1);
}
ret = xmlSecQName2BitMaskGetBitMaskFromString(info, cur, content, &tmp);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecQName2BitMaskGetBitMaskFromString",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "value=%s",
- xmlSecErrorsSafeString(content));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecQName2BitMaskGetBitMaskFromString",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "value=%s",
+ xmlSecErrorsSafeString(content));
xmlFree(content);
- return(-1);
+ return(-1);
}
xmlFree(content);
- if((stopOnUnknown != 0) && (tmp == 0)) {
- /* todo: better error */
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecQName2BitMaskGetBitMaskFromString",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "value=%s",
- xmlSecErrorsSafeString(content));
- return(-1);
- }
-
+ if((stopOnUnknown != 0) && (tmp == 0)) {
+ /* todo: better error */
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecQName2BitMaskGetBitMaskFromString",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "value=%s",
+ xmlSecErrorsSafeString(content));
+ return(-1);
+ }
+
(*mask) |= tmp;
- cur = xmlSecGetNextElementNode(cur->next);
+ cur = xmlSecGetNextElementNode(cur->next);
}
(*node) = cur;
@@ -1791,7 +1791,7 @@ xmlSecQName2BitMaskNodesRead(xmlSecQName2BitMaskInfoConstPtr info, xmlNodePtr* n
*/
int
xmlSecQName2BitMaskNodesWrite(xmlSecQName2BitMaskInfoConstPtr info, xmlNodePtr node,
- const xmlChar* nodeName, const xmlChar* nodeNs,
+ const xmlChar* nodeName, const xmlChar* nodeNs,
xmlSecBitMask mask) {
unsigned int ii;
@@ -1806,27 +1806,27 @@ xmlSecQName2BitMaskNodesWrite(xmlSecQName2BitMaskInfoConstPtr info, xmlNodePtr n
xmlNodePtr cur;
xmlChar* qname;
- qname = xmlSecGetQName(node, info[ii].qnameHref, info[ii].qnameLocalPart);
+ qname = xmlSecGetQName(node, info[ii].qnameHref, info[ii].qnameLocalPart);
if(qname == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecGetQName",
- XMLSEC_ERRORS_R_XML_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(nodeName));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecGetQName",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(nodeName));
+ return(-1);
}
cur = xmlSecAddChild(node, nodeName, nodeNs);
if(cur == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecAddChild",
- XMLSEC_ERRORS_R_XML_FAILED,
- "node=%s",
- xmlSecErrorsSafeString(nodeName));
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecAddChild",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "node=%s",
+ xmlSecErrorsSafeString(nodeName));
xmlFree(qname);
- return(-1);
+ return(-1);
}
xmlNodeSetContent(cur, qname);
@@ -1840,14 +1840,14 @@ xmlSecQName2BitMaskNodesWrite(xmlSecQName2BitMaskInfoConstPtr info, xmlNodePtr n
* xmlSecQName2BitMaskDebugDump:
* @info: the qname<->bit mask mapping information.
* @mask: the bit mask.
- * @name: the value name to print.
+ * @name: the value name to print.
* @output: the pointer to output FILE.
*
* Prints debug information about @mask to @output.
*/
void
xmlSecQName2BitMaskDebugDump(xmlSecQName2BitMaskInfoConstPtr info, xmlSecBitMask mask,
- const xmlChar* name, FILE* output) {
+ const xmlChar* name, FILE* output) {
unsigned int ii;
xmlSecAssert(info != NULL);
@@ -1873,14 +1873,14 @@ xmlSecQName2BitMaskDebugDump(xmlSecQName2BitMaskInfoConstPtr info, xmlSecBitMask
* xmlSecQName2BitMaskDebugXmlDump:
* @info: the qname<->bit mask mapping information.
* @mask: the bit mask.
- * @name: the value name to print.
+ * @name: the value name to print.
* @output: the pointer to output FILE.
*
* Prints debug information about @mask to @output in XML format.
*/
void
xmlSecQName2BitMaskDebugXmlDump(xmlSecQName2BitMaskInfoConstPtr info, xmlSecBitMask mask,
- const xmlChar* name, FILE* output) {
+ const xmlChar* name, FILE* output) {
unsigned int ii;
xmlSecAssert(info != NULL);
@@ -1902,7 +1902,7 @@ xmlSecQName2BitMaskDebugXmlDump(xmlSecQName2BitMaskInfoConstPtr info, xmlSecBitM
}
fprintf(output, "</%sList>\n", name);
}
-
+
diff --git a/src/xpath.c b/src/xpath.c
index 8b0b4f8..b8bc203 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -29,8 +29,8 @@
/**************************************************************************
*
* xmlSecXPathHereFunction:
- * @ctxt: the ponter to XPath context.
- * @nargs: the arguments nubmer.
+ * @ctxt: the ponter to XPath context.
+ * @nargs: the arguments nubmer.
*
* The implementation of XPath "here()" function.
* See xmlXPtrHereFunction() in xpointer.c. the only change is that
@@ -42,7 +42,7 @@ xmlSecXPathHereFunction(xmlXPathParserContextPtr ctxt, int nargs) {
CHECK_ARITY(0);
if((ctxt == NULL) || (ctxt->context == NULL) || (ctxt->context->here == NULL)) {
- XP_ERROR(XPTR_SYNTAX_ERROR);
+ XP_ERROR(XPTR_SYNTAX_ERROR);
}
valuePush(ctxt, xmlXPathNewNodeSet(ctxt->context->here));
}
@@ -52,8 +52,8 @@ xmlSecXPathHereFunction(xmlXPathParserContextPtr ctxt, int nargs) {
* XPath/XPointer data
*
*****************************************************************************/
-typedef struct _xmlSecXPathData xmlSecXPathData,
- *xmlSecXPathDataPtr;
+typedef struct _xmlSecXPathData xmlSecXPathData,
+ *xmlSecXPathDataPtr;
typedef enum {
xmlSecXPathDataTypeXPath,
xmlSecXPathDataTypeXPath2,
@@ -61,24 +61,24 @@ typedef enum {
} xmlSecXPathDataType;
struct _xmlSecXPathData {
- xmlSecXPathDataType type;
- xmlXPathContextPtr ctx;
- xmlChar* expr;
- xmlSecNodeSetOp nodeSetOp;
- xmlSecNodeSetType nodeSetType;
+ xmlSecXPathDataType type;
+ xmlXPathContextPtr ctx;
+ xmlChar* expr;
+ xmlSecNodeSetOp nodeSetOp;
+ xmlSecNodeSetType nodeSetType;
};
-static xmlSecXPathDataPtr xmlSecXPathDataCreate (xmlSecXPathDataType type);
-static void xmlSecXPathDataDestroy (xmlSecXPathDataPtr data);
-static int xmlSecXPathDataSetExpr (xmlSecXPathDataPtr data,
- const xmlChar* expr);
-static int xmlSecXPathDataRegisterNamespaces(xmlSecXPathDataPtr data,
- xmlNodePtr node);
-static int xmlSecXPathDataNodeRead (xmlSecXPathDataPtr data,
- xmlNodePtr node);
-static xmlSecNodeSetPtr xmlSecXPathDataExecute (xmlSecXPathDataPtr data,
- xmlDocPtr doc,
- xmlNodePtr hereNode);
+static xmlSecXPathDataPtr xmlSecXPathDataCreate (xmlSecXPathDataType type);
+static void xmlSecXPathDataDestroy (xmlSecXPathDataPtr data);
+static int xmlSecXPathDataSetExpr (xmlSecXPathDataPtr data,
+ const xmlChar* expr);
+static int xmlSecXPathDataRegisterNamespaces(xmlSecXPathDataPtr data,
+ xmlNodePtr node);
+static int xmlSecXPathDataNodeRead (xmlSecXPathDataPtr data,
+ xmlNodePtr node);
+static xmlSecNodeSetPtr xmlSecXPathDataExecute (xmlSecXPathDataPtr data,
+ xmlDocPtr doc,
+ xmlNodePtr hereNode);
static xmlSecXPathDataPtr
xmlSecXPathDataCreate(xmlSecXPathDataType type) {
@@ -86,13 +86,13 @@ xmlSecXPathDataCreate(xmlSecXPathDataType type) {
data = (xmlSecXPathDataPtr) xmlMalloc(sizeof(xmlSecXPathData));
if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "sizeof(xmlSecXPathData)=%d",
- sizeof(xmlSecXPathData));
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "sizeof(xmlSecXPathData)=%d",
+ sizeof(xmlSecXPathData));
+ return(NULL);
}
memset(data, 0, sizeof(xmlSecXPathData));
@@ -103,43 +103,43 @@ xmlSecXPathDataCreate(xmlSecXPathDataType type) {
switch(data->type) {
case xmlSecXPathDataTypeXPath:
case xmlSecXPathDataTypeXPath2:
- data->ctx = xmlXPathNewContext(NULL); /* we'll set doc in the context later */
- if(data->ctx == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlXPathNewContext",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXPathDataDestroy(data);
- return(NULL);
- }
- break;
+ data->ctx = xmlXPathNewContext(NULL); /* we'll set doc in the context later */
+ if(data->ctx == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlXPathNewContext",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXPathDataDestroy(data);
+ return(NULL);
+ }
+ break;
case xmlSecXPathDataTypeXPointer:
- data->ctx = xmlXPtrNewContext(NULL, NULL, NULL); /* we'll set doc in the context later */
- if(data->ctx == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlXPtrNewContext",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXPathDataDestroy(data);
- return(NULL);
- }
- break;
+ data->ctx = xmlXPtrNewContext(NULL, NULL, NULL); /* we'll set doc in the context later */
+ if(data->ctx == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlXPtrNewContext",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXPathDataDestroy(data);
+ return(NULL);
+ }
+ break;
}
return(data);
}
-static void
+static void
xmlSecXPathDataDestroy(xmlSecXPathDataPtr data) {
xmlSecAssert(data != NULL);
if(data->expr != NULL) {
- xmlFree(data->expr);
+ xmlFree(data->expr);
}
if(data->ctx != NULL) {
- xmlXPathFreeContext(data->ctx);
+ xmlXPathFreeContext(data->ctx);
}
memset(data, 0, sizeof(xmlSecXPathData));
xmlFree(data);
@@ -154,11 +154,11 @@ xmlSecXPathDataSetExpr(xmlSecXPathDataPtr data, const xmlChar* expr) {
data->expr = xmlStrdup(expr);
if(data->expr == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- NULL,
- XMLSEC_ERRORS_R_STRDUP_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ NULL,
+ XMLSEC_ERRORS_R_STRDUP_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
return(0);
@@ -177,22 +177,22 @@ xmlSecXPathDataRegisterNamespaces(xmlSecXPathDataPtr data, xmlNodePtr node) {
/* register namespaces */
for(cur = node; cur != NULL; cur = cur->parent) {
- for(ns = cur->nsDef; ns != NULL; ns = ns->next) {
- /* check that we have no other namespace with same prefix already */
- if((ns->prefix != NULL) && (xmlXPathNsLookup(data->ctx, ns->prefix) == NULL)){
- ret = xmlXPathRegisterNs(data->ctx, ns->prefix, ns->href);
- if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlXPathRegisterNs",
- XMLSEC_ERRORS_R_XML_FAILED,
- "href=%s;prefix=%s",
- xmlSecErrorsSafeString(ns->href),
- xmlSecErrorsSafeString(ns->prefix));
- return(-1);
- }
- }
- }
+ for(ns = cur->nsDef; ns != NULL; ns = ns->next) {
+ /* check that we have no other namespace with same prefix already */
+ if((ns->prefix != NULL) && (xmlXPathNsLookup(data->ctx, ns->prefix) == NULL)){
+ ret = xmlXPathRegisterNs(data->ctx, ns->prefix, ns->href);
+ if(ret != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlXPathRegisterNs",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "href=%s;prefix=%s",
+ xmlSecErrorsSafeString(ns->href),
+ xmlSecErrorsSafeString(ns->prefix));
+ return(-1);
+ }
+ }
+ }
}
return(0);
@@ -209,22 +209,22 @@ xmlSecXPathDataNodeRead(xmlSecXPathDataPtr data, xmlNodePtr node) {
ret = xmlSecXPathDataRegisterNamespaces (data, node);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXPathDataRegisterNamespaces",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXPathDataRegisterNamespaces",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
/* read node content and set expr */
data->expr = xmlNodeGetContent(node);
if(data->expr == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
- XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
- XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ xmlSecErrorsSafeString(xmlSecNodeGetName(node)),
+ XMLSEC_ERRORS_R_INVALID_NODE_CONTENT,
+ XMLSEC_ERRORS_NO_MESSAGE);
return(-1);
}
@@ -247,49 +247,49 @@ xmlSecXPathDataExecute(xmlSecXPathDataPtr data, xmlDocPtr doc, xmlNodePtr hereNo
/* here function works only on the same document */
if(hereNode->doc == doc) {
- xmlXPathRegisterFunc(data->ctx, (xmlChar *)"here", xmlSecXPathHereFunction);
- data->ctx->here = hereNode;
- data->ctx->xptr = 1;
+ xmlXPathRegisterFunc(data->ctx, (xmlChar *)"here", xmlSecXPathHereFunction);
+ data->ctx->here = hereNode;
+ data->ctx->xptr = 1;
}
/* execute xpath or xpointer expression */
switch(data->type) {
case xmlSecXPathDataTypeXPath:
case xmlSecXPathDataTypeXPath2:
- xpathObj = xmlXPathEvalExpression(data->expr, data->ctx);
- if(xpathObj == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlXPathEvalExpression",
- XMLSEC_ERRORS_R_XML_FAILED,
- "expr=%s",
- xmlSecErrorsSafeString(data->expr));
- return(NULL);
- }
- break;
+ xpathObj = xmlXPathEvalExpression(data->expr, data->ctx);
+ if(xpathObj == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlXPathEvalExpression",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "expr=%s",
+ xmlSecErrorsSafeString(data->expr));
+ return(NULL);
+ }
+ break;
case xmlSecXPathDataTypeXPointer:
- xpathObj = xmlXPtrEval(data->expr, data->ctx);
- if(xpathObj == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlXPtrEval",
- XMLSEC_ERRORS_R_XML_FAILED,
- "expr=%s",
- xmlSecErrorsSafeString(data->expr));
- return(NULL);
- }
- break;
+ xpathObj = xmlXPtrEval(data->expr, data->ctx);
+ if(xpathObj == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlXPtrEval",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "expr=%s",
+ xmlSecErrorsSafeString(data->expr));
+ return(NULL);
+ }
+ break;
}
nodes = xmlSecNodeSetCreate(doc, xpathObj->nodesetval, data->nodeSetType);
if(nodes == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNodeSetCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "type=%d", data->nodeSetType);
- xmlXPathFreeObject(xpathObj);
- return(NULL);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNodeSetCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "type=%d", data->nodeSetType);
+ xmlXPathFreeObject(xpathObj);
+ return(NULL);
}
xpathObj->nodesetval = NULL;
xmlXPathFreeObject(xpathObj);
@@ -303,20 +303,20 @@ xmlSecXPathDataExecute(xmlSecXPathDataPtr data, xmlDocPtr doc, xmlNodePtr hereNo
* XPath data list
*
*****************************************************************************/
-#define xmlSecXPathDataListId \
- xmlSecXPathDataListGetKlass()
-static xmlSecPtrListId xmlSecXPathDataListGetKlass (void);
-static xmlSecNodeSetPtr xmlSecXPathDataListExecute (xmlSecPtrListPtr dataList,
- xmlDocPtr doc,
- xmlNodePtr hereNode,
- xmlSecNodeSetPtr nodes);
+#define xmlSecXPathDataListId \
+ xmlSecXPathDataListGetKlass()
+static xmlSecPtrListId xmlSecXPathDataListGetKlass (void);
+static xmlSecNodeSetPtr xmlSecXPathDataListExecute (xmlSecPtrListPtr dataList,
+ xmlDocPtr doc,
+ xmlNodePtr hereNode,
+ xmlSecNodeSetPtr nodes);
static xmlSecPtrListKlass xmlSecXPathDataListKlass = {
BAD_CAST "xpath-data-list",
- NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
- (xmlSecPtrDestroyItemMethod)xmlSecXPathDataDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */
- NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
- NULL, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
+ NULL, /* xmlSecPtrDuplicateItemMethod duplicateItem; */
+ (xmlSecPtrDestroyItemMethod)xmlSecXPathDataDestroy, /* xmlSecPtrDestroyItemMethod destroyItem; */
+ NULL, /* xmlSecPtrDebugDumpItemMethod debugDumpItem; */
+ NULL, /* xmlSecPtrDebugDumpItemMethod debugXmlDumpItem; */
};
static xmlSecPtrListId
@@ -324,9 +324,9 @@ xmlSecXPathDataListGetKlass(void) {
return(&xmlSecXPathDataListKlass);
}
-static xmlSecNodeSetPtr
+static xmlSecNodeSetPtr
xmlSecXPathDataListExecute(xmlSecPtrListPtr dataList, xmlDocPtr doc,
- xmlNodePtr hereNode, xmlSecNodeSetPtr nodes) {
+ xmlNodePtr hereNode, xmlSecNodeSetPtr nodes) {
xmlSecXPathDataPtr data;
xmlSecNodeSetPtr res, tmp, tmp2;
xmlSecSize pos;
@@ -339,45 +339,45 @@ xmlSecXPathDataListExecute(xmlSecPtrListPtr dataList, xmlDocPtr doc,
res = nodes;
for(pos = 0; pos < xmlSecPtrListGetSize(dataList); ++pos) {
data = (xmlSecXPathDataPtr)xmlSecPtrListGetItem(dataList, pos);
- if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecPtrListGetItem",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "pos=%d", pos);
- if((res != NULL) && (res != nodes)) {
- xmlSecNodeSetDestroy(res);
- }
- return(NULL);
- }
-
- tmp = xmlSecXPathDataExecute(data, doc, hereNode);
- if(tmp == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecXPathDataExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- if((res != NULL) && (res != nodes)) {
- xmlSecNodeSetDestroy(res);
- }
- return(NULL);
- }
-
- tmp2 = xmlSecNodeSetAdd(res, tmp, data->nodeSetOp);
- if(tmp2 == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecNodeSetAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "xmlSecNodeSetIntersection");
- if((res != NULL) && (res != nodes)) {
- xmlSecNodeSetDestroy(res);
- }
- xmlSecNodeSetDestroy(tmp);
- return(NULL);
- }
- res = tmp2;
+ if(data == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecPtrListGetItem",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "pos=%d", pos);
+ if((res != NULL) && (res != nodes)) {
+ xmlSecNodeSetDestroy(res);
+ }
+ return(NULL);
+ }
+
+ tmp = xmlSecXPathDataExecute(data, doc, hereNode);
+ if(tmp == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecXPathDataExecute",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ if((res != NULL) && (res != nodes)) {
+ xmlSecNodeSetDestroy(res);
+ }
+ return(NULL);
+ }
+
+ tmp2 = xmlSecNodeSetAdd(res, tmp, data->nodeSetOp);
+ if(tmp2 == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecNodeSetAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "xmlSecNodeSetIntersection");
+ if((res != NULL) && (res != nodes)) {
+ xmlSecNodeSetDestroy(res);
+ }
+ xmlSecNodeSetDestroy(tmp);
+ return(NULL);
+ }
+ res = tmp2;
}
return(res);
@@ -390,25 +390,25 @@ xmlSecXPathDataListExecute(xmlSecPtrListPtr dataList, xmlDocPtr doc,
* xmlSecXPathDataList is located after xmlSecTransform structure
*
*****************************************************************************/
-#define xmlSecXPathTransformSize \
+#define xmlSecXPathTransformSize \
(sizeof(xmlSecTransform) + sizeof(xmlSecPtrList))
#define xmlSecXPathTransformGetDataList(transform) \
((xmlSecTransformCheckSize((transform), xmlSecXPathTransformSize)) ? \
- (xmlSecPtrListPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)) : \
- (xmlSecPtrListPtr)NULL)
+ (xmlSecPtrListPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)) : \
+ (xmlSecPtrListPtr)NULL)
#define xmlSecTransformXPathCheckId(transform) \
(xmlSecTransformCheckId((transform), xmlSecTransformXPathId) || \
xmlSecTransformCheckId((transform), xmlSecTransformXPath2Id) || \
xmlSecTransformCheckId((transform), xmlSecTransformXPointerId))
-static int xmlSecTransformXPathInitialize (xmlSecTransformPtr transform);
-static void xmlSecTransformXPathFinalize (xmlSecTransformPtr transform);
-static int xmlSecTransformXPathExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecTransformXPathInitialize (xmlSecTransformPtr transform);
+static void xmlSecTransformXPathFinalize (xmlSecTransformPtr transform);
+static int xmlSecTransformXPathExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
static int
-xmlSecTransformXPathInitialize(xmlSecTransformPtr transform) {
+xmlSecTransformXPathInitialize(xmlSecTransformPtr transform) {
xmlSecPtrListPtr dataList;
int ret;
@@ -419,12 +419,12 @@ xmlSecTransformXPathInitialize(xmlSecTransformPtr transform) {
ret = xmlSecPtrListInitialize(dataList, xmlSecXPathDataListId);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecPtrListInitialize",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecPtrListInitialize",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
@@ -443,7 +443,7 @@ xmlSecTransformXPathFinalize(xmlSecTransformPtr transform) {
static int
xmlSecTransformXPathExecute(xmlSecTransformPtr transform, int last,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecTransformCtxPtr transformCtx) {
xmlSecPtrListPtr dataList;
xmlDocPtr doc;
@@ -461,14 +461,14 @@ xmlSecTransformXPathExecute(xmlSecTransformPtr transform, int last,
xmlSecAssert2(doc != NULL, -1);
transform->outNodes = xmlSecXPathDataListExecute(dataList, doc,
- transform->hereNode, transform->inNodes);
+ transform->hereNode, transform->inNodes);
if(transform->outNodes == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecXPathDataExecute",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecXPathDataExecute",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
@@ -478,35 +478,35 @@ xmlSecTransformXPathExecute(xmlSecTransformPtr transform, int last,
* XPath transform
*
*****************************************************************************/
-static int xmlSecTransformXPathNodeRead (xmlSecTransformPtr transform,
- xmlNodePtr node,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecTransformXPathNodeRead (xmlSecTransformPtr transform,
+ xmlNodePtr node,
+ xmlSecTransformCtxPtr transformCtx);
static xmlSecTransformKlass xmlSecTransformXPathKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecXPathTransformSize, /* xmlSecSize objSize */
-
- xmlSecNameXPath, /* const xmlChar* name; */
- xmlSecXPathNs, /* const xmlChar* href; */
- xmlSecTransformUsageDSigTransform, /* xmlSecTransformUsage usage; */
-
- xmlSecTransformXPathInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecTransformXPathFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- xmlSecTransformXPathNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- NULL, /* xmlSecTransformPushBinMethod pushBin; */
- NULL, /* xmlSecTransformPopBinMethod popBin; */
- xmlSecTransformDefaultPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
- xmlSecTransformDefaultPopXml, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecTransformXPathExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecXPathTransformSize, /* xmlSecSize objSize */
+
+ xmlSecNameXPath, /* const xmlChar* name; */
+ xmlSecXPathNs, /* const xmlChar* href; */
+ xmlSecTransformUsageDSigTransform, /* xmlSecTransformUsage usage; */
+
+ xmlSecTransformXPathInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecTransformXPathFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ xmlSecTransformXPathNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ NULL, /* xmlSecTransformPushBinMethod pushBin; */
+ NULL, /* xmlSecTransformPopBinMethod popBin; */
+ xmlSecTransformDefaultPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
+ xmlSecTransformDefaultPopXml, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecTransformXPathExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -543,79 +543,79 @@ xmlSecTransformXPathNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlS
/* there is only one required node */
cur = xmlSecGetNextElementNode(node->children);
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeXPath, xmlSecDSigNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "expected=%s",
- xmlSecErrorsSafeString(xmlSecNodeXPath));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "expected=%s",
+ xmlSecErrorsSafeString(xmlSecNodeXPath));
+ return(-1);
}
/* read information from the node */
data = xmlSecXPathDataCreate(xmlSecXPathDataTypeXPath);
if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecXPathDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecXPathDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecXPathDataNodeRead(data, cur);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecXPathDataNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXPathDataDestroy(data);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecXPathDataNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXPathDataDestroy(data);
+ return(-1);
}
/* append it to the list */
ret = xmlSecPtrListAdd(dataList, data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXPathDataDestroy(data);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXPathDataDestroy(data);
+ return(-1);
}
/* create full XPath expression */
xmlSecAssert2(data->expr != NULL, -1);
tmp = (xmlChar*) xmlMalloc(sizeof(xmlChar) * (xmlStrlen(data->expr) +
- strlen(xpathPattern) + 1));
+ strlen(xpathPattern) + 1));
if(tmp == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- "size=%d",
- xmlStrlen(data->expr) + strlen(xpathPattern) + 1);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ "size=%d",
+ xmlStrlen(data->expr) + strlen(xpathPattern) + 1);
+ return(-1);
}
- sprintf((char*)tmp, xpathPattern, (char*)data->expr);
+ sprintf((char*)tmp, xpathPattern, (char*)data->expr);
xmlFree(data->expr);
data->expr = tmp;
/* set correct node set type and operation */
- data->nodeSetOp = xmlSecNodeSetIntersection;
- data->nodeSetType = xmlSecNodeSetNormal;
+ data->nodeSetOp = xmlSecNodeSetIntersection;
+ data->nodeSetType = xmlSecNodeSetNormal;
/* check that we have nothing else */
cur = xmlSecGetNextElementNode(cur->next);
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
@@ -625,34 +625,34 @@ xmlSecTransformXPathNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlS
* XPath2 transform
*
*****************************************************************************/
-static int xmlSecTransformXPath2NodeRead (xmlSecTransformPtr transform,
- xmlNodePtr node,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecTransformXPath2NodeRead (xmlSecTransformPtr transform,
+ xmlNodePtr node,
+ xmlSecTransformCtxPtr transformCtx);
static xmlSecTransformKlass xmlSecTransformXPath2Klass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecXPathTransformSize, /* xmlSecSize objSize */
-
- xmlSecNameXPath2, /* const xmlChar* name; */
- xmlSecXPath2Ns, /* const xmlChar* href; */
- xmlSecTransformUsageDSigTransform, /* xmlSecTransformUsage usage; */
-
- xmlSecTransformXPathInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecTransformXPathFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- xmlSecTransformXPath2NodeRead, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- NULL, /* xmlSecTransformPushBinMethod pushBin; */
- NULL, /* xmlSecTransformPopBinMethod popBin; */
- xmlSecTransformDefaultPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
- xmlSecTransformDefaultPopXml, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecTransformXPathExecute, /* xmlSecTransformExecuteMethod execute; */
-
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecXPathTransformSize, /* xmlSecSize objSize */
+
+ xmlSecNameXPath2, /* const xmlChar* name; */
+ xmlSecXPath2Ns, /* const xmlChar* href; */
+ xmlSecTransformUsageDSigTransform, /* xmlSecTransformUsage usage; */
+
+ xmlSecTransformXPathInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecTransformXPathFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ xmlSecTransformXPath2NodeRead, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ NULL, /* xmlSecTransformPushBinMethod pushBin; */
+ NULL, /* xmlSecTransformPopBinMethod popBin; */
+ xmlSecTransformDefaultPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
+ xmlSecTransformDefaultPopXml, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecTransformXPathExecute, /* xmlSecTransformExecuteMethod execute; */
+
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -687,80 +687,80 @@ xmlSecTransformXPath2NodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xml
cur = xmlSecGetNextElementNode(node->children);
while((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeXPath2, xmlSecXPath2Ns)) {
/* read information from the node */
- data = xmlSecXPathDataCreate(xmlSecXPathDataTypeXPath2);
- if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecXPathDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ data = xmlSecXPathDataCreate(xmlSecXPathDataTypeXPath2);
+ if(data == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecXPathDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
ret = xmlSecXPathDataNodeRead(data, cur);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecXPathDataNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXPathDataDestroy(data);
- return(-1);
- }
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecXPathDataNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXPathDataDestroy(data);
+ return(-1);
+ }
/* append it to the list */
- ret = xmlSecPtrListAdd(dataList, data);
+ ret = xmlSecPtrListAdd(dataList, data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXPathDataDestroy(data);
- return(-1);
- }
-
- /* set correct node set type and operation */
- data->nodeSetType = xmlSecNodeSetTree;
- op = xmlGetProp(cur, xmlSecAttrFilter);
- if(op == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- xmlSecErrorsSafeString(xmlSecAttrFilter),
- XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
- "node=%s",
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
- return(-1);
- }
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXPathDataDestroy(data);
+ return(-1);
+ }
+
+ /* set correct node set type and operation */
+ data->nodeSetType = xmlSecNodeSetTree;
+ op = xmlGetProp(cur, xmlSecAttrFilter);
+ if(op == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ xmlSecErrorsSafeString(xmlSecAttrFilter),
+ XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
+ "node=%s",
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+ return(-1);
+ }
if(xmlStrEqual(op, xmlSecXPath2FilterIntersect)) {
- data->nodeSetOp = xmlSecNodeSetIntersection;
- } else if(xmlStrEqual(op, xmlSecXPath2FilterSubtract)) {
- data->nodeSetOp = xmlSecNodeSetSubtraction;
- } else if(xmlStrEqual(op, xmlSecXPath2FilterUnion)) {
- data->nodeSetOp = xmlSecNodeSetUnion;
- } else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- xmlSecErrorsSafeString(xmlSecAttrFilter),
- XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
- "filter=%s",
- xmlSecErrorsSafeString(op));
- xmlFree(op);
- return(-1);
- }
- xmlFree(op);
+ data->nodeSetOp = xmlSecNodeSetIntersection;
+ } else if(xmlStrEqual(op, xmlSecXPath2FilterSubtract)) {
+ data->nodeSetOp = xmlSecNodeSetSubtraction;
+ } else if(xmlStrEqual(op, xmlSecXPath2FilterUnion)) {
+ data->nodeSetOp = xmlSecNodeSetUnion;
+ } else {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ xmlSecErrorsSafeString(xmlSecAttrFilter),
+ XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
+ "filter=%s",
+ xmlSecErrorsSafeString(op));
+ xmlFree(op);
+ return(-1);
+ }
+ xmlFree(op);
cur = xmlSecGetNextElementNode(cur->next);
}
/* check that we have nothing else */
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
@@ -770,34 +770,34 @@ xmlSecTransformXPath2NodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xml
* XPointer transform
*
*****************************************************************************/
-static int xmlSecTransformXPointerNodeRead (xmlSecTransformPtr transform,
- xmlNodePtr node,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecTransformXPointerNodeRead (xmlSecTransformPtr transform,
+ xmlNodePtr node,
+ xmlSecTransformCtxPtr transformCtx);
static xmlSecTransformKlass xmlSecTransformXPointerKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecXPathTransformSize, /* xmlSecSize objSize */
-
- xmlSecNameXPointer, /* const xmlChar* name; */
- xmlSecXPointerNs, /* const xmlChar* href; */
- xmlSecTransformUsageDSigTransform, /* xmlSecTransformUsage usage; */
-
- xmlSecTransformXPathInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecTransformXPathFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- xmlSecTransformXPointerNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- NULL, /* xmlSecTransformPushBinMethod pushBin; */
- NULL, /* xmlSecTransformPopBinMethod popBin; */
- xmlSecTransformDefaultPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
- xmlSecTransformDefaultPopXml, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecTransformXPathExecute, /* xmlSecTransformExecuteMethod execute; */
-
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecXPathTransformSize, /* xmlSecSize objSize */
+
+ xmlSecNameXPointer, /* const xmlChar* name; */
+ xmlSecXPointerNs, /* const xmlChar* href; */
+ xmlSecTransformUsageDSigTransform, /* xmlSecTransformUsage usage; */
+
+ xmlSecTransformXPathInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecTransformXPathFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ xmlSecTransformXPointerNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ NULL, /* xmlSecTransformPushBinMethod pushBin; */
+ NULL, /* xmlSecTransformPopBinMethod popBin; */
+ xmlSecTransformDefaultPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
+ xmlSecTransformDefaultPopXml, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecTransformXPathExecute, /* xmlSecTransformExecuteMethod execute; */
+
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -815,10 +815,10 @@ xmlSecTransformXPointerGetKlass(void) {
/**
* xmlSecTransformXPointerSetExpr:
- * @transform: the pointer to XPointer transform.
- * @expr: the XPointer expression.
- * @nodeSetType: the type of evaluated XPointer expression.
- * @hereNode: the pointer to "here" node.
+ * @transform: the pointer to XPointer transform.
+ * @expr: the XPointer expression.
+ * @nodeSetType: the type of evaluated XPointer expression.
+ * @hereNode: the pointer to "here" node.
*
* Sets the XPointer expression for an XPointer @transform.
*
@@ -826,7 +826,7 @@ xmlSecTransformXPointerGetKlass(void) {
*/
int
xmlSecTransformXPointerSetExpr(xmlSecTransformPtr transform, const xmlChar* expr,
- xmlSecNodeSetType nodeSetType, xmlNodePtr hereNode) {
+ xmlSecNodeSetType nodeSetType, xmlNodePtr hereNode) {
xmlSecPtrListPtr dataList;
xmlSecXPathDataPtr data;
int ret;
@@ -844,51 +844,51 @@ xmlSecTransformXPointerSetExpr(xmlSecTransformPtr transform, const xmlChar* expr
data = xmlSecXPathDataCreate(xmlSecXPathDataTypeXPointer);
if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecXPathDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecXPathDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecXPathDataRegisterNamespaces(data, hereNode);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecXPathDataRegisterNamespaces",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXPathDataDestroy(data);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecXPathDataRegisterNamespaces",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXPathDataDestroy(data);
+ return(-1);
}
ret = xmlSecXPathDataSetExpr(data, expr);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecXPathDataSetExpr",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXPathDataDestroy(data);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecXPathDataSetExpr",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXPathDataDestroy(data);
+ return(-1);
}
/* append it to the list */
ret = xmlSecPtrListAdd(dataList, data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXPathDataDestroy(data);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXPathDataDestroy(data);
+ return(-1);
}
/* set correct node set type and operation */
- data->nodeSetOp = xmlSecNodeSetIntersection;
- data->nodeSetType = nodeSetType;
+ data->nodeSetOp = xmlSecNodeSetIntersection;
+ data->nodeSetType = nodeSetType;
return(0);
}
@@ -911,62 +911,62 @@ xmlSecTransformXPointerNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, x
/* there is only one required node */
cur = xmlSecGetNextElementNode(node->children);
if((cur == NULL) || (!xmlSecCheckNodeName(cur, xmlSecNodeXPointer, xmlSecXPointerNs))) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_INVALID_NODE,
- "expected=%s",
- xmlSecErrorsSafeString(xmlSecNodeXPath));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_INVALID_NODE,
+ "expected=%s",
+ xmlSecErrorsSafeString(xmlSecNodeXPath));
+ return(-1);
}
/* read information from the node */
data = xmlSecXPathDataCreate(xmlSecXPathDataTypeXPointer);
if(data == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecXPathDataCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecXPathDataCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
ret = xmlSecXPathDataNodeRead(data, cur);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecXPathDataNodeRead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXPathDataDestroy(data);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecXPathDataNodeRead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXPathDataDestroy(data);
+ return(-1);
}
/* append it to the list */
ret = xmlSecPtrListAdd(dataList, data);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecPtrListAdd",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlSecXPathDataDestroy(data);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecPtrListAdd",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlSecXPathDataDestroy(data);
+ return(-1);
}
/* set correct node set type and operation */
- data->nodeSetOp = xmlSecNodeSetIntersection;
- data->nodeSetType = xmlSecNodeSetTree;
+ data->nodeSetOp = xmlSecNodeSetIntersection;
+ data->nodeSetType = xmlSecNodeSetTree;
/* check that we have nothing else */
cur = xmlSecGetNextElementNode(cur->next);
if(cur != NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
- XMLSEC_ERRORS_R_UNEXPECTED_NODE,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),
+ XMLSEC_ERRORS_R_UNEXPECTED_NODE,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
@@ -977,46 +977,46 @@ xmlSecTransformXPointerNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, x
* Visa3DHack transform
*
*****************************************************************************/
-#define xmlSecVisa3DHackTransformSize \
+#define xmlSecVisa3DHackTransformSize \
(sizeof(xmlSecTransform) + sizeof(xmlChar*))
#define xmlSecVisa3DHackTransformGetIDPtr(transform) \
((xmlSecTransformCheckSize((transform), xmlSecVisa3DHackTransformSize)) ? \
- (xmlChar**)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)) : \
- (xmlChar**)NULL)
+ (xmlChar**)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)) : \
+ (xmlChar**)NULL)
#define xmlSecTransformVisa3DHackCheckId(transform) \
(xmlSecTransformCheckId((transform), xmlSecTransformVisa3DHackId))
-static int xmlSecTransformVisa3DHackInitialize (xmlSecTransformPtr transform);
-static void xmlSecTransformVisa3DHackFinalize (xmlSecTransformPtr transform);
-static int xmlSecTransformVisa3DHackExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
+static int xmlSecTransformVisa3DHackInitialize (xmlSecTransformPtr transform);
+static void xmlSecTransformVisa3DHackFinalize (xmlSecTransformPtr transform);
+static int xmlSecTransformVisa3DHackExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
static xmlSecTransformKlass xmlSecTransformVisa3DHackKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecVisa3DHackTransformSize, /* xmlSecSize objSize */
-
- BAD_CAST "Visa3DHackTransform", /* const xmlChar* name; */
- NULL, /* const xmlChar* href; */
- xmlSecTransformUsageDSigTransform, /* xmlSecTransformUsage usage; */
-
- xmlSecTransformVisa3DHackInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecTransformVisa3DHackFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- NULL, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- NULL, /* xmlSecTransformPushBinMethod pushBin; */
- NULL, /* xmlSecTransformPopBinMethod popBin; */
- xmlSecTransformDefaultPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
- xmlSecTransformDefaultPopXml, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecTransformVisa3DHackExecute, /* xmlSecTransformExecuteMethod execute; */
-
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecVisa3DHackTransformSize, /* xmlSecSize objSize */
+
+ BAD_CAST "Visa3DHackTransform", /* const xmlChar* name; */
+ NULL, /* const xmlChar* href; */
+ xmlSecTransformUsageDSigTransform, /* xmlSecTransformUsage usage; */
+
+ xmlSecTransformVisa3DHackInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecTransformVisa3DHackFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ NULL, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ NULL, /* xmlSecTransformPushBinMethod pushBin; */
+ NULL, /* xmlSecTransformPopBinMethod popBin; */
+ xmlSecTransformDefaultPushXml, /* xmlSecTransformPushXmlMethod pushXml; */
+ xmlSecTransformDefaultPopXml, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecTransformVisa3DHackExecute, /* xmlSecTransformExecuteMethod execute; */
+
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -1036,8 +1036,8 @@ xmlSecTransformVisa3DHackGetKlass(void) {
/**
* xmlSecTransformVisa3DHackSetID:
- * @transform: the pointer to Visa3DHack transform.
- * @id: the ID value.
+ * @transform: the pointer to Visa3DHack transform.
+ * @id: the ID value.
*
* Sets the ID value for an Visa3DHack @transform.
*
@@ -1056,19 +1056,19 @@ xmlSecTransformVisa3DHackSetID(xmlSecTransformPtr transform, const xmlChar* id)
(*idPtr) = xmlStrdup(id);
if((*idPtr) == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlStrdup",
- XMLSEC_ERRORS_R_MALLOC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlStrdup",
+ XMLSEC_ERRORS_R_MALLOC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
return(0);
}
static int
-xmlSecTransformVisa3DHackInitialize(xmlSecTransformPtr transform) {
+xmlSecTransformVisa3DHackInitialize(xmlSecTransformPtr transform) {
xmlSecAssert2(xmlSecTransformVisa3DHackCheckId(transform), -1);
return(0);
@@ -1084,14 +1084,14 @@ xmlSecTransformVisa3DHackFinalize(xmlSecTransformPtr transform) {
xmlSecAssert(idPtr != NULL);
if((*idPtr) != NULL) {
- xmlFree((*idPtr));
+ xmlFree((*idPtr));
}
(*idPtr) = NULL;
}
static int
xmlSecTransformVisa3DHackExecute(xmlSecTransformPtr transform, int last,
- xmlSecTransformCtxPtr transformCtx) {
+ xmlSecTransformCtxPtr transformCtx) {
xmlChar** idPtr;
xmlDocPtr doc;
xmlAttrPtr attr;
@@ -1111,35 +1111,35 @@ xmlSecTransformVisa3DHackExecute(xmlSecTransformPtr transform, int last,
attr = xmlGetID(doc, (*idPtr));
if((attr == NULL) || (attr->parent == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlGetID",
- XMLSEC_ERRORS_R_XML_FAILED,
- "id=\"%s\"",
- xmlSecErrorsSafeString((*idPtr)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlGetID",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "id=\"%s\"",
+ xmlSecErrorsSafeString((*idPtr)));
+ return(-1);
}
nodeSet = xmlXPathNodeSetCreate(attr->parent);
if(nodeSet == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlXPathNodeSetCreate",
- XMLSEC_ERRORS_R_XML_FAILED,
- "id=\"%s\"",
- xmlSecErrorsSafeString((*idPtr)));
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlXPathNodeSetCreate",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "id=\"%s\"",
+ xmlSecErrorsSafeString((*idPtr)));
+ return(-1);
}
transform->outNodes = xmlSecNodeSetCreate(doc, nodeSet, xmlSecNodeSetTreeWithoutComments);
if(transform->outNodes == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecNodeSetCreate",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlXPathFreeNodeSet(nodeSet);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecNodeSetCreate",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlXPathFreeNodeSet(nodeSet);
+ return(-1);
}
return(0);
}
diff --git a/src/xslt.c b/src/xslt.c
index e5e5268..33e8cae 100644
--- a/src/xslt.c
+++ b/src/xslt.c
@@ -34,11 +34,11 @@
* Internal xslt ctx
*
*****************************************************************************/
-typedef struct _xmlSecXsltCtx xmlSecXsltCtx, *xmlSecXsltCtxPtr;
+typedef struct _xmlSecXsltCtx xmlSecXsltCtx, *xmlSecXsltCtxPtr;
struct _xmlSecXsltCtx {
- xsltStylesheetPtr xslt;
- xmlParserCtxtPtr parserCtx;
-};
+ xsltStylesheetPtr xslt;
+ xmlParserCtxtPtr parserCtx;
+};
/****************************************************************************
*
@@ -47,52 +47,52 @@ struct _xmlSecXsltCtx {
* xmlSecXsltCtx is located after xmlSecTransform
*
***************************************************************************/
-#define xmlSecXsltSize \
- (sizeof(xmlSecTransform) + sizeof(xmlSecXsltCtx))
+#define xmlSecXsltSize \
+ (sizeof(xmlSecTransform) + sizeof(xmlSecXsltCtx))
#define xmlSecXsltGetCtx(transform) \
((xmlSecXsltCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
-static int xmlSecXsltInitialize (xmlSecTransformPtr transform);
-static void xmlSecXsltFinalize (xmlSecTransformPtr transform);
-static int xmlSecXsltReadNode (xmlSecTransformPtr transform,
- xmlNodePtr node,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecXsltPushBin (xmlSecTransformPtr transform,
- const xmlSecByte* data,
- xmlSecSize dataSize,
- int final,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecXsltExecute (xmlSecTransformPtr transform,
- int last,
- xmlSecTransformCtxPtr transformCtx);
-static int xmlSecXslProcess (xmlSecBufferPtr in,
- xmlSecBufferPtr out,
- xsltStylesheetPtr stylesheet);
+static int xmlSecXsltInitialize (xmlSecTransformPtr transform);
+static void xmlSecXsltFinalize (xmlSecTransformPtr transform);
+static int xmlSecXsltReadNode (xmlSecTransformPtr transform,
+ xmlNodePtr node,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecXsltPushBin (xmlSecTransformPtr transform,
+ const xmlSecByte* data,
+ xmlSecSize dataSize,
+ int final,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecXsltExecute (xmlSecTransformPtr transform,
+ int last,
+ xmlSecTransformCtxPtr transformCtx);
+static int xmlSecXslProcess (xmlSecBufferPtr in,
+ xmlSecBufferPtr out,
+ xsltStylesheetPtr stylesheet);
static xmlSecTransformKlass xmlSecXsltKlass = {
/* klass/object sizes */
- sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
- xmlSecXsltSize, /* xmlSecSize objSize */
-
- xmlSecNameXslt, /* const xmlChar* name; */
- xmlSecHrefXslt, /* const xmlChar* href; */
- xmlSecTransformUsageDSigTransform, /* xmlSecAlgorithmUsage usage; */
-
- xmlSecXsltInitialize, /* xmlSecTransformInitializeMethod initialize; */
- xmlSecXsltFinalize, /* xmlSecTransformFinalizeMethod finalize; */
- xmlSecXsltReadNode, /* xmlSecTransformNodeReadMethod readNode; */
- NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
- NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
- NULL, /* xmlSecTransformSetKeyMethod setKey; */
- NULL, /* xmlSecTransformValidateMethod validate; */
- xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
- xmlSecXsltPushBin, /* xmlSecTransformPushBinMethod pushBin; */
- xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
- NULL, /* xmlSecTransformPushXmlMethod pushXml; */
- NULL, /* xmlSecTransformPopXmlMethod popXml; */
- xmlSecXsltExecute, /* xmlSecTransformExecuteMethod execute; */
+ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
+ xmlSecXsltSize, /* xmlSecSize objSize */
+
+ xmlSecNameXslt, /* const xmlChar* name; */
+ xmlSecHrefXslt, /* const xmlChar* href; */
+ xmlSecTransformUsageDSigTransform, /* xmlSecAlgorithmUsage usage; */
+
+ xmlSecXsltInitialize, /* xmlSecTransformInitializeMethod initialize; */
+ xmlSecXsltFinalize, /* xmlSecTransformFinalizeMethod finalize; */
+ xmlSecXsltReadNode, /* xmlSecTransformNodeReadMethod readNode; */
+ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
+ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
+ NULL, /* xmlSecTransformSetKeyMethod setKey; */
+ NULL, /* xmlSecTransformValidateMethod validate; */
+ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
+ xmlSecXsltPushBin, /* xmlSecTransformPushBinMethod pushBin; */
+ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
+ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
+ NULL, /* xmlSecTransformPopXmlMethod popXml; */
+ xmlSecXsltExecute, /* xmlSecTransformExecuteMethod execute; */
- NULL, /* void* reserved0; */
- NULL, /* void* reserved1; */
+ NULL, /* void* reserved0; */
+ NULL, /* void* reserved1; */
};
/**
@@ -158,10 +158,10 @@ xmlSecXsltFinalize(xmlSecTransformPtr transform) {
xmlSecAssert(ctx != NULL);
if(ctx->xslt != NULL) {
- xsltFreeStylesheet(ctx->xslt);
+ xsltFreeStylesheet(ctx->xslt);
}
if(ctx->parserCtx != NULL) {
- xmlFreeParserCtxt(ctx->parserCtx);
+ xmlFreeParserCtxt(ctx->parserCtx);
}
memset(ctx, 0, sizeof(xmlSecXsltCtx));
}
@@ -185,45 +185,45 @@ xmlSecXsltReadNode(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransfor
/* read content in the buffer */
buffer = xmlBufferCreate();
if(buffer == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlBufferCreate",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlBufferCreate",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
cur = node->children;
while(cur != NULL) {
- xmlNodeDump(buffer, cur->doc, cur, 0, 0);
- cur = cur->next;
+ xmlNodeDump(buffer, cur->doc, cur, 0, 0);
+ cur = cur->next;
}
/* parse the buffer */
doc = xmlSecParseMemory(xmlBufferContent(buffer),
- xmlBufferLength(buffer), 1);
+ xmlBufferLength(buffer), 1);
if(doc == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecParseMemory",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlBufferFree(buffer);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecParseMemory",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlBufferFree(buffer);
+ return(-1);
}
/* pre-process stylesheet */
ctx->xslt = xsltParseStylesheetDoc(doc);
if(ctx->xslt == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xsltParseStylesheetDoc",
- XMLSEC_ERRORS_R_XSLT_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- /* after parsing stylesheet doc is assigned
- * to it and will be freed by xsltFreeStylesheet() */
- xmlFreeDoc(doc);
- xmlBufferFree(buffer);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xsltParseStylesheetDoc",
+ XMLSEC_ERRORS_R_XSLT_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ /* after parsing stylesheet doc is assigned
+ * to it and will be freed by xsltFreeStylesheet() */
+ xmlFreeDoc(doc);
+ xmlBufferFree(buffer);
+ return(-1);
}
xmlBufferFree(buffer);
@@ -232,7 +232,7 @@ xmlSecXsltReadNode(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransfor
static int
xmlSecXsltPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
- xmlSecSize dataSize, int final, xmlSecTransformCtxPtr transformCtx) {
+ xmlSecSize dataSize, int final, xmlSecTransformCtxPtr transformCtx) {
xmlSecXsltCtxPtr ctx;
int ret;
@@ -246,47 +246,47 @@ xmlSecXsltPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
/* check/update current transform status */
if(transform->status == xmlSecTransformStatusNone) {
- xmlSecAssert2(ctx->parserCtx == NULL, -1);
-
- ctx->parserCtx = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, NULL);
- if(ctx->parserCtx == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlCreatePushParserCtxt",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
+ xmlSecAssert2(ctx->parserCtx == NULL, -1);
+
+ ctx->parserCtx = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, NULL);
+ if(ctx->parserCtx == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlCreatePushParserCtxt",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
/* required for c14n! */
- ctx->parserCtx->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
- ctx->parserCtx->replaceEntities = 1;
+ ctx->parserCtx->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
+ ctx->parserCtx->replaceEntities = 1;
- transform->status = xmlSecTransformStatusWorking;
+ transform->status = xmlSecTransformStatusWorking;
} else if(transform->status == xmlSecTransformStatusFinished) {
- return(0);
+ return(0);
} else if(transform->status != xmlSecTransformStatusWorking) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
xmlSecAssert2(transform->status == xmlSecTransformStatusWorking, -1);
xmlSecAssert2(ctx->parserCtx != NULL, -1);
/* push data to the input buffer */
if((data != NULL) && (dataSize > 0)) {
- ret = xmlParseChunk(ctx->parserCtx, (const char*)data, dataSize, 0);
- if(ret != 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlParseChunk",
- XMLSEC_ERRORS_R_XML_FAILED,
- "size=%d", dataSize);
- return(-1);
- }
+ ret = xmlParseChunk(ctx->parserCtx, (const char*)data, dataSize, 0);
+ if(ret != 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlParseChunk",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ "size=%d", dataSize);
+ return(-1);
+ }
}
/* finish parsing, apply xslt transforms and push to next in the chain */
@@ -295,81 +295,81 @@ xmlSecXsltPushBin(xmlSecTransformPtr transform, const xmlSecByte* data,
xmlDocPtr docOut;
xmlOutputBufferPtr output;
- /* finalize */
- ret = xmlParseChunk(ctx->parserCtx, NULL, 0, 1);
- if((ret != 0) || (ctx->parserCtx->myDoc == NULL)) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlParseChunk",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- /* todo: check that document is well formed? */
- docIn = ctx->parserCtx->myDoc;
- ctx->parserCtx->myDoc = NULL;
-
- docOut = xsltApplyStylesheet(ctx->xslt, docIn, NULL);
- if(docOut == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xsltApplyStylesheet",
- XMLSEC_ERRORS_R_XSLT_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFreeDoc(docIn);
- return(-1);
- }
- xmlFreeDoc(docIn);
+ /* finalize */
+ ret = xmlParseChunk(ctx->parserCtx, NULL, 0, 1);
+ if((ret != 0) || (ctx->parserCtx->myDoc == NULL)) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlParseChunk",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ /* todo: check that document is well formed? */
+ docIn = ctx->parserCtx->myDoc;
+ ctx->parserCtx->myDoc = NULL;
+
+ docOut = xsltApplyStylesheet(ctx->xslt, docIn, NULL);
+ if(docOut == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xsltApplyStylesheet",
+ XMLSEC_ERRORS_R_XSLT_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFreeDoc(docIn);
+ return(-1);
+ }
+ xmlFreeDoc(docIn);
- if(transform->next != NULL) {
- output = xmlSecTransformCreateOutputBuffer(transform->next, transformCtx);
- if(output == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecTransformCreateOutputBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFreeDoc(docOut);
- return(-1);
- }
- } else {
- output = xmlSecBufferCreateOutputBuffer(&(transform->outBuf));
- if(output == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferCreateOutputBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFreeDoc(docOut);
- return(-1);
- }
- }
-
- ret = xsltSaveResultTo(output, docOut, ctx->xslt);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xsltSaveResultTo",
- XMLSEC_ERRORS_R_XSLT_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlOutputBufferClose(output);
- xmlFreeDoc(docOut);
- return(-1);
- }
- ret = xmlOutputBufferClose(output);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlOutputBufferClose",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- xmlFreeDoc(docOut);
- return(-1);
- }
- xmlFreeDoc(docOut);
-
- transform->status = xmlSecTransformStatusFinished;
+ if(transform->next != NULL) {
+ output = xmlSecTransformCreateOutputBuffer(transform->next, transformCtx);
+ if(output == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecTransformCreateOutputBuffer",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFreeDoc(docOut);
+ return(-1);
+ }
+ } else {
+ output = xmlSecBufferCreateOutputBuffer(&(transform->outBuf));
+ if(output == NULL) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferCreateOutputBuffer",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFreeDoc(docOut);
+ return(-1);
+ }
+ }
+
+ ret = xsltSaveResultTo(output, docOut, ctx->xslt);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xsltSaveResultTo",
+ XMLSEC_ERRORS_R_XSLT_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlOutputBufferClose(output);
+ xmlFreeDoc(docOut);
+ return(-1);
+ }
+ ret = xmlOutputBufferClose(output);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlOutputBufferClose",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ xmlFreeDoc(docOut);
+ return(-1);
+ }
+ xmlFreeDoc(docOut);
+
+ transform->status = xmlSecTransformStatusFinished;
}
return(0);
@@ -396,47 +396,47 @@ xmlSecXsltExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr
outSize = xmlSecBufferGetSize(out);
if(transform->status == xmlSecTransformStatusNone) {
- transform->status = xmlSecTransformStatusWorking;
+ transform->status = xmlSecTransformStatusWorking;
}
if((transform->status == xmlSecTransformStatusWorking) && (last == 0)) {
- /* just do nothing */
- xmlSecAssert2(outSize == 0, -1);
+ /* just do nothing */
+ xmlSecAssert2(outSize == 0, -1);
} else if((transform->status == xmlSecTransformStatusWorking) && (last != 0)) {
- xmlSecAssert2(outSize == 0, -1);
-
- ret = xmlSecXslProcess(in, out, ctx->xslt);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecXslProcess",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
- }
-
- ret = xmlSecBufferRemoveHead(in, inSize);
- if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- "xmlSecBufferRemoveHead",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- "size=%d", inSize);
- return(-1);
- }
-
- transform->status = xmlSecTransformStatusFinished;
+ xmlSecAssert2(outSize == 0, -1);
+
+ ret = xmlSecXslProcess(in, out, ctx->xslt);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecXslProcess",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
+ }
+
+ ret = xmlSecBufferRemoveHead(in, inSize);
+ if(ret < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ "xmlSecBufferRemoveHead",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ "size=%d", inSize);
+ return(-1);
+ }
+
+ transform->status = xmlSecTransformStatusFinished;
} else if(transform->status == xmlSecTransformStatusFinished) {
- /* the only way we can get here is if there is no input */
- xmlSecAssert2(inSize == 0, -1);
+ /* the only way we can get here is if there is no input */
+ xmlSecAssert2(inSize == 0, -1);
} else {
- xmlSecError(XMLSEC_ERRORS_HERE,
- xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
- NULL,
- XMLSEC_ERRORS_R_INVALID_STATUS,
- "status=%d", transform->status);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),
+ NULL,
+ XMLSEC_ERRORS_R_INVALID_STATUS,
+ "status=%d", transform->status);
+ return(-1);
}
return(0);
}
@@ -456,53 +456,53 @@ xmlSecXslProcess(xmlSecBufferPtr in, xmlSecBufferPtr out, xsltStylesheetPtr sty
docIn = xmlSecParseMemory(xmlSecBufferGetData(in), xmlSecBufferGetSize(in), 1);
if(docIn == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecParseMemory",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecParseMemory",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
docOut = xsltApplyStylesheet(stylesheet, docIn, NULL);
if(docOut == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xsltApplyStylesheet",
- XMLSEC_ERRORS_R_XSLT_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xsltApplyStylesheet",
+ XMLSEC_ERRORS_R_XSLT_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
output = xmlSecBufferCreateOutputBuffer(out);
if(output == NULL) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlSecBufferCreateOutputBuffer",
- XMLSEC_ERRORS_R_XMLSEC_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlSecBufferCreateOutputBuffer",
+ XMLSEC_ERRORS_R_XMLSEC_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
ret = xsltSaveResultTo(output, docOut, stylesheet);
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xsltSaveResultTo",
- XMLSEC_ERRORS_R_XSLT_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- goto done;
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xsltSaveResultTo",
+ XMLSEC_ERRORS_R_XSLT_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ goto done;
}
ret = xmlOutputBufferClose(output);
output = NULL;
if(ret < 0) {
- xmlSecError(XMLSEC_ERRORS_HERE,
- NULL,
- "xmlOutputBufferClose",
- XMLSEC_ERRORS_R_XML_FAILED,
- XMLSEC_ERRORS_NO_MESSAGE);
- return(-1);
+ xmlSecError(XMLSEC_ERRORS_HERE,
+ NULL,
+ "xmlOutputBufferClose",
+ XMLSEC_ERRORS_R_XML_FAILED,
+ XMLSEC_ERRORS_NO_MESSAGE);
+ return(-1);
}
res = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]