⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fsinvalid.c

📁 一个免费的SMART CARD OS系统。
💻 C
字号:
/* ============================================================================   Project Name : jayaCard   Module Name  : proto/bios/fs/fsinvalid.c   Version : $Id: fsinvalid.c,v 1.3 2004/01/11 09:56:30 dgil Exp $    Description: Invalidate / Rehabilitate an EF or DF (or Application)    The Original Code is jayaCard code.    The Initial Developer of the Original Code is Gilles Dumortier.	Portions created by the Initial Developer are Copyright (C) 2002-2004 the    Initial Developer. All Rights Reserved.    Contributor(s):    This program is free software; you can redistribute it and/or modify    it under the terms of the GNU General Public License as published by    the Free Software Foundation; either version 2 of the License, or    (at your option) any later version.    This program is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU General Public License for more details.    You should have received a copy of the GNU General Public License    along with this program; see http://www.gnu.org/licenses/gpl.html   History Rev	Description   112503 dgil   wrote it from scratch   ============================================================================*/#include "precomp.h"/* ============================================================================	Import from fstools.c   ========================================================================= */void __fs_save_EF_header(void);void __fs_save_DF_header(void);/* ============================================================================    __fs_invalidate()    Invalidate the current file   ========================================================================= */#ifdef JAYA_FILESYSTEM_INVALIDATEvoid __fs_invalidate(void){	LOCAL(jbyte,res);	if (current_EF_addr == NO_CURRENT_FILE) {        /* operate on current DF */        if (current_DF_addr == NO_CURRENT_FILE) {            BIOS_SETERR(ERR_NO_EF_SELECTED);            return;        }		/* check that we have invalidate access in the current DF */		gGlobalSem = JSEC_FAIL;    	res = FS_CHECK_AC(ACC_CHECK_DF|ACC_INVALIDATE);		gGlobalSem++;		if (res != JSEC_OK) {			BIOS_SETERR(ERR_ACCESS_DENIED);			return;		}		if (gGlobalSem!=JSEC_SEM) {			LOG("ATTACK","__fs_invalidate() #1 - check security failure !");			BIOS_SETERR(ERR_ACCESS_DENIED);			HAL_HALT();			return;		}        current_DF.fdesc |= FDESC_INVALIDATED;        __fs_save_DF_header();    } else {		/* check that we have invalidate access in the current EF */		gGlobalSem = JSEC_FAIL;    	res = FS_CHECK_AC(ACC_CHECK_EF|ACC_INVALIDATE);		gGlobalSem++;		if (res != JSEC_OK) {			BIOS_SETERR(ERR_ACCESS_DENIED);			return;		}		if (gGlobalSem!=JSEC_SEM) {			LOG("ATTACK","__fs_invalidate() #2 - check security failure !");			BIOS_SETERR(ERR_ACCESS_DENIED);			HAL_HALT();			return;		}        current_EF.fdesc |= FDESC_INVALIDATED;        __fs_save_EF_header();    }}#endif/* ============================================================================    __fs_rehabilitate()    Rehabilitate the current file   ========================================================================= */#ifdef JAYA_FILESYSTEM_REHABILITATEvoid __fs_rehabilitate(void){	LOCAL(jbyte,res);    if (current_EF_addr == NO_CURRENT_FILE) {        /* operate on current DF */        if (current_DF_addr == NO_CURRENT_FILE) {            BIOS_SETERR(ERR_NO_EF_SELECTED);            return;        }		/* check that we have rehabilitate access in the current DF */		gGlobalSem = JSEC_FAIL;    	res = FS_CHECK_AC(ACC_CHECK_DF|ACC_REHABILITATE);		gGlobalSem++;		if (res != JSEC_OK) {			BIOS_SETERR(ERR_ACCESS_DENIED);			return;		}		if (gGlobalSem!=JSEC_SEM) {			LOG("ATTACK","__fs_rehabilitate() #1 - check security failure !");			BIOS_SETERR(ERR_ACCESS_DENIED);			HAL_HALT();			return;		}        current_DF.fdesc &= ~(FDESC_INVALIDATED);        __fs_save_DF_header();    } else {		/* check that we have rehabilitate access in the current EF */		gGlobalSem = JSEC_FAIL;    	res = FS_CHECK_AC(ACC_CHECK_EF|ACC_REHABILITATE);		gGlobalSem++;		if (res != JSEC_OK) {			BIOS_SETERR(ERR_ACCESS_DENIED);			return;		}		if (gGlobalSem!=JSEC_SEM) {			LOG("ATTACK","__fs_rehabilitate() #2 - check security failure !");			BIOS_SETERR(ERR_ACCESS_DENIED);			HAL_HALT();			return;		}        current_EF.fdesc &= ~(FDESC_INVALIDATED);        __fs_save_EF_header();    }}#endif/* =========================================================================	That's all folks !   ========================================================================= */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -