common/cnxk: swap ZUC-256 key
[dpdk.git] / drivers / common / cnxk / roc_se.h
index 5be832f..c565ec1 100644 (file)
 #define ROC_SE_FC_MINOR_OP_DECRYPT    0x1
 #define ROC_SE_FC_MINOR_OP_HMAC_FIRST 0x10
 
-#define ROC_SE_MAJOR_OP_HASH      0x34
-#define ROC_SE_MAJOR_OP_HMAC      0x35
-#define ROC_SE_MAJOR_OP_ZUC_SNOW3G 0x37
-#define ROC_SE_MAJOR_OP_KASUMI    0x38
-#define ROC_SE_MAJOR_OP_MISC      0x01
+#define ROC_SE_MAJOR_OP_HASH   0x34
+#define ROC_SE_MAJOR_OP_HMAC   0x35
+#define ROC_SE_MAJOR_OP_PDCP   0x37
+#define ROC_SE_MAJOR_OP_KASUMI 0x38
+
+#define ROC_SE_MAJOR_OP_MISC            0x01
+#define ROC_SE_MISC_MINOR_OP_PASSTHROUGH 0x03
+#define ROC_SE_MISC_MINOR_OP_DUMMY      0x04
+#define ROC_SE_MISC_MINOR_OP_HW_SUPPORT         0x08
 
 #define ROC_SE_MAX_AAD_SIZE 64
 #define ROC_SE_MAX_MAC_LEN  64
@@ -242,7 +246,7 @@ struct roc_se_buf_ptr {
 /* IOV Pointer */
 struct roc_se_iov_ptr {
        int buf_cnt;
-       struct roc_se_buf_ptr bufs[0];
+       struct roc_se_buf_ptr bufs[];
 };
 
 struct roc_se_fc_params {
@@ -297,6 +301,27 @@ struct roc_se_ctx {
        uint8_t *auth_key;
 };
 
+static inline void
+roc_se_zuc_bytes_swap(uint8_t *arr, int len)
+{
+       int start, end;
+       uint8_t tmp;
+
+       if (len <= 0)
+               return;
+
+       start = 0;
+       end = len - 1;
+
+       while (start < end) {
+               tmp = arr[start];
+               arr[start] = arr[end];
+               arr[end] = tmp;
+               start++;
+               end--;
+       }
+}
+
 int __roc_api roc_se_auth_key_set(struct roc_se_ctx *se_ctx,
                                  roc_se_auth_type type, const uint8_t *key,
                                  uint16_t key_len, uint16_t mac_len);
@@ -306,4 +331,5 @@ int __roc_api roc_se_ciph_key_set(struct roc_se_ctx *se_ctx,
                                  uint16_t key_len, uint8_t *salt);
 
 void __roc_api roc_se_ctx_swap(struct roc_se_ctx *se_ctx);
+
 #endif /* __ROC_SE_H__ */