Changeset efd19aa in rtems
- Timestamp:
- 07/09/18 07:24:05 (5 years ago)
- Branches:
- master
- Children:
- f5ee9a0
- Parents:
- 48f7979
- git-author:
- Conrad Meyer <cem@…> (07/09/18 07:24:05)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (09/08/22 14:14:56)
- Location:
- cpukit
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/libmd/sha256c.c
r48f7979 refd19aa 33 33 #include <string.h> 34 34 35 #include "sha224.h" 35 36 #include "sha256.h" 36 37 … … 297 298 memset(ctx, 0, sizeof(*ctx)); 298 299 } 300 301 /*** SHA-224: *********************************************************/ 302 /* 303 * the SHA224 and SHA256 transforms are identical 304 */ 305 306 /* SHA-224 initialization. Begins a SHA-224 operation. */ 307 void 308 SHA224_Init(SHA224_CTX * ctx) 309 { 310 311 /* Zero bits processed so far */ 312 ctx->count = 0; 313 314 /* Magic initialization constants */ 315 ctx->state[0] = 0xC1059ED8; 316 ctx->state[1] = 0x367CD507; 317 ctx->state[2] = 0x3070DD17; 318 ctx->state[3] = 0xF70E5939; 319 ctx->state[4] = 0xFFC00B31; 320 ctx->state[5] = 0x68581511; 321 ctx->state[6] = 0x64f98FA7; 322 ctx->state[7] = 0xBEFA4FA4; 323 } 324 325 /* Add bytes into the SHA-224 hash */ 326 void 327 SHA224_Update(SHA224_CTX * ctx, const void *in, size_t len) 328 { 329 330 SHA256_Update((SHA256_CTX *)ctx, in, len); 331 } 332 333 /* 334 * SHA-224 finalization. Pads the input data, exports the hash value, 335 * and clears the context state. 336 */ 337 void 338 SHA224_Final(unsigned char digest[static SHA224_DIGEST_LENGTH], SHA224_CTX *ctx) 339 { 340 341 /* Add padding */ 342 SHA256_Pad((SHA256_CTX *)ctx); 343 344 /* Write the hash */ 345 be32enc_vect(digest, ctx->state, SHA224_DIGEST_LENGTH); 346 347 /* Clear the context state */ 348 explicit_bzero(ctx, sizeof(*ctx)); 349 }
Note: See TracChangeset
for help on using the changeset viewer.