Fossil: Check-in [20187be723]

Fossil SCM

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Omit some asm code from the SHA1 implementation as it provides no performance improvement with modern compilers, and SHA1 is seldom used now anyhow.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:20187be72370eda24b32cfe1bd3c7216bc1ada7158cc33491a8ebe1bd5f55b2c
User & Date: drh 2019-11-11 15:22:09
Context
2019-11-15
02:50
Removed the media="screen" part of the stylesheet link output because it provides no benefit to on-screen reading and causes the style to be completely lost when printing. See https://fossil-scm.org/forum/forumpost/63a45d759e. check-in: f27d4b5054 user: stephan tags: trunk
02:31
Modified grep command to respect the hash-digits config option. Closed-Leaf check-in: dccab378ce user: stephan tags: grep-hash-digits
2019-11-11
15:22
Omit some asm code from the SHA1 implementation as it provides no performance improvement with modern compilers, and SHA1 is seldom used now anyhow. check-in: 20187be723 user: drh tags: trunk
2019-11-09
04:27
Told .editorconfig to use tabs for Makefiles, otherwise it mangles them with the default indention style (spaces). check-in: b86c8b476b user: stephan tags: trunk
Changes

Changes to src/sha1.c.

99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134

/*
 * blk0() and blk() perform the initial expand.
 * I got the idea of expanding during the round function from SSLeay
 *
 * blk0le() for little-endian and blk0be() for big-endian.
 */
#if __GNUC__ && (defined(__i386__) || defined(__x86_64__))
/*
 * GCC by itself only generates left rotates.  Use right rotates if
 * possible to be kinder to dinky implementations with iterative rotate
 * instructions.
 */
#define SHA_ROT(op, x, k) \
        ({ unsigned int y; asm(op " %1,%0" : "=r" (y) : "I" (k), "0" (x)); y; })
#define rol(x,k) SHA_ROT("roll", x, k)
#define ror(x,k) SHA_ROT("rorl", x, k)

#else
/* Generic C equivalent */
#define SHA_ROT(x,l,r) ((x) << (l) | (x) >> (r))
#define rol(x,k) SHA_ROT(x,k,32-(k))
#define ror(x,k) SHA_ROT(x,32-(k),k)
#endif





#define blk0le(i) (block[i] = (ror(block[i],8)&0xFF00FF00) \
    |(rol(block[i],8)&0x00FF00FF))
#define blk0be(i) block[i]
#define blk(i) (block[i&15] = rol(block[(i+13)&15]^block[(i+8)&15] \
    ^block[(i+2)&15]^block[i&15],1))

/*







<
<
<
<
<
<
<
<
<
<
<
<
<



<
<
<
<
<
<







99
100
101
102
103
104
105













106
107
108






109
110
111
112
113
114
115

/*
 * blk0() and blk() perform the initial expand.
 * I got the idea of expanding during the round function from SSLeay
 *
 * blk0le() for little-endian and blk0be() for big-endian.
 */













#define SHA_ROT(x,l,r) ((x) << (l) | (x) >> (r))
#define rol(x,k) SHA_ROT(x,k,32-(k))
#define ror(x,k) SHA_ROT(x,32-(k),k)






#define blk0le(i) (block[i] = (ror(block[i],8)&0xFF00FF00) \
    |(rol(block[i],8)&0x00FF00FF))
#define blk0be(i) block[i]
#define blk(i) (block[i&15] = rol(block[(i+13)&15]^block[(i+8)&15] \
    ^block[(i+2)&15]^block[i&15],1))

/*