summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/m_sha1.c
diff options
context:
space:
mode:
authorjsing <>2014-05-08 16:05:38 +0000
committerjsing <>2014-05-08 16:05:38 +0000
commit7779067b7b5b2153b20dc72d5116caaa3383df0c (patch)
treebccc71e2bc50ab48238241efca5212c0b3a7faa5 /src/lib/libcrypto/evp/m_sha1.c
parentb590070115ee73703baaa8c896eed6bb11a45b0e (diff)
downloadopenbsd-7779067b7b5b2153b20dc72d5116caaa3383df0c.tar.gz
openbsd-7779067b7b5b2153b20dc72d5116caaa3383df0c.tar.bz2
openbsd-7779067b7b5b2153b20dc72d5116caaa3383df0c.zip
More KNF.
Diffstat (limited to 'src/lib/libcrypto/evp/m_sha1.c')
-rw-r--r--src/lib/libcrypto/evp/m_sha1.c49
1 files changed, 34 insertions, 15 deletions
diff --git a/src/lib/libcrypto/evp/m_sha1.c b/src/lib/libcrypto/evp/m_sha1.c
index 8c7e4eb222..e4af84acd2 100644
--- a/src/lib/libcrypto/evp/m_sha1.c
+++ b/src/lib/libcrypto/evp/m_sha1.c
@@ -69,17 +69,20 @@
69#endif 69#endif
70 70
71 71
72static int init(EVP_MD_CTX *ctx) 72static int
73init(EVP_MD_CTX *ctx)
73{ 74{
74 return SHA1_Init(ctx->md_data); 75 return SHA1_Init(ctx->md_data);
75} 76}
76 77
77static int update(EVP_MD_CTX *ctx, const void *data, size_t count) 78static int
79update(EVP_MD_CTX *ctx, const void *data, size_t count)
78{ 80{
79 return SHA1_Update(ctx->md_data, data, count); 81 return SHA1_Update(ctx->md_data, data, count);
80} 82}
81 83
82static int final(EVP_MD_CTX *ctx, unsigned char *md) 84static int
85final(EVP_MD_CTX *ctx, unsigned char *md)
83{ 86{
84 return SHA1_Final(md, ctx->md_data); 87 return SHA1_Final(md, ctx->md_data);
85} 88}
@@ -107,11 +110,14 @@ EVP_sha1(void)
107#endif 110#endif
108 111
109#ifndef OPENSSL_NO_SHA256 112#ifndef OPENSSL_NO_SHA256
110static int init224(EVP_MD_CTX *ctx) 113static int
114init224(EVP_MD_CTX *ctx)
111{ 115{
112 return SHA224_Init(ctx->md_data); 116 return SHA224_Init(ctx->md_data);
113} 117}
114static int init256(EVP_MD_CTX *ctx) 118
119static int
120init256(EVP_MD_CTX *ctx)
115{ 121{
116 return SHA256_Init(ctx->md_data); 122 return SHA256_Init(ctx->md_data);
117} 123}
@@ -120,11 +126,14 @@ static int init256(EVP_MD_CTX *ctx)
120 * SHA256 functions even in SHA224 context. This is what happens 126 * SHA256 functions even in SHA224 context. This is what happens
121 * there anyway, so we can spare few CPU cycles:-) 127 * there anyway, so we can spare few CPU cycles:-)
122 */ 128 */
123static int update256(EVP_MD_CTX *ctx, const void *data, size_t count) 129static int
130update256(EVP_MD_CTX *ctx, const void *data, size_t count)
124{ 131{
125 return SHA256_Update(ctx->md_data, data, count); 132 return SHA256_Update(ctx->md_data, data, count);
126} 133}
127static int final256(EVP_MD_CTX *ctx, unsigned char *md) 134
135static int
136final256(EVP_MD_CTX *ctx, unsigned char *md)
128{ 137{
129 return SHA256_Final(md, ctx->md_data); 138 return SHA256_Final(md, ctx->md_data);
130} 139}
@@ -144,7 +153,8 @@ static const EVP_MD sha224_md = {
144 sizeof(EVP_MD *) + sizeof(SHA256_CTX), 153 sizeof(EVP_MD *) + sizeof(SHA256_CTX),
145}; 154};
146 155
147const EVP_MD *EVP_sha224(void) 156const EVP_MD *
157EVP_sha224(void)
148{ 158{
149 return (&sha224_md); 159 return (&sha224_md);
150} 160}
@@ -164,27 +174,34 @@ static const EVP_MD sha256_md = {
164 sizeof(EVP_MD *) + sizeof(SHA256_CTX), 174 sizeof(EVP_MD *) + sizeof(SHA256_CTX),
165}; 175};
166 176
167const EVP_MD *EVP_sha256(void) 177const EVP_MD *
178EVP_sha256(void)
168{ 179{
169 return (&sha256_md); 180 return (&sha256_md);
170} 181}
171#endif /* ifndef OPENSSL_NO_SHA256 */ 182#endif /* ifndef OPENSSL_NO_SHA256 */
172 183
173#ifndef OPENSSL_NO_SHA512 184#ifndef OPENSSL_NO_SHA512
174static int init384(EVP_MD_CTX *ctx) 185static int
186init384(EVP_MD_CTX *ctx)
175{ 187{
176 return SHA384_Init(ctx->md_data); 188 return SHA384_Init(ctx->md_data);
177} 189}
178static int init512(EVP_MD_CTX *ctx) 190
191static int
192init512(EVP_MD_CTX *ctx)
179{ 193{
180 return SHA512_Init(ctx->md_data); 194 return SHA512_Init(ctx->md_data);
181} 195}
182/* See comment in SHA224/256 section */ 196/* See comment in SHA224/256 section */
183static int update512(EVP_MD_CTX *ctx, const void *data, size_t count) 197static int
198update512(EVP_MD_CTX *ctx, const void *data, size_t count)
184{ 199{
185 return SHA512_Update(ctx->md_data, data, count); 200 return SHA512_Update(ctx->md_data, data, count);
186} 201}
187static int final512(EVP_MD_CTX *ctx, unsigned char *md) 202
203static int
204final512(EVP_MD_CTX *ctx, unsigned char *md)
188{ 205{
189 return SHA512_Final(md, ctx->md_data); 206 return SHA512_Final(md, ctx->md_data);
190} 207}
@@ -204,7 +221,8 @@ static const EVP_MD sha384_md = {
204 sizeof(EVP_MD *) + sizeof(SHA512_CTX), 221 sizeof(EVP_MD *) + sizeof(SHA512_CTX),
205}; 222};
206 223
207const EVP_MD *EVP_sha384(void) 224const EVP_MD *
225EVP_sha384(void)
208{ 226{
209 return (&sha384_md); 227 return (&sha384_md);
210} 228}
@@ -224,7 +242,8 @@ static const EVP_MD sha512_md = {
224 sizeof(EVP_MD *) + sizeof(SHA512_CTX), 242 sizeof(EVP_MD *) + sizeof(SHA512_CTX),
225}; 243};
226 244
227const EVP_MD *EVP_sha512(void) 245const EVP_MD *
246EVP_sha512(void)
228{ 247{
229 return (&sha512_md); 248 return (&sha512_md);
230} 249}