Coverage Report

Created: 2025-06-11 06:40

/src/boringssl/crypto/sha/sha1.cc
Line
Count
Source (jump to first uncovered line)
1
// Copyright 2024 The BoringSSL Authors
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     https://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#include <openssl/sha.h>
16
17
#include <openssl/mem.h>
18
19
#include "../fipsmodule/bcm_interface.h"
20
21
0
int SHA1_Init(SHA_CTX *sha) {
22
0
  BCM_sha1_init(sha);
23
0
  return 1;
24
0
}
25
26
0
int SHA1_Update(SHA_CTX *sha, const void *data, size_t len) {
27
0
  BCM_sha1_update(sha, data, len);
28
0
  return 1;
29
0
}
30
31
0
int SHA1_Final(uint8_t out[SHA_DIGEST_LENGTH], SHA_CTX *sha) {
32
0
  BCM_sha1_final(out, sha);
33
0
  return 1;
34
0
}
35
36
0
uint8_t *SHA1(const uint8_t *data, size_t len, uint8_t out[SHA_DIGEST_LENGTH]) {
37
0
  SHA_CTX ctx;
38
0
  BCM_sha1_init(&ctx);
39
0
  BCM_sha1_update(&ctx, data, len);
40
0
  BCM_sha1_final(out, &ctx);
41
0
  OPENSSL_cleanse(&ctx, sizeof(ctx));
42
0
  return out;
43
0
}
44
45
0
void SHA1_Transform(SHA_CTX *sha, const uint8_t block[SHA_CBLOCK]) {
46
0
  BCM_sha1_transform(sha, block);
47
0
}
48
49
void CRYPTO_fips_186_2_prf(uint8_t *out, size_t out_len,
50
0
                           const uint8_t xkey[SHA_DIGEST_LENGTH]) {
51
0
  BCM_fips_186_2_prf(out, out_len, xkey);
52
0
}