Coverage Report

Created: 2021-05-04 09:02

/src/botan/build/include/botan/rfc4880.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
* (C) 2021 Jack Lloyd
3
*
4
* Botan is released under the Simplified BSD License (see license.txt)
5
*/
6
7
#ifndef BOTAN_RFC4880_H_
8
#define BOTAN_RFC4880_H_
9
10
#include <botan/types.h>
11
12
namespace Botan {
13
14
/*
15
Helpers for encoding PGP S2K values (see RFC 4880)
16
*/
17
18
/**
19
* RFC 4880 encodes the iteration count to a single-byte value
20
*/
21
uint8_t BOTAN_PUBLIC_API(2,8) RFC4880_encode_count(size_t iterations);
22
23
/**
24
* Decode the iteration count from RFC 4880 encoding
25
*/
26
size_t BOTAN_PUBLIC_API(2,8) RFC4880_decode_count(uint8_t encoded_iter);
27
28
/**
29
* Round an arbitrary iteration count to next largest iteration count
30
* supported by RFC4880 encoding.
31
*/
32
inline size_t RFC4880_round_iterations(size_t iterations)
33
0
   {
34
0
   return RFC4880_decode_count(RFC4880_encode_count(iterations));
35
0
   }
36
37
}
38
39
#endif