/** * xmlSecCryptoDLInit: * * Initializes dynamic loading engine. This is an internal function * and should not be called by application directly. * * Returns 0 on success or a negative value if an error occurs. */ int xmlSecCryptoDLInit(void) { int ret; ret = xmlSecPtrListInitialize(&gXmlSecCryptoDLLibraries, xmlSecCryptoDLLibrariesListGetKlass()); if(ret < 0) { xmlSecErr_a_ignorar5(XMLSEC_ERRORS_HERE, NULL, "xmlSecPtrListPtrInitialize", XMLSEC_ERRORS_R_XMLSEC_FAILED, "xmlSecCryptoDLLibrariesListGetKlass"); return(-1); } /* use xmlMalloc/xmlFree */ xmlsec_lt_dlmalloc = xmlSecCryptoDLMalloc; xmlsec_lt_dlfree = xmlSecCryptoDLFree; ret = xmlsec_lt_dlinit (); if(ret != 0) { xmlSecErr_a_ignorar5(XMLSEC_ERRORS_HERE, NULL, "xmlsec_lt_dlinit", XMLSEC_ERRORS_R_IO_FAILED, XMLSEC_ERRORS_NO_MESSAGE); return(-1); } /* TODO: LTDL_SET_PRELOADED_SYMBOLS(); */ return(0); }
/** * xmlSecKeysMngrCreate: * * Creates new keys manager. Caller is responsible for freeing it with * #xmlSecKeysMngrDestroy function. * * Returns the pointer to newly allocated keys manager or NULL if * an error occurs. */ xmlSecKeysMngrPtr xmlSecKeysMngrCreate(void) { xmlSecKeysMngrPtr mngr; int ret; /* Allocate a new xmlSecKeysMngr and fill the fields. */ mngr = (xmlSecKeysMngrPtr)xmlMalloc(sizeof(xmlSecKeysMngr)); if(mngr == NULL) { xmlSecErr_a_ignorar6(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) { xmlSecErr_a_ignorar5(XMLSEC_ERRORS_HERE, NULL, "xmlSecPtrListInitialize", XMLSEC_ERRORS_R_XMLSEC_FAILED, "xmlSecKeyDataStorePtrListId"); return(NULL); } return(mngr); }
/** * xmlSecPtrListCreate: * @id: the list klass. * * Creates new list object. Caller is responsible for freeing returned list * by calling #xmlSecPtrListDestroy function. * * Returns pointer to newly allocated list or NULL if an error occurs. */ xmlSecPtrListPtr xmlSecPtrListCreate(xmlSecPtrListId id) { xmlSecPtrListPtr list; int ret; xmlSecAssert2(id != xmlSecPtrListIdUnknown, NULL); /* Allocate a new xmlSecPtrList and fill the fields. */ list = (xmlSecPtrListPtr)xmlMalloc(sizeof(xmlSecPtrList)); if(list == NULL) { xmlSecErr_a_ignorar6(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) { xmlSecErr_a_ignorar5(XMLSEC_ERRORS_HERE, xmlSecErrorsSafeString(xmlSecPtrListKlassGetName(id)), "xmlSecPtrListInitialize", XMLSEC_ERRORS_R_XMLSEC_FAILED, XMLSEC_ERRORS_NO_MESSAGE); xmlFree(list); return(NULL); } return(list); }
/** * xmlSecKeyDataIdsInit: * * Initializes the key data klasses. This function is called from the * #xmlSecInit function and the application should not call it directly. * * Returns: 0 on success or a negative value if an error occurs. */ int xmlSecKeyDataIdsInit(void) { int ret; ret = xmlSecPtrListInitialize(xmlSecKeyDataIdsGet(), xmlSecKeyDataIdListId); if(ret < 0) { 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); return(-1); } return(0); }
PyObject *xmlsec_PtrListInitialize(PyObject *self, PyObject *args) { PyObject *list_obj, *id_obj; xmlSecPtrListPtr list; xmlSecPtrListId id; if (CheckArgs(args, "OO:ptrListInitialize")) { if(!PyArg_ParseTuple(args, (char *) "OO:ptrListInitialize", &list_obj, &id_obj)) return NULL; } else return NULL; list = xmlSecPtrListPtr_get(list_obj); id = xmlSecPtrListId_get(id_obj); return (wrap_int(xmlSecPtrListInitialize(list, id))); }
static int xmlSecTransformXPathInitialize(xmlSecTransformPtr transform) { xmlSecPtrListPtr dataList; int ret; xmlSecAssert2(xmlSecTransformXPathCheckId(transform), -1); dataList = xmlSecXPathTransformGetDataList(transform); xmlSecAssert2(dataList != NULL, -1); ret = xmlSecPtrListInitialize(dataList, xmlSecXPathDataListId); if(ret < 0) { xmlSecInternalError("xmlSecPtrListInitialize", xmlSecTransformGetName(transform)); return(-1); } return(0); }
static int xmlSecTransformXPathInitialize(xmlSecTransformPtr transform) { xmlSecPtrListPtr dataList; int ret; xmlSecAssert2(xmlSecTransformXPathCheckId(transform), -1); dataList = xmlSecXPathTransformGetDataList(transform); xmlSecAssert2(dataList != NULL, -1); 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); } return(0); }
static int xmlSecSimpleKeysStoreInitialize(xmlSecKeyStorePtr store) { xmlSecPtrListPtr list; int ret; xmlSecAssert2(xmlSecKeyStoreCheckId(store, xmlSecSimpleKeysStoreId), -1); list = xmlSecSimpleKeysStoreGetList(store); xmlSecAssert2(list != NULL, -1); ret = xmlSecPtrListInitialize(list, xmlSecKeyPtrListId); if(ret < 0) { xmlSecErr_a_ignorar5(XMLSEC_ERRORS_HERE, xmlSecErrorsSafeString(xmlSecKeyStoreGetName(store)), "xmlSecPtrListInitialize", XMLSEC_ERRORS_R_XMLSEC_FAILED, "xmlSecKeyPtrListId"); return(-1); } return(0); }
/** * xmlSecKeyReqInitialize: * @keyReq: the pointer to key requirements object. * * Initialize key requirements object. Caller is responsible for * cleaning it with #xmlSecKeyReqFinalize function. * * Returns: 0 on success or a negative value if an error occurs. */ int xmlSecKeyReqInitialize(xmlSecKeyReqPtr keyReq) { int ret; xmlSecAssert2(keyReq != NULL, -1); memset(keyReq, 0, sizeof(xmlSecKeyReq)); 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); } return(0); }
{ xmlSecKeyPtr key = NULL; xmlSecKeyPtr res = NULL; xmlSecPtrList certsList; xmlSecKeyDataPtr keyData = NULL; xmlSecKeyDataPtr x509Data = NULL; gnutls_x509_privkey_t priv_key = NULL; gnutls_x509_crt_t key_cert = NULL; xmlSecSize certsSize; int ret; xmlSecAssert2(data != NULL, NULL); xmlSecAssert2(dataSize > 0, NULL); /* prepare */ ret = xmlSecPtrListInitialize(&(certsList), xmlSecGnuTLSX509CrtListId); if(ret < 0) { xmlSecError(XMLSEC_ERRORS_HERE, NULL, "xmlSecPtrListInitialize", XMLSEC_ERRORS_R_XMLSEC_FAILED, "certsList"); return(NULL); } /* load pkcs12 */ ret = xmlSecGnuTLSPkcs12LoadMemory(data, dataSize, pwd, &priv_key, &key_cert, &certsList); if((ret < 0) || (priv_key == NULL)) { xmlSecError(XMLSEC_ERRORS_HERE, NULL, "xmlSecGnuTLSPkcs12LoadMemory",