-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
202 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[submodule ".gnulib"] | ||
path = .gnulib | ||
url = https://git.savannah.gnu.org/git/gnulib.git | ||
url = https://github.com/coreutils/gnulib.git | ||
[submodule "include/oasis-pkcs11"] | ||
path = include/oasis-pkcs11 | ||
url = https://github.com/oasis-tcs/pkcs11.git |
Submodule .gnulib
updated
5379 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,65 @@ | ||
#!/usr/bin/env sh | ||
#!/bin/sh | ||
|
||
# pull submodule stuff | ||
git submodule update --init .gnulib | ||
git submodule update --init include/oasis-pkcs11 | ||
# Copyright (c) 2021 Mastercard | ||
|
||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
|
||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
######################################################################## | ||
# bootstrap.sh: used to bootstrap project once cloned from git | ||
# or during FreeBSD package build | ||
######################################################################## | ||
|
||
# no tolerance to errors | ||
set -e | ||
|
||
cleanup() { | ||
if [ -n ${oldpath} ]; then | ||
cd ${oldpath} | ||
fi | ||
} | ||
|
||
trap cleanup EXIT | ||
|
||
oldpath=$PWD | ||
cd ${oldpath} | ||
|
||
# detect if we are in a git repo | ||
if [ -d .git ]; then | ||
# pull submodule stuff | ||
git submodule update --init | ||
# git submodule update --init .gnulib | ||
# git submodule update --init include/oasis-pkcs11 | ||
else | ||
# if not a git repo, then two possibilities: | ||
# 1) we are building a FreeBSD port, in which case | ||
# BUILD_PORT is set | ||
# 2) we are not, in which case we choke and die | ||
# | ||
if [ -z ${BUILD_PORT} ]; then | ||
echo "***Error: $0 is not invoked from a git repository." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# invoke gnulib | ||
.gnulib/gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-conditional-dependencies --no-libtool --macro-prefix=gl byteswap gethostname getline getopt-gnu malloc-gnu calloc-gnu realloc-gnu regex strcase termios time sysexits | ||
|
||
# create configure scripts | ||
autoreconf -vfi | ||
|
||
cat <<EOF | ||
======================================================================== | ||
Bootstrap complete. | ||
Execute './configure' and 'make' to build the project. | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* -*- mode: c; c-file-style:"stroustrup"; -*- */ | ||
|
||
/* | ||
* Copyright (c) 2018 Mastercard | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
|
||
#include <config.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <stdlib.h> | ||
#include <stdarg.h> | ||
#include <ctype.h> | ||
#include <openssl/objects.h> | ||
#include <openssl/ec.h> | ||
#include "pkcs11lib.h" | ||
|
||
|
||
#define HAS_FLAG(a,fl,t,f) ( (a & fl) ? t : f ) | ||
#define IS_VENDOR_DEFINED(m,t,f) ( (m & CKM_VENDOR_DEFINED) == CKM_VENDOR_DEFINED ? t : f ) | ||
|
||
/* high-level search functions */ | ||
|
||
func_rc pkcs11_info_library(pkcs11Context *p11Context) | ||
{ | ||
func_rc rc=rc_error_library; | ||
|
||
if(p11Context && p11Context->initialized==CK_TRUE) { | ||
CK_INFO libinfo; | ||
CK_RV rv; | ||
|
||
if((rv = p11Context->FunctionList.C_GetInfo(&libinfo)) != CKR_OK ) { | ||
pkcs11_error( rv, "C_GetInfo" ); | ||
rc = rc_error_pkcs11_api; | ||
goto error; | ||
} | ||
|
||
fprintf( stdout, | ||
"PKCS#11 Library\n" | ||
"---------------\n" | ||
"Name : %s\n" | ||
"Lib version : %d.%d\n" | ||
"API version : %d.%d\n" | ||
"Description : %.*s\n" | ||
"Manufacturer: %.*s\n" | ||
"\n", | ||
p11Context->library, | ||
libinfo.libraryVersion.major, libinfo.libraryVersion.minor, | ||
libinfo.cryptokiVersion.major, libinfo.cryptokiVersion.minor, | ||
(int)sizeof(libinfo.libraryDescription), libinfo.libraryDescription, | ||
(int)sizeof(libinfo.manufacturerID), libinfo.manufacturerID | ||
); | ||
|
||
rc = rc_ok; | ||
} | ||
|
||
error: | ||
return rc; | ||
} | ||
|
||
/* EOF */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters