diff options
| author | jsing <> | 2023-04-09 15:40:09 +0000 |
|---|---|---|
| committer | jsing <> | 2023-04-09 15:40:09 +0000 |
| commit | ea1bee2aa256ddf3ce62ba1cf3d1d75e97fe2fb1 (patch) | |
| tree | 18cfbb513ea1dfc4575663a51e37316c3cab0e9e | |
| parent | 80ede1e4086bd12da20391622270559e39911876 (diff) | |
| download | openbsd-ea1bee2aa256ddf3ce62ba1cf3d1d75e97fe2fb1.tar.gz openbsd-ea1bee2aa256ddf3ce62ba1cf3d1d75e97fe2fb1.tar.bz2 openbsd-ea1bee2aa256ddf3ce62ba1cf3d1d75e97fe2fb1.zip | |
Rename SHA functions to have sha{1,224,256,384,512}_ prefix.
Also remove some unnecessary parentheses.
No functional change.
ok tb@
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/evp/m_sha1.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/src/lib/libcrypto/evp/m_sha1.c b/src/lib/libcrypto/evp/m_sha1.c index 5b38666892..16aab86292 100644 --- a/src/lib/libcrypto/evp/m_sha1.c +++ b/src/lib/libcrypto/evp/m_sha1.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: m_sha1.c,v 1.20 2022/11/26 16:08:52 tb Exp $ */ | 1 | /* $OpenBSD: m_sha1.c,v 1.21 2023/04/09 15:40:09 jsing Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -73,19 +73,19 @@ | |||
| 73 | #include "evp_local.h" | 73 | #include "evp_local.h" |
| 74 | 74 | ||
| 75 | static int | 75 | static int |
| 76 | init(EVP_MD_CTX *ctx) | 76 | sha1_init(EVP_MD_CTX *ctx) |
| 77 | { | 77 | { |
| 78 | return SHA1_Init(ctx->md_data); | 78 | return SHA1_Init(ctx->md_data); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | static int | 81 | static int |
| 82 | update(EVP_MD_CTX *ctx, const void *data, size_t count) | 82 | sha1_update(EVP_MD_CTX *ctx, const void *data, size_t count) |
| 83 | { | 83 | { |
| 84 | return SHA1_Update(ctx->md_data, data, count); | 84 | return SHA1_Update(ctx->md_data, data, count); |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | static int | 87 | static int |
| 88 | final(EVP_MD_CTX *ctx, unsigned char *md) | 88 | sha1_final(EVP_MD_CTX *ctx, unsigned char *md) |
| 89 | { | 89 | { |
| 90 | return SHA1_Final(md, ctx->md_data); | 90 | return SHA1_Final(md, ctx->md_data); |
| 91 | } | 91 | } |
| @@ -95,9 +95,9 @@ static const EVP_MD sha1_md = { | |||
| 95 | .pkey_type = NID_sha1WithRSAEncryption, | 95 | .pkey_type = NID_sha1WithRSAEncryption, |
| 96 | .md_size = SHA_DIGEST_LENGTH, | 96 | .md_size = SHA_DIGEST_LENGTH, |
| 97 | .flags = EVP_MD_FLAG_DIGALGID_ABSENT, | 97 | .flags = EVP_MD_FLAG_DIGALGID_ABSENT, |
| 98 | .init = init, | 98 | .init = sha1_init, |
| 99 | .update = update, | 99 | .update = sha1_update, |
| 100 | .final = final, | 100 | .final = sha1_final, |
| 101 | .copy = NULL, | 101 | .copy = NULL, |
| 102 | .cleanup = NULL, | 102 | .cleanup = NULL, |
| 103 | .block_size = SHA_CBLOCK, | 103 | .block_size = SHA_CBLOCK, |
| @@ -107,19 +107,19 @@ static const EVP_MD sha1_md = { | |||
| 107 | const EVP_MD * | 107 | const EVP_MD * |
| 108 | EVP_sha1(void) | 108 | EVP_sha1(void) |
| 109 | { | 109 | { |
| 110 | return (&sha1_md); | 110 | return &sha1_md; |
| 111 | } | 111 | } |
| 112 | #endif | 112 | #endif |
| 113 | 113 | ||
| 114 | #ifndef OPENSSL_NO_SHA256 | 114 | #ifndef OPENSSL_NO_SHA256 |
| 115 | static int | 115 | static int |
| 116 | init224(EVP_MD_CTX *ctx) | 116 | sha224_init(EVP_MD_CTX *ctx) |
| 117 | { | 117 | { |
| 118 | return SHA224_Init(ctx->md_data); | 118 | return SHA224_Init(ctx->md_data); |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | static int | 121 | static int |
| 122 | init256(EVP_MD_CTX *ctx) | 122 | sha256_init(EVP_MD_CTX *ctx) |
| 123 | { | 123 | { |
| 124 | return SHA256_Init(ctx->md_data); | 124 | return SHA256_Init(ctx->md_data); |
| 125 | } | 125 | } |
| @@ -129,13 +129,13 @@ init256(EVP_MD_CTX *ctx) | |||
| 129 | * there anyway, so we can spare few CPU cycles:-) | 129 | * there anyway, so we can spare few CPU cycles:-) |
| 130 | */ | 130 | */ |
| 131 | static int | 131 | static int |
| 132 | update256(EVP_MD_CTX *ctx, const void *data, size_t count) | 132 | sha256_update(EVP_MD_CTX *ctx, const void *data, size_t count) |
| 133 | { | 133 | { |
| 134 | return SHA256_Update(ctx->md_data, data, count); | 134 | return SHA256_Update(ctx->md_data, data, count); |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | static int | 137 | static int |
| 138 | final256(EVP_MD_CTX *ctx, unsigned char *md) | 138 | sha256_final(EVP_MD_CTX *ctx, unsigned char *md) |
| 139 | { | 139 | { |
| 140 | return SHA256_Final(md, ctx->md_data); | 140 | return SHA256_Final(md, ctx->md_data); |
| 141 | } | 141 | } |
| @@ -145,9 +145,9 @@ static const EVP_MD sha224_md = { | |||
| 145 | .pkey_type = NID_sha224WithRSAEncryption, | 145 | .pkey_type = NID_sha224WithRSAEncryption, |
| 146 | .md_size = SHA224_DIGEST_LENGTH, | 146 | .md_size = SHA224_DIGEST_LENGTH, |
| 147 | .flags = EVP_MD_FLAG_DIGALGID_ABSENT, | 147 | .flags = EVP_MD_FLAG_DIGALGID_ABSENT, |
| 148 | .init = init224, | 148 | .init = sha224_init, |
| 149 | .update = update256, | 149 | .update = sha256_update, |
| 150 | .final = final256, | 150 | .final = sha256_final, |
| 151 | .copy = NULL, | 151 | .copy = NULL, |
| 152 | .cleanup = NULL, | 152 | .cleanup = NULL, |
| 153 | .block_size = SHA256_CBLOCK, | 153 | .block_size = SHA256_CBLOCK, |
| @@ -165,9 +165,9 @@ static const EVP_MD sha256_md = { | |||
| 165 | .pkey_type = NID_sha256WithRSAEncryption, | 165 | .pkey_type = NID_sha256WithRSAEncryption, |
| 166 | .md_size = SHA256_DIGEST_LENGTH, | 166 | .md_size = SHA256_DIGEST_LENGTH, |
| 167 | .flags = EVP_MD_FLAG_DIGALGID_ABSENT, | 167 | .flags = EVP_MD_FLAG_DIGALGID_ABSENT, |
| 168 | .init = init256, | 168 | .init = sha256_init, |
| 169 | .update = update256, | 169 | .update = sha256_update, |
| 170 | .final = final256, | 170 | .final = sha256_final, |
| 171 | .copy = NULL, | 171 | .copy = NULL, |
| 172 | .cleanup = NULL, | 172 | .cleanup = NULL, |
| 173 | .block_size = SHA256_CBLOCK, | 173 | .block_size = SHA256_CBLOCK, |
| @@ -177,31 +177,31 @@ static const EVP_MD sha256_md = { | |||
| 177 | const EVP_MD * | 177 | const EVP_MD * |
| 178 | EVP_sha256(void) | 178 | EVP_sha256(void) |
| 179 | { | 179 | { |
| 180 | return (&sha256_md); | 180 | return &sha256_md; |
| 181 | } | 181 | } |
| 182 | #endif /* ifndef OPENSSL_NO_SHA256 */ | 182 | #endif /* ifndef OPENSSL_NO_SHA256 */ |
| 183 | 183 | ||
| 184 | #ifndef OPENSSL_NO_SHA512 | 184 | #ifndef OPENSSL_NO_SHA512 |
| 185 | static int | 185 | static int |
| 186 | init384(EVP_MD_CTX *ctx) | 186 | sha384_init(EVP_MD_CTX *ctx) |
| 187 | { | 187 | { |
| 188 | return SHA384_Init(ctx->md_data); | 188 | return SHA384_Init(ctx->md_data); |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | static int | 191 | static int |
| 192 | init512(EVP_MD_CTX *ctx) | 192 | sha512_init(EVP_MD_CTX *ctx) |
| 193 | { | 193 | { |
| 194 | return SHA512_Init(ctx->md_data); | 194 | return SHA512_Init(ctx->md_data); |
| 195 | } | 195 | } |
| 196 | /* See comment in SHA224/256 section */ | 196 | /* See comment in SHA224/256 section */ |
| 197 | static int | 197 | static int |
| 198 | update512(EVP_MD_CTX *ctx, const void *data, size_t count) | 198 | sha512_update(EVP_MD_CTX *ctx, const void *data, size_t count) |
| 199 | { | 199 | { |
| 200 | return SHA512_Update(ctx->md_data, data, count); | 200 | return SHA512_Update(ctx->md_data, data, count); |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | static int | 203 | static int |
| 204 | final512(EVP_MD_CTX *ctx, unsigned char *md) | 204 | sha512_final(EVP_MD_CTX *ctx, unsigned char *md) |
| 205 | { | 205 | { |
| 206 | return SHA512_Final(md, ctx->md_data); | 206 | return SHA512_Final(md, ctx->md_data); |
| 207 | } | 207 | } |
| @@ -211,9 +211,9 @@ static const EVP_MD sha384_md = { | |||
| 211 | .pkey_type = NID_sha384WithRSAEncryption, | 211 | .pkey_type = NID_sha384WithRSAEncryption, |
| 212 | .md_size = SHA384_DIGEST_LENGTH, | 212 | .md_size = SHA384_DIGEST_LENGTH, |
| 213 | .flags = EVP_MD_FLAG_DIGALGID_ABSENT, | 213 | .flags = EVP_MD_FLAG_DIGALGID_ABSENT, |
| 214 | .init = init384, | 214 | .init = sha384_init, |
| 215 | .update = update512, | 215 | .update = sha512_update, |
| 216 | .final = final512, | 216 | .final = sha512_final, |
| 217 | .copy = NULL, | 217 | .copy = NULL, |
| 218 | .cleanup = NULL, | 218 | .cleanup = NULL, |
| 219 | .block_size = SHA512_CBLOCK, | 219 | .block_size = SHA512_CBLOCK, |
| @@ -223,7 +223,7 @@ static const EVP_MD sha384_md = { | |||
| 223 | const EVP_MD * | 223 | const EVP_MD * |
| 224 | EVP_sha384(void) | 224 | EVP_sha384(void) |
| 225 | { | 225 | { |
| 226 | return (&sha384_md); | 226 | return &sha384_md; |
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | static const EVP_MD sha512_md = { | 229 | static const EVP_MD sha512_md = { |
| @@ -231,9 +231,9 @@ static const EVP_MD sha512_md = { | |||
| 231 | .pkey_type = NID_sha512WithRSAEncryption, | 231 | .pkey_type = NID_sha512WithRSAEncryption, |
| 232 | .md_size = SHA512_DIGEST_LENGTH, | 232 | .md_size = SHA512_DIGEST_LENGTH, |
| 233 | .flags = EVP_MD_FLAG_DIGALGID_ABSENT, | 233 | .flags = EVP_MD_FLAG_DIGALGID_ABSENT, |
| 234 | .init = init512, | 234 | .init = sha512_init, |
| 235 | .update = update512, | 235 | .update = sha512_update, |
| 236 | .final = final512, | 236 | .final = sha512_final, |
| 237 | .copy = NULL, | 237 | .copy = NULL, |
| 238 | .cleanup = NULL, | 238 | .cleanup = NULL, |
| 239 | .block_size = SHA512_CBLOCK, | 239 | .block_size = SHA512_CBLOCK, |
| @@ -243,6 +243,6 @@ static const EVP_MD sha512_md = { | |||
| 243 | const EVP_MD * | 243 | const EVP_MD * |
| 244 | EVP_sha512(void) | 244 | EVP_sha512(void) |
| 245 | { | 245 | { |
| 246 | return (&sha512_md); | 246 | return &sha512_md; |
| 247 | } | 247 | } |
| 248 | #endif /* ifndef OPENSSL_NO_SHA512 */ | 248 | #endif /* ifndef OPENSSL_NO_SHA512 */ |
