Merge branch 'each-style-tweak' into 'master'
adjust clang-format options to get closer to ISC style See merge request isc-projects/bind9!3061 (cherry picked from commitd3b49b6675)0255a974revise .clang-format and add a C formatting script in utile851ed0bapply the modified style
This commit is contained in:
@@ -61,14 +61,12 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#endif /* ifndef CLOCK_REALTIME */
|
||||
|
||||
static int
|
||||
clock_gettime(int32_t id, struct timespec *tp);
|
||||
static int clock_gettime(int32_t id, struct timespec *tp);
|
||||
|
||||
static int
|
||||
clock_gettime(int32_t id, struct timespec *tp)
|
||||
{
|
||||
clock_gettime(int32_t id, struct timespec *tp) {
|
||||
struct timeval tv;
|
||||
int result;
|
||||
int result;
|
||||
|
||||
UNUSED(id);
|
||||
|
||||
@@ -82,36 +80,35 @@ clock_gettime(int32_t id, struct timespec *tp)
|
||||
#endif /* ifndef HAVE_CLOCK_GETTIME */
|
||||
|
||||
CK_BYTE buf[1024];
|
||||
char label[16];
|
||||
char label[16];
|
||||
|
||||
static CK_BBOOL truevalue = TRUE;
|
||||
static CK_BBOOL falsevalue = FALSE;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
isc_result_t result;
|
||||
CK_RV rv;
|
||||
CK_SLOT_ID slot = 0;
|
||||
main(int argc, char *argv[]) {
|
||||
isc_result_t result;
|
||||
CK_RV rv;
|
||||
CK_SLOT_ID slot = 0;
|
||||
CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE;
|
||||
CK_OBJECT_HANDLE *hKey;
|
||||
CK_OBJECT_CLASS kClass = CKO_DATA;
|
||||
CK_ULONG len = sizeof(buf);
|
||||
CK_ATTRIBUTE kTemplate[] = {
|
||||
{ CKA_CLASS, &kClass, (CK_ULONG)sizeof(kClass) },
|
||||
{ CKA_TOKEN, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
|
||||
{ CKA_PRIVATE, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
|
||||
{ CKA_LABEL, (CK_BYTE_PTR)label, (CK_ULONG)sizeof(label) },
|
||||
{ CKA_VALUE, buf, (CK_ULONG)sizeof(buf) }
|
||||
CK_OBJECT_CLASS kClass = CKO_DATA;
|
||||
CK_ULONG len = sizeof(buf);
|
||||
CK_ATTRIBUTE kTemplate[] = {
|
||||
{ CKA_CLASS, &kClass, (CK_ULONG)sizeof(kClass) },
|
||||
{ CKA_TOKEN, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
|
||||
{ CKA_PRIVATE, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
|
||||
{ CKA_LABEL, (CK_BYTE_PTR)label, (CK_ULONG)sizeof(label) },
|
||||
{ CKA_VALUE, buf, (CK_ULONG)sizeof(buf) }
|
||||
};
|
||||
pk11_context_t pctx;
|
||||
char * lib_name = NULL;
|
||||
char * pin = NULL;
|
||||
int error = 0;
|
||||
int c, errflg = 0;
|
||||
int ontoken = 0;
|
||||
unsigned int count = 1000;
|
||||
unsigned int i;
|
||||
pk11_context_t pctx;
|
||||
char *lib_name = NULL;
|
||||
char *pin = NULL;
|
||||
int error = 0;
|
||||
int c, errflg = 0;
|
||||
int ontoken = 0;
|
||||
unsigned int count = 1000;
|
||||
unsigned int i;
|
||||
struct timespec starttime;
|
||||
struct timespec endtime;
|
||||
|
||||
@@ -176,7 +173,8 @@ main(int argc, char *argv[])
|
||||
(const char *)pin, slot);
|
||||
if ((result != ISC_R_SUCCESS) && (result != PK11_R_NORANDOMSERVICE) &&
|
||||
(result != PK11_R_NODIGESTSERVICE) &&
|
||||
(result != PK11_R_NOAESSERVICE)) {
|
||||
(result != PK11_R_NOAESSERVICE))
|
||||
{
|
||||
fprintf(stderr, "Error initializing PKCS#11: %s\n",
|
||||
isc_result_totext(result));
|
||||
exit(1);
|
||||
|
||||
@@ -61,14 +61,12 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#endif /* ifndef CLOCK_REALTIME */
|
||||
|
||||
static int
|
||||
clock_gettime(int32_t id, struct timespec *tp);
|
||||
static int clock_gettime(int32_t id, struct timespec *tp);
|
||||
|
||||
static int
|
||||
clock_gettime(int32_t id, struct timespec *tp)
|
||||
{
|
||||
clock_gettime(int32_t id, struct timespec *tp) {
|
||||
struct timeval tv;
|
||||
int result;
|
||||
int result;
|
||||
|
||||
UNUSED(id);
|
||||
|
||||
@@ -84,27 +82,26 @@ clock_gettime(int32_t id, struct timespec *tp)
|
||||
CK_BYTE label[] = "foo??bar!!";
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
isc_result_t result;
|
||||
CK_RV rv;
|
||||
CK_SLOT_ID slot = 0;
|
||||
main(int argc, char *argv[]) {
|
||||
isc_result_t result;
|
||||
CK_RV rv;
|
||||
CK_SLOT_ID slot = 0;
|
||||
CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE;
|
||||
CK_ATTRIBUTE sTemplate[] = {
|
||||
{ CKA_LABEL, label, (CK_ULONG)sizeof(label) },
|
||||
CK_ATTRIBUTE sTemplate[] = {
|
||||
{ CKA_LABEL, label, (CK_ULONG)sizeof(label) },
|
||||
};
|
||||
CK_OBJECT_HANDLE sKey = CK_INVALID_HANDLE;
|
||||
CK_ULONG found = 0;
|
||||
pk11_context_t pctx;
|
||||
pk11_optype_t op_type = OP_RSA;
|
||||
char * lib_name = NULL;
|
||||
char * pin = NULL;
|
||||
int error = 0;
|
||||
int c, errflg = 0;
|
||||
unsigned int count = 1000;
|
||||
unsigned int i;
|
||||
struct timespec starttime;
|
||||
struct timespec endtime;
|
||||
CK_ULONG found = 0;
|
||||
pk11_context_t pctx;
|
||||
pk11_optype_t op_type = OP_RSA;
|
||||
char *lib_name = NULL;
|
||||
char *pin = NULL;
|
||||
int error = 0;
|
||||
int c, errflg = 0;
|
||||
unsigned int count = 1000;
|
||||
unsigned int i;
|
||||
struct timespec starttime;
|
||||
struct timespec endtime;
|
||||
|
||||
while ((c = isc_commandline_parse(argc, argv, ":m:s:p:n:")) != -1) {
|
||||
switch (c) {
|
||||
@@ -156,7 +153,8 @@ main(int argc, char *argv[])
|
||||
(const char *)pin, slot);
|
||||
if ((result != ISC_R_SUCCESS) && (result != PK11_R_NORANDOMSERVICE) &&
|
||||
(result != PK11_R_NODIGESTSERVICE) &&
|
||||
(result != PK11_R_NOAESSERVICE)) {
|
||||
(result != PK11_R_NOAESSERVICE))
|
||||
{
|
||||
fprintf(stderr, "Error initializing PKCS#11: %s\n",
|
||||
isc_result_totext(result));
|
||||
exit(1);
|
||||
|
||||
@@ -61,14 +61,12 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#endif /* ifndef CLOCK_REALTIME */
|
||||
|
||||
static int
|
||||
clock_gettime(int32_t id, struct timespec *tp);
|
||||
static int clock_gettime(int32_t id, struct timespec *tp);
|
||||
|
||||
static int
|
||||
clock_gettime(int32_t id, struct timespec *tp)
|
||||
{
|
||||
clock_gettime(int32_t id, struct timespec *tp) {
|
||||
struct timeval tv;
|
||||
int result;
|
||||
int result;
|
||||
|
||||
UNUSED(id);
|
||||
|
||||
@@ -85,28 +83,27 @@ static CK_BBOOL truevalue = TRUE;
|
||||
static CK_BBOOL falsevalue = FALSE;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
isc_result_t result;
|
||||
CK_RV rv;
|
||||
CK_SLOT_ID slot = 0;
|
||||
main(int argc, char *argv[]) {
|
||||
isc_result_t result;
|
||||
CK_RV rv;
|
||||
CK_SLOT_ID slot = 0;
|
||||
CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE;
|
||||
CK_MECHANISM mech = { CKM_RSA_PKCS_KEY_PAIR_GEN, NULL, 0 };
|
||||
CK_MECHANISM mech = { CKM_RSA_PKCS_KEY_PAIR_GEN, NULL, 0 };
|
||||
CK_OBJECT_HANDLE *pubKey;
|
||||
CK_OBJECT_HANDLE *privKey;
|
||||
CK_OBJECT_CLASS pubClass = CKO_PUBLIC_KEY;
|
||||
CK_OBJECT_CLASS privClass = CKO_PRIVATE_KEY;
|
||||
CK_KEY_TYPE kType = CKK_RSA;
|
||||
CK_ULONG bits = 1024;
|
||||
CK_BYTE exponent[] = { 0x01, 0x00, 0x01 };
|
||||
CK_ATTRIBUTE pubTemplate[] = {
|
||||
{ CKA_CLASS, &pubClass, (CK_ULONG)sizeof(pubClass) },
|
||||
{ CKA_KEY_TYPE, &kType, (CK_ULONG)sizeof(kType) },
|
||||
{ CKA_TOKEN, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
|
||||
{ CKA_PRIVATE, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
|
||||
{ CKA_VERIFY, &truevalue, (CK_ULONG)sizeof(truevalue) },
|
||||
{ CKA_MODULUS_BITS, &bits, (CK_ULONG)sizeof(bits) },
|
||||
{ CKA_PUBLIC_EXPONENT, exponent, (CK_ULONG)sizeof(exponent) }
|
||||
CK_OBJECT_CLASS pubClass = CKO_PUBLIC_KEY;
|
||||
CK_OBJECT_CLASS privClass = CKO_PRIVATE_KEY;
|
||||
CK_KEY_TYPE kType = CKK_RSA;
|
||||
CK_ULONG bits = 1024;
|
||||
CK_BYTE exponent[] = { 0x01, 0x00, 0x01 };
|
||||
CK_ATTRIBUTE pubTemplate[] = {
|
||||
{ CKA_CLASS, &pubClass, (CK_ULONG)sizeof(pubClass) },
|
||||
{ CKA_KEY_TYPE, &kType, (CK_ULONG)sizeof(kType) },
|
||||
{ CKA_TOKEN, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
|
||||
{ CKA_PRIVATE, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
|
||||
{ CKA_VERIFY, &truevalue, (CK_ULONG)sizeof(truevalue) },
|
||||
{ CKA_MODULUS_BITS, &bits, (CK_ULONG)sizeof(bits) },
|
||||
{ CKA_PUBLIC_EXPONENT, exponent, (CK_ULONG)sizeof(exponent) }
|
||||
};
|
||||
CK_ATTRIBUTE privTemplate[] = {
|
||||
{ CKA_CLASS, &privClass, (CK_ULONG)sizeof(privClass) },
|
||||
@@ -115,15 +112,15 @@ main(int argc, char *argv[])
|
||||
{ CKA_PRIVATE, &truevalue, (CK_ULONG)sizeof(truevalue) },
|
||||
{ CKA_SIGN, &truevalue, (CK_ULONG)sizeof(truevalue) },
|
||||
};
|
||||
pk11_context_t pctx;
|
||||
pk11_optype_t op_type = OP_RSA;
|
||||
char * lib_name = NULL;
|
||||
char * pin = NULL;
|
||||
int error = 0;
|
||||
int c, errflg = 0;
|
||||
int ontoken = 0;
|
||||
unsigned int count = 1000;
|
||||
unsigned int i;
|
||||
pk11_context_t pctx;
|
||||
pk11_optype_t op_type = OP_RSA;
|
||||
char *lib_name = NULL;
|
||||
char *pin = NULL;
|
||||
int error = 0;
|
||||
int c, errflg = 0;
|
||||
int ontoken = 0;
|
||||
unsigned int count = 1000;
|
||||
unsigned int i;
|
||||
struct timespec starttime;
|
||||
struct timespec endtime;
|
||||
|
||||
@@ -201,7 +198,8 @@ main(int argc, char *argv[])
|
||||
(const char *)pin, slot);
|
||||
if ((result != ISC_R_SUCCESS) && (result != PK11_R_NORANDOMSERVICE) &&
|
||||
(result != PK11_R_NODIGESTSERVICE) &&
|
||||
(result != PK11_R_NOAESSERVICE)) {
|
||||
(result != PK11_R_NOAESSERVICE))
|
||||
{
|
||||
fprintf(stderr, "Error initializing PKCS#11: %s\n",
|
||||
isc_result_totext(result));
|
||||
exit(1);
|
||||
|
||||
@@ -61,14 +61,12 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#endif /* ifndef CLOCK_REALTIME */
|
||||
|
||||
static int
|
||||
clock_gettime(int32_t id, struct timespec *tp);
|
||||
static int clock_gettime(int32_t id, struct timespec *tp);
|
||||
|
||||
static int
|
||||
clock_gettime(int32_t id, struct timespec *tp)
|
||||
{
|
||||
clock_gettime(int32_t id, struct timespec *tp) {
|
||||
struct timeval tv;
|
||||
int result;
|
||||
int result;
|
||||
|
||||
UNUSED(id);
|
||||
|
||||
@@ -82,19 +80,18 @@ clock_gettime(int32_t id, struct timespec *tp)
|
||||
#endif /* ifndef HAVE_CLOCK_GETTIME */
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
CK_RV rv;
|
||||
CK_SLOT_ID slot = 0;
|
||||
main(int argc, char *argv[]) {
|
||||
CK_RV rv;
|
||||
CK_SLOT_ID slot = 0;
|
||||
CK_SESSION_HANDLE *hSession;
|
||||
CK_UTF8CHAR * pin = NULL;
|
||||
char * lib_name = NULL;
|
||||
int error = 0;
|
||||
int c, errflg = 0;
|
||||
unsigned int count = 1000;
|
||||
unsigned int i, j;
|
||||
struct timespec starttime;
|
||||
struct timespec endtime;
|
||||
CK_UTF8CHAR *pin = NULL;
|
||||
char *lib_name = NULL;
|
||||
int error = 0;
|
||||
int c, errflg = 0;
|
||||
unsigned int count = 1000;
|
||||
unsigned int i, j;
|
||||
struct timespec starttime;
|
||||
struct timespec endtime;
|
||||
|
||||
while ((c = isc_commandline_parse(argc, argv, ":m:s:p:n:")) != -1) {
|
||||
switch (c) {
|
||||
|
||||
@@ -61,14 +61,12 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#endif /* ifndef CLOCK_REALTIME */
|
||||
|
||||
static int
|
||||
clock_gettime(int32_t id, struct timespec *tp);
|
||||
static int clock_gettime(int32_t id, struct timespec *tp);
|
||||
|
||||
static int
|
||||
clock_gettime(int32_t id, struct timespec *tp)
|
||||
{
|
||||
clock_gettime(int32_t id, struct timespec *tp) {
|
||||
struct timeval tv;
|
||||
int result;
|
||||
int result;
|
||||
|
||||
UNUSED(id);
|
||||
|
||||
@@ -150,40 +148,39 @@ static CK_BBOOL truevalue = TRUE;
|
||||
static CK_BBOOL falsevalue = FALSE;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
isc_result_t result;
|
||||
CK_RV rv;
|
||||
CK_SLOT_ID slot = 0;
|
||||
main(int argc, char *argv[]) {
|
||||
isc_result_t result;
|
||||
CK_RV rv;
|
||||
CK_SLOT_ID slot = 0;
|
||||
CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE;
|
||||
CK_OBJECT_HANDLE *hKey;
|
||||
CK_OBJECT_CLASS kClass = CKO_PRIVATE_KEY;
|
||||
CK_KEY_TYPE kType = CKK_RSA;
|
||||
CK_ATTRIBUTE kTemplate[] = {
|
||||
{ CKA_CLASS, &kClass, (CK_ULONG)sizeof(kClass) },
|
||||
{ CKA_KEY_TYPE, &kType, (CK_ULONG)sizeof(kType) },
|
||||
{ CKA_TOKEN, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
|
||||
{ CKA_PRIVATE, &truevalue, (CK_ULONG)sizeof(truevalue) },
|
||||
{ CKA_LABEL, (CK_BYTE_PTR)label, (CK_ULONG)sizeof(label) },
|
||||
{ CKA_SIGN, &truevalue, (CK_ULONG)sizeof(truevalue) },
|
||||
{ CKA_MODULUS, modulus, (CK_ULONG)sizeof(modulus) },
|
||||
{ CKA_PUBLIC_EXPONENT, pubexp, (CK_ULONG)sizeof(pubexp) },
|
||||
{ CKA_PRIVATE_EXPONENT, privexp, (CK_ULONG)sizeof(privexp) },
|
||||
{ CKA_PRIME_1, prime1, (CK_ULONG)sizeof(prime1) },
|
||||
{ CKA_PRIME_2, prime2, (CK_ULONG)sizeof(prime2) },
|
||||
{ CKA_EXPONENT_1, exp_1, (CK_ULONG)sizeof(exp_1) },
|
||||
{ CKA_EXPONENT_2, exp_2, (CK_ULONG)sizeof(exp_2) },
|
||||
{ CKA_COEFFICIENT, coeff, (CK_ULONG)sizeof(coeff) }
|
||||
CK_OBJECT_CLASS kClass = CKO_PRIVATE_KEY;
|
||||
CK_KEY_TYPE kType = CKK_RSA;
|
||||
CK_ATTRIBUTE kTemplate[] = {
|
||||
{ CKA_CLASS, &kClass, (CK_ULONG)sizeof(kClass) },
|
||||
{ CKA_KEY_TYPE, &kType, (CK_ULONG)sizeof(kType) },
|
||||
{ CKA_TOKEN, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
|
||||
{ CKA_PRIVATE, &truevalue, (CK_ULONG)sizeof(truevalue) },
|
||||
{ CKA_LABEL, (CK_BYTE_PTR)label, (CK_ULONG)sizeof(label) },
|
||||
{ CKA_SIGN, &truevalue, (CK_ULONG)sizeof(truevalue) },
|
||||
{ CKA_MODULUS, modulus, (CK_ULONG)sizeof(modulus) },
|
||||
{ CKA_PUBLIC_EXPONENT, pubexp, (CK_ULONG)sizeof(pubexp) },
|
||||
{ CKA_PRIVATE_EXPONENT, privexp, (CK_ULONG)sizeof(privexp) },
|
||||
{ CKA_PRIME_1, prime1, (CK_ULONG)sizeof(prime1) },
|
||||
{ CKA_PRIME_2, prime2, (CK_ULONG)sizeof(prime2) },
|
||||
{ CKA_EXPONENT_1, exp_1, (CK_ULONG)sizeof(exp_1) },
|
||||
{ CKA_EXPONENT_2, exp_2, (CK_ULONG)sizeof(exp_2) },
|
||||
{ CKA_COEFFICIENT, coeff, (CK_ULONG)sizeof(coeff) }
|
||||
};
|
||||
pk11_context_t pctx;
|
||||
pk11_optype_t op_type = OP_RSA;
|
||||
char * lib_name = NULL;
|
||||
char * pin = NULL;
|
||||
int error = 0;
|
||||
int c, errflg = 0;
|
||||
int ontoken = 0;
|
||||
unsigned int count = 1000;
|
||||
unsigned int i;
|
||||
pk11_context_t pctx;
|
||||
pk11_optype_t op_type = OP_RSA;
|
||||
char *lib_name = NULL;
|
||||
char *pin = NULL;
|
||||
int error = 0;
|
||||
int c, errflg = 0;
|
||||
int ontoken = 0;
|
||||
unsigned int count = 1000;
|
||||
unsigned int i;
|
||||
struct timespec starttime;
|
||||
struct timespec endtime;
|
||||
|
||||
@@ -249,7 +246,8 @@ main(int argc, char *argv[])
|
||||
(const char *)pin, slot);
|
||||
if ((result != ISC_R_SUCCESS) && (result != PK11_R_NORANDOMSERVICE) &&
|
||||
(result != PK11_R_NODIGESTSERVICE) &&
|
||||
(result != PK11_R_NOAESSERVICE)) {
|
||||
(result != PK11_R_NOAESSERVICE))
|
||||
{
|
||||
fprintf(stderr, "Error initializing PKCS#11: %s\n",
|
||||
isc_result_totext(result));
|
||||
free(hKey);
|
||||
|
||||
@@ -61,14 +61,12 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#endif /* ifndef CLOCK_REALTIME */
|
||||
|
||||
static int
|
||||
clock_gettime(int32_t id, struct timespec *tp);
|
||||
static int clock_gettime(int32_t id, struct timespec *tp);
|
||||
|
||||
static int
|
||||
clock_gettime(int32_t id, struct timespec *tp)
|
||||
{
|
||||
clock_gettime(int32_t id, struct timespec *tp) {
|
||||
struct timeval tv;
|
||||
int result;
|
||||
int result;
|
||||
|
||||
UNUSED(id);
|
||||
|
||||
@@ -102,34 +100,33 @@ static CK_BBOOL truevalue = TRUE;
|
||||
static CK_BBOOL falsevalue = FALSE;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
isc_result_t result;
|
||||
CK_RV rv;
|
||||
CK_SLOT_ID slot = 0;
|
||||
main(int argc, char *argv[]) {
|
||||
isc_result_t result;
|
||||
CK_RV rv;
|
||||
CK_SLOT_ID slot = 0;
|
||||
CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE;
|
||||
CK_OBJECT_HANDLE *hKey;
|
||||
CK_OBJECT_CLASS kClass = CKO_PUBLIC_KEY;
|
||||
CK_KEY_TYPE kType = CKK_RSA;
|
||||
CK_ATTRIBUTE kTemplate[] = {
|
||||
{ CKA_CLASS, &kClass, (CK_ULONG)sizeof(kClass) },
|
||||
{ CKA_KEY_TYPE, &kType, (CK_ULONG)sizeof(kType) },
|
||||
{ CKA_TOKEN, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
|
||||
{ CKA_PRIVATE, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
|
||||
{ CKA_LABEL, (CK_BYTE_PTR)label, (CK_ULONG)sizeof(label) },
|
||||
{ CKA_VERIFY, &truevalue, (CK_ULONG)sizeof(truevalue) },
|
||||
{ CKA_MODULUS, modulus, (CK_ULONG)sizeof(modulus) },
|
||||
{ CKA_PUBLIC_EXPONENT, exponent, (CK_ULONG)sizeof(exponent) }
|
||||
CK_OBJECT_CLASS kClass = CKO_PUBLIC_KEY;
|
||||
CK_KEY_TYPE kType = CKK_RSA;
|
||||
CK_ATTRIBUTE kTemplate[] = {
|
||||
{ CKA_CLASS, &kClass, (CK_ULONG)sizeof(kClass) },
|
||||
{ CKA_KEY_TYPE, &kType, (CK_ULONG)sizeof(kType) },
|
||||
{ CKA_TOKEN, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
|
||||
{ CKA_PRIVATE, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
|
||||
{ CKA_LABEL, (CK_BYTE_PTR)label, (CK_ULONG)sizeof(label) },
|
||||
{ CKA_VERIFY, &truevalue, (CK_ULONG)sizeof(truevalue) },
|
||||
{ CKA_MODULUS, modulus, (CK_ULONG)sizeof(modulus) },
|
||||
{ CKA_PUBLIC_EXPONENT, exponent, (CK_ULONG)sizeof(exponent) }
|
||||
};
|
||||
pk11_context_t pctx;
|
||||
pk11_optype_t op_type = OP_RSA;
|
||||
char * lib_name = NULL;
|
||||
char * pin = NULL;
|
||||
int error = 0;
|
||||
int c, errflg = 0;
|
||||
int ontoken = 0;
|
||||
unsigned int count = 1000;
|
||||
unsigned int i;
|
||||
pk11_context_t pctx;
|
||||
pk11_optype_t op_type = OP_RSA;
|
||||
char *lib_name = NULL;
|
||||
char *pin = NULL;
|
||||
int error = 0;
|
||||
int c, errflg = 0;
|
||||
int ontoken = 0;
|
||||
unsigned int count = 1000;
|
||||
unsigned int i;
|
||||
struct timespec starttime;
|
||||
struct timespec endtime;
|
||||
|
||||
@@ -195,7 +192,8 @@ main(int argc, char *argv[])
|
||||
(const char *)pin, slot);
|
||||
if ((result != ISC_R_SUCCESS) && (result != PK11_R_NORANDOMSERVICE) &&
|
||||
(result != PK11_R_NODIGESTSERVICE) &&
|
||||
(result != PK11_R_NOAESSERVICE)) {
|
||||
(result != PK11_R_NOAESSERVICE))
|
||||
{
|
||||
fprintf(stderr, "Error initializing PKCS#11: %s\n",
|
||||
isc_result_totext(result));
|
||||
free(hKey);
|
||||
|
||||
@@ -61,14 +61,12 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#endif /* ifndef CLOCK_REALTIME */
|
||||
|
||||
static int
|
||||
clock_gettime(int32_t id, struct timespec *tp);
|
||||
static int clock_gettime(int32_t id, struct timespec *tp);
|
||||
|
||||
static int
|
||||
clock_gettime(int32_t id, struct timespec *tp)
|
||||
{
|
||||
clock_gettime(int32_t id, struct timespec *tp) {
|
||||
struct timeval tv;
|
||||
int result;
|
||||
int result;
|
||||
|
||||
UNUSED(id);
|
||||
|
||||
@@ -82,18 +80,17 @@ clock_gettime(int32_t id, struct timespec *tp)
|
||||
#endif /* ifndef HAVE_CLOCK_GETTIME */
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
CK_RV rv;
|
||||
CK_SLOT_ID slot = 0;
|
||||
main(int argc, char *argv[]) {
|
||||
CK_RV rv;
|
||||
CK_SLOT_ID slot = 0;
|
||||
CK_SESSION_HANDLE *hSession;
|
||||
char * lib_name = NULL;
|
||||
int error = 0;
|
||||
int c, errflg = 0;
|
||||
unsigned int count = 1000;
|
||||
unsigned int i;
|
||||
struct timespec starttime;
|
||||
struct timespec endtime;
|
||||
char *lib_name = NULL;
|
||||
int error = 0;
|
||||
int c, errflg = 0;
|
||||
unsigned int count = 1000;
|
||||
unsigned int i;
|
||||
struct timespec starttime;
|
||||
struct timespec endtime;
|
||||
|
||||
while ((c = isc_commandline_parse(argc, argv, ":m:s:n:")) != -1) {
|
||||
switch (c) {
|
||||
|
||||
@@ -61,14 +61,12 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#endif /* ifndef CLOCK_REALTIME */
|
||||
|
||||
static int
|
||||
clock_gettime(int32_t id, struct timespec *tp);
|
||||
static int clock_gettime(int32_t id, struct timespec *tp);
|
||||
|
||||
static int
|
||||
clock_gettime(int32_t id, struct timespec *tp)
|
||||
{
|
||||
clock_gettime(int32_t id, struct timespec *tp) {
|
||||
struct timeval tv;
|
||||
int result;
|
||||
int result;
|
||||
|
||||
UNUSED(id);
|
||||
|
||||
@@ -84,23 +82,22 @@ clock_gettime(int32_t id, struct timespec *tp)
|
||||
CK_BYTE buf[1024];
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
isc_result_t result;
|
||||
CK_RV rv;
|
||||
CK_SLOT_ID slot = 0;
|
||||
main(int argc, char *argv[]) {
|
||||
isc_result_t result;
|
||||
CK_RV rv;
|
||||
CK_SLOT_ID slot = 0;
|
||||
CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE;
|
||||
CK_MECHANISM mech = { CKM_SHA_1, NULL, 0 };
|
||||
CK_ULONG len = sizeof(buf);
|
||||
pk11_context_t pctx;
|
||||
pk11_optype_t op_type = OP_DIGEST;
|
||||
char * lib_name = NULL;
|
||||
int error = 0;
|
||||
int c, errflg = 0;
|
||||
unsigned int count = 1000;
|
||||
unsigned int i;
|
||||
struct timespec starttime;
|
||||
struct timespec endtime;
|
||||
CK_MECHANISM mech = { CKM_SHA_1, NULL, 0 };
|
||||
CK_ULONG len = sizeof(buf);
|
||||
pk11_context_t pctx;
|
||||
pk11_optype_t op_type = OP_DIGEST;
|
||||
char *lib_name = NULL;
|
||||
int error = 0;
|
||||
int c, errflg = 0;
|
||||
unsigned int count = 1000;
|
||||
unsigned int i;
|
||||
struct timespec starttime;
|
||||
struct timespec endtime;
|
||||
|
||||
while ((c = isc_commandline_parse(argc, argv, ":m:s:n:")) != -1) {
|
||||
switch (c) {
|
||||
@@ -143,7 +140,8 @@ main(int argc, char *argv[])
|
||||
result = pk11_get_session(&pctx, op_type, false, false, false, NULL,
|
||||
slot);
|
||||
if ((result != ISC_R_SUCCESS) && (result != PK11_R_NORANDOMSERVICE) &&
|
||||
(result != PK11_R_NOAESSERVICE)) {
|
||||
(result != PK11_R_NOAESSERVICE))
|
||||
{
|
||||
fprintf(stderr, "Error initializing PKCS#11: %s\n",
|
||||
isc_result_totext(result));
|
||||
exit(1);
|
||||
|
||||
@@ -61,14 +61,12 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#endif /* ifndef CLOCK_REALTIME */
|
||||
|
||||
static int
|
||||
clock_gettime(int32_t id, struct timespec *tp);
|
||||
static int clock_gettime(int32_t id, struct timespec *tp);
|
||||
|
||||
static int
|
||||
clock_gettime(int32_t id, struct timespec *tp)
|
||||
{
|
||||
clock_gettime(int32_t id, struct timespec *tp) {
|
||||
struct timeval tv;
|
||||
int result;
|
||||
int result;
|
||||
|
||||
UNUSED(id);
|
||||
|
||||
@@ -151,42 +149,41 @@ static CK_BBOOL truevalue = TRUE;
|
||||
static CK_BBOOL falsevalue = FALSE;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
isc_result_t result;
|
||||
CK_RV rv;
|
||||
CK_SLOT_ID slot = 0;
|
||||
main(int argc, char *argv[]) {
|
||||
isc_result_t result;
|
||||
CK_RV rv;
|
||||
CK_SLOT_ID slot = 0;
|
||||
CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE;
|
||||
CK_ULONG len;
|
||||
CK_ULONG slen;
|
||||
CK_OBJECT_HANDLE hKey = CK_INVALID_HANDLE;
|
||||
CK_OBJECT_CLASS kClass = CKO_PRIVATE_KEY;
|
||||
CK_KEY_TYPE kType = CKK_RSA;
|
||||
CK_ATTRIBUTE kTemplate[] = {
|
||||
{ CKA_CLASS, &kClass, (CK_ULONG)sizeof(kClass) },
|
||||
{ CKA_KEY_TYPE, &kType, (CK_ULONG)sizeof(kType) },
|
||||
{ CKA_TOKEN, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
|
||||
{ CKA_PRIVATE, &truevalue, (CK_ULONG)sizeof(truevalue) },
|
||||
{ CKA_SIGN, &truevalue, (CK_ULONG)sizeof(truevalue) },
|
||||
{ CKA_MODULUS, modulus, (CK_ULONG)sizeof(modulus) },
|
||||
{ CKA_PUBLIC_EXPONENT, pubexp, (CK_ULONG)sizeof(pubexp) },
|
||||
{ CKA_PRIVATE_EXPONENT, privexp, (CK_ULONG)sizeof(privexp) },
|
||||
{ CKA_PRIME_1, prime1, (CK_ULONG)sizeof(prime1) },
|
||||
{ CKA_PRIME_2, prime2, (CK_ULONG)sizeof(prime2) },
|
||||
{ CKA_EXPONENT_1, exp_1, (CK_ULONG)sizeof(exp_1) },
|
||||
{ CKA_EXPONENT_2, exp_2, (CK_ULONG)sizeof(exp_2) },
|
||||
{ CKA_COEFFICIENT, coeff, (CK_ULONG)sizeof(coeff) }
|
||||
CK_ULONG len;
|
||||
CK_ULONG slen;
|
||||
CK_OBJECT_HANDLE hKey = CK_INVALID_HANDLE;
|
||||
CK_OBJECT_CLASS kClass = CKO_PRIVATE_KEY;
|
||||
CK_KEY_TYPE kType = CKK_RSA;
|
||||
CK_ATTRIBUTE kTemplate[] = {
|
||||
{ CKA_CLASS, &kClass, (CK_ULONG)sizeof(kClass) },
|
||||
{ CKA_KEY_TYPE, &kType, (CK_ULONG)sizeof(kType) },
|
||||
{ CKA_TOKEN, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
|
||||
{ CKA_PRIVATE, &truevalue, (CK_ULONG)sizeof(truevalue) },
|
||||
{ CKA_SIGN, &truevalue, (CK_ULONG)sizeof(truevalue) },
|
||||
{ CKA_MODULUS, modulus, (CK_ULONG)sizeof(modulus) },
|
||||
{ CKA_PUBLIC_EXPONENT, pubexp, (CK_ULONG)sizeof(pubexp) },
|
||||
{ CKA_PRIVATE_EXPONENT, privexp, (CK_ULONG)sizeof(privexp) },
|
||||
{ CKA_PRIME_1, prime1, (CK_ULONG)sizeof(prime1) },
|
||||
{ CKA_PRIME_2, prime2, (CK_ULONG)sizeof(prime2) },
|
||||
{ CKA_EXPONENT_1, exp_1, (CK_ULONG)sizeof(exp_1) },
|
||||
{ CKA_EXPONENT_2, exp_2, (CK_ULONG)sizeof(exp_2) },
|
||||
{ CKA_COEFFICIENT, coeff, (CK_ULONG)sizeof(coeff) }
|
||||
};
|
||||
CK_MECHANISM mech = { CKM_SHA1_RSA_PKCS, NULL, 0 };
|
||||
pk11_context_t pctx;
|
||||
pk11_optype_t op_type = OP_RSA;
|
||||
char * lib_name = NULL;
|
||||
char * pin = NULL;
|
||||
int error = 0;
|
||||
int c, errflg = 0;
|
||||
int ontoken = 0;
|
||||
unsigned int count = 1000;
|
||||
unsigned int i;
|
||||
CK_MECHANISM mech = { CKM_SHA1_RSA_PKCS, NULL, 0 };
|
||||
pk11_context_t pctx;
|
||||
pk11_optype_t op_type = OP_RSA;
|
||||
char *lib_name = NULL;
|
||||
char *pin = NULL;
|
||||
int error = 0;
|
||||
int c, errflg = 0;
|
||||
int ontoken = 0;
|
||||
unsigned int count = 1000;
|
||||
unsigned int i;
|
||||
struct timespec starttime;
|
||||
struct timespec endtime;
|
||||
|
||||
@@ -243,7 +240,8 @@ main(int argc, char *argv[])
|
||||
(const char *)pin, slot);
|
||||
if ((result != ISC_R_SUCCESS) && (result != PK11_R_NORANDOMSERVICE) &&
|
||||
(result != PK11_R_NODIGESTSERVICE) &&
|
||||
(result != PK11_R_NOAESSERVICE)) {
|
||||
(result != PK11_R_NOAESSERVICE))
|
||||
{
|
||||
fprintf(stderr, "Error initializing PKCS#11: %s\n",
|
||||
isc_result_totext(result));
|
||||
exit(1);
|
||||
|
||||
@@ -61,14 +61,12 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#endif /* ifndef CLOCK_REALTIME */
|
||||
|
||||
static int
|
||||
clock_gettime(int32_t id, struct timespec *tp);
|
||||
static int clock_gettime(int32_t id, struct timespec *tp);
|
||||
|
||||
static int
|
||||
clock_gettime(int32_t id, struct timespec *tp)
|
||||
{
|
||||
clock_gettime(int32_t id, struct timespec *tp) {
|
||||
struct timeval tv;
|
||||
int result;
|
||||
int result;
|
||||
|
||||
UNUSED(id);
|
||||
|
||||
@@ -103,36 +101,35 @@ static CK_BBOOL truevalue = TRUE;
|
||||
static CK_BBOOL falsevalue = FALSE;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
isc_result_t result;
|
||||
CK_RV rv;
|
||||
CK_SLOT_ID slot = 0;
|
||||
main(int argc, char *argv[]) {
|
||||
isc_result_t result;
|
||||
CK_RV rv;
|
||||
CK_SLOT_ID slot = 0;
|
||||
CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE;
|
||||
CK_ULONG len;
|
||||
CK_ULONG slen;
|
||||
CK_OBJECT_HANDLE hKey = CK_INVALID_HANDLE;
|
||||
CK_OBJECT_CLASS kClass = CKO_PUBLIC_KEY;
|
||||
CK_KEY_TYPE kType = CKK_RSA;
|
||||
CK_ATTRIBUTE kTemplate[] = {
|
||||
{ CKA_CLASS, &kClass, (CK_ULONG)sizeof(kClass) },
|
||||
{ CKA_KEY_TYPE, &kType, (CK_ULONG)sizeof(kType) },
|
||||
{ CKA_TOKEN, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
|
||||
{ CKA_PRIVATE, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
|
||||
{ CKA_VERIFY, &truevalue, (CK_ULONG)sizeof(truevalue) },
|
||||
{ CKA_MODULUS, modulus, (CK_ULONG)sizeof(modulus) },
|
||||
{ CKA_PUBLIC_EXPONENT, exponent, (CK_ULONG)sizeof(exponent) }
|
||||
CK_ULONG len;
|
||||
CK_ULONG slen;
|
||||
CK_OBJECT_HANDLE hKey = CK_INVALID_HANDLE;
|
||||
CK_OBJECT_CLASS kClass = CKO_PUBLIC_KEY;
|
||||
CK_KEY_TYPE kType = CKK_RSA;
|
||||
CK_ATTRIBUTE kTemplate[] = {
|
||||
{ CKA_CLASS, &kClass, (CK_ULONG)sizeof(kClass) },
|
||||
{ CKA_KEY_TYPE, &kType, (CK_ULONG)sizeof(kType) },
|
||||
{ CKA_TOKEN, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
|
||||
{ CKA_PRIVATE, &falsevalue, (CK_ULONG)sizeof(falsevalue) },
|
||||
{ CKA_VERIFY, &truevalue, (CK_ULONG)sizeof(truevalue) },
|
||||
{ CKA_MODULUS, modulus, (CK_ULONG)sizeof(modulus) },
|
||||
{ CKA_PUBLIC_EXPONENT, exponent, (CK_ULONG)sizeof(exponent) }
|
||||
};
|
||||
CK_MECHANISM mech = { CKM_SHA1_RSA_PKCS, NULL, 0 };
|
||||
pk11_context_t pctx;
|
||||
pk11_optype_t op_type = OP_RSA;
|
||||
char * lib_name = NULL;
|
||||
char * pin = NULL;
|
||||
int error = 0;
|
||||
int c, errflg = 0;
|
||||
int ontoken = 0;
|
||||
unsigned int count = 1000;
|
||||
unsigned int i;
|
||||
CK_MECHANISM mech = { CKM_SHA1_RSA_PKCS, NULL, 0 };
|
||||
pk11_context_t pctx;
|
||||
pk11_optype_t op_type = OP_RSA;
|
||||
char *lib_name = NULL;
|
||||
char *pin = NULL;
|
||||
int error = 0;
|
||||
int c, errflg = 0;
|
||||
int ontoken = 0;
|
||||
unsigned int count = 1000;
|
||||
unsigned int i;
|
||||
struct timespec starttime;
|
||||
struct timespec endtime;
|
||||
|
||||
@@ -189,7 +186,8 @@ main(int argc, char *argv[])
|
||||
(const char *)pin, slot);
|
||||
if ((result != ISC_R_SUCCESS) && (result != PK11_R_NORANDOMSERVICE) &&
|
||||
(result != PK11_R_NODIGESTSERVICE) &&
|
||||
(result != PK11_R_NOAESSERVICE)) {
|
||||
(result != PK11_R_NOAESSERVICE))
|
||||
{
|
||||
fprintf(stderr, "Error initializing PKCS#11: %s\n",
|
||||
isc_result_totext(result));
|
||||
exit(1);
|
||||
|
||||
Reference in New Issue
Block a user