| 1 | |
| 2 | [//]: # (DO NOT DIRECTLY MODIFY THIS FILE:) |
| 3 | [//]: # (The code in this file is generated from scripts/s2n_safety_macros.py and any modifications) |
| 4 | [//]: # (should be in there.) |
| 5 | |
| 6 | # S2N Safety Macros |
| 7 | |
| 8 | ## Macros for functions that return `S2N_RESULT` |
| 9 | |
| 10 | |
| 11 | ### RESULT_BAIL(error) |
| 12 | |
| 13 | Sets the global `s2n_errno` to `error` and returns with an `S2N_RESULT_ERROR` |
| 14 | |
| 15 | |
| 16 | ### RESULT_ENSURE(condition, error) |
| 17 | |
| 18 | Ensures the `condition` is `true`, otherwise the function will `RESULT_BAIL` with `error` |
| 19 | |
| 20 | |
| 21 | ### RESULT_DEBUG_ENSURE(condition, error) |
| 22 | |
| 23 | Ensures the `condition` is `true`, otherwise the function will `RESULT_BAIL` with `error` |
| 24 | |
| 25 | NOTE: The condition will _only_ be checked when the code is compiled in debug mode. |
| 26 | In release mode, the check is removed. |
| 27 | |
| 28 | |
| 29 | ### RESULT_ENSURE_OK(result, error) |
| 30 | |
| 31 | Ensures `s2n_result_is_ok(result)`, otherwise the function will `RESULT_BAIL` with `error` |
| 32 | |
| 33 | This can be useful for overriding the global `s2n_errno` |
| 34 | |
| 35 | |
| 36 | ### RESULT_ENSURE_GTE(a, b) |
| 37 | |
| 38 | Ensures `a` is greater than or equal to `b`, otherwise the function will `RESULT_BAIL` with a `S2N_ERR_SAFETY` error |
| 39 | |
| 40 | |
| 41 | ### RESULT_ENSURE_LTE(a, b) |
| 42 | |
| 43 | Ensures `a` is less than or equal to `b`, otherwise the function will `RESULT_BAIL` with a `S2N_ERR_SAFETY` error |
| 44 | |
| 45 | |
| 46 | ### RESULT_ENSURE_GT(a, b) |
| 47 | |
| 48 | Ensures `a` is greater than `b`, otherwise the function will `RESULT_BAIL` with a `S2N_ERR_SAFETY` error |
| 49 | |
| 50 | |
| 51 | ### RESULT_ENSURE_LT(a, b) |
| 52 | |
| 53 | Ensures `a` is less than `b`, otherwise the function will `RESULT_BAIL` with a `S2N_ERR_SAFETY` error |
| 54 | |
| 55 | |
| 56 | ### RESULT_ENSURE_EQ(a, b) |
| 57 | |
| 58 | Ensures `a` is equal to `b`, otherwise the function will `RESULT_BAIL` with a `S2N_ERR_SAFETY` error |
| 59 | |
| 60 | |
| 61 | ### RESULT_ENSURE_NE(a, b) |
| 62 | |
| 63 | Ensures `a` is not equal to `b`, otherwise the function will `RESULT_BAIL` with a `S2N_ERR_SAFETY` error |
| 64 | |
| 65 | |
| 66 | ### RESULT_ENSURE_INCLUSIVE_RANGE(min, n, max) |
| 67 | |
| 68 | Ensures `min <= n <= max`, otherwise the function will `RESULT_BAIL` with `S2N_ERR_SAFETY` |
| 69 | |
| 70 | |
| 71 | ### RESULT_ENSURE_EXCLUSIVE_RANGE(min, n, max) |
| 72 | |
| 73 | Ensures `min < n < max`, otherwise the function will `RESULT_BAIL` with `S2N_ERR_SAFETY` |
| 74 | |
| 75 | |
| 76 | ### RESULT_ENSURE_REF(x) |
| 77 | |
| 78 | Ensures `x` is a readable reference, otherwise the function will `RESULT_BAIL` with `S2N_ERR_NULL` |
| 79 | |
| 80 | |
| 81 | ### RESULT_ENSURE_MUT(x) |
| 82 | |
| 83 | Ensures `x` is a mutable reference, otherwise the function will `RESULT_BAIL` with `S2N_ERR_NULL` |
| 84 | |
| 85 | |
| 86 | ### RESULT_PRECONDITION(result) |
| 87 | |
| 88 | Ensures the `result` is `S2N_RESULT_OK`, otherwise the function will return an error signal |
| 89 | |
| 90 | `RESULT_PRECONDITION` should be used at the beginning of a function to make assertions about |
| 91 | the provided arguments. By default, it is functionally equivalent to `RESULT_GUARD(result)` |
| 92 | but can be altered by a testing environment to provide additional guarantees. |
| 93 | |
| 94 | |
| 95 | ### RESULT_POSTCONDITION(result) |
| 96 | |
| 97 | Ensures the `result` is `S2N_RESULT_OK`, otherwise the function will return an error signal |
| 98 | |
| 99 | NOTE: The condition will _only_ be checked when the code is compiled in debug mode. |
| 100 | In release mode, the check is removed. |
| 101 | |
| 102 | `RESULT_POSTCONDITION` should be used at the end of a function to make assertions about |
| 103 | the resulting state. In debug mode, it is functionally equivalent to `RESULT_GUARD(result)`. |
| 104 | In production builds, it becomes a no-op. This can also be altered by a testing environment |
| 105 | to provide additional guarantees. |
| 106 | |
| 107 | |
| 108 | ### RESULT_CHECKED_MEMCPY(destination, source, len) |
| 109 | |
| 110 | Performs a safer memcpy. |
| 111 | |
| 112 | The following checks are performed: |
| 113 | |
| 114 | * `destination` is non-null |
| 115 | * `source` is non-null |
| 116 | |
| 117 | Callers will still need to ensure the following: |
| 118 | |
| 119 | * The size of the data pointed to by both the `destination` and `source` parameters, |
| 120 | shall be at least `len` bytes. |
| 121 | |
| 122 | |
| 123 | ### RESULT_CHECKED_MEMSET(destination, value, len) |
| 124 | |
| 125 | Performs a safer memset |
| 126 | |
| 127 | The following checks are performed: |
| 128 | |
| 129 | * `destination` is non-null |
| 130 | |
| 131 | Callers will still need to ensure the following: |
| 132 | |
| 133 | * The size of the data pointed to by the `destination` parameter shall be at least |
| 134 | `len` bytes. |
| 135 | |
| 136 | |
| 137 | ### RESULT_GUARD(result) |
| 138 | |
| 139 | Ensures `s2n_result_is_ok(result)`, otherwise the function will return `S2N_RESULT_ERROR` |
| 140 | |
| 141 | |
| 142 | ### RESULT_GUARD_OSSL(result, error) |
| 143 | |
| 144 | Ensures `result == _OSSL_SUCCESS`, otherwise the function will `RESULT_BAIL` with `error` |
| 145 | |
| 146 | |
| 147 | ### RESULT_GUARD_POSIX(result) |
| 148 | |
| 149 | Ensures `(result) > S2N_FAILURE`, otherwise the function will return `S2N_RESULT_ERROR` |
| 150 | |
| 151 | |
| 152 | ### RESULT_GUARD_PTR(result) |
| 153 | |
| 154 | Ensures `(result) != NULL`, otherwise the function will return `S2N_RESULT_ERROR` |
| 155 | |
| 156 | Does not set s2n_errno to S2N_ERR_NULL, so is NOT a direct replacement for RESULT_ENSURE_REF. |
| 157 | |
| 158 | |
| 159 | ## Macros for functions that return `int` (POSIX error signal) |
| 160 | |
| 161 | |
| 162 | ### POSIX_BAIL(error) |
| 163 | |
| 164 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 165 | |
| 166 | Sets the global `s2n_errno` to `error` and returns with an `S2N_FAILURE` |
| 167 | |
| 168 | |
| 169 | ### POSIX_ENSURE(condition, error) |
| 170 | |
| 171 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 172 | |
| 173 | Ensures the `condition` is `true`, otherwise the function will `POSIX_BAIL` with `error` |
| 174 | |
| 175 | |
| 176 | ### POSIX_DEBUG_ENSURE(condition, error) |
| 177 | |
| 178 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 179 | |
| 180 | Ensures the `condition` is `true`, otherwise the function will `POSIX_BAIL` with `error` |
| 181 | |
| 182 | NOTE: The condition will _only_ be checked when the code is compiled in debug mode. |
| 183 | In release mode, the check is removed. |
| 184 | |
| 185 | |
| 186 | ### POSIX_ENSURE_OK(result, error) |
| 187 | |
| 188 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 189 | |
| 190 | Ensures `(result) > S2N_FAILURE`, otherwise the function will `POSIX_BAIL` with `error` |
| 191 | |
| 192 | This can be useful for overriding the global `s2n_errno` |
| 193 | |
| 194 | |
| 195 | ### POSIX_ENSURE_GTE(a, b) |
| 196 | |
| 197 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 198 | |
| 199 | Ensures `a` is greater than or equal to `b`, otherwise the function will `POSIX_BAIL` with a `S2N_ERR_SAFETY` error |
| 200 | |
| 201 | |
| 202 | ### POSIX_ENSURE_LTE(a, b) |
| 203 | |
| 204 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 205 | |
| 206 | Ensures `a` is less than or equal to `b`, otherwise the function will `POSIX_BAIL` with a `S2N_ERR_SAFETY` error |
| 207 | |
| 208 | |
| 209 | ### POSIX_ENSURE_GT(a, b) |
| 210 | |
| 211 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 212 | |
| 213 | Ensures `a` is greater than `b`, otherwise the function will `POSIX_BAIL` with a `S2N_ERR_SAFETY` error |
| 214 | |
| 215 | |
| 216 | ### POSIX_ENSURE_LT(a, b) |
| 217 | |
| 218 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 219 | |
| 220 | Ensures `a` is less than `b`, otherwise the function will `POSIX_BAIL` with a `S2N_ERR_SAFETY` error |
| 221 | |
| 222 | |
| 223 | ### POSIX_ENSURE_EQ(a, b) |
| 224 | |
| 225 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 226 | |
| 227 | Ensures `a` is equal to `b`, otherwise the function will `POSIX_BAIL` with a `S2N_ERR_SAFETY` error |
| 228 | |
| 229 | |
| 230 | ### POSIX_ENSURE_NE(a, b) |
| 231 | |
| 232 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 233 | |
| 234 | Ensures `a` is not equal to `b`, otherwise the function will `POSIX_BAIL` with a `S2N_ERR_SAFETY` error |
| 235 | |
| 236 | |
| 237 | ### POSIX_ENSURE_INCLUSIVE_RANGE(min, n, max) |
| 238 | |
| 239 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 240 | |
| 241 | Ensures `min <= n <= max`, otherwise the function will `POSIX_BAIL` with `S2N_ERR_SAFETY` |
| 242 | |
| 243 | |
| 244 | ### POSIX_ENSURE_EXCLUSIVE_RANGE(min, n, max) |
| 245 | |
| 246 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 247 | |
| 248 | Ensures `min < n < max`, otherwise the function will `POSIX_BAIL` with `S2N_ERR_SAFETY` |
| 249 | |
| 250 | |
| 251 | ### POSIX_ENSURE_REF(x) |
| 252 | |
| 253 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 254 | |
| 255 | Ensures `x` is a readable reference, otherwise the function will `POSIX_BAIL` with `S2N_ERR_NULL` |
| 256 | |
| 257 | |
| 258 | ### POSIX_ENSURE_MUT(x) |
| 259 | |
| 260 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 261 | |
| 262 | Ensures `x` is a mutable reference, otherwise the function will `POSIX_BAIL` with `S2N_ERR_NULL` |
| 263 | |
| 264 | |
| 265 | ### POSIX_PRECONDITION(result) |
| 266 | |
| 267 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 268 | |
| 269 | Ensures the `result` is `S2N_RESULT_OK`, otherwise the function will return an error signal |
| 270 | |
| 271 | `POSIX_PRECONDITION` should be used at the beginning of a function to make assertions about |
| 272 | the provided arguments. By default, it is functionally equivalent to `POSIX_GUARD_RESULT(result)` |
| 273 | but can be altered by a testing environment to provide additional guarantees. |
| 274 | |
| 275 | |
| 276 | ### POSIX_POSTCONDITION(result) |
| 277 | |
| 278 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 279 | |
| 280 | Ensures the `result` is `S2N_RESULT_OK`, otherwise the function will return an error signal |
| 281 | |
| 282 | NOTE: The condition will _only_ be checked when the code is compiled in debug mode. |
| 283 | In release mode, the check is removed. |
| 284 | |
| 285 | `POSIX_POSTCONDITION` should be used at the end of a function to make assertions about |
| 286 | the resulting state. In debug mode, it is functionally equivalent to `POSIX_GUARD_RESULT(result)`. |
| 287 | In production builds, it becomes a no-op. This can also be altered by a testing environment |
| 288 | to provide additional guarantees. |
| 289 | |
| 290 | |
| 291 | ### POSIX_CHECKED_MEMCPY(destination, source, len) |
| 292 | |
| 293 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 294 | |
| 295 | Performs a safer memcpy. |
| 296 | |
| 297 | The following checks are performed: |
| 298 | |
| 299 | * `destination` is non-null |
| 300 | * `source` is non-null |
| 301 | |
| 302 | Callers will still need to ensure the following: |
| 303 | |
| 304 | * The size of the data pointed to by both the `destination` and `source` parameters, |
| 305 | shall be at least `len` bytes. |
| 306 | |
| 307 | |
| 308 | ### POSIX_CHECKED_MEMSET(destination, value, len) |
| 309 | |
| 310 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 311 | |
| 312 | Performs a safer memset |
| 313 | |
| 314 | The following checks are performed: |
| 315 | |
| 316 | * `destination` is non-null |
| 317 | |
| 318 | Callers will still need to ensure the following: |
| 319 | |
| 320 | * The size of the data pointed to by the `destination` parameter shall be at least |
| 321 | `len` bytes. |
| 322 | |
| 323 | |
| 324 | ### POSIX_GUARD(result) |
| 325 | |
| 326 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 327 | |
| 328 | Ensures `(result) > S2N_FAILURE`, otherwise the function will return `S2N_FAILURE` |
| 329 | |
| 330 | |
| 331 | ### POSIX_GUARD_OSSL(result, error) |
| 332 | |
| 333 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 334 | |
| 335 | Ensures `result == _OSSL_SUCCESS`, otherwise the function will `POSIX_BAIL` with `error` |
| 336 | |
| 337 | |
| 338 | ### POSIX_GUARD_RESULT(result) |
| 339 | |
| 340 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 341 | |
| 342 | Ensures `s2n_result_is_ok(result)`, otherwise the function will return `S2N_FAILURE` |
| 343 | |
| 344 | |
| 345 | ### POSIX_GUARD_PTR(result) |
| 346 | |
| 347 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 348 | |
| 349 | Ensures `(result) != NULL`, otherwise the function will return `S2N_FAILURE` |
| 350 | |
| 351 | Does not set s2n_errno to S2N_ERR_NULL, so is NOT a direct replacement for POSIX_ENSURE_REF. |
| 352 | |
| 353 | |
| 354 | ## Macros for functions that return a pointer |
| 355 | |
| 356 | |
| 357 | ### PTR_BAIL(error) |
| 358 | |
| 359 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 360 | |
| 361 | Sets the global `s2n_errno` to `error` and returns with an `NULL` |
| 362 | |
| 363 | |
| 364 | ### PTR_ENSURE(condition, error) |
| 365 | |
| 366 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 367 | |
| 368 | Ensures the `condition` is `true`, otherwise the function will `PTR_BAIL` with `error` |
| 369 | |
| 370 | |
| 371 | ### PTR_DEBUG_ENSURE(condition, error) |
| 372 | |
| 373 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 374 | |
| 375 | Ensures the `condition` is `true`, otherwise the function will `PTR_BAIL` with `error` |
| 376 | |
| 377 | NOTE: The condition will _only_ be checked when the code is compiled in debug mode. |
| 378 | In release mode, the check is removed. |
| 379 | |
| 380 | |
| 381 | ### PTR_ENSURE_OK(result, error) |
| 382 | |
| 383 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 384 | |
| 385 | Ensures `(result) != NULL`, otherwise the function will `PTR_BAIL` with `error` |
| 386 | |
| 387 | This can be useful for overriding the global `s2n_errno` |
| 388 | |
| 389 | |
| 390 | ### PTR_ENSURE_GTE(a, b) |
| 391 | |
| 392 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 393 | |
| 394 | Ensures `a` is greater than or equal to `b`, otherwise the function will `PTR_BAIL` with a `S2N_ERR_SAFETY` error |
| 395 | |
| 396 | |
| 397 | ### PTR_ENSURE_LTE(a, b) |
| 398 | |
| 399 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 400 | |
| 401 | Ensures `a` is less than or equal to `b`, otherwise the function will `PTR_BAIL` with a `S2N_ERR_SAFETY` error |
| 402 | |
| 403 | |
| 404 | ### PTR_ENSURE_GT(a, b) |
| 405 | |
| 406 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 407 | |
| 408 | Ensures `a` is greater than `b`, otherwise the function will `PTR_BAIL` with a `S2N_ERR_SAFETY` error |
| 409 | |
| 410 | |
| 411 | ### PTR_ENSURE_LT(a, b) |
| 412 | |
| 413 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 414 | |
| 415 | Ensures `a` is less than `b`, otherwise the function will `PTR_BAIL` with a `S2N_ERR_SAFETY` error |
| 416 | |
| 417 | |
| 418 | ### PTR_ENSURE_EQ(a, b) |
| 419 | |
| 420 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 421 | |
| 422 | Ensures `a` is equal to `b`, otherwise the function will `PTR_BAIL` with a `S2N_ERR_SAFETY` error |
| 423 | |
| 424 | |
| 425 | ### PTR_ENSURE_NE(a, b) |
| 426 | |
| 427 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 428 | |
| 429 | Ensures `a` is not equal to `b`, otherwise the function will `PTR_BAIL` with a `S2N_ERR_SAFETY` error |
| 430 | |
| 431 | |
| 432 | ### PTR_ENSURE_INCLUSIVE_RANGE(min, n, max) |
| 433 | |
| 434 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 435 | |
| 436 | Ensures `min <= n <= max`, otherwise the function will `PTR_BAIL` with `S2N_ERR_SAFETY` |
| 437 | |
| 438 | |
| 439 | ### PTR_ENSURE_EXCLUSIVE_RANGE(min, n, max) |
| 440 | |
| 441 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 442 | |
| 443 | Ensures `min < n < max`, otherwise the function will `PTR_BAIL` with `S2N_ERR_SAFETY` |
| 444 | |
| 445 | |
| 446 | ### PTR_ENSURE_REF(x) |
| 447 | |
| 448 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 449 | |
| 450 | Ensures `x` is a readable reference, otherwise the function will `PTR_BAIL` with `S2N_ERR_NULL` |
| 451 | |
| 452 | |
| 453 | ### PTR_ENSURE_MUT(x) |
| 454 | |
| 455 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 456 | |
| 457 | Ensures `x` is a mutable reference, otherwise the function will `PTR_BAIL` with `S2N_ERR_NULL` |
| 458 | |
| 459 | |
| 460 | ### PTR_PRECONDITION(result) |
| 461 | |
| 462 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 463 | |
| 464 | Ensures the `result` is `S2N_RESULT_OK`, otherwise the function will return an error signal |
| 465 | |
| 466 | `PTR_PRECONDITION` should be used at the beginning of a function to make assertions about |
| 467 | the provided arguments. By default, it is functionally equivalent to `PTR_GUARD_RESULT(result)` |
| 468 | but can be altered by a testing environment to provide additional guarantees. |
| 469 | |
| 470 | |
| 471 | ### PTR_POSTCONDITION(result) |
| 472 | |
| 473 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 474 | |
| 475 | Ensures the `result` is `S2N_RESULT_OK`, otherwise the function will return an error signal |
| 476 | |
| 477 | NOTE: The condition will _only_ be checked when the code is compiled in debug mode. |
| 478 | In release mode, the check is removed. |
| 479 | |
| 480 | `PTR_POSTCONDITION` should be used at the end of a function to make assertions about |
| 481 | the resulting state. In debug mode, it is functionally equivalent to `PTR_GUARD_RESULT(result)`. |
| 482 | In production builds, it becomes a no-op. This can also be altered by a testing environment |
| 483 | to provide additional guarantees. |
| 484 | |
| 485 | |
| 486 | ### PTR_CHECKED_MEMCPY(destination, source, len) |
| 487 | |
| 488 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 489 | |
| 490 | Performs a safer memcpy. |
| 491 | |
| 492 | The following checks are performed: |
| 493 | |
| 494 | * `destination` is non-null |
| 495 | * `source` is non-null |
| 496 | |
| 497 | Callers will still need to ensure the following: |
| 498 | |
| 499 | * The size of the data pointed to by both the `destination` and `source` parameters, |
| 500 | shall be at least `len` bytes. |
| 501 | |
| 502 | |
| 503 | ### PTR_CHECKED_MEMSET(destination, value, len) |
| 504 | |
| 505 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 506 | |
| 507 | Performs a safer memset |
| 508 | |
| 509 | The following checks are performed: |
| 510 | |
| 511 | * `destination` is non-null |
| 512 | |
| 513 | Callers will still need to ensure the following: |
| 514 | |
| 515 | * The size of the data pointed to by the `destination` parameter shall be at least |
| 516 | `len` bytes. |
| 517 | |
| 518 | |
| 519 | ### PTR_GUARD(result) |
| 520 | |
| 521 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 522 | |
| 523 | Ensures `(result) != NULL`, otherwise the function will return `NULL` |
| 524 | |
| 525 | |
| 526 | ### PTR_GUARD_OSSL(result, error) |
| 527 | |
| 528 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 529 | |
| 530 | Ensures `result == _OSSL_SUCCESS`, otherwise the function will `PTR_BAIL` with `error` |
| 531 | |
| 532 | |
| 533 | ### PTR_GUARD_RESULT(result) |
| 534 | |
| 535 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 536 | |
| 537 | Ensures `s2n_result_is_ok(result)`, otherwise the function will return `NULL` |
| 538 | |
| 539 | |
| 540 | ### PTR_GUARD_POSIX(result) |
| 541 | |
| 542 | DEPRECATED: all methods (except those in s2n.h) should return s2n_result. |
| 543 | |
| 544 | Ensures `(result) > S2N_FAILURE`, otherwise the function will return `NULL` |
| 545 |