   AssertIsEqual(0xd9, tag[14]);
   // Decrypt via simplified interface...
   uint8_t inputDecoded[32];
-  AssertIsTrue(OTAESGCM::fixed32BTextSize12BNonce16BTagSimpleDec_DEFAULT_STATELESS(NULL,
+  AssertIsTrue(OTAESGCM::fixed32BTextSize12BNonce16BTagSimpleDec_DEFAULT_WITH_LWORKSPACE(
+            workspace, workspaceRequired,
             key, nonce,
             aad, sizeof(aad),
             cipherText, tag,
             inputDecoded));
   AssertIsEqual(0, memcmp(input, inputDecoded, 32));
   // Try enc/auth with no (ie zero-length) plaintext.
-  AssertIsTrue(OTAESGCM::fixed32BTextSize12BNonce16BTagSimpleEnc_DEFAULT_STATELESS(NULL,
+  AssertIsTrue(OTAESGCM::fixed32BTextSize12BNonce16BTagSimpleEnc_DEFAULT_WITH_LWORKSPACE(
+            workspace, workspaceRequired,
             key, nonce,
             aad, sizeof(aad),
             NULL,

static void testGCMVS1ViaFixed32BTextSize()
  {
  Serial.println("GCMVS1ViaFixed32BTextSize");
  // Inputs to encryption.
  static const uint8_t input[32] = { 0xcc, 0x38, 0xbc, 0xcd, 0x6b, 0xc5, 0x36, 0xad, 0x91, 0x9b, 0x13, 0x95, 0xf5, 0xd6, 0x38, 0x01, 0xf9, 0x9f, 0x80, 0x68, 0xd6, 0x5c, 0xa5, 0xac, 0x63, 0x87, 0x2d, 0xaf, 0x16, 0xb9, 0x39, 0x01 };
  static const uint8_t key[AES_KEY_SIZE/8] = { 0x29, 0x8e, 0xfa, 0x1c, 0xcf, 0x29, 0xcf, 0x62, 0xae, 0x68, 0x24, 0xbf, 0xc1, 0x95, 0x57, 0xfc };

//        assertTrue((Arrays.equals(input, plainText)));
//        }

namespace W0
{
    // Workspace for AES functions
    static constexpr size_t workspaceRequired = OTAESGCM::OTAES128GCMGenericWithWorkspace<>::workspaceRequired;
    static uint8_t workspace[workspaceRequired];

    // A const all-zeros block useful for keys, nonce, plaintext, etc.
    static const uint8_t allZerosBlock[32] = { };
    static uint8_t tag[GCM_TAG_LENGTH]; // Space for tag.
    static const uint8_t inputSize = 30; // Typical non-block-size input size.
    static uint8_t cipherText[max(32, inputSize)]; // Space for encrypted text, rounded up to block size.
    static uint8_t plain[sizeof(cipherText)]; // Space for decrypted text.

    void resetFields()
    {
        memset(workspace, 0, sizeof(workspace));
        memset(tag, 0, sizeof(tag));
        memset(cipherText, 0, sizeof(cipherText));
        memset(plain, 0, sizeof(plain));
    }
}

// Check that all zeros key, plaintext and ADATA gives the correct result.
static void testAESGCMAll0()
  {
  Serial.println("AESGCMAll0");

  // First clear any data from other tests.
  W0::resetFields();
  // Inputs to encryption.
//  uint8_t input[30]; // All-zeros input.
//  memset(input, 0x0, sizeof(input));
  const uint8_t *input = W0::allZerosBlock;

//  uint8_t key[AES_KEY_SIZE/8];
//  memset(key, 0, sizeof(key)); // All-zeros key.
  const uint8_t *key = W0::allZerosBlock;

//  uint8_t nonce[GCM_NONCE_LENGTH];
//  memset(nonce, 0x0, sizeof(nonce)); // All-zeros nonce.
  const uint8_t *nonce = W0::allZerosBlock;

  const uint8_t aadSize = 4;
//  uint8_t aad[4];
//  memset(aad, 0, sizeof(aad)); // All-zeros ADATA.
  const uint8_t *aad = W0::allZerosBlock;

  // Space for outputs from encryption.
  memset(W0::tag, 0, sizeof(W0::tag));
  memset(W0::cipherText, 0, sizeof(W0::cipherText));

  // Instance to perform enc/dec.
  // Do encryption.
  OTAESGCM::OTAES128GCMGenericWithWorkspace<> gen(W0::workspace, sizeof(W0::workspace));
  gen.gcmEncryptPadded(key, nonce, input, W0::inputSize,
                         aad, aadSize, W0::cipherText, W0::tag);
  // Check some of the cipher text and tag.
//            "0388DACE60B6A392F328C2B971B2FE78 F795AAAB494B5923F7FD89FF948B  61 47 72 C7 92 9C D0 DD 68 1B D8 A3 7A 65 6F 33" :
  AssertIsEqual(0x03, W0::cipherText[0]);
  AssertIsEqual(0x88, W0::cipherText[1]);
  AssertIsEqual(0x8b, W0::cipherText[29]);
  AssertIsEqual(0xb6, W0::tag[0]); // Was, before CDATAlength fix, AssertIsEqual(0x61, tag[0]);
  AssertIsEqual(0x18, W0::tag[15]); // Was, before CDATAlength fix, AssertIsEqual(0x33, tag[15]);
  // Decrypt...
  // Should pass authentication and produce the original plaintext.
  AssertIsTrue(gen.gcmDecrypt(key, nonce,
          W0::cipherText, sizeof(W0::cipherText),
                            aad, aadSize,
                            W0::tag, W0::plain));
  AssertIsEqual(0, memcmp(input, W0::plain, W0::inputSize)); // 0 indicates plain text recovered correctly.
  }

#if 0
// Check that padding works
static void testAESGCMPadding()
  {
  Serial.println("AESGCMPadding");

  // First clear any data from other tests.
  W0::resetFields();
  // Inputs to encryption.
  constexpr uint8_t inputSize = 9;
  memset(W0::input, 0x55, inputSize);
  
  uint8_t key[AES_KEY_SIZE/8];
  memset(key, 0, sizeof(key)); // All-zeros key.
