Skip to content

Commit 19b9242

Browse files
committed
fix cbmc
1 parent d6329d5 commit 19b9242

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

tests/cbmc/proofs/s2n_hmac_is_available/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ HARNESS_FILE = $(HARNESS_ENTRY).c
2222
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE)
2323
PROOF_SOURCES += $(PROOF_STUB)/s2n_calculate_stacktrace.c
2424
PROOF_SOURCES += $(PROOF_STUB)/s2n_is_in_fips_mode.c
25+
PROOF_SOURCES += $(PROOF_STUB)/s2n_libcrypto_is_awslc.c
2526

2627
PROJECT_SOURCES += $(SRCDIR)/crypto/s2n_hmac.c
2728

tests/cbmc/proofs/s2n_hmac_is_available/s2n_hmac_is_available_harness.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include "crypto/s2n_fips.h"
1919
#include "crypto/s2n_hmac.h"
20+
#include "crypto/s2n_openssl.h"
2021

2122
#include <assert.h>
2223

@@ -33,7 +34,7 @@ void s2n_hmac_is_available_harness()
3334
case S2N_HASH_MD5:
3435
case S2N_HMAC_SSLv3_MD5:
3536
case S2N_HMAC_SSLv3_SHA1:
36-
assert(is_available == !s2n_is_in_fips_mode()); break;
37+
assert(is_available == !s2n_is_in_fips_mode() || s2n_libcrypto_is_awslc()); break;
3738
case S2N_HASH_NONE:
3839
case S2N_HASH_SHA1:
3940
case S2N_HASH_SHA224:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
5+
* this file except in compliance with the License. A copy of the License is
6+
* located at
7+
*
8+
* http://aws.amazon.com/apache2.0/
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed on an
11+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12+
* implied. See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
#include <cbmc_proof/nondet.h>
17+
18+
#include "crypto/s2n_openssl.h"
19+
20+
static int flag = 0;
21+
static int s2n_awslc_flag = 0;
22+
23+
int s2n_libcrypto_is_awslc()
24+
{
25+
if (flag == 0) {
26+
s2n_awslc_flag = nondet_bool() ? 1 : 0;
27+
flag = 1;
28+
}
29+
return s2n_awslc_flag;
30+
}

0 commit comments

Comments
 (0)