Skip to content

Commit 3b63e4b

Browse files
authored
Merge pull request #221 from athoelke/crypto-signature-introduction
Provide an clear overview of the asymmetric signature API
2 parents b2eab5e + 32ce931 commit 3b63e4b

File tree

7 files changed

+354
-373
lines changed

7 files changed

+354
-373
lines changed

doc/crypto/api/keys/policy.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ The usage flags are encoded in a bitmask, which has the type `psa_key_usage_t`.
204204
.. summary::
205205
Permission to sign a message hash with the key.
206206

207-
This flag is required to use the key to sign a message hash in an asymmetric signature operation. The flag must be present on keys used when calling `psa_sign_hash()`.
207+
This flag is required to use the key to sign a pre-computed message hash in an asymmetric signature operation. The flag must be present on keys used with the following APIs:
208+
209+
* `psa_sign_hash()`
208210

209211
This flag automatically sets `PSA_KEY_USAGE_SIGN_MESSAGE`: if an application sets the flag `PSA_KEY_USAGE_SIGN_HASH` when creating a key, then the key always has the permissions conveyed by `PSA_KEY_USAGE_SIGN_MESSAGE`, and the flag `PSA_KEY_USAGE_SIGN_MESSAGE` will also be present when the application queries the usage flags of the key.
210212

@@ -216,7 +218,9 @@ The usage flags are encoded in a bitmask, which has the type `psa_key_usage_t`.
216218
.. summary::
217219
Permission to verify a message hash with the key.
218220

219-
This flag is required to use the key to verify a message hash in an asymmetric signature verification operation. The flag must be present on keys used when calling `psa_verify_hash()`.
221+
This flag is required to use the key to verify a pre-computed message hash in an asymmetric signature verification operation. The flag must be present on keys used with the following APIs:
222+
223+
* `psa_verify_hash()`
220224

221225
This flag automatically sets `PSA_KEY_USAGE_VERIFY_MESSAGE`: if an application sets the flag `PSA_KEY_USAGE_VERIFY_HASH` when creating a key, then the key always has the permissions conveyed by `PSA_KEY_USAGE_VERIFY_MESSAGE`, and the flag `PSA_KEY_USAGE_VERIFY_MESSAGE` will also be present when the application queries the usage flags of the key.
222226

