Update SM3 implementation from GmSSL v3.1.1.

This commit is contained in:
MouriNaruto
2024-04-13 15:07:52 +08:00
parent e1ef0c13c7
commit 402aaf0e93

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
* Copyright 2014-2023 The GmSSL Project. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
@@ -363,7 +363,6 @@ void sm3_finish(SM3_CTX *ctx, uint8_t *digest)
for (i = 0; i < 8; i++) {
PUTU32(digest + i*4, ctx->digest[i]);
}
memset(ctx, 0, sizeof(SM3_CTX));
}
void sm3_digest(const uint8_t *msg, size_t msglen,
@@ -373,4 +372,5 @@ void sm3_digest(const uint8_t *msg, size_t msglen,
sm3_init(&ctx);
sm3_update(&ctx, msg, msglen);
sm3_finish(&ctx, dgst);
memset(&ctx, 0, sizeof(ctx));
}