Bundle Protocol Security (RFC 9172) - authentication and encryption for DTN
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(lint): replace Printf/Format with Fmt in block and bpsec

+23 -29
+23 -29
lib/bpsec.ml
··· 83 83 | Cbor_error of string 84 84 85 85 let pp_error fmt = function 86 - | Invalid_security_context n -> 87 - Format.fprintf fmt "invalid security context: %d" n 88 - | Invalid_parameter n -> Format.fprintf fmt "invalid parameter: %d" n 89 - | Invalid_result n -> Format.fprintf fmt "invalid result: %d" n 90 - | Missing_parameter name -> Format.fprintf fmt "missing parameter: %s" name 91 - | Verification_failed -> Format.fprintf fmt "verification failed" 92 - | Decryption_failed -> Format.fprintf fmt "decryption failed" 93 - | Cbor_error msg -> Format.fprintf fmt "CBOR error: %s" msg 86 + | Invalid_security_context n -> Fmt.pf fmt "invalid security context: %d" n 87 + | Invalid_parameter n -> Fmt.pf fmt "invalid parameter: %d" n 88 + | Invalid_result n -> Fmt.pf fmt "invalid result: %d" n 89 + | Missing_parameter name -> Fmt.pf fmt "missing parameter: %s" name 90 + | Verification_failed -> Fmt.pf fmt "verification failed" 91 + | Decryption_failed -> Fmt.pf fmt "decryption failed" 92 + | Cbor_error msg -> Fmt.pf fmt "CBOR error: %s" msg 94 93 95 94 open Result.Syntax 96 95 ··· 425 424 (* {1 Pretty Printing} *) 426 425 427 426 let pp_parameter fmt = function 428 - | Bib_param (SHA_variant v) -> Format.fprintf fmt "sha_variant=%d" v 429 - | Bib_param (Wrapped_key _) -> Format.fprintf fmt "wrapped_key=<bytes>" 430 - | Bib_param (Integrity_scope_flags f) -> 431 - Format.fprintf fmt "integrity_scope=0x%x" f 432 - | Bcb_param (IV _) -> Format.fprintf fmt "iv=<bytes>" 433 - | Bcb_param (AES_variant v) -> Format.fprintf fmt "aes_variant=%d" v 434 - | Bcb_param (Wrapped_key _) -> Format.fprintf fmt "wrapped_key=<bytes>" 435 - | Bcb_param (AAD_scope_flags f) -> Format.fprintf fmt "aad_scope=0x%x" f 436 - | Unknown_param (id, _) -> Format.fprintf fmt "unknown(%d)=<bytes>" id 427 + | Bib_param (SHA_variant v) -> Fmt.pf fmt "sha_variant=%d" v 428 + | Bib_param (Wrapped_key _) -> Fmt.pf fmt "wrapped_key=<bytes>" 429 + | Bib_param (Integrity_scope_flags f) -> Fmt.pf fmt "integrity_scope=0x%x" f 430 + | Bcb_param (IV _) -> Fmt.pf fmt "iv=<bytes>" 431 + | Bcb_param (AES_variant v) -> Fmt.pf fmt "aes_variant=%d" v 432 + | Bcb_param (Wrapped_key _) -> Fmt.pf fmt "wrapped_key=<bytes>" 433 + | Bcb_param (AAD_scope_flags f) -> Fmt.pf fmt "aad_scope=0x%x" f 434 + | Unknown_param (id, _) -> Fmt.pf fmt "unknown(%d)=<bytes>" id 437 435 438 436 let pp_result fmt = function 439 - | Bib_result (Expected_hmac _) -> Format.fprintf fmt "hmac=<bytes>" 440 - | Bcb_result (Auth_tag _) -> Format.fprintf fmt "tag=<bytes>" 441 - | Unknown_result (id, _) -> Format.fprintf fmt "unknown(%d)=<bytes>" id 437 + | Bib_result (Expected_hmac _) -> Fmt.pf fmt "hmac=<bytes>" 438 + | Bcb_result (Auth_tag _) -> Fmt.pf fmt "tag=<bytes>" 439 + | Unknown_result (id, _) -> Fmt.pf fmt "unknown(%d)=<bytes>" id 442 440 443 441 let pp_security_block fmt sb = 444 - Format.fprintf fmt 442 + Fmt.pf fmt 445 443 "@[<v 2>security_block {@ targets=[%a];@ context=%d;@ source=%a;@ \ 446 444 parameters=[%a];@ results=[%a]@ }@]" 447 445 (Format.pp_print_list 448 - ~pp_sep:(fun fmt () -> Format.fprintf fmt ", ") 446 + ~pp_sep:(fun fmt () -> Fmt.pf fmt ", ") 449 447 Format.pp_print_int) 450 448 sb.targets sb.context_id Bundle.pp_eid sb.source 451 - (Format.pp_print_list 452 - ~pp_sep:(fun fmt () -> Format.fprintf fmt "; ") 453 - pp_parameter) 449 + (Format.pp_print_list ~pp_sep:(fun fmt () -> Fmt.pf fmt "; ") pp_parameter) 454 450 sb.parameters 455 451 (Format.pp_print_list 456 - ~pp_sep:(fun fmt () -> Format.fprintf fmt "; ") 457 - (Format.pp_print_list 458 - ~pp_sep:(fun fmt () -> Format.fprintf fmt ", ") 459 - pp_result)) 452 + ~pp_sep:(fun fmt () -> Fmt.pf fmt "; ") 453 + (Format.pp_print_list ~pp_sep:(fun fmt () -> Fmt.pf fmt ", ") pp_result)) 460 454 sb.results 461 455 462 456 let pp_bib = pp_security_block