+/**
+ * GMAC is essentially zero length plaintext and uses AAD as input data.
+ * NIST does not have GMAC specific test vector but using zero length "PTlen"
+ * and uses AAD as input.
+ **/
+static int
+parser_read_gcm_pt_len(const char *key, char *src,
+ __rte_unused struct fips_val *val)
+{
+ int ret = parser_read_uint32_bit_val(key, src, &vec.pt);
+
+ if (ret < 0)
+ return ret;
+
+ if (vec.pt.len == 0) {
+ info.interim_info.gcm_data.is_gmac = 1;
+ test_ops.prepare_op = prepare_auth_op;
+ test_ops.prepare_xform = prepare_gmac_xform;
+ } else {
+ info.interim_info.gcm_data.is_gmac = 0;
+ test_ops.prepare_op = prepare_aead_op;
+ test_ops.prepare_xform = prepare_gcm_xform;
+ }
+
+ return ret;
+}
+
+static int
+parse_gcm_aad_str(const char *key, char *src,
+ __rte_unused struct fips_val *val)
+{
+ /* For GMAC test vector, AAD is treated as input */
+ if (info.interim_info.gcm_data.is_gmac) {
+ vec.pt.len = vec.aead.aad.len;
+ return parse_uint8_known_len_hex_str(key, src, &vec.pt);
+ } else /* gcm */
+ return parse_uint8_known_len_hex_str(key, src, &vec.aead.aad);
+}
+
+static int
+parse_gcm_pt_ct_str(const char *key, char *src, struct fips_val *val)
+{
+ /* According to NIST GCMVS section 6.1, IUT should generate IV data */
+ if (info.interim_info.gcm_data.gen_iv && vec.iv.len) {
+ uint32_t i;
+
+ if (!vec.iv.val) {
+ vec.iv.val = rte_malloc(0, vec.iv.len, 0);
+ if (!vec.iv.val)
+ return -ENOMEM;
+ }
+
+ for (i = 0; i < vec.iv.len; i++) {
+ int random = rand();
+ vec.iv.val[i] = (uint8_t)random;
+ }
+ }
+
+ /* if PTlen == 0, pt or ct will be handled by AAD later */
+ if (info.interim_info.gcm_data.is_gmac)
+ return 0;
+
+ return parse_uint8_known_len_hex_str(key, src, val);
+}
+