本文整理汇总了C++中CHECK_OBJECT函数的典型用法代码示例。如果您正苦于以下问题:C++ CHECK_OBJECT函数的具体用法?C++ CHECK_OBJECT怎么用?C++ CHECK_OBJECT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CHECK_OBJECT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LUA_FUNCTION
/***
verify x509_req signature
@function verify
@treturn boolean result true for verify pass
*/
static LUA_FUNCTION(openssl_csr_verify)
{
X509_REQ *csr = CHECK_OBJECT(1, X509_REQ, "openssl.x509_req");
EVP_PKEY * self_key = X509_REQ_get_pubkey(csr);
if (self_key)
{
lua_pushboolean(L, X509_REQ_verify(csr, self_key) == 1);
EVP_PKEY_free(self_key);
}
else
lua_pushboolean(L, 0);
return 1;
};
示例2: EXCEPTION_MATCH_BOOL_SINGLE
NUITKA_MAY_BE_UNUSED static bool EXCEPTION_MATCH_BOOL_SINGLE( PyObject *exception_value, PyObject *exception_checked )
{
CHECK_OBJECT( exception_value );
CHECK_OBJECT( exception_checked );
// We need to check the class.
if ( PyExceptionInstance_Check( exception_value ) )
{
exception_value = PyExceptionInstance_Class( exception_value );
}
// Lets be optimistic. If it matches, we would be wasting our time.
if ( exception_value == exception_checked )
{
return true;
}
if ( PyExceptionClass_Check( exception_value ) )
{
// Save the current exception, if any, we must preserve it.
PyObject *save_exception_type, *save_exception_value;
PyTracebackObject *save_exception_tb;
FETCH_ERROR_OCCURRED( &save_exception_type, &save_exception_value, &save_exception_tb );
int res = PyObject_IsSubclass( exception_value, exception_checked );
// This function must not fail, so print the error here */
if (unlikely( res == -1 ))
{
PyErr_WriteUnraisable( exception_value );
}
RESTORE_ERROR_OCCURRED( save_exception_type, save_exception_value, save_exception_tb );
return res == 1;
}
return false;
}
示例3: openssl_engine_name
static int openssl_engine_name(lua_State*L){
ENGINE* eng = CHECK_OBJECT(1,ENGINE,"openssl.engine");
const char*id = NULL;
int ret = 0;
if(lua_isstring(L, 2)){
id = luaL_checkstring(L, 2);
ret = ENGINE_set_name(eng,id);
lua_pushboolean(L, ret);
return 1;
}
lua_pushstring(L, ENGINE_get_name(eng));
return 1;
}
示例4: LUA_FUNCTION
static LUA_FUNCTION(openssl_ts_req_export)
{
TS_REQ *ts_req = CHECK_OBJECT(1, TS_REQ, "openssl.ts_req");
unsigned char *data = NULL;
int len = i2d_TS_REQ(ts_req, &data);
if (len > 0)
{
lua_pushlstring(L, data, (size_t)len);
OPENSSL_free(data);
return 1;
}
return 0;
}
示例5: LUA_FUNCTION
static LUA_FUNCTION(openssl_digest_info)
{
EVP_MD *md = CHECK_OBJECT(1, EVP_MD, "openssl.evp_digest");
lua_newtable(L);
AUXILIAR_SET(L, -1, "nid", EVP_MD_nid(md), integer);
AUXILIAR_SET(L, -1, "name", EVP_MD_name(md), string);
AUXILIAR_SET(L, -1, "size", EVP_MD_size(md), integer);
AUXILIAR_SET(L, -1, "block_size", EVP_MD_block_size(md), integer);
AUXILIAR_SET(L, -1, "pkey_type", EVP_MD_pkey_type(md), integer);
AUXILIAR_SET(L, -1, "flags", EVP_MD_type(md), integer);
return 1;
}
示例6: openssl_cms_content
static int openssl_cms_content(lua_State *L)
{
CMS_ContentInfo *cms = CHECK_OBJECT(1, CMS_ContentInfo, "openssl.cms");
ASN1_OCTET_STRING** content = CMS_get0_content(cms);
if (content && *content)
{
lua_pushnil(L);
return 1;
}
lua_pushnil(L);
return 1;
}
示例7: setInitInfo
/** @ingroup SystemInfo
* @brief Get the configuration parameters used to initialize the API.
*
* This function returns the configuration parameters that were used to
* initialize the API.
*
* @param value_p WO: Pointer in which to store revision info.
*
* @par Externals:
* None.
*
* @return
* N8_STATUS_OK: The function worked correctly.
* N8_INVALID_OBJECT: The output pointer is NULL.
*
* @par Errors:
* N8_INVALID_OBJECT as described in the return section.
*
* @par Locks:
* None.
*
* @par Assumptions:
* This function can not be called until the initialization of the API
* is complete. The value_p pointer points to a "reasonable" location.
*****************************************************************************/
static N8_Status_t setInitInfo(N8_Buffer_t *value_p)
{
N8_Status_t ret = N8_STATUS_OK;
DBG(("setInitInfo\n"));
do
{
CHECK_OBJECT(value_p, ret);
n8_getConfigInfo((N8_ConfigAPI_t *)value_p);
}while (FALSE);
DBG(("setInitInfo - OK\n"));
return ret;
}
示例8: LUA_FUNCTION
/* mem */
static LUA_FUNCTION(openssl_bio_get_mem)
{
BIO* bio = CHECK_OBJECT(1, BIO, "openssl.bio");
if (BIO_method_type(bio) == BIO_TYPE_MEM)
{
BUF_MEM* mem;
BIO_get_mem_ptr(bio, &mem);
lua_pushlstring(L, mem->data, mem->length);
return 1;
}
luaL_error(L, "#1 BIO must be memory type");
return 0;
}
示例9: openssl_xext_export
static int openssl_xext_export(lua_State* L)
{
X509_EXTENSION *x = CHECK_OBJECT(1, X509_EXTENSION, "openssl.x509_extension");
unsigned char* p = NULL;
int len = i2d_X509_EXTENSION(x, &p);
if (len > 0)
{
lua_pushlstring(L, (const char *) p, len);
}
else
lua_pushnil(L);
return 1;
};
示例10: openssl_cms_EncryptedData_decrypt
static int openssl_cms_EncryptedData_decrypt(lua_State*L)
{
CMS_ContentInfo *cms = CHECK_OBJECT(1, CMS_ContentInfo, "openssl.cms");
size_t klen;
const char* key = luaL_checklstring(L, 2, &klen);
BIO* dcont = load_bio_object(L, 3);
BIO* out = load_bio_object(L, 4);
unsigned int flags = luaL_optint(L, 5, 0);
int ret = CMS_EncryptedData_decrypt(cms, (const unsigned char*)key, klen, dcont, out, flags);
return openssl_pushresult(L, ret);
}
示例11: LUA_FUNCTION
static LUA_FUNCTION(openssl_pkcs7_verify)
{
int ret = 0;
PKCS7 *p7 = CHECK_OBJECT(1, PKCS7, "openssl.pkcs7");
STACK_OF(X509) *signers = lua_isnoneornil(L, 2) ? NULL : openssl_sk_x509_fromtable(L, 2);
X509_STORE *store = lua_isnoneornil(L, 3) ? NULL : CHECK_OBJECT(3, X509_STORE, "openssl.x509_store");
BIO* in = lua_isnoneornil(L, 4) ? NULL : load_bio_object(L, 4);
long flags = luaL_optint(L, 5, 0);
BIO* out = BIO_new(BIO_s_mem());
if (!store)
flags |= PKCS7_NOVERIFY;
if (PKCS7_verify(p7, signers, store, in, out, flags) == 1)
{
if (out && (flags & PKCS7_DETACHED) == 0)
{
BUF_MEM *bio_buf;
BIO_get_mem_ptr(out, &bio_buf);
lua_pushlstring(L, bio_buf->data, bio_buf->length);
}
else
{
lua_pushboolean(L, 1);
}
ret += 1;
}
else
{
ret = openssl_pushresult(L, 0);
}
if (signers)
sk_X509_pop_free(signers, X509_free);
if (out)
BIO_free(out);
if (in)
BIO_free(in);
return ret;
}
示例12: openssl_xname_info
static int openssl_xname_info(lua_State*L)
{
X509_NAME* name = CHECK_OBJECT(1, X509_NAME, "openssl.x509_name");
int i;
int n_entries = X509_NAME_entry_count(name);
lua_newtable(L);
for (i = 0; i < n_entries; i++)
{
X509_NAME_ENTRY* entry = X509_NAME_get_entry(name, i);
openssl_push_xname_entry(L, entry);
lua_rawseti(L, -2, i + 1);
}
return 1;
};
示例13: openssl_xname_digest
static int openssl_xname_digest(lua_State*L)
{
X509_NAME* xname = CHECK_OBJECT(1, X509_NAME, "openssl.x509_name");
const EVP_MD* md = get_digest(L, 2);
unsigned char buf [EVP_MAX_MD_SIZE];
unsigned int len = sizeof(buf);
int ret = X509_NAME_digest(xname, md, buf, &len);
if (ret == 1)
lua_pushlstring(L, (const char *) buf, len);
else
return openssl_pushresult(L, ret);
return 1;
};
示例14: openssl_xname_i2d
static int openssl_xname_i2d(lua_State*L)
{
X509_NAME* xn = CHECK_OBJECT(1, X509_NAME, "openssl.x509_name");
unsigned char* out = NULL;
int len = i2d_X509_NAME(xn, &out);
if (len > 0)
{
lua_pushlstring(L, (const char *)out, len);
CRYPTO_free(out);
return 1;
}
else
return openssl_pushresult(L, len);
};
示例15: openssl_xname_info
/***
return x509_name as table
@function info
@tparam[opt=false] boolean asobject table key will use asn1_object or short name of asn1_object
@treturn table names
@see new
*/
static int openssl_xname_info(lua_State*L)
{
X509_NAME* name = CHECK_OBJECT(1, X509_NAME, "openssl.x509_name");
int obj = lua_isnoneornil(L, 2) ? 0 : lua_toboolean(L, 2);
int i, n;
lua_newtable(L);
for (i = 0, n = X509_NAME_entry_count(name); i < n; i++)
{
X509_NAME_ENTRY* entry = X509_NAME_get_entry(name, i);
openssl_push_xname_entry(L, entry, obj);
lua_rawseti(L, -2, i + 1);
}
return 1;
};