Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\crypto\poly1305.c Create Date:2022-07-28 06:47:33
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:poly1305_core_blocks

Proto:void poly1305_core_blocks(struct poly1305_state *state, const struct poly1305_key *key, const void *src, unsigned int nblocks, u32 hibit)

Type:void

Parameter:

TypeParameterName
struct poly1305_state *state
const struct poly1305_key *key
const void *src
unsigned intnblocks
u32hibit
50  If Not nblocks Then Return
53  r0 = key, base 2^26 [0]
54  r1 = key, base 2^26 [1]
55  r2 = key, base 2^26 [2]
56  r3 = key, base 2^26 [3]
57  r4 = key, base 2^26 [4]
59  s1 = r1 * 5
60  s2 = r2 * 5
61  s3 = r3 * 5
62  s4 = r4 * 5
64  h0 = accumulator, base 2^26 [0]
65  h1 = accumulator, base 2^26 [1]
66  h2 = accumulator, base 2^26 [2]
67  h3 = accumulator, base 2^26 [3]
68  h4 = accumulator, base 2^26 [4]
70  Do
72  h0 += get_unaligned_le32(src + 0) >> 0 & 0x3ffffff
73  h1 += get_unaligned_le32(src + 3) >> 2 & 0x3ffffff
74  h2 += get_unaligned_le32(src + 6) >> 4 & 0x3ffffff
75  h3 += get_unaligned_le32(src + 9) >> 6 & 0x3ffffff
76  h4 += get_unaligned_le32(src + 12) >> 8 | hibit << 24
79  d0 = mlt(h0, r0) + mlt(h1, s4) + mlt(h2, s3) + mlt(h3, s2) + mlt(h4, s1)
81  d1 = mlt(h0, r1) + mlt(h1, r0) + mlt(h2, s4) + mlt(h3, s3) + mlt(h4, s2)
83  d2 = mlt(h0, r2) + mlt(h1, r1) + mlt(h2, r0) + mlt(h3, s4) + mlt(h4, s3)
85  d3 = mlt(h0, r3) + mlt(h1, r2) + mlt(h2, r1) + mlt(h3, r0) + mlt(h4, s4)
87  d4 = mlt(h0, r4) + mlt(h1, r3) + mlt(h2, r2) + mlt(h3, r1) + mlt(h4, r0)
91  d1 += sr(d0, 26)
91  h0 = and(d0, 0x3ffffff)
92  d2 += sr(d1, 26)
92  h1 = and(d1, 0x3ffffff)
93  d3 += sr(d2, 26)
93  h2 = and(d2, 0x3ffffff)
94  d4 += sr(d3, 26)
94  h3 = and(d3, 0x3ffffff)
95  h0 += sr(d4, 26) * 5
95  h4 = and(d4, 0x3ffffff)
96  h1 += h0 >> 26
96  h0 = h0 & 0x3ffffff
98  src += POLY1305_BLOCK_SIZE
99  When --nblocks cycle
101  accumulator, base 2^26 [0] = h0
102  accumulator, base 2^26 [1] = h1
103  accumulator, base 2^26 [2] = h2
104  accumulator, base 2^26 [3] = h3
105  accumulator, base 2^26 [4] = h4
Caller
NameDescribe
poly1305_update_generic
poly1305_final_generic