Hi all,

I want to use FIPS mode under linux. With openssl-0.9.8o, I typed "./config
fipscanisterbuild" and then typed "make". The compile successful.
Then I did a test about fips, below is my test code (main.cpp):
#include <iostream>
#include <openssl/ssl.h>
#include <openssl/fips.h>
int main(int argc, char *argv[])
{
    OpenSSL_add_all_algorithms();
#ifdef OPENSSL_FIPS
    std::cout << "OPENSSL_FIPS be defined" << std::endl;
    bool bRet = FIPS_mode();
    if(bRet)
        std::cout << "Already in fips mode" << std::endl;
    else
    {
        bRet = FIPS_mode_set(1);
        if(bRet)
            std::cout << "FIPS mode set ok" << std::endl;
        else
            std::cout << "FIPS mode set failed" << std::endl;
    }
#else
    std::cout << "OPENSSL_FIPS not be defined" << std::endl;
#endif
    return 0;   
}

And my Makefile is like:
XX = g++
CFLAGS = -DOPENSSL_FIPS -I/usr/local/openssl-0.9.8o/include
LDFLAGS = --enable-auto-import -L/usr/local/openssl-0.9.8o/lib -Wl, -Bstatic
-lssl -lcrypto -Wl, -Bdynamic -ldl

TARGET = ./test
%.o : %.c
    $(CC) $(CFLAGS) -c $< -o $@ -g
%.o : %.cpp
    $(XX) $(CFLAGS) -c $< -o $@ -g

SOURCES = $(wildcard *.c *.cpp)
OBJS = $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SOURCES)))

$(TARGET) : $(OBJS)
    $(XX) $(OBJS) -o $(TARGET) $(LDFLAGS)
    chmod a+x $(TARGET)

clean:
    rm $(OBJS)

And the output is:
x...@xxx-desktop:~/test$ ./test
OPENSSL_FIPS be defined
FIPS mode set failed

Can anyone see where I have made mistakes? Any suggestion would be much
appreciated.

Best Regards,
rentt
-- 
View this message in context: 
http://old.nabble.com/openssl-FIPS-on-linux-tp29477756p29477756.html
Sent from the OpenSSL - Dev mailing list archive at Nabble.com.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

Reply via email to