Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

lib/crypto: sha256: Document the SHA-224 and SHA-256 API

Add kerneldoc comments, consistent with the kerneldoc comments of the
SHA-384 and SHA-512 API.

Acked-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20250630160645.3198-15-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>

+76
+76
include/crypto/sha2.h
··· 155 155 struct __sha256_ctx ctx; 156 156 }; 157 157 158 + /** 159 + * sha224_init() - Initialize a SHA-224 context for a new message 160 + * @ctx: the context to initialize 161 + * 162 + * If you don't need incremental computation, consider sha224() instead. 163 + * 164 + * Context: Any context. 165 + */ 158 166 void sha224_init(struct sha224_ctx *ctx); 167 + 168 + /** 169 + * sha224_update() - Update a SHA-224 context with message data 170 + * @ctx: the context to update; must have been initialized 171 + * @data: the message data 172 + * @len: the data length in bytes 173 + * 174 + * This can be called any number of times. 175 + * 176 + * Context: Any context. 177 + */ 159 178 static inline void sha224_update(struct sha224_ctx *ctx, 160 179 const u8 *data, size_t len) 161 180 { 162 181 __sha256_update(&ctx->ctx, data, len); 163 182 } 183 + 184 + /** 185 + * sha224_final() - Finish computing a SHA-224 message digest 186 + * @ctx: the context to finalize; must have been initialized 187 + * @out: (output) the resulting SHA-224 message digest 188 + * 189 + * After finishing, this zeroizes @ctx. So the caller does not need to do it. 190 + * 191 + * Context: Any context. 192 + */ 164 193 void sha224_final(struct sha224_ctx *ctx, u8 out[SHA224_DIGEST_SIZE]); 194 + 195 + /** 196 + * sha224() - Compute SHA-224 message digest in one shot 197 + * @data: the message data 198 + * @len: the data length in bytes 199 + * @out: (output) the resulting SHA-224 message digest 200 + * 201 + * Context: Any context. 202 + */ 165 203 void sha224(const u8 *data, size_t len, u8 out[SHA224_DIGEST_SIZE]); 166 204 167 205 /** ··· 313 275 struct __sha256_ctx ctx; 314 276 }; 315 277 278 + /** 279 + * sha256_init() - Initialize a SHA-256 context for a new message 280 + * @ctx: the context to initialize 281 + * 282 + * If you don't need incremental computation, consider sha256() instead. 283 + * 284 + * Context: Any context. 285 + */ 316 286 void sha256_init(struct sha256_ctx *ctx); 287 + 288 + /** 289 + * sha256_update() - Update a SHA-256 context with message data 290 + * @ctx: the context to update; must have been initialized 291 + * @data: the message data 292 + * @len: the data length in bytes 293 + * 294 + * This can be called any number of times. 295 + * 296 + * Context: Any context. 297 + */ 317 298 static inline void sha256_update(struct sha256_ctx *ctx, 318 299 const u8 *data, size_t len) 319 300 { 320 301 __sha256_update(&ctx->ctx, data, len); 321 302 } 303 + 304 + /** 305 + * sha256_final() - Finish computing a SHA-256 message digest 306 + * @ctx: the context to finalize; must have been initialized 307 + * @out: (output) the resulting SHA-256 message digest 308 + * 309 + * After finishing, this zeroizes @ctx. So the caller does not need to do it. 310 + * 311 + * Context: Any context. 312 + */ 322 313 void sha256_final(struct sha256_ctx *ctx, u8 out[SHA256_DIGEST_SIZE]); 314 + 315 + /** 316 + * sha256() - Compute SHA-256 message digest in one shot 317 + * @data: the message data 318 + * @len: the data length in bytes 319 + * @out: (output) the resulting SHA-256 message digest 320 + * 321 + * Context: Any context. 322 + */ 323 323 void sha256(const u8 *data, size_t len, u8 out[SHA256_DIGEST_SIZE]); 324 324 325 325 /**