STACK_OF(X509) *X509_STORE_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm)
	{
	int i, idx, cnt;
	STACK_OF(X509) *sk;
	X509 *x;
	X509_OBJECT *obj;
	sk = sk_X509_new_null();
	CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
	idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt);
	if (idx < 0)
		{
		X509_OBJECT xobj;
		CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
		if (!X509_STORE_get_by_subject(ctx, X509_LU_X509, nm, &xobj))
			{
			sk_X509_free(sk);
			return NULL;
			}
		X509_OBJECT_free_contents(&xobj);
		CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
		idx = x509_object_idx_cnt(ctx->ctx->objs,X509_LU_X509,nm, &cnt);
		if (idx < 0)
			{
			CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
			sk_X509_free(sk);
			return NULL;
			}
		}
	for (i = 0; i < cnt; i++, idx++)
		{
		obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
		x = obj->data.x509;
		CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);
		if (!sk_X509_push(sk, x))
			{
			CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
			X509_free(x);
			sk_X509_pop_free(sk, X509_free);
			return NULL;
			}
		}
	CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
	return sk;
	}
['STACK_OF(X509) *X509_STORE_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm)\n\t{\n\tint i, idx, cnt;\n\tSTACK_OF(X509) *sk;\n\tX509 *x;\n\tX509_OBJECT *obj;\n\tsk = sk_X509_new_null();\n\tCRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);\n\tidx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt);\n\tif (idx < 0)\n\t\t{\n\t\tX509_OBJECT xobj;\n\t\tCRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);\n\t\tif (!X509_STORE_get_by_subject(ctx, X509_LU_X509, nm, &xobj))\n\t\t\t{\n\t\t\tsk_X509_free(sk);\n\t\t\treturn NULL;\n\t\t\t}\n\t\tX509_OBJECT_free_contents(&xobj);\n\t\tCRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);\n\t\tidx = x509_object_idx_cnt(ctx->ctx->objs,X509_LU_X509,nm, &cnt);\n\t\tif (idx < 0)\n\t\t\t{\n\t\t\tCRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);\n\t\t\tsk_X509_free(sk);\n\t\t\treturn NULL;\n\t\t\t}\n\t\t}\n\tfor (i = 0; i < cnt; i++, idx++)\n\t\t{\n\t\tobj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);\n\t\tx = obj->data.x509;\n\t\tCRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);\n\t\tif (!sk_X509_push(sk, x))\n\t\t\t{\n\t\t\tCRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);\n\t\t\tX509_free(x);\n\t\t\tsk_X509_pop_free(sk, X509_free);\n\t\t\treturn NULL;\n\t\t\t}\n\t\t}\n\tCRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);\n\treturn sk;\n\t}', '_STACK *sk_new_null(void)\n\t{\n\treturn sk_new((int (*)(const void *, const void *))0);\n\t}', 'void CRYPTO_lock(int mode, int type, const char *file, int line)\n\t{\n#ifdef LOCK_DEBUG\n\t\t{\n\t\tCRYPTO_THREADID id;\n\t\tchar *rw_text,*operation_text;\n\t\tif (mode & CRYPTO_LOCK)\n\t\t\toperation_text="lock  ";\n\t\telse if (mode & CRYPTO_UNLOCK)\n\t\t\toperation_text="unlock";\n\t\telse\n\t\t\toperation_text="ERROR ";\n\t\tif (mode & CRYPTO_READ)\n\t\t\trw_text="r";\n\t\telse if (mode & CRYPTO_WRITE)\n\t\t\trw_text="w";\n\t\telse\n\t\t\trw_text="ERROR";\n\t\tCRYPTO_THREADID_current(&id);\n\t\tfprintf(stderr,"lock:%08lx:(%s)%s %-18s %s:%d\\n",\n\t\t\tCRYPTO_THREADID_hash(&id), rw_text, operation_text,\n\t\t\tCRYPTO_get_lock_name(type), file, line);\n\t\t}\n#endif\n\tif (type < 0)\n\t\t{\n\t\tif (dynlock_lock_callback != NULL)\n\t\t\t{\n\t\t\tstruct CRYPTO_dynlock_value *pointer\n\t\t\t\t= CRYPTO_get_dynlock_value(type);\n\t\t\tOPENSSL_assert(pointer != NULL);\n\t\t\tdynlock_lock_callback(mode, pointer, file, line);\n\t\t\tCRYPTO_destroy_dynlockid(type);\n\t\t\t}\n\t\t}\n\telse\n\t\tif (locking_callback != NULL)\n\t\t\tlocking_callback(mode,type,file,line);\n\t}', 'void *sk_value(const _STACK *st, int i)\n{\n\tif(!st || (i < 0) || (i >= st->num)) return NULL;\n\treturn st->data[i];\n}']