OLD | NEW |
1 /* | 1 /* |
2 * key.c | 2 * key.c |
3 * | 3 * |
4 * key usage limits enforcement | 4 * key usage limits enforcement |
5 * | 5 * |
6 * David A. Mcgrew | 6 * David A. Mcgrew |
7 * Cisco Systems, Inc. | 7 * Cisco Systems, Inc. |
8 */ | 8 */ |
9 /* | 9 /* |
10 * | 10 * |
(...skipping 24 matching lines...) Expand all Loading... |
35 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 35 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
36 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 36 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
37 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 37 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
40 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 40 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
41 * OF THE POSSIBILITY OF SUCH DAMAGE. | 41 * OF THE POSSIBILITY OF SUCH DAMAGE. |
42 * | 42 * |
43 */ | 43 */ |
44 | 44 |
| 45 #ifdef HAVE_CONFIG_H |
| 46 #include <config.h> |
| 47 #endif |
| 48 |
45 #include "key.h" | 49 #include "key.h" |
46 | 50 |
47 #define soft_limit 0x10000 | 51 #define soft_limit 0x10000 |
48 | 52 |
49 err_status_t | 53 err_status_t |
50 key_limit_set(key_limit_t key, const xtd_seq_num_t s) { | 54 key_limit_set(key_limit_t key, const xtd_seq_num_t s) { |
51 #ifdef NO_64BIT_MATH | 55 #ifdef NO_64BIT_MATH |
52 if (high32(s) == 0 && low32(s) < soft_limit) | 56 if (high32(s) == 0 && low32(s) < soft_limit) |
53 return err_status_bad_param; | 57 return err_status_bad_param; |
54 #else | 58 #else |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 #else | 110 #else |
107 if (key->num_left < 1) | 111 if (key->num_left < 1) |
108 #endif | 112 #endif |
109 { /* we just hit the hard limit */ | 113 { /* we just hit the hard limit */ |
110 key->state = key_state_expired; | 114 key->state = key_state_expired; |
111 return key_event_hard_limit; | 115 return key_event_hard_limit; |
112 } | 116 } |
113 return key_event_soft_limit; | 117 return key_event_soft_limit; |
114 } | 118 } |
115 | 119 |
OLD | NEW |