Add AES-KW(P) to test_fips.cc

These algorithms are implemented in the FIPS module we'll test them in
test_fips.cc

Change-Id: I3b83118a7a3c59b298c8e37854c9a8d29b008bad
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/80768
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/util/fipstools/test_fips.cc b/util/fipstools/test_fips.cc
index 5345c2b..60a642d 100644
--- a/util/fipstools/test_fips.cc
+++ b/util/fipstools/test_fips.cc
@@ -98,18 +98,40 @@
       "DBRG Reseed Entropy                            ";
 
   AES_KEY aes_key;
-  uint8_t aes_iv[16];
-  uint8_t output[256];
 
-  /* AES-CBC Encryption */
-  memset(aes_iv, 0, sizeof(aes_iv));
   if (AES_set_encrypt_key(kAESKey, 8 * sizeof(kAESKey), &aes_key) != 0) {
     printf("AES_set_encrypt_key failed\n");
     return 0;
   }
 
-  printf("About to AES-CBC encrypt ");
+  /* AES-KW */
   hexdump(kPlaintext, sizeof(kPlaintext));
+
+  printf("About to do AES-KW");
+  uint8_t output[256];
+  const int kw_len = AES_wrap_key(&aes_key, nullptr, output, kPlaintext, 16);
+  if (kw_len == -1) {
+    printf("AES_wrap_key failed\n");
+    return 0;
+  }
+  printf("  got ");
+  hexdump(output, kw_len);
+
+  /* AES-KWP */
+  printf("About to do AES-KWP");
+  size_t out_len;
+  if (!AES_wrap_key_padded(&aes_key, output, &out_len, sizeof(output),
+                            kPlaintext, 16)) {
+    printf("AES_wrap_key_padded failed\n");
+    return 0;
+  }
+  printf(" got ");
+  hexdump(output, out_len);
+
+  /* AES-CBC Encryption */
+  uint8_t aes_iv[16];
+  memset(aes_iv, 0, sizeof(aes_iv));
+  printf("About to AES-CBC encrypt ");
   AES_cbc_encrypt(kPlaintext, output, sizeof(kPlaintext), &aes_key, aes_iv,
                   AES_ENCRYPT);
   printf("  got ");
@@ -128,7 +150,6 @@
   printf("  got ");
   hexdump(output, sizeof(kPlaintext));
 
-  size_t out_len;
   uint8_t nonce[EVP_AEAD_MAX_NONCE_LENGTH];
   OPENSSL_memset(nonce, 0, sizeof(nonce));
   bssl::ScopedEVP_AEAD_CTX aead_ctx;