You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/crypto/api/keys/management.rst
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -155,7 +155,7 @@ When creating a key, the attributes for the new key are specified in a `psa_key_
155
155
156
156
The following type-specific considerations apply:
157
157
158
-
* For RSA keys (`PSA_KEY_TYPE_RSA_KEY_PAIR`), the public exponent is 65537. The modulus is a product of two probabilistic primes between 2^{n-1} and 2^n where n is the bit size specified in the attributes.
158
+
* For RSA keys (`PSA_KEY_TYPE_RSA_KEY_PAIR`), the public exponent is 65537. The modulus is a product of two probabilistic primes between :math:`2^{n-1}` and :math:`2^n` where :math:`n` is the bit size specified in the attributes.
159
159
160
160
.. function:: psa_copy_key
161
161
@@ -626,29 +626,29 @@ This section defines the format of the key data that an implementation is requir
626
626
627
627
The key data is the content of the ``privateKey`` field of the ``ECPrivateKey`` format defined by :RFC-title:`5915`.
628
628
629
-
This is a ``ceiling(m/8)``-byte string in big-endian order where ``m`` is the key size in bits.
629
+
This is a :math:`\lceil{m/8}\rceil`-byte string in big-endian order, where :math:`m` is the key size in bits.
630
630
631
631
* - Weierstrass Elliptic curve public key
632
632
- :code:`PSA_KEY_TYPE_ECC_PUBLIC_KEY(ecc_family)`, where ``ecc_family`` designates a Weierstrass curve family.
633
633
634
634
The key data is the uncompressed representation of an elliptic curve point as an octet string defined in :cite-title:`SEC1` §2.3.3.
635
-
If ``m`` is the bit size associated with the curve, i.e. the bit size of ``q`` for a curve over ``F_q``, then the representation consists of:
635
+
If :math:`m` is the bit size associated with the curve, i.e. the bit size of :math:`q` for a curve over :math:`\mathbb{F}_q`, then the representation of point :math:`P` consists of:
636
636
637
637
* The byte ``0x04``;
638
-
* ``x_P`` as a ``ceiling(m/8)``-byte string, big-endian;
639
-
* ``y_P`` as a ``ceiling(m/8)``-byte string, big-endian.
638
+
* :math:`x_P` as a :math:`\lceil{m/8}\rceil`-byte string, big-endian;
639
+
* :math:`y_P` as a :math:`\lceil{m/8}\rceil`-byte string, big-endian.
The key data is the scalar value of the 'private key' in little-endian order as defined by :RFC-title:`7748#6`. The value must have the forced bits set to zero or one as specified by ``decodeScalar25519()`` and ``decodeScalar448()`` in :RFC:`7748#5`.
645
645
646
-
This is a ``ceiling(m/8)``-byte string where ``m`` is the key size in bits. This is 32 bytes for Curve25519, and 56 bytes for Curve448.
646
+
This is a :math:`\lceil{m/8}\rceil`-byte string where :math:`m` is the key size in bits. This is 32 bytes for Curve25519, and 56 bytes for Curve448.
The key data is the scalar value of the 'public key' in little-endian order as defined by :RFC-title:`7748#6`. This is a ``ceiling(m/8)``-byte string where ``m`` is the key size in bits.
651
+
The key data is the scalar value of the 'public key' in little-endian order as defined by :RFC-title:`7748#6`. This is a :math:`\lceil{m/8}\rceil`-byte string where :math:`m` is the key size in bits.
652
652
653
653
* This is 32 bytes for Curve25519, computed as ``X25519(private_key, 9)``.
654
654
* This is 56 bytes for Curve448, computed as ``X448(private_key, 5)``.
@@ -670,9 +670,9 @@ This section defines the format of the key data that an implementation is requir
670
670
* - Finite-field Diffie-Hellman key pair
671
671
- :code:`PSA_KEY_TYPE_DH_KEY_PAIR(dh_family)` where ``dh_family`` designates any Diffie-Hellman family.
672
672
673
-
The key data is the representation of the private key ``x`` as a big-endian byte string. The length of the byte string is the private key size in bytes, and leading zeroes are not stripped.
673
+
The key data is the representation of the private key :math:`x` as a big-endian byte string. The length of the byte string is the private key size in bytes, and leading zeroes are not stripped.
674
674
675
675
* - Finite-field Diffie-Hellman public key
676
676
- :code:`PSA_KEY_TYPE_DH_PUBLIC_KEY(dh_family)` where ``dh_family`` designates any Diffie-Hellman family.
677
677
678
-
The key data is the representation of the public key ``y = g^xmod p`` as a big-endian byte string. The length of the byte string is the length of the base prime ``p`` in bytes.
678
+
The key data is the representation of the public key :math:`y = g^x\!\mod p` as a big-endian byte string. The length of the byte string is the length of the base prime :math:`p` in bytes.
Copy file name to clipboardExpand all lines: doc/crypto/api/keys/types.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -495,7 +495,7 @@ Elliptic Curve keys
495
495
.. summary::
496
496
Elliptic curve key pair: both the private and public key.
497
497
498
-
The size of an elliptic curve key is the bit size associated with the curve, that is, the bit size of *q* for a curve over a field *F*\ :sub:`q`. See the documentation of each Elliptic curve family for details.
498
+
The size of an elliptic curve key is the bit size associated with the curve, that is, the bit size of :math:`q`` for a curve over a field :math:`\mathbb{F}_q`. See the documentation of each Elliptic curve family for details.
499
499
500
500
.. param:: curve
501
501
A value of type `psa_ecc_family_t` that identifies the ECC curve family to be used.
Copy file name to clipboardExpand all lines: doc/crypto/api/ops/aead.rst
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,13 +58,13 @@ AEAD algorithms
58
58
59
59
To use `PSA_ALG_CCM` with a multi-part AEAD operation, the application must call `psa_aead_set_lengths()` before providing the nonce, the additional data and plaintext to the operation.
60
60
61
-
CCM requires a nonce of between 7 and 13 bytes in length. The length of the nonce affects the maximum length of the plaintext than can be encrypted or decrypted. If the nonce has length *N*, then the plaintext length *pLen* is encoded in *L* = 15 - *N* octets, this requires that *pLen* < 2\ :sup:`8L`.
61
+
CCM requires a nonce of between 7 and 13 bytes in length. The length of the nonce affects the maximum length of the plaintext than can be encrypted or decrypted. If the nonce has length :math:`N`, then the plaintext length :math:`pLen` is encoded in :math:`L = 15 - N` octets, this requires that :math:`pLen < 2^{8L}`.
62
62
63
-
The value for *L* that is used with `PSA_ALG_CCM` depends on the function used to provide the nonce:
63
+
The value for :math:`L` that is used with `PSA_ALG_CCM` depends on the function used to provide the nonce:
64
64
65
-
* A call to `psa_aead_encrypt()`, `psa_aead_decrypt()`, or `psa_aead_set_nonce()` will set *L* to 15 - ``nonce_length``. If the plaintext length cannot be encoded in *L* octets, then a :code:`PSA_ERROR_INVALID_ARGUMENT` error is returned.
65
+
* A call to `psa_aead_encrypt()`, `psa_aead_decrypt()`, or `psa_aead_set_nonce()` will set :math:`L =15 - \mathtt{nonce\_length}`. If the plaintext length cannot be encoded in :math:`L` octets, then a :code:`PSA_ERROR_INVALID_ARGUMENT` error is returned.
66
66
67
-
* A call to `psa_aead_generate_nonce()` on a multi-part cipher operation will select *L* as the smallest integer >= 2 where *pLen* < 2\ :sup:`8L`, with *pLen* being the ``plaintext_length`` provided to `psa_aead_set_lengths()`. The call to `psa_aead_generate_nonce()` will generate and return a random nonce of length 15 - *L* bytes.
67
+
* A call to `psa_aead_generate_nonce()` on a multi-part cipher operation will select the smallest integer :math:`L \geq2`, where :math:`pLen < 2^{8L}`, with :math:`pLen` being the ``plaintext_length`` provided to `psa_aead_set_lengths()`. The call to `psa_aead_generate_nonce()` will generate and return a random nonce of length :math:`15 - L` bytes.
68
68
69
69
CCM supports authentication tag sizes of 4, 6, 8, 10, 12, 14, and 16 bytes. The default tag length is 16. Shortened tag lengths can be requested using :code:`PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, tag_length)`, where ``tag_length`` is a valid CCM tag length.
Copy file name to clipboardExpand all lines: doc/crypto/api/ops/ciphers.rst
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -119,7 +119,7 @@ Cipher algorithms
119
119
120
120
A counter block value must only be used once across all messages encrypted using the same key value. This is typically achieved by splitting the counter block into a nonce, which is unique among all message encrypted with the key, and a counter which is incremented for each block of a message.
121
121
122
-
For example, when using AES-CTR encryption, which uses a 16-byte block, the application can provide a 12-byte nonce when setting the IV. This leaves 4 bytes for the counter, allowing up to 2^32 blocks (64GB) of message data to be encrypted in each message.
122
+
For example, when using AES-CTR encryption, which uses a 16-byte block, the application can provide a 12-byte nonce when setting the IV. This leaves 4 bytes for the counter, allowing up to :math:`2^{32}` blocks (64GB) of message data to be encrypted in each message.
123
123
124
124
The first counter block is constructed from the initialization vector (IV). The initial counter block is is constructed in the following ways:
125
125
@@ -129,7 +129,7 @@ Cipher algorithms
129
129
130
130
* A call to `psa_cipher_generate_iv()` on a multi-part cipher operation will generate and return a random counter block value.
131
131
132
-
* A call to `psa_cipher_set_iv()` on a multi-part cipher operation requires an IV that is between ``1`` and *n* bytes in length, where *n* is the cipher block length. The counter block is initialized using the IV, and padded with zero bytes up to the block length.
132
+
* A call to `psa_cipher_set_iv()` on a multi-part cipher operation requires an IV that is between ``1`` and :math:`n` bytes in length, where :math:`n` is the cipher block length. The counter block is initialized using the IV, and padded with zero bytes up to the block length.
133
133
134
134
During the counter block update operation, the counter block is treated as a single big-endian encoded integer and the update operation increments this integer by ``1``.
135
135
@@ -170,15 +170,15 @@ Cipher algorithms
170
170
171
171
The Zigbee message encryption algorithm is based on CCM*. This is detailed in :cite-title:`ZIGBEE` §B.1.1 and §A.
172
172
173
-
* For unauthenticated messages — when *M* = 0 --- the `PSA_ALG_CCM_STAR_NO_TAG` algorithm is used with an AES-128 key in a multi-part cipher operation. The 13-byte IV must be constructed as specified in `[ZIGBEE]`, and provided to the operation using `psa_cipher_set_iv()`.
173
+
* For unauthenticated messages --- when tag length :math:`M = 0` --- the `PSA_ALG_CCM_STAR_NO_TAG` algorithm is used with an AES-128 key in a multi-part cipher operation. The 13-byte IV must be constructed as specified in `[ZIGBEE]`, and provided to the operation using `psa_cipher_set_iv()`.
174
174
175
175
.. note::
176
176
177
177
An implementation of Zigbee cannot use the single-part `psa_cipher_encrypt()` function, as this generates a random IV, which is not valid for the Zigbee protocol.
178
178
179
-
* For authenticated messages — when *M* ∈ {4, 8, 16} --- the :code:`PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, tag_length)` algorithm is used with an AES-128 key, where ``tag_length`` is the required value of *M*. The 13-byte nonce must be constructed as specified in `[ZIGBEE]`.
179
+
* For authenticated messages --- when tag length :math:`M \in\{4, 8, 16\}` --- the :code:`PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, tag_length)` algorithm is used with an AES-128 key, where ``tag_length`` is the required value of :math:`M`. The 13-byte nonce must be constructed as specified in `[ZIGBEE]`.
180
180
181
-
As the default tag length for CCM is 16, then `PSA_ALG_CCM` algorithm can be used when *M* = 16.
181
+
As the default tag length for CCM is 16, then `PSA_ALG_CCM` algorithm can be used when :math:`M = 16`.
182
182
183
183
* To enable a single AES-128 key to be used for both the `PSA_ALG_CCM_STAR_NO_TAG` cipher and `PSA_ALG_CCM` AEAD algorithm, the key can be defined with the wildcard `PSA_ALG_CCM_STAR_ANY_TAG` permitted algorithm.
184
184
@@ -206,7 +206,7 @@ Cipher algorithms
206
206
.. note::
207
207
The cipher block length can be determined using `PSA_BLOCK_CIPHER_BLOCK_LENGTH()`.
208
208
209
-
The CFB block cipher mode is defined in :cite-title:`SP800-38A`, using a segment size *s* equal to the block size *b*. The definition in `[SP800-38A]` is extended to allow an incomplete final block of input, in which case the algorithm discards the final bytes of the key stream when encrypting or decrypting the final partial block.
209
+
The CFB block cipher mode is defined in :cite-title:`SP800-38A`, using a segment size :math:`s` equal to the block size :math:`b`. The definition in `[SP800-38A]` is extended to allow an incomplete final block of input, in which case the algorithm discards the final bytes of the key stream when encrypting or decrypting the final partial block.
Copy file name to clipboardExpand all lines: doc/crypto/api/ops/hashes.rst
+27-23Lines changed: 27 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,7 +81,7 @@ Hash algorithms
81
81
82
82
This is the cryptographic hash function based on the Merkle-Damgård construction over a Matyas-Meyer-Oseas one-way compression function and the AES-128 block cipher, with the parametrization defined in :cite-title:`ZIGBEE` §B.6.
83
83
84
-
This hash function can operate on input strings of up to 2\ :sup:`32` - 1 bits.
84
+
This hash function can operate on input strings of up to :math:`2^{32} - 1` bits.
The fields in the hash suspend state are defined as follows:
786
788
787
-
*algorithm*
789
+
:math:`algorithm`
788
790
A big-endian 32-bit unsigned integer.
789
791
790
792
The |API| algorithm identifier value.
791
793
792
-
The byte length of the *algorithm* field can be evaluated using `PSA_HASH_SUSPEND_ALGORITHM_FIELD_LENGTH`.
794
+
The byte length of the :math:`algorithm` field can be evaluated using `PSA_HASH_SUSPEND_ALGORITHM_FIELD_LENGTH`.
793
795
794
-
*input-length*
796
+
:math:`input\_length`
795
797
A big-endian unsigned integer
796
798
797
799
The content of this field is algorithm-specific:
798
800
799
-
* For MD2, this is the number of bytes in the *unprocessed-input*.
800
-
* For all other hash algorithms, this is the total number of bytes of input to the hash computation. This includes the *unprocessed-input* bytes.
801
+
* For MD2, this is the number of bytes in :math:`unprocessed\_input`.
802
+
* For all other hash algorithms, this is the total number of bytes of input to the hash computation. This includes the :math:`unprocessed\_input` bytes.
801
803
802
804
The size of this field is algorithm-specific:
803
805
804
-
* For MD2: *input-length* is an 8-bit unsigned integer.
805
-
* For MD4, MD5, RIPEMD-160, SHA-1, SHA-224, and SHA-256: *input-length* is a 64-bit unsigned integer.
806
-
* For SHA-512/224, SHA-512/256, SHA-384, and SHA-512: *input-length* is a 128-bit unsigned integer.
806
+
* For MD2: :math:`input\_length` is an 8-bit unsigned integer.
807
+
* For MD4, MD5, RIPEMD-160, SHA-1, SHA-224, and SHA-256: :math:`input\_length` is a 64-bit unsigned integer.
808
+
* For SHA-512/224, SHA-512/256, SHA-384, and SHA-512: :math:`input\_length` is a 128-bit unsigned integer.
807
809
808
-
The length, in bytes, of the *input-length* field can be calculated using :code:`PSA_HASH_SUSPEND_INPUT_LENGTH_FIELD_LENGTH(alg)` where ``alg`` is a hash algorithm.
810
+
The length, in bytes, of the :math:`input\_length` field can be calculated using :code:`PSA_HASH_SUSPEND_INPUT_LENGTH_FIELD_LENGTH(alg)` where ``alg`` is a hash algorithm.
809
811
See :secref:`hash-suspend-state-constants`.
810
812
811
-
*hash-state*
813
+
:math:`hash\_state`
812
814
An array of bytes
813
815
814
816
Algorithm-specific intermediate hash state:
@@ -821,17 +823,19 @@ The fields in the hash suspend state are defined as follows:
821
823
* For SHA-512/224, SHA-512/256, SHA-384, and SHA-512: 8x 64-bit integers, in big-endian encoding.
822
824
823
825
The length of this field is specific to the algorithm.
824
-
The length, in bytes, of the *hash-state* field can be calculated using :code:`PSA_HASH_SUSPEND_HASH_STATE_FIELD_LENGTH(alg)` where ``alg`` is a hash algorithm.
826
+
The length, in bytes, of the :math:`hash\_state` field can be calculated using :code:`PSA_HASH_SUSPEND_HASH_STATE_FIELD_LENGTH(alg)` where ``alg`` is a hash algorithm.
The *hash-block-size* is specific to the algorithm.
838
+
The value of :math:`hash\_block\_size` is specific to the hash algorithm.
835
839
The size of a hash block can be calculated using :code:`PSA_HASH_BLOCK_LENGTH(alg)` where ``alg`` is a hash algorithm.
836
840
See :secref:`hash-suspend-state-constants`.
837
841
@@ -842,18 +846,18 @@ Hash suspend state field sizes
842
846
843
847
The following table defines the algorithm-specific field lengths for the hash suspend state returned by `psa_hash_suspend()`. All of the field lengths are in bytes. To compute the field lengths for algorithm ``alg``, use the following expressions:
844
848
845
-
* :code:`PSA_HASH_SUSPEND_ALGORITHM_FIELD_LENGTH` returns the length of the *algorithm* field.
846
-
* :code:`PSA_HASH_SUSPEND_INPUT_LENGTH_FIELD_LENGTH(alg)` returns the length of the *input-length* field.
847
-
* :code:`PSA_HASH_SUSPEND_HASH_STATE_FIELD_LENGTH(alg)` returns the length of the *hash-state* field.
848
-
* :code:`PSA_HASH_BLOCK_LENGTH(alg)-1` is the maximum length of the *unprocessed-bytes* field.
849
+
* :code:`PSA_HASH_SUSPEND_ALGORITHM_FIELD_LENGTH` returns the length of the :math:`algorithm` field.
850
+
* :code:`PSA_HASH_SUSPEND_INPUT_LENGTH_FIELD_LENGTH(alg)` returns the length of the :math:`input\_length` field.
851
+
* :code:`PSA_HASH_SUSPEND_HASH_STATE_FIELD_LENGTH(alg)` returns the length of the :math:`hash\_state` field.
852
+
* :code:`PSA_HASH_BLOCK_LENGTH(alg) - 1` is the maximum length of the :math:`unprocessed\_bytes` field.
849
853
* :code:`PSA_HASH_SUSPEND_OUTPUT_SIZE(alg)` returns the maximum size of the hash suspend state.
0 commit comments