📄 1036.sha1.patch
字号:
diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/mips/config-tango2.in linuxmips-2.4.30/arch/mips/config-tango2.in--- linuxmips-2.4.30.ref/arch/mips/config-tango2.in 2007-07-06 10:04:19.000000000 -0700+++ linuxmips-2.4.30/arch/mips/config-tango2.in 2007-07-06 13:05:00.000000000 -0700@@ -70,5 +70,10 @@ define_bool CONFIG_SD_IPFILTER y +if [ "$CONFIG_TANGO2_XENV" = "y" ]; then+ define_bool CONFIG_CRYPTO y+ define_bool CONFIG_CRYPTO_SHA1 y+fi+ endmenu diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/mips/tango2/full_sha1.c linuxmips-2.4.30/arch/mips/tango2/full_sha1.c--- linuxmips-2.4.30.ref/arch/mips/tango2/full_sha1.c 2007-07-06 10:04:19.000000000 -0700+++ linuxmips-2.4.30/arch/mips/tango2/full_sha1.c 2007-07-06 12:53:33.000000000 -0700@@ -8,7 +8,7 @@ #include "util.h" #endif -#include "sha1sum.h"+#include "sha1.h" #if defined(CONFIG_XENV_SUPPORT) || defined(CONFIG_TANGO2_XENV) @@ -36,13 +36,7 @@ void full_sha1(RMuint32 digest[5],const RMuint8 *src,RMuint32 size,RMuint32 fromISP) {-#if 0- if (fromISP) sink(); // unsupported-#else- if (fromISP) return; // unsupported-#endif-- sha1sum(src, size, digest);+ sha1_full(digest, src, size); } #endif /* CONFIG_XENV_SUPPORT */ diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/mips/tango2/Makefile linuxmips-2.4.30/arch/mips/tango2/Makefile--- linuxmips-2.4.30.ref/arch/mips/tango2/Makefile 2007-07-06 10:04:19.000000000 -0700+++ linuxmips-2.4.30/arch/mips/tango2/Makefile 2007-07-06 12:51:15.000000000 -0700@@ -15,7 +15,7 @@ obj-y := tango2IRQ.o setup.o prom.o gbus_standalone.o irq.o tango2controllers.o delay.o tango2api.o ifdef CONFIG_TANGO2_XENV-obj-y += sha1sum.o xenv.o full_sha1.o+obj-y += sha1.o xenv.o full_sha1.o endif ifdef CONFIG_PCIdiff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/mips/tango2/sha1.c linuxmips-2.4.30/arch/mips/tango2/sha1.c--- linuxmips-2.4.30.ref/arch/mips/tango2/sha1.c 1969-12-31 16:00:00.000000000 -0800+++ linuxmips-2.4.30/arch/mips/tango2/sha1.c 2007-07-06 13:01:51.000000000 -0700@@ -0,0 +1,26 @@++#include <linux/config.h>+#include <linux/init.h>+#include <linux/module.h>+#include <linux/mm.h>+#include <linux/crypto.h>+#include <asm/scatterlist.h>+#include <asm/byteorder.h>++#include "sha1.h"+ +#ifdef CONFIG_TANGO2_XENV+void __init sha1_full(u8 *digest, const u8 *src, u32 len)+{+ struct sha1_ctx ctx;+ int i;++ sha1_init(&ctx);+ sha1_update(&ctx, src, len);+ sha1_final(&ctx, digest);++ for (i = 0; i < SHA1_DIGEST_SIZE / 2; i++)+ digest[i] = digest[SHA1_DIGEST_SIZE - i - 1];+}+#endif+diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/mips/tango2/sha1.h linuxmips-2.4.30/arch/mips/tango2/sha1.h--- linuxmips-2.4.30.ref/arch/mips/tango2/sha1.h 1969-12-31 16:00:00.000000000 -0800+++ linuxmips-2.4.30/arch/mips/tango2/sha1.h 2007-07-06 13:10:15.000000000 -0700@@ -0,0 +1,22 @@++#ifndef __SHA1_H__+#define __SHA1_H__++#ifdef CONFIG_CRYPTO_SHA1 +#define SHA1_DIGEST_SIZE 20++struct sha1_ctx {+ u64 count;+ u32 state[5];+ u8 buffer[64];+};++void sha1_init(void *ctx);+void sha1_update(void *ctx, const u8 *data, unsigned int len);+void sha1_final(void* ctx, u8 *out);++void sha1_full(u8 *digest, const u8 *src, u32 len);+#endif++#endif+diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/mips/tango2/sha1sum.c linuxmips-2.4.30/arch/mips/tango2/sha1sum.c--- linuxmips-2.4.30.ref/arch/mips/tango2/sha1sum.c 2007-07-06 10:04:19.000000000 -0700+++ linuxmips-2.4.30/arch/mips/tango2/sha1sum.c 1969-12-31 16:00:00.000000000 -0800@@ -1,350 +0,0 @@-/* sha1sum.c - print SHA-1 Message-Digest Algorithm - * Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.- * Copyright (C) 2004 g10 Code GmbH- *- * 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, 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; if not, write to the Free Software Foundation,- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.- */--/* SHA-1 coden take from gnupg 1.3.92. -- Note, that this is a simple tool to be used for MS Windows.-*/--#if 0-#include <stdio.h>-#include <stdlib.h>-#include <string.h>-#include <assert.h>-#include <errno.h>-#else-#ifdef __KERNEL__-#include <linux/config.h>-#include <linux/string.h>-#else-#include "zbootcfg.h"-#include "util.h"-#include "uart.h"-#endif-#include "sha1sum.h"-#endif--#if defined(CONFIG_XENV_SUPPORT) || defined(CONFIG_TANGO2_XENV)--#undef BIG_ENDIAN_HOST-#ifndef __KERNEL__-typedef unsigned int u32;-#endif--/****************- * Rotate a 32 bit integer by n bytes- */-#if defined(__GNUC__) && defined(__i386__)-static inline u32-rol( u32 x, int n)-{- __asm__("roll %%cl,%0"- :"=r" (x)- :"0" (x),"c" (n));- return x;-}-#else-#define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )-#endif---typedef struct {- u32 h0,h1,h2,h3,h4;- u32 nblocks;- unsigned char buf[64];- int count;-} SHA1_CONTEXT;----static void-sha1_init( SHA1_CONTEXT *hd )-{- hd->h0 = 0x67452301;- hd->h1 = 0xefcdab89;- hd->h2 = 0x98badcfe;- hd->h3 = 0x10325476;- hd->h4 = 0xc3d2e1f0;- hd->nblocks = 0;- hd->count = 0;-}---/****************- * Transform the message X which consists of 16 32-bit-words- */-static void-transform( SHA1_CONTEXT *hd, const unsigned char *data )-{- u32 a,b,c,d,e,tm;- u32 x[16];-- /* get values from the chaining vars */- a = hd->h0;- b = hd->h1;- c = hd->h2;- d = hd->h3;- e = hd->h4;--#ifdef BIG_ENDIAN_HOST- memcpy( x, data, 64 );-#else- { int i;- unsigned char *p2;- for(i=0, p2=(unsigned char*)x; i < 16; i++, p2 += 4 ) {- p2[3] = *data++;- p2[2] = *data++;- p2[1] = *data++;- p2[0] = *data++;- }- }-#endif---#define K1 0x5A827999L-#define K2 0x6ED9EBA1L-#define K3 0x8F1BBCDCL-#define K4 0xCA62C1D6L-#define F1(x,y,z) ( z ^ ( x & ( y ^ z ) ) )-#define F2(x,y,z) ( x ^ y ^ z )-#define F3(x,y,z) ( ( x & y ) | ( z & ( x | y ) ) )-#define F4(x,y,z) ( x ^ y ^ z )---#define M(i) ( tm = x[i&0x0f] ^ x[(i-14)&0x0f] \- ^ x[(i-8)&0x0f] ^ x[(i-3)&0x0f] \- , (x[i&0x0f] = rol(tm,1)) )--#define R(a,b,c,d,e,f,k,m) do { e += rol( a, 5 ) \- + f( b, c, d ) \- + k \- + m; \- b = rol( b, 30 ); \- } while(0)- R( a, b, c, d, e, F1, K1, x[ 0] );- R( e, a, b, c, d, F1, K1, x[ 1] );- R( d, e, a, b, c, F1, K1, x[ 2] );- R( c, d, e, a, b, F1, K1, x[ 3] );- R( b, c, d, e, a, F1, K1, x[ 4] );- R( a, b, c, d, e, F1, K1, x[ 5] );- R( e, a, b, c, d, F1, K1, x[ 6] );- R( d, e, a, b, c, F1, K1, x[ 7] );- R( c, d, e, a, b, F1, K1, x[ 8] );- R( b, c, d, e, a, F1, K1, x[ 9] );- R( a, b, c, d, e, F1, K1, x[10] );- R( e, a, b, c, d, F1, K1, x[11] );- R( d, e, a, b, c, F1, K1, x[12] );- R( c, d, e, a, b, F1, K1, x[13] );- R( b, c, d, e, a, F1, K1, x[14] );- R( a, b, c, d, e, F1, K1, x[15] );- R( e, a, b, c, d, F1, K1, M(16) );- R( d, e, a, b, c, F1, K1, M(17) );- R( c, d, e, a, b, F1, K1, M(18) );- R( b, c, d, e, a, F1, K1, M(19) );- R( a, b, c, d, e, F2, K2, M(20) );- R( e, a, b, c, d, F2, K2, M(21) );- R( d, e, a, b, c, F2, K2, M(22) );- R( c, d, e, a, b, F2, K2, M(23) );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -