diff options
| author | jsing <> | 2023-07-07 14:32:41 +0000 |
|---|---|---|
| committer | jsing <> | 2023-07-07 14:32:41 +0000 |
| commit | 94d3e66bc0e7a75b697c3f80aa4dc9abb31d00dd (patch) | |
| tree | 7306b2af267ad2a954676f59c6772a27001fd72e | |
| parent | f9fcde20a6214da85e802190ccd3a2bf5f891559 (diff) | |
| download | openbsd-94d3e66bc0e7a75b697c3f80aa4dc9abb31d00dd.tar.gz openbsd-94d3e66bc0e7a75b697c3f80aa4dc9abb31d00dd.tar.bz2 openbsd-94d3e66bc0e7a75b697c3f80aa4dc9abb31d00dd.zip | |
Remove unused SHA-256 implementation.
ok beck@
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/sha/sha256.c | 72 |
1 files changed, 1 insertions, 71 deletions
diff --git a/src/lib/libcrypto/sha/sha256.c b/src/lib/libcrypto/sha/sha256.c index 0ed4129f3d..a8c8aa3e26 100644 --- a/src/lib/libcrypto/sha/sha256.c +++ b/src/lib/libcrypto/sha/sha256.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: sha256.c,v 1.23 2023/07/07 10:22:28 jsing Exp $ */ | 1 | /* $OpenBSD: sha256.c,v 1.24 2023/07/07 14:32:41 jsing Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -120,74 +120,6 @@ static const SHA_LONG K256[64] = { | |||
| 120 | #define Ch(x, y, z) (((x) & (y)) ^ ((~(x)) & (z))) | 120 | #define Ch(x, y, z) (((x) & (y)) ^ ((~(x)) & (z))) |
| 121 | #define Maj(x, y, z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) | 121 | #define Maj(x, y, z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) |
| 122 | 122 | ||
| 123 | #ifdef OPENSSL_SMALL_FOOTPRINT | ||
| 124 | |||
| 125 | static void | ||
| 126 | sha256_block_data_order(SHA256_CTX *ctx, const void *in, size_t num) | ||
| 127 | { | ||
| 128 | unsigned MD32_REG_T a, b, c, d, e, f, g, h, s0, s1, T1, T2; | ||
| 129 | SHA_LONG X[16], l; | ||
| 130 | int i; | ||
| 131 | const unsigned char *data = in; | ||
| 132 | |||
| 133 | while (num--) { | ||
| 134 | |||
| 135 | a = ctx->h[0]; | ||
| 136 | b = ctx->h[1]; | ||
| 137 | c = ctx->h[2]; | ||
| 138 | d = ctx->h[3]; | ||
| 139 | e = ctx->h[4]; | ||
| 140 | f = ctx->h[5]; | ||
| 141 | g = ctx->h[6]; | ||
| 142 | h = ctx->h[7]; | ||
| 143 | |||
| 144 | for (i = 0; i < 16; i++) { | ||
| 145 | HOST_c2l(data, l); | ||
| 146 | T1 = X[i] = l; | ||
| 147 | T1 += h + Sigma1(e) + Ch(e, f, g) + K256[i]; | ||
| 148 | T2 = Sigma0(a) + Maj(a, b, c); | ||
| 149 | h = g; | ||
| 150 | g = f; | ||
| 151 | f = e; | ||
| 152 | e = d + T1; | ||
| 153 | d = c; | ||
| 154 | c = b; | ||
| 155 | b = a; | ||
| 156 | a = T1 + T2; | ||
| 157 | } | ||
| 158 | |||
| 159 | for (; i < 64; i++) { | ||
| 160 | s0 = X[(i + 1)&0x0f]; | ||
| 161 | s0 = sigma0(s0); | ||
| 162 | s1 = X[(i + 14)&0x0f]; | ||
| 163 | s1 = sigma1(s1); | ||
| 164 | |||
| 165 | T1 = X[i&0xf] += s0 + s1 + X[(i + 9)&0xf]; | ||
| 166 | T1 += h + Sigma1(e) + Ch(e, f, g) + K256[i]; | ||
| 167 | T2 = Sigma0(a) + Maj(a, b, c); | ||
| 168 | h = g; | ||
| 169 | g = f; | ||
| 170 | f = e; | ||
| 171 | e = d + T1; | ||
| 172 | d = c; | ||
| 173 | c = b; | ||
| 174 | b = a; | ||
| 175 | a = T1 + T2; | ||
| 176 | } | ||
| 177 | |||
| 178 | ctx->h[0] += a; | ||
| 179 | ctx->h[1] += b; | ||
| 180 | ctx->h[2] += c; | ||
| 181 | ctx->h[3] += d; | ||
| 182 | ctx->h[4] += e; | ||
| 183 | ctx->h[5] += f; | ||
| 184 | ctx->h[6] += g; | ||
| 185 | ctx->h[7] += h; | ||
| 186 | } | ||
| 187 | } | ||
| 188 | |||
| 189 | #else | ||
| 190 | |||
| 191 | #define ROUND_00_15(i, a, b, c, d, e, f, g, h) do { \ | 123 | #define ROUND_00_15(i, a, b, c, d, e, f, g, h) do { \ |
| 192 | T1 += h + Sigma1(e) + Ch(e, f, g) + K256[i]; \ | 124 | T1 += h + Sigma1(e) + Ch(e, f, g) + K256[i]; \ |
| 193 | h = Sigma0(a) + Maj(a, b, c); \ | 125 | h = Sigma0(a) + Maj(a, b, c); \ |
| @@ -330,8 +262,6 @@ sha256_block_data_order(SHA256_CTX *ctx, const void *in, size_t num) | |||
| 330 | ctx->h[7] += h; | 262 | ctx->h[7] += h; |
| 331 | } | 263 | } |
| 332 | } | 264 | } |
| 333 | |||
| 334 | #endif | ||
| 335 | #endif /* SHA256_ASM */ | 265 | #endif /* SHA256_ASM */ |
| 336 | 266 | ||
| 337 | int | 267 | int |
