Skip to content

Commit d097bb4

Browse files
committed
manual commit: put everything in a checked scope
1 parent 82c56f6 commit d097bb4

File tree

9 files changed

+15
-4
lines changed

9 files changed

+15
-4
lines changed

bn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ There may well be room for performance-optimizations and improvements.
2323
#include <assert.h>
2424
#include "bn.h"
2525

26-
26+
#pragma CHECKED_SCOPE on
2727

2828
/* Functions for shifting number in-place. */
2929
static void _lshift_one_bit(_Ptr<struct bn> a);

bn.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ There may well be room for performance-optimizations and improvements.
2323
#include <stdint.h>
2424
#include <assert.h>
2525

26+
#pragma CHECKED_SCOPE push
27+
#pragma CHECKED_SCOPE on
2628

2729
/* This macro defines the word size in bytes of the array that constitues the big-number data structure. */
2830
#ifndef WORD_SIZE
@@ -117,6 +119,7 @@ void bignum_pow(_Ptr<struct bn> a, _Ptr<struct bn> b, _Ptr<struct bn> c); /* Cal
117119
void bignum_isqrt(_Ptr<struct bn> a, _Ptr<struct bn> b); /* Integer square root -- e.g. isqrt(5) => 2*/
118120
void bignum_assign(_Ptr<struct bn> dst, _Ptr<struct bn> src); /* Copy src into dst -- dst := src */
119121

122+
#pragma CHECKED_SCOPE pop
120123

121124
#endif /* #ifndef __BIGNUM_H__ */
122125

tests/factorial.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include <stdio.h>
3333
#include "bn.h"
3434

35-
35+
#pragma CHECKED_SCOPE on
3636

3737
void factorial(_Ptr<struct bn> n, _Ptr<struct bn> res)
3838
{

tests/golden.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <stdio.h>
22
#include "bn.h"
33

4+
#pragma CHECKED_SCOPE on
45

56
/* For table-defined list of tests */
67
struct test

tests/hand_picked.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <stdio.h>
22
#include "bn.h"
33

4+
#pragma CHECKED_SCOPE on
45

56
int npassed = 0;
67
int ntests = 0;

tests/load_cmp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <assert.h>
1212
#include "bn.h"
1313

14-
14+
#pragma CHECKED_SCOPE on
1515

1616
int main(int argc, _Array_ptr<_Nt_array_ptr<char>> argv : count(argc))
1717
{

tests/randomized.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
#include <string.h>
55
#include "bn.h"
66

7-
void bignum_from_string_using_strlen(_Ptr<struct bn> n, _Nt_array_ptr<char> str) {
7+
#pragma CHECKED_SCOPE on
8+
9+
_Unchecked void bignum_from_string_using_strlen(_Ptr<struct bn> n, _Nt_array_ptr<char> str) {
810
int len = strlen(str);
911
_Nt_array_ptr<char> str2 : count(len) =
1012
_Assume_bounds_cast<_Nt_array_ptr<char>>(str, count(len));

tests/rsa.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
#include <string.h> /* for memcpy */
4141
#include "bn.h"
4242

43+
#pragma CHECKED_SCOPE on
44+
4345
/* O(log n) */
4446
void pow_mod_faster(_Ptr<struct bn> a, _Ptr<struct bn> b, _Ptr<struct bn> n, _Ptr<struct bn> res)
4547
{

tests/test_div_algo.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#include <stdio.h>
33
#include "bn.h"
44

5+
#pragma CHECKED_SCOPE on
6+
57
/*
68
79
Division algorithms using bitwise operations

0 commit comments

Comments
 (0)