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

📄 digest-sha384.c

📁 海思KEY驱动
💻 C
📖 第 1 页 / 共 2 页
字号:
	t2 = e0(a) + Maj(a,b,c);    d+=t1;    h=t1+t2;	t1 = g + e1(d) + Ch(d,e,f) + 0x2e1b21385c26c926 + W[33];	t2 = e0(h) + Maj(h,a,b);    c+=t1;    g=t1+t2;	t1 = f + e1(c) + Ch(c,d,e) + 0x4d2c6dfc5ac42aed + W[34];	t2 = e0(g) + Maj(g,h,a);    b+=t1;    f=t1+t2;	t1 = e + e1(b) + Ch(b,c,d) + 0x53380d139d95b3df + W[35];	t2 = e0(f) + Maj(f,g,h);    a+=t1;    e=t1+t2;	t1 = d + e1(a) + Ch(a,b,c) + 0x650a73548baf63de + W[36];	t2 = e0(e) + Maj(e,f,g);    h+=t1;    d=t1+t2;	t1 = c + e1(h) + Ch(h,a,b) + 0x766a0abb3c77b2a8 + W[37];	t2 = e0(d) + Maj(d,e,f);    g+=t1;    c=t1+t2;	t1 = b + e1(g) + Ch(g,h,a) + 0x81c2c92e47edaee6 + W[38];	t2 = e0(c) + Maj(c,d,e);    f+=t1;    b=t1+t2;	t1 = a + e1(f) + Ch(f,g,h) + 0x92722c851482353b + W[39];	t2 = e0(b) + Maj(b,c,d);    e+=t1;    a=t1+t2;	t1 = h + e1(e) + Ch(e,f,g) + 0xa2bfe8a14cf10364 + W[40];	t2 = e0(a) + Maj(a,b,c);    d+=t1;    h=t1+t2;	t1 = g + e1(d) + Ch(d,e,f) + 0xa81a664bbc423001 + W[41];	t2 = e0(h) + Maj(h,a,b);    c+=t1;    g=t1+t2;	t1 = f + e1(c) + Ch(c,d,e) + 0xc24b8b70d0f89791 + W[42];	t2 = e0(g) + Maj(g,h,a);    b+=t1;    f=t1+t2;	t1 = e + e1(b) + Ch(b,c,d) + 0xc76c51a30654be30 + W[43];	t2 = e0(f) + Maj(f,g,h);    a+=t1;    e=t1+t2;	t1 = d + e1(a) + Ch(a,b,c) + 0xd192e819d6ef5218 + W[44];	t2 = e0(e) + Maj(e,f,g);    h+=t1;    d=t1+t2;	t1 = c + e1(h) + Ch(h,a,b) + 0xd69906245565a910 + W[45];	t2 = e0(d) + Maj(d,e,f);    g+=t1;    c=t1+t2;	t1 = b + e1(g) + Ch(g,h,a) + 0xf40e35855771202a + W[46];	t2 = e0(c) + Maj(c,d,e);    f+=t1;    b=t1+t2;	t1 = a + e1(f) + Ch(f,g,h) + 0x106aa07032bbd1b8 + W[47];	t2 = e0(b) + Maj(b,c,d);    e+=t1;    a=t1+t2;	t1 = h + e1(e) + Ch(e,f,g) + 0x19a4c116b8d2d0c8 + W[48];	t2 = e0(a) + Maj(a,b,c);    d+=t1;    h=t1+t2;	t1 = g + e1(d) + Ch(d,e,f) + 0x1e376c085141ab53 + W[49];	t2 = e0(h) + Maj(h,a,b);    c+=t1;    g=t1+t2;	t1 = f + e1(c) + Ch(c,d,e) + 0x2748774cdf8eeb99 + W[50];	t2 = e0(g) + Maj(g,h,a);    b+=t1;    f=t1+t2;	t1 = e + e1(b) + Ch(b,c,d) + 0x34b0bcb5e19b48a8 + W[51];	t2 = e0(f) + Maj(f,g,h);    a+=t1;    e=t1+t2;	t1 = d + e1(a) + Ch(a,b,c) + 0x391c0cb3c5c95a63 + W[52];	t2 = e0(e) + Maj(e,f,g);    h+=t1;    d=t1+t2;	t1 = c + e1(h) + Ch(h,a,b) + 0x4ed8aa4ae3418acb + W[53];	t2 = e0(d) + Maj(d,e,f);    g+=t1;    c=t1+t2;	t1 = b + e1(g) + Ch(g,h,a) + 0x5b9cca4f7763e373 + W[54];	t2 = e0(c) + Maj(c,d,e);    f+=t1;    b=t1+t2;	t1 = a + e1(f) + Ch(f,g,h) + 0x682e6ff3d6b2b8a3 + W[55];	t2 = e0(b) + Maj(b,c,d);    e+=t1;    a=t1+t2;	t1 = h + e1(e) + Ch(e,f,g) + 0x748f82ee5defb2fc + W[56];	t2 = e0(a) + Maj(a,b,c);    d+=t1;    h=t1+t2;	t1 = g + e1(d) + Ch(d,e,f) + 0x78a5636f43172f60 + W[57];	t2 = e0(h) + Maj(h,a,b);    c+=t1;    g=t1+t2;	t1 = f + e1(c) + Ch(c,d,e) + 0x84c87814a1f0ab72 + W[58];	t2 = e0(g) + Maj(g,h,a);    b+=t1;    f=t1+t2;	t1 = e + e1(b) + Ch(b,c,d) + 0x8cc702081a6439ec + W[59];	t2 = e0(f) + Maj(f,g,h);    a+=t1;    e=t1+t2;	t1 = d + e1(a) + Ch(a,b,c) + 0x90befffa23631e28 + W[60];	t2 = e0(e) + Maj(e,f,g);    h+=t1;    d=t1+t2;	t1 = c + e1(h) + Ch(h,a,b) + 0xa4506cebde82bde9 + W[61];	t2 = e0(d) + Maj(d,e,f);    g+=t1;    c=t1+t2;	t1 = b + e1(g) + Ch(g,h,a) + 0xbef9a3f7b2c67915 + W[62];	t2 = e0(c) + Maj(c,d,e);    f+=t1;    b=t1+t2;	t1 = a + e1(f) + Ch(f,g,h) + 0xc67178f2e372532b + W[63];	t2 = e0(b) + Maj(b,c,d);    e+=t1;    a=t1+t2;	t1 = h + e1(e) + Ch(e,f,g) + 0xca273eceea26619c + W[64];	t2 = e0(a) + Maj(a,b,c);    d+=t1;    h=t1+t2;	t1 = g + e1(d) + Ch(d,e,f) + 0xd186b8c721c0c207 + W[65];	t2 = e0(h) + Maj(h,a,b);    c+=t1;    g=t1+t2;	t1 = f + e1(c) + Ch(c,d,e) + 0xeada7dd6cde0eb1e + W[66];	t2 = e0(g) + Maj(g,h,a);    b+=t1;    f=t1+t2;	t1 = e + e1(b) + Ch(b,c,d) + 0xf57d4f7fee6ed178 + W[67];	t2 = e0(f) + Maj(f,g,h);    a+=t1;    e=t1+t2;	t1 = d + e1(a) + Ch(a,b,c) + 0x06f067aa72176fba + W[68];	t2 = e0(e) + Maj(e,f,g);    h+=t1;    d=t1+t2;	t1 = c + e1(h) + Ch(h,a,b) + 0x0a637dc5a2c898a6 + W[69];	t2 = e0(d) + Maj(d,e,f);    g+=t1;    c=t1+t2;	t1 = b + e1(g) + Ch(g,h,a) + 0x113f9804bef90dae + W[70];	t2 = e0(c) + Maj(c,d,e);    f+=t1;    b=t1+t2;	t1 = a + e1(f) + Ch(f,g,h) + 0x1b710b35131c471b + W[71];	t2 = e0(b) + Maj(b,c,d);    e+=t1;    a=t1+t2;	t1 = h + e1(e) + Ch(e,f,g) + 0x28db77f523047d84 + W[72];	t2 = e0(a) + Maj(a,b,c);    d+=t1;    h=t1+t2;	t1 = g + e1(d) + Ch(d,e,f) + 0x32caab7b40c72493 + W[73];	t2 = e0(h) + Maj(h,a,b);    c+=t1;    g=t1+t2;	t1 = f + e1(c) + Ch(c,d,e) + 0x3c9ebe0a15c9bebc + W[74];	t2 = e0(g) + Maj(g,h,a);    b+=t1;    f=t1+t2;	t1 = e + e1(b) + Ch(b,c,d) + 0x431d67c49c100d4c + W[75];	t2 = e0(f) + Maj(f,g,h);    a+=t1;    e=t1+t2;	t1 = d + e1(a) + Ch(a,b,c) + 0x4cc5d4becb3e42b6 + W[76];	t2 = e0(e) + Maj(e,f,g);    h+=t1;    d=t1+t2;	t1 = c + e1(h) + Ch(h,a,b) + 0x597f299cfc657e2a + W[77];	t2 = e0(d) + Maj(d,e,f);    g+=t1;    c=t1+t2;	t1 = b + e1(g) + Ch(g,h,a) + 0x5fcb6fab3ad6faec + W[78];	t2 = e0(c) + Maj(c,d,e);    f+=t1;    b=t1+t2;	t1 = a + e1(f) + Ch(f,g,h) + 0x6c44198c4a475817 + W[79];	t2 = e0(b) + Maj(b,c,d);    e+=t1;    a=t1+t2;#endif /* CONFIG_DIGEST_FAST */  	state[0] += a; state[1] += b; state[2] += c; state[3] += d;  	state[4] += e; state[5] += f; state[6] += g; state[7] += h;  	/* erase our data */	a = b = c = d = e = f = g = h = t1 = t2 = 0;	memset(W, 0, sizeof (W));}static voidSHA384Update(sha384_ctx_t *ctx, const u8 *input, u32 inputLen){	u32 i, index, partLen;	/* Compute number of bytes mod 128 */	index = (u32)((ctx->count[0] >> 3) & 0x7F);		/* Update number of bits */	if ((ctx->count[0] += (inputLen << 3)) < (inputLen << 3)) {		if ((ctx->count[1] += 1) < 1)			if ((ctx->count[2] += 1) < 1)				ctx->count[3]++;		ctx->count[1] += (inputLen >> 29);	}		partLen = 128 - index;		/* Transform as many times as possible. */	if (inputLen >= partLen) {		memcpy(&ctx->buf[index], input, partLen);		SHA384Transform(ctx->state, ctx->buf);		for (i = partLen; i + 127 < inputLen; i += 128)			SHA384Transform(ctx->state, &input[i]);		index = 0;	} else {		i = 0;	}	/* Buffer remaining input */	memcpy(&ctx->buf[index], &input[i], inputLen-i);}static voidSHA384Final(sha384_ctx_t *ctx, u8 *digest){	const static u8 padding[128] = { 0x80, };	u8 bits[16];	u32 t, index, padLen;	int i,j;	/* Save number of bits */	t = ctx->count[0];	bits[15] = t; t>>=8;	bits[14] = t; t>>=8;	bits[13] = t; t>>=8;	bits[12] = t; 	t = ctx->count[1];	bits[11] = t; t>>=8;	bits[10] = t; t>>=8;	bits[9 ] = t; t>>=8;	bits[8 ] = t; 	t = ctx->count[2];	bits[7 ] = t; t>>=8;	bits[6 ] = t; t>>=8;	bits[5 ] = t; t>>=8;	bits[4 ] = t; 	t = ctx->count[3];	bits[3 ] = t; t>>=8;	bits[2 ] = t; t>>=8;	bits[1 ] = t; t>>=8;	bits[0 ] = t; 		/* Pad out to 112 mod 128. */	index = (ctx->count[0] >> 3) & 0x7f;	padLen = (index < 112) ? (112 - index) : ((128+112) - index);	SHA384Update(ctx, padding, padLen);	/* Append length (before padding) */	SHA384Update(ctx, bits, sizeof(bits));	/* Store state in digest */	for (i = j = 0; i < 6; i++, j += 8) {		u64 t2 = ctx->state[i];		digest[j+7] = t2 & 0xff; t2>>=8;		digest[j+6] = t2 & 0xff; t2>>=8;		digest[j+5] = t2 & 0xff; t2>>=8;		digest[j+4] = t2 & 0xff; t2>>=8;		digest[j+3] = t2 & 0xff; t2>>=8;		digest[j+2] = t2 & 0xff; t2>>=8;		digest[j+1] = t2 & 0xff; t2>>=8;		digest[j  ] = t2 & 0xff;	}		/* Zeroize sensitive information. */	memset(ctx, 0, sizeof(sha384_ctx_t));}/*  * registered entry points */static intsha384_open(struct digest_context *cx, int atomic){	sha384_ctx_t *const ctx = (sha384_ctx_t *) cx->digest_info;	SHA384Init(ctx);	return 0;}static intsha384_update(struct digest_context *cx, const u8 *in, int size, int atomic){	sha384_ctx_t *const ctx = (sha384_ctx_t *) cx->digest_info;	SHA384Update(ctx, in, size);	return 0;}static intsha384_digest(struct digest_context *cx, u8 *out, int atomic){	sha384_ctx_t *const ctx = (sha384_ctx_t *) cx->digest_info;	sha384_ctx_t *const ctx_tmp = kmalloc (sizeof *ctx_tmp, GFP_KERNEL);	if (!ctx_tmp)		return -ENOMEM;	*ctx_tmp = *ctx;	SHA384Final(ctx_tmp, out);	kfree (ctx_tmp);	return 0;}static intsha384_close(struct digest_context *cx, u8 *out, int atomic){	sha384_ctx_t *const ctx = (sha384_ctx_t *) cx->digest_info;	static u8 tmp[48]; /* /dev/null - buf */	SHA384Final(ctx, out ? out : tmp);	return 0;}#define DIGEST_ID		sha384#define DIGEST_BLOCKSIZE	48#include "gen-hash.h"EXPORT_NO_SYMBOLS;

⌨️ 快捷键说明

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