Link GCM into FIPS module. Check return value in EVP gcm.
authorDr. Stephen Henson <steve@openssl.org>
Tue, 8 Feb 2011 15:10:42 +0000 (15:10 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Tue, 8 Feb 2011 15:10:42 +0000 (15:10 +0000)
Makefile.org
crypto/evp/e_aes.c
crypto/modes/gcm128.c
fips/Makefile

index b608f710e9df87e9a0517e7769230cc0d658925e..89fa394546050de9d2d2570cfe321a8cf8e102a8 100644 (file)
@@ -316,6 +316,7 @@ FIPS_EX_OBJ= ../crypto/aes/aes_cfb.o \
        ../crypto/modes/cbc128.o \
        ../crypto/modes/cfb128.o \
        ../crypto/modes/ctr128.o \
+       ../crypto/modes/gcm128.o \
        ../crypto/modes/ofb128.o \
        ../crypto/rand/md_rand.o \
        ../crypto/rand/rand_egd.o \
@@ -350,7 +351,7 @@ build_fips:
 
 build_crypto:
        if [ -n "$(FIPSCANLIB)" ]; then \
-               EXCL_OBJ='$(AES_ENC) $(BN_ASM) $(DES_ENC) $(CPUID_OBJ) $(SHA1_ASM_OBJ) $(FIPS_EX_OBJ)' ; export EXCL_OBJ ; \
+               EXCL_OBJ='$(AES_ENC) $(BN_ASM) $(DES_ENC) $(CPUID_OBJ) $(SHA1_ASM_OBJ) $(MODES_ASM_OBJ) $(FIPS_EX_OBJ)' ; export EXCL_OBJ ; \
                ARX='$(PERL) $${TOP}/util/arx.pl $(AR)' ; \
        else \
                ARX='${AR}' ; \
index 34a350a8804873998b74b1bfeb745ee742cf528d..ed21d0a923ce97edb629682b6ff422bb7dc9387e 100644 (file)
@@ -312,11 +312,20 @@ static int aes_gcm(EVP_CIPHER_CTX *ctx, unsigned char *out,
        if (in)
                {
                if (out == NULL)
-                       CRYPTO_gcm128_aad(gctx->gcm, in, len);
+                       {
+                       if (CRYPTO_gcm128_aad(gctx->gcm, in, len))
+                               return -1;
+                       }
                else if (ctx->encrypt)
-                       CRYPTO_gcm128_encrypt(gctx->gcm, in, out, len);
+                       {
+                       if (CRYPTO_gcm128_encrypt(gctx->gcm, in, out, len))
+                               return -1;
+                       }
                else
-                       CRYPTO_gcm128_decrypt(gctx->gcm, in, out, len);
+                       {
+                       if (CRYPTO_gcm128_decrypt(gctx->gcm, in, out, len))
+                               return -1;
+                       }
                return len;
                }
        else
index 3f6b70df4b3607658408353324e3076a9d018732..1287bce7735dec159e395433e2f847d6a2421a10 100644 (file)
@@ -47,6 +47,8 @@
  * ====================================================================
  */
 
+#define OPENSSL_FIPSAPI
+
 #include <openssl/crypto.h>
 #include "modes_lcl.h"
 #include <string.h>
index 1eafa5548185df600214b3b4e1be448f45d4e165..6d4c27fd1bda09127b8f2bffbc284513dcdee2f6 100644 (file)
@@ -89,6 +89,7 @@ fipscanister.o: fips_start.o $(LIBOBJ) $(FIPS_OBJ_LISTS) fips_end.o
        list="$(AES_ENC)"; for i in $$list; do FIPS_ASM="$$FIPS_ASM ../crypto/aes/$$i" ; done; \
        list="$(DES_ENC)"; for i in $$list; do FIPS_ASM="$$FIPS_ASM ../crypto/des/$$i" ; done; \
        list="$(SHA1_ASM_OBJ)"; for i in $$list; do FIPS_ASM="$$FIPS_ASM ../crypto/sha/$$i" ; done; \
+       list="$(MODES_ASM_OBJ)"; for i in $$list; do FIPS_ASM="$$FIPS_ASM ../crypto/modes/$$i" ; done; \
        if [ -n "$(CPUID_OBJ)" ]; then \
                CPUID=../crypto/$(CPUID_OBJ) ; \
        else \