Disable FIPS restrictions when doing GCM testing.
authorDr. Stephen Henson <steve@openssl.org>
Thu, 10 Feb 2011 01:46:25 +0000 (01:46 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 10 Feb 2011 01:46:25 +0000 (01:46 +0000)
fips/aes/fips_gcmtest.c

index 32bbf3b321abb511ed171da2cd626c4400e20743..e7bcad0dca41612604e53368d501f6299053224e 100644 (file)
@@ -176,6 +176,8 @@ static void gcmtest(int encrypt)
                        {
                        tag = OPENSSL_malloc(taglen);
                        EVP_CipherInit_ex(&ctx, gcm, NULL, NULL, NULL, 1);
                        {
                        tag = OPENSSL_malloc(taglen);
                        EVP_CipherInit_ex(&ctx, gcm, NULL, NULL, NULL, 1);
+                       /* Relax FIPS constraints for testing */
+                       M_EVP_CIPHER_CTX_set_flags(&ctx, EVP_CIPH_FLAG_NON_FIPS_ALLOW);
                        EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_GCM_SET_IVLEN, ivlen, 0);
                        if (encrypt == 1)
                                {
                        EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_GCM_SET_IVLEN, ivlen, 0);
                        if (encrypt == 1)
                                {
@@ -227,6 +229,8 @@ static void gcmtest(int encrypt)
                if (!encrypt && tag)
                        {
                        EVP_CipherInit_ex(&ctx, gcm, NULL, NULL, NULL, 0);
                if (!encrypt && tag)
                        {
                        EVP_CipherInit_ex(&ctx, gcm, NULL, NULL, NULL, 0);
+                       /* Relax FIPS constraints for testing */
+                       M_EVP_CIPHER_CTX_set_flags(&ctx, EVP_CIPH_FLAG_NON_FIPS_ALLOW);
                        EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_GCM_SET_IVLEN, ivlen, 0);
                        EVP_CipherInit_ex(&ctx, NULL, NULL, key, iv, 0);
                        EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_GCM_SET_TAG, taglen, tag);
                        EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_GCM_SET_IVLEN, ivlen, 0);
                        EVP_CipherInit_ex(&ctx, NULL, NULL, key, iv, 0);
                        EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_GCM_SET_TAG, taglen, tag);