+typedef enum {
+ mgm_associated_data = 0,
+ mgm_main_data,
+} mgm_state;
+
+typedef struct {
+ gost_grasshopper_cipher_ctx c;
+ grasshopper_w128_t partial_buffer;
+
+ mgm_state mgm_state; /* associated_data/plain text */
+ grasshopper_w128_t mgm_iv[16]; /* nonce */
+ grasshopper_w128_t mgm_partial_buffer; /* Rest of associated data */
+ size_t ad_length;
+ size_t taglen; /* MAC length*/
+ unsigned char tag[16]; /* MAC - intermediate state */
+ unsigned char final_tag[16]; /* MAC - final state*/
+} gost_grasshopper_cipher_ctx_mgm;
+