doc/crypto/api/library/status.rst

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,29 @@ The following elements are defined in :file:`psa/error.h` from :cite-title:`PSA-
1212

1313
.. code-block:: xref
1414
15-
typedef int32_t psa_status_t;
16-
17-
#define PSA_SUCCESS ((psa_status_t)0)
18-
19-
#define PSA_ERROR_GENERIC_ERROR ((psa_status_t)-132)
20-
#define PSA_ERROR_NOT_PERMITTED ((psa_status_t)-133)
21-
#define PSA_ERROR_NOT_SUPPORTED ((psa_status_t)-134)
22-
#define PSA_ERROR_INVALID_ARGUMENT ((psa_status_t)-135)
23-
#define PSA_ERROR_INVALID_HANDLE ((psa_status_t)-136)
24-
#define PSA_ERROR_BAD_STATE ((psa_status_t)-137)
25-
#define PSA_ERROR_BUFFER_TOO_SMALL ((psa_status_t)-138)
26-
#define PSA_ERROR_ALREADY_EXISTS ((psa_status_t)-139)
27-
#define PSA_ERROR_DOES_NOT_EXIST ((psa_status_t)-140)
28-
#define PSA_ERROR_INSUFFICIENT_MEMORY ((psa_status_t)-141)
29-
#define PSA_ERROR_INSUFFICIENT_STORAGE ((psa_status_t)-142)
30-
#define PSA_ERROR_INSUFFICIENT_DATA ((psa_status_t)-143)
31-
#define PSA_ERROR_COMMUNICATION_FAILURE ((psa_status_t)-145)
32-
#define PSA_ERROR_STORAGE_FAILURE ((psa_status_t)-146)
33-
#define PSA_ERROR_HARDWARE_FAILURE ((psa_status_t)-147)
34-
#define PSA_ERROR_INVALID_SIGNATURE ((psa_status_t)-149)
35-
#define PSA_ERROR_CORRUPTION_DETECTED ((psa_status_t)-151)
36-
#define PSA_ERROR_DATA_CORRUPT ((psa_status_t)-152)
37-
#define PSA_ERROR_DATA_INVALID ((psa_status_t)-153)
15+
typedef int32_t psa_status_t;
16+
17+
#define PSA_SUCCESS ((psa_status_t)0)
18+
19+
#define PSA_ERROR_GENERIC_ERROR ((psa_status_t)-132)
20+
#define PSA_ERROR_NOT_PERMITTED ((psa_status_t)-133)
21+
#define PSA_ERROR_NOT_SUPPORTED ((psa_status_t)-134)
22+
#define PSA_ERROR_INVALID_ARGUMENT ((psa_status_t)-135)
23+
#define PSA_ERROR_INVALID_HANDLE ((psa_status_t)-136)
24+
#define PSA_ERROR_BAD_STATE ((psa_status_t)-137)
25+
#define PSA_ERROR_BUFFER_TOO_SMALL ((psa_status_t)-138)
26+
#define PSA_ERROR_ALREADY_EXISTS ((psa_status_t)-139)
27+
#define PSA_ERROR_DOES_NOT_EXIST ((psa_status_t)-140)
28+
#define PSA_ERROR_INSUFFICIENT_MEMORY ((psa_status_t)-141)
29+
#define PSA_ERROR_INSUFFICIENT_STORAGE ((psa_status_t)-142)
30+
#define PSA_ERROR_INSUFFICIENT_DATA ((psa_status_t)-143)
31+
#define PSA_ERROR_COMMUNICATION_FAILURE ((psa_status_t)-145)
32+
#define PSA_ERROR_STORAGE_FAILURE ((psa_status_t)-146)
33+
#define PSA_ERROR_HARDWARE_FAILURE ((psa_status_t)-147)
34+
#define PSA_ERROR_INVALID_SIGNATURE ((psa_status_t)-149)
35+
#define PSA_ERROR_CORRUPTION_DETECTED ((psa_status_t)-151)
36+
#define PSA_ERROR_DATA_CORRUPT ((psa_status_t)-152)
37+
#define PSA_ERROR_DATA_INVALID ((psa_status_t)-153)
3838
3939
These definitions must be available to an application that includes the :file:`psa/crypto.h` header file.
4040

@@ -89,7 +89,7 @@ Some of the common status codes have a more precise meaning when returned by a f
8989
.. _specific-errors:
9090

9191
Error codes specific to the |API|
92-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
92+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9393

9494
.. header:: psa/crypto
9595
:seq: 2

doc/crypto/api/ops/algorithms.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The specific algorithm identifiers are described alongside the cryptographic ope
2020
* :secref:`cipher-algorithms`
2121
* :secref:`aead-algorithms`
2222
* :secref:`key-derivation-algorithms`
23-
* :secref:`sign-algorithms`
23+
* :secref:`sign`
2424
* :secref:`asymmetric-encryption-algorithms`
2525
* :secref:`key-agreement-algorithms`
2626
* :secref:`pake`
@@ -150,7 +150,7 @@ Algorithm categories
150150
.. return::
151151
``1`` if ``alg`` is an asymmetric signature algorithm, ``0`` otherwise. This macro can return either ``0`` or ``1`` if ``alg`` is not a supported algorithm identifier.
152152

153-
See :secref:`sign-algorithms` for a list of defined signature algorithms.
153+
See :secref:`sign` for a list of defined signature algorithms.
154154

155155
.. macro:: PSA_ALG_IS_ASYMMETRIC_ENCRYPTION
156156
:definition: /* specification-defined value */

doc/crypto/api/ops/hash.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ Hash algorithms
184184
.. summary::
185185
The first 512 bits (64 bytes) of the SHAKE256 output.
186186

187-
This is the prehashing for Ed448ph (see `PSA_ALG_ED448PH`).
187+
This is the pre-hashing for Ed448ph (see `PSA_ALG_ED448PH`).
188188

189189
SHAKE256 is defined in :cite:`FIPS202`.
190190

0 commit comments

Comments
 (0)