aboutsummaryrefslogtreecommitdiff
path: root/include/libwebsockets/lws-genaes.h
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2018-12-13 20:05:12 +0800
committerAndy Green <andy@warmcat.com>2018-12-27 06:45:32 +0800
commiteda102e39760b89d94a76a2b58cd052752874c80 (patch)
treeefb8736400afd4e7342c75eed8c5798133f150e3 /include/libwebsockets/lws-genaes.h
parenta3dcc95471c34c9a819ee1327ac03a74d1fb4f78 (diff)
downloadlibwebsockets-eda102e39760b89d94a76a2b58cd052752874c80.tar.gz
jwe
Diffstat (limited to 'include/libwebsockets/lws-genaes.h')
-rw-r--r--include/libwebsockets/lws-genaes.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/include/libwebsockets/lws-genaes.h b/include/libwebsockets/lws-genaes.h
index 1e7c3cdc..aecb68d3 100644
--- a/include/libwebsockets/lws-genaes.h
+++ b/include/libwebsockets/lws-genaes.h
@@ -46,6 +46,7 @@ enum enum_aes_modes {
LWS_GAESM_OFB,
LWS_GAESM_XTS, /* care... requires double-length key */
LWS_GAESM_GCM,
+ LWS_GAESM_KW,
};
enum enum_aes_operation {
@@ -53,6 +54,11 @@ enum enum_aes_operation {
LWS_GAESO_DEC
};
+enum enum_aes_padding {
+ LWS_GAESP_NO_PADDING,
+ LWS_GAESP_WITH_PADDING
+};
+
/* include/libwebsockets/lws-jwk.h must be included before this */
#define LWS_AES_BLOCKSIZE 128
@@ -99,7 +105,7 @@ struct lws_genaes_ctx {
LWS_VISIBLE LWS_EXTERN int
lws_genaes_create(struct lws_genaes_ctx *ctx, enum enum_aes_operation op,
enum enum_aes_modes mode, struct lws_gencrypto_keyelem *el,
- int padding, void *engine);
+ enum enum_aes_padding padding, void *engine);
/** lws_genaes_destroy() - Destroy genaes AES context
*
@@ -119,21 +125,22 @@ lws_genaes_destroy(struct lws_genaes_ctx *ctx, unsigned char *tag, size_t tlen);
/** lws_genaes_crypt() - Encrypt or decrypt
*
* \param ctx: your struct lws_genaes_ctx
+ * \param in: input plaintext or ciphertext
+ * \param len: length of input (which is always length of output)
+ * \param out: output plaintext or ciphertext
* \param op: LWS_GAESO_ENC or LWS_GAESO_DEC
* \param iv_or_nonce_ctr_or_data_unit_16: NULL, iv, nonce_ctr16, or data_unit16
* \param stream_block_16: pointer to 16-byte stream block for CTR mode only
* \param nc_or_iv_off: NULL or pointer to nc, or iv_off
- * \param in: input plaintext or ciphertext
- * \param len: length of input (which is always length of output)
- * \param out: output plaintext or ciphertext
+ * \param taglen: length of tag
*
* Encrypts or decrypts using the AES mode set when the ctx was created.
* The last three arguments have different meanings depending on the mode:
*
- * CBC CFB128 CFB8 CTR ECB OFB XTS
- * iv_or_nonce_ctr_or_data_unit_16 : iv iv iv nonce NULL iv dataunt
- * stream_block_16 : NULL NULL NULL stream NULL NULL NULL
- * nc_or_iv_off : NULL iv_off NULL nc_off NULL iv_off NULL
+ * KW CBC CFB128 CFB8 CTR ECB OFB XTS
+ * iv_or_nonce_ct.._unit_16 : iv iv iv iv nonce NULL iv dataunt
+ * stream_block_16 : NULL NULL NULL NULL stream NULL NULL NULL
+ * nc_or_iv_off : NULL NULL iv_off NULL nc_off NULL iv_off NULL
*
* For GCM:
*