11541Srgrimes#!/bin/sh
21541Srgrimes#
31541Srgrimes# Copyright (c) 2006 Kungliga Tekniska H��gskolan
41541Srgrimes# (Royal Institute of Technology, Stockholm, Sweden). 
551138Salfred# All rights reserved. 
6157039Sdavidxu#
71541Srgrimes# Redistribution and use in source and binary forms, with or without 
81541Srgrimes# modification, are permitted provided that the following conditions 
9106149Sdwmalone# are met: 
101541Srgrimes#
1164002Speter# 1. Redistributions of source code must retain the above copyright 
121541Srgrimes#    notice, this list of conditions and the following disclaimer. 
131541Srgrimes#
141541Srgrimes# 2. Redistributions in binary form must reproduce the above copyright 
151541Srgrimes#    notice, this list of conditions and the following disclaimer in the 
161541Srgrimes#    documentation and/or other materials provided with the distribution. 
171541Srgrimes#
181541Srgrimes# 3. Neither the name of the Institute nor the names of its contributors 
191541Srgrimes#    may be used to endorse or promote products derived from this software 
201541Srgrimes#    without specific prior written permission. 
211541Srgrimes#
221541Srgrimes# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 
231541Srgrimes# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
241541Srgrimes# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
251541Srgrimes# ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 
261541Srgrimes# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
271541Srgrimes# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
28122540Smckusick# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
291541Srgrimes# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
301541Srgrimes# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
311541Srgrimes# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
321541Srgrimes# SUCH DAMAGE. 
331541Srgrimes#
341541Srgrimes# $Id$
351541Srgrimes#
361541Srgrimes
371541Srgrimessrcdir="@srcdir@"
381541Srgrimesobjdir="@objdir@"
391541Srgrimesnistdir=${objdir}/PKITS_data
401541Srgrimesnistzip=${srcdir}/data/PKITS_data.zip
411541Srgrimes
421541Srgrimes# nistzip is not distributed part of the distribution
431541Srgrimestest -f "$nistzip" || exit 77
441541Srgrimes
451541Srgrimesstat="--statistic-file=${objdir}/statfile"
461541Srgrimes
471541Srgrimeshxtool="${TESTS_ENVIRONMENT} ./hxtool ${stat}"
481541Srgrimes
491541Srgrimesif ${hxtool} info | grep 'rsa: hcrypto null RSA' > /dev/null ; then
501541Srgrimes    exit 77
511541Srgrimesfi
521541Srgrimesif ${hxtool} info | grep 'rand: not available' > /dev/null ; then
531541Srgrimes    exit 77
541541Srgrimesfi
551541Srgrimes
5652150Smarcelif [ ! -d "$nistdir" ] ; then
571541Srgrimes    ( mkdir "$nistdir" &&  cd "$nistdir" && unzip "$nistzip" ) >/dev/null || \
5852150Smarcel	{ rm -rf "$nistdir" ; exit 1; }
591541Srgrimesfi
601541Srgrimes
611541Srgrimesif ${hxtool} validate DIR:$nistdir/certs > /dev/null; then
6252150Smarcel   :
631541Srgrimeselse
641541Srgrimes   echo "validate failed"
651541Srgrimes   exit 1
661541Srgrimesfi
671541Srgrimes
681541Srgrimesexit 0
691541Srgrimes