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

📄 grub-0.97-fc5-tcg-0.2.0-beta1.patch

📁 可信GRUB的源码
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
+	movl    %ebx, %eax+	ret++/*+ * int tcg_extend (  int pcr_index,                     *IN*+ *                   unsigned char *digest,             *IN*+ *                   unsigned char *pcr_value );        *OUT*+ * Send TPM_Extend.+ * This returns 0 if successful. As defined by TCG PC Specification 1.00+ * (8.1.2 Return Codes, Page 40)+ */++ENTRY(tcg_extend)+	push    %ebp+	movl    %esp, %ebp+	push    %ebx+	push    %ecx+	push    %edx+	push    %esi+	push    %edi++	movl    0x8(%ebp), %eax	 /* pcr_index */+	movb    %al, ABS(tpm_extend_pcr_num)++	movl    0xC(%ebp), %esi	 /* *digest */+	movl    $ABS(tpm_extend_digest), %edi+	movl    $TCG_DIGEST_SIZE, %ecx+	cld+	rep+	movsb++	movl    $ABS(tpm_extend_in), %esi+	call    EXT_C(tcg_passthru_to_tpm)+	test    %eax, %eax+	jnz     tcg_extend_go_back++	/* Return PCR value */+	addl    $(tpm_extend_pcr_value), %esi+	movl    0x24(%esp), %edi	 /* *pcr_value */+	movl    $(TCG_PCR_VALUE_SIZE), %ecx+	cld+	rep+	movsb++tcg_extend_go_back:+	pop     %edi+	pop     %esi+	pop     %edx+	pop     %ecx+	pop     %ebx+	pop     %ebp+	ret+++/*+ * int tcg_pcr_read (  int pcr_index,                   *IN*+ *                     unsigned char *pcr_value );      *OUT*+ * Send TPM_PcrRead.+ * This returns 0 if successful. As defined by TCG PC Specification 1.00+ * (8.1.2 Return Codes, Page 40)+ */++ENTRY(tcg_pcr_read)+	push    %ebp+	movl    %esp, %ebp+	push    %ebx+	push    %ecx+	push    %edx+	push    %esi+	push    %edi++	movl    0x1C(%esp), %eax		/* pcr_index */+	movb    %al, ABS(tpm_pcrread_pcrindex)++	movl    $ABS(tpm_pcrread_in), %esi+	call    EXT_C(tcg_passthru_to_tpm)+	test    %eax, %eax+	jnz     tcg_pcr_read_go_back++	/* Return PCR value */+	addl    $(tpm_pcrread_pcr_value), %esi+	movl    0x20(%esp), %edi	 /* *pcr_value */+	movl    $(TCG_PCR_VALUE_SIZE), %ecx+	cld+	rep+	movsb++tcg_pcr_read_go_back:+	pop     %edi+	pop     %esi+	pop     %edx+	pop     %ecx+	pop     %ebx+	pop     %ebp+	ret+	+	+/*+ * int TCG_LogExtend ( int pcr_index,            *IN+ *                     int eventtype             *IN+ *                     int loddatasize           *IN+ *                     unsigned char *logdata )  *IN+ * Log PCR event and extend.+ * This returns 0 if successful. As defined by TCG PC Specification 1.00+ * (8.1.2 Return Codes, Page 40)+ * BIOS Call "Int 1AH Function" to log TCG_PCR_EVENT+ *      Call with       %ax = 0xBB04h (TCG_LogEvent)+ *                      %es = Segment of the TPM input parameter block+ *                      %di = Offset of the TPM input parameter block+ *                      %ds = Segment of the TPM output parameter block+ *                      %si = Offset of the TPM output parameter block+ *                      %ebx = "TCPA" (0x41504354)+ *                      %ecx = 0+ *                      %edx = 0+ */+ENTRY(TCG_LogExtend)+	push    %ebp+	movl    %esp, %ebp+	push    %ebx+	push    %ecx+	push    %edx+	push    %esi+	push    %edi+	/* ipb - PCR index */+	movl    0x08(%ebp), %eax+	movl    %eax, ABS(tcg_le_ipb_pcr_index)++	/* ipb - type */+	movl    0x0C(%ebp), %eax+	movl    %eax, ABS(tcg_le_ipb_eventtype)+	+	/* ipb - Log Data Size */+	movl    0x10(%ebp), %eax+	movl    %eax, ABS(tcg_le_ipb_logdatalen)++	/* ipb - Log Data Ptr */+	movl    0x14(%ebp), %esi+	movl    %esi, ABS(tcg_le_ipb_logdata)++	/* ipb - clear Hash Data */+	xorl    %esi, %esi+	movl    %esi, ABS(tcg_le_ipb_hashdatalen)+	movl    %esi, ABS(tcg_le_ipb_hashdata)+		++#ifdef TCG_BIOS_BIGREALMODE_FIX +	call    EXT_C(prot_to_big_real)+#else	+	call    EXT_C(prot_to_real)+#endif /* TCG_BIOS_BIGREALMODE_FIX */+	.code16++	/* TCG_LogEvent */+	MSG(logevent_msg)++	movw    $0xBB04, %ax+	movw    $ABS(tcg_le_ipb), %di+	movw    $ABS(tcg_le_opb), %si+	movl    ABS(tcg_signature), %ebx+	xorl    %ecx, %ecx+	movl    %ecx, %edx+	int     $0x1A+	and     %eax, %eax+	jz      tle3_ok+	MSG(ng_msg)+	jmp     tle3_go_back++tle3_ok:+	MSG(ok_msg)++tle3_go_back:+	movl    %eax, %ebx+	DATA32  call    EXT_C(real_to_prot)+	.code32++	movl    %ebx, %eax+	pop     %edi+	pop     %esi+	pop     %edx+	pop     %ecx+	pop     %ebx+	pop     %ebp+	ret+		++/*+ * int TCG_HashAll ( int len,                 *IN+ *	              unsigned char *data,     *IN+ *                    unsigned char *digest ); *OUT+ * Hash the data+ * This returns 0 if successful. As defined by TCG PC Specification 1.1+ * (8.1.9 Return Codes, Page 50)+ * BIOS Call "Int 1AH Function" to Hash the Data+ *      Call with       %ax = 0xBB05h (TCG_HashAll)+ *                      %es = Segment of the TPM input parameter block+ *                      %di = Offset of the TPM input parameter block+ *                      %ds = Segment of the TPM output parameter block+ *                      %si = Offset of the TPM output parameter block+ *                      %ebx = "TCPA" (0x41504354)+ *                      %ecx = 0+ *                      %edx = 0+ *+ * 2004-10-15 S. Munetoh added+ *+ */+ENTRY(TCG_HashAll)+        push    %ebp+	/* movl    %esp, %ebp */+	push    %ebx+	push    %ecx+	push    %edx+	push    %esi+	push    %edi++	/* len */+	movl    0x1c(%esp), %eax+	movl    %eax, ABS(tcg_hashall_ipb_data_len)++	/* *data */+	movl    0x20(%esp), %esi	 +	movl    %esi, ABS(tcg_hashall_ipb_data_ptr)+	+#ifdef TCG_BIOS_BIGREALMODE_FIX +	call    EXT_C(prot_to_big_real)+#else	+	call    EXT_C(prot_to_real)+#endif /* TCG_BIOS_BIGREALMODE_FIX */+	.code16++	/* TCG_HashAll */+	MSG(hashall_msg)++	movw    $0xBB05, %ax+	movw    $ABS(tcg_hashall_ipb), %di+	movw    $ABS(tcg_hashall_opb), %si+	movl    ABS(tcg_signature), %ebx+	xorl    %ecx, %ecx+	movl    %ecx, %edx+	int     $0x1A+	and     %eax, %eax+	jz      tcg_hashall_ok+	MSG(ng_msg)+	jmp     tcg_hashall_go_back+tcg_hashall_ok:+	MSG(ok_msg)+tcg_hashall_go_back:+	movl    %eax, %ebx+	DATA32  call    EXT_C(real_to_prot)+	.code32+		+	/* Return Digest value, whether call is ok or not*/ +	/* this will copy the digest */+	movl    $ABS(tcg_hashall_opb), %esi+	movl    0x24(%esp), %edi       +	movl    $TCG_DIGEST_SIZE, %ecx +	cld+	rep+	movsb++	movl    %ebx, %eax+	pop     %edi+	pop     %esi+	pop     %edx+	pop     %ecx+	pop     %ebx+	pop     %ebp+	ret++#if 0	+/* +  Fujitsu + Infineon TPM v1.1++	2006-06-23 SM FOR TEST+ */+ENTRY(TCG_HashAll2)+	push    %ebp+	/* movl    %esp, %ebp */+	push    %ebx+	push    %ecx+	push    %edx+	push    %esi+	push    %edi++	/* len */+	movl    0x1c(%esp), %eax+	movl    %eax, ABS(tcg_hashall_ipb_data_len)++	/* *data */+	movl    0x20(%esp), %esi	 +	movl    %esi, ABS(tcg_hashall_ipb_data_ptr)+	+#ifdef TCG_BIOS_BIGREALMODE_FIX +	call    EXT_C(prot_to_big_real)+#else	+	call    EXT_C(prot_to_real)+#endif /* TCG_BIOS_BIGREALMODE_FIX */+	.code16++	/* TCG_HashAll */+	MSG(hashall_msg)++	movw    $0xBB05, %ax+	movw    $ABS(tcg_hashall_ipb), %di+	movw    $ABS(tcg_hashall_opb), %si+	movl    ABS(tcg_signature), %ebx+	xorl    %ecx, %ecx+	movl    %ecx, %edx+	int     $0x1A+	+	and     %eax, %eax+	jz      tcg_hashall_ok+	MSG(ng_msg)+	jmp     tcg_hashall_go_back+tcg_hashall_ok:+	MSG(ok_msg)+tcg_hashall_go_back:+	movl    %eax, %ebx+	DATA32  call    EXT_C(real_to_prot)+	.code32+		+	/* Return Digest value, whether call is ok or not*/ +	/* this will copy the digest */+	movl    $ABS(tcg_hashall_opb), %esi+	movl    0x24(%esp), %edi       +	movl    $TCG_DIGEST_SIZE, %ecx +	cld+	rep+	movsb++	movl    %ebx, %eax+	pop     %edi+	pop     %esi+	pop     %edx+	pop     %ecx+	pop     %ebx+	pop     %ebp+	ret+#endif++	+	+/*+ * int TCG_CompactHashLogExtendEvent( int pcr_index,          *IN+ *                                 int hashdatasize           *IN+ *                                 unsigned char *hashdeta)   *IN+ *+ *  Event Type  :	EV_COMPACT_HASH (0Ch) - fixed+ *  Event Field :	4 bytes "GRUB"+ *+ * BIOS Call "Int 1AH Function" to log TCG_PCR_EVENT+ *      Call with       %ax = 0xBB07h (TCG_CompactHashLogExtendEvent)+ *                      %es = Segment of data to be hashed+ *                      %di = Offset of data to be hashed+ *                      %esi = event field+ *                      %ebx = "TCPA" (0x41504354)+ *                      %ecx = data length+ *                      %edx = pcr index+ *+ *      Return          %eax = Return code+ *                      %edx = event num+ */+ENTRY(TCG_CompactHashLogExtendEvent)+	push    %ebp+	movl    %esp, %ebp+	push    %ebx+	push    %ecx+	push    %edx+	push    %esi+	push    %edi+	/* PCR index */+	movl    0x08(%ebp), %edx ++	/* Hash Data Size */+		movl    0x0C(%ebp), %ecx	 +	+	/* Hash Data Ptr  */+#if 0	+		/* Sorry, this does not work */+	movw    0x10(%ebp), %ax+	shlw    $12,  %ax+	movw	%ax, %es+	movw    0x12(%ebp), %di+#endif	+		+#ifdef TCG_BIOS_BIGREALMODE_FIX +	call    EXT_C(prot_to_big_real)+#else	+	call    EXT_C(prot_to_real)+#endif /* TCG_BIOS_BIGREALMODE_FIX */+	.code16++	/* TCG_CompactHashLogExtendEvent */+	MSG(compacthashlogevent_msg)++	movw    $0xBB07, %ax+	movw	$ABS(tcg_chlee_buf), %di+	movl    ABS(tcg_signature), %ebx+	movl    ABS(tcg_grub), %esi+	int     $0x1A+	and     %eax, %eax+	jz      tcg_chlee_ok+	MSG(ng_msg)+	jmp     tcg_chlee_go_back++tcg_chlee_ok:+	MSG(ok_msg)++tcg_chlee_go_back:+	movl    %eax, %ebx /* TODO return 3h???  */+	DATA32  call    EXT_C(real_to_prot)+	.code32++	movl    %ebx, %eax+	pop     %edi+	pop     %esi+	pop     %edx+	pop     %ecx+	pop     %ebx+	pop     %ebp+	ret+		+#ifdef TCG_BIOS_BIGREALMODE_FIX+/*+ *  "prot_to_big_real" enters into "Big Real Mode" which differs+ *  from real mode in that "Big Real Mode" has no segment limit of 64KB.+ *  Int 1AH for TCG functions assumes the "Big Real Mode".+ *+ *  NOTE:  Use of this function messes up %eax and %ebp.+ */++ENTRY(prot_to_big_real)+	/* just in case, set GDT */+	lgdt    gdtdesc++	/* save the protected mode stack */+	movl    %esp, %eax+	movl    %eax, protstack++	/* get the return address */+	movl    (%esp), %eax+	movl    %eax, STACKOFF++	/* set up new stack */+	movl    $STACKOFF, %eax+	movl    %eax, %esp+	movl    %eax, %ebp++	/* set up segment limits */+	movw    $PROT_MODE_DSEG, %ax+	movw    %ax, %ds+	movw    %ax, %es+	movw    %ax, %fs+	movw    %ax, %gs+	movw    %ax, %ss++	/* this might be an extra step */+	ljmp    $PSEUDO_RM_CSEG, $tmpcsegb      /* jump to a 16 bit segment */++tmpcsegb:+	.code16++	/* clear the PE bit of CR0 */+	movl    %cr0, %eax+	andl    $CR0_PE_OFF, %eax+	movl    %eax, %cr0++	/* flush prefetch queue, reload %cs */+	DATA32  ljmp    $0, $realcsegb++realcsegb:+	/* we are in real mode now+	 * set up the real mode segment registers : DS, SS, ES+	 */+	/* zero %eax */+	xorl    %eax, %eax++	movw    %ax, %ds+	movw    %ax, %es+	movw    %ax, %fs+	movw    %ax, %gs+	movw    %ax, %ss++	/* Enable A20 gate for the case it's disabled */+	movw    $0x2401, %ax+	int     $0x15++	/* restore interrupts */+	sti+

⌨️ 快捷键说明

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