Skip to content

Commit 7f372f8

Browse files
author
Ben Taylor
committed
Remove redundant declarations and update docs
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
1 parent cf675b4 commit 7f372f8

2 files changed

Lines changed: 214 additions & 269 deletions

File tree

include/psa/crypto.h

Lines changed: 0 additions & 269 deletions
Original file line numberDiff line numberDiff line change
@@ -117,251 +117,6 @@ psa_status_t psa_crypto_init(void);
117117
* of type #psa_key_attributes_t.
118118
*/
119119

120-
/** Return an initial value for a key attributes structure.
121-
*/
122-
static psa_key_attributes_t psa_key_attributes_init(void);
123-
124-
/** Declare a key as persistent and set its key identifier.
125-
*
126-
* If the attribute structure currently declares the key as volatile (which
127-
* is the default content of an attribute structure), this function sets
128-
* the lifetime attribute to #PSA_KEY_LIFETIME_PERSISTENT.
129-
*
130-
* This function does not access storage, it merely stores the given
131-
* value in the structure.
132-
* The persistent key will be written to storage when the attribute
133-
* structure is passed to a key creation function such as
134-
* psa_import_key(), psa_generate_key(), psa_generate_key_custom(),
135-
* psa_key_derivation_output_key(), psa_key_derivation_output_key_custom()
136-
* or psa_copy_key().
137-
*
138-
* This function may be declared as `static` (i.e. without external
139-
* linkage). This function may be provided as a function-like macro,
140-
* but in this case it must evaluate each of its arguments exactly once.
141-
*
142-
* \param[out] attributes The attribute structure to write to.
143-
* \param key The persistent identifier for the key.
144-
* This can be any value in the range from
145-
* #PSA_KEY_ID_USER_MIN to #PSA_KEY_ID_USER_MAX
146-
* inclusive.
147-
*/
148-
static void psa_set_key_id(psa_key_attributes_t *attributes,
149-
mbedtls_svc_key_id_t key);
150-
151-
#ifdef MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
152-
/** Set the owner identifier of a key.
153-
*
154-
* When key identifiers encode key owner identifiers, psa_set_key_id() does
155-
* not allow to define in key attributes the owner of volatile keys as
156-
* psa_set_key_id() enforces the key to be persistent.
157-
*
158-
* This function allows to set in key attributes the owner identifier of a
159-
* key. It is intended to be used for volatile keys. For persistent keys,
160-
* it is recommended to use the PSA Cryptography API psa_set_key_id() to define
161-
* the owner of a key.
162-
*
163-
* \param[out] attributes The attribute structure to write to.
164-
* \param owner The key owner identifier.
165-
*/
166-
static void mbedtls_set_key_owner_id(psa_key_attributes_t *attributes,
167-
mbedtls_key_owner_id_t owner);
168-
#endif
169-
170-
/** Set the location of a persistent key.
171-
*
172-
* To make a key persistent, you must give it a persistent key identifier
173-
* with psa_set_key_id(). By default, a key that has a persistent identifier
174-
* is stored in the default storage area identifier by
175-
* #PSA_KEY_LIFETIME_PERSISTENT. Call this function to choose a storage
176-
* area, or to explicitly declare the key as volatile.
177-
*
178-
* This function does not access storage, it merely stores the given
179-
* value in the structure.
180-
* The persistent key will be written to storage when the attribute
181-
* structure is passed to a key creation function such as
182-
* psa_import_key(), psa_generate_key(), psa_generate_key_custom(),
183-
* psa_key_derivation_output_key(), psa_key_derivation_output_key_custom()
184-
* or psa_copy_key().
185-
*
186-
* This function may be declared as `static` (i.e. without external
187-
* linkage). This function may be provided as a function-like macro,
188-
* but in this case it must evaluate each of its arguments exactly once.
189-
*
190-
* \param[out] attributes The attribute structure to write to.
191-
* \param lifetime The lifetime for the key.
192-
* If this is #PSA_KEY_LIFETIME_VOLATILE, the
193-
* key will be volatile, and the key identifier
194-
* attribute is reset to 0.
195-
*/
196-
static void psa_set_key_lifetime(psa_key_attributes_t *attributes,
197-
psa_key_lifetime_t lifetime);
198-
199-
/** Retrieve the key identifier from key attributes.
200-
*
201-
* This function may be declared as `static` (i.e. without external
202-
* linkage). This function may be provided as a function-like macro,
203-
* but in this case it must evaluate its argument exactly once.
204-
*
205-
* \param[in] attributes The key attribute structure to query.
206-
*
207-
* \return The persistent identifier stored in the attribute structure.
208-
* This value is unspecified if the attribute structure declares
209-
* the key as volatile.
210-
*/
211-
static mbedtls_svc_key_id_t psa_get_key_id(
212-
const psa_key_attributes_t *attributes);
213-
214-
/** Retrieve the lifetime from key attributes.
215-
*
216-
* This function may be declared as `static` (i.e. without external
217-
* linkage). This function may be provided as a function-like macro,
218-
* but in this case it must evaluate its argument exactly once.
219-
*
220-
* \param[in] attributes The key attribute structure to query.
221-
*
222-
* \return The lifetime value stored in the attribute structure.
223-
*/
224-
static psa_key_lifetime_t psa_get_key_lifetime(
225-
const psa_key_attributes_t *attributes);
226-
227-
/** Declare usage flags for a key.
228-
*
229-
* Usage flags are part of a key's usage policy. They encode what
230-
* kind of operations are permitted on the key. For more details,
231-
* refer to the documentation of the type #psa_key_usage_t.
232-
*
233-
* This function overwrites any usage flags
234-
* previously set in \p attributes.
235-
*
236-
* This function may be declared as `static` (i.e. without external
237-
* linkage). This function may be provided as a function-like macro,
238-
* but in this case it must evaluate each of its arguments exactly once.
239-
*
240-
* \param[out] attributes The attribute structure to write to.
241-
* \param usage_flags The usage flags to write.
242-
*/
243-
static void psa_set_key_usage_flags(psa_key_attributes_t *attributes,
244-
psa_key_usage_t usage_flags);
245-
246-
/** Retrieve the usage flags from key attributes.
247-
*
248-
* This function may be declared as `static` (i.e. without external
249-
* linkage). This function may be provided as a function-like macro,
250-
* but in this case it must evaluate its argument exactly once.
251-
*
252-
* \param[in] attributes The key attribute structure to query.
253-
*
254-
* \return The usage flags stored in the attribute structure.
255-
*/
256-
static psa_key_usage_t psa_get_key_usage_flags(
257-
const psa_key_attributes_t *attributes);
258-
259-
/** Declare the permitted algorithm policy for a key.
260-
*
261-
* The permitted algorithm policy of a key encodes which algorithm or
262-
* algorithms are permitted to be used with this key. The following
263-
* algorithm policies are supported:
264-
* - 0 does not allow any cryptographic operation with the key. The key
265-
* may be used for non-cryptographic actions such as exporting (if
266-
* permitted by the usage flags).
267-
* - An algorithm value permits this particular algorithm.
268-
* - An algorithm wildcard built from #PSA_ALG_ANY_HASH allows the specified
269-
* signature scheme with any hash algorithm.
270-
* - An algorithm built from #PSA_ALG_AT_LEAST_THIS_LENGTH_MAC allows
271-
* any MAC algorithm from the same base class (e.g. CMAC) which
272-
* generates/verifies a MAC length greater than or equal to the length
273-
* encoded in the wildcard algorithm.
274-
* - An algorithm built from #PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG
275-
* allows any AEAD algorithm from the same base class (e.g. CCM) which
276-
* generates/verifies a tag length greater than or equal to the length
277-
* encoded in the wildcard algorithm.
278-
*
279-
* This function overwrites any algorithm policy
280-
* previously set in \p attributes.
281-
*
282-
* This function may be declared as `static` (i.e. without external
283-
* linkage). This function may be provided as a function-like macro,
284-
* but in this case it must evaluate each of its arguments exactly once.
285-
*
286-
* \param[out] attributes The attribute structure to write to.
287-
* \param alg The permitted algorithm policy to write.
288-
*/
289-
static void psa_set_key_algorithm(psa_key_attributes_t *attributes,
290-
psa_algorithm_t alg);
291-
292-
293-
/** Retrieve the algorithm policy from key attributes.
294-
*
295-
* This function may be declared as `static` (i.e. without external
296-
* linkage). This function may be provided as a function-like macro,
297-
* but in this case it must evaluate its argument exactly once.
298-
*
299-
* \param[in] attributes The key attribute structure to query.
300-
*
301-
* \return The algorithm stored in the attribute structure.
302-
*/
303-
static psa_algorithm_t psa_get_key_algorithm(
304-
const psa_key_attributes_t *attributes);
305-
306-
/** Declare the type of a key.
307-
*
308-
* This function overwrites any key type
309-
* previously set in \p attributes.
310-
*
311-
* This function may be declared as `static` (i.e. without external
312-
* linkage). This function may be provided as a function-like macro,
313-
* but in this case it must evaluate each of its arguments exactly once.
314-
*
315-
* \param[out] attributes The attribute structure to write to.
316-
* \param type The key type to write.
317-
* If this is 0, the key type in \p attributes
318-
* becomes unspecified.
319-
*/
320-
static void psa_set_key_type(psa_key_attributes_t *attributes,
321-
psa_key_type_t type);
322-
323-
324-
/** Declare the size of a key.
325-
*
326-
* This function overwrites any key size previously set in \p attributes.
327-
*
328-
* This function may be declared as `static` (i.e. without external
329-
* linkage). This function may be provided as a function-like macro,
330-
* but in this case it must evaluate each of its arguments exactly once.
331-
*
332-
* \param[out] attributes The attribute structure to write to.
333-
* \param bits The key size in bits.
334-
* If this is 0, the key size in \p attributes
335-
* becomes unspecified. Keys of size 0 are
336-
* not supported.
337-
*/
338-
static void psa_set_key_bits(psa_key_attributes_t *attributes,
339-
size_t bits);
340-
341-
/** Retrieve the key type from key attributes.
342-
*
343-
* This function may be declared as `static` (i.e. without external
344-
* linkage). This function may be provided as a function-like macro,
345-
* but in this case it must evaluate its argument exactly once.
346-
*
347-
* \param[in] attributes The key attribute structure to query.
348-
*
349-
* \return The key type stored in the attribute structure.
350-
*/
351-
static psa_key_type_t psa_get_key_type(const psa_key_attributes_t *attributes);
352-
353-
/** Retrieve the key size from key attributes.
354-
*
355-
* This function may be declared as `static` (i.e. without external
356-
* linkage). This function may be provided as a function-like macro,
357-
* but in this case it must evaluate its argument exactly once.
358-
*
359-
* \param[in] attributes The key attribute structure to query.
360-
*
361-
* \return The key size stored in the attribute structure, in bits.
362-
*/
363-
static size_t psa_get_key_bits(const psa_key_attributes_t *attributes);
364-
365120
/** Retrieve the attributes of a key.
366121
*
367122
* This function first resets the attribute structure as with
@@ -945,10 +700,6 @@ typedef struct psa_hash_operation_s psa_hash_operation_t;
945700
* of type #psa_hash_operation_t.
946701
*/
947702

948-
/** Return an initial value for a hash operation object.
949-
*/
950-
static psa_hash_operation_t psa_hash_operation_init(void);
951-
952703
/** Set up a multipart hash operation.
953704
*
954705
* The sequence of operations to calculate a hash (message digest)
@@ -1213,10 +964,6 @@ typedef struct psa_xof_operation_s psa_xof_operation_t;
1213964
* of type #psa_xof_operation_t.
1214965
*/
1215966

1216-
/** Return an initial value for a XOF operation object.
1217-
*/
1218-
static psa_xof_operation_t psa_xof_operation_init(void);
1219-
1220967
/** Set up a multipart XOF (extendable-operation function) operation.
1221968
*
1222969
* The sequence of operations to calculate a XOF is as follows:
@@ -1493,10 +1240,6 @@ typedef struct psa_mac_operation_s psa_mac_operation_t;
14931240
* #psa_mac_operation_t.
14941241
*/
14951242

1496-
/** Return an initial value for a MAC operation object.
1497-
*/
1498-
static psa_mac_operation_t psa_mac_operation_init(void);
1499-
15001243
/** Set up a multipart MAC calculation operation.
15011244
*
15021245
* This function sets up the calculation of the MAC
@@ -1906,10 +1649,6 @@ typedef struct psa_cipher_operation_s psa_cipher_operation_t;
19061649
* type #psa_cipher_operation_t.
19071650
*/
19081651

1909-
/** Return an initial value for a cipher operation object.
1910-
*/
1911-
static psa_cipher_operation_t psa_cipher_operation_init(void);
1912-
19131652
/** Set the key for a multipart symmetric encryption operation.
19141653
*
19151654
* The sequence of operations to encrypt a message with a symmetric cipher
@@ -2424,10 +2163,6 @@ typedef struct psa_aead_operation_s psa_aead_operation_t;
24242163
* type #psa_aead_operation_t.
24252164
*/
24262165

2427-
/** Return an initial value for an AEAD operation object.
2428-
*/
2429-
static psa_aead_operation_t psa_aead_operation_init(void);
2430-
24312166
/** Set the key for a multipart authenticated encryption operation.
24322167
*
24332168
* The sequence of operations to encrypt a message with authentication
@@ -3411,10 +3146,6 @@ typedef struct psa_key_derivation_s psa_key_derivation_operation_t;
34113146
* object of type #psa_key_derivation_operation_t.
34123147
*/
34133148

3414-
/** Return an initial value for a key derivation operation object.
3415-
*/
3416-
static psa_key_derivation_operation_t psa_key_derivation_operation_init(void);
3417-
34183149
/** Set up a key derivation operation.
34193150
*
34203151
* A key derivation algorithm takes some inputs and uses them to generate

0 commit comments

Comments
 (0)