shorten64 fixes for key-gen/cert-gen
This commit is contained in:
parent
0bbbea20be
commit
01ae0696af
@ -2863,8 +2863,8 @@ int DerToPem(const byte* der, word32 derSz, byte* output, word32 outSz,
|
|||||||
XSTRNCPY(footer, "-----END RSA PRIVATE KEY-----\n", sizeof(footer));
|
XSTRNCPY(footer, "-----END RSA PRIVATE KEY-----\n", sizeof(footer));
|
||||||
}
|
}
|
||||||
|
|
||||||
headerLen = XSTRLEN(header);
|
headerLen = (int)XSTRLEN(header);
|
||||||
footerLen = XSTRLEN(footer);
|
footerLen = (int)XSTRLEN(footer);
|
||||||
|
|
||||||
if (!der || !output)
|
if (!der || !output)
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
@ -3410,7 +3410,7 @@ static int SetName(byte* output, CertName* name)
|
|||||||
byte set[MAX_SET_SZ];
|
byte set[MAX_SET_SZ];
|
||||||
|
|
||||||
int email = i == (NAME_ENTRIES - 1) ? 1 : 0;
|
int email = i == (NAME_ENTRIES - 1) ? 1 : 0;
|
||||||
int strLen = XSTRLEN(nameStr);
|
int strLen = (int)XSTRLEN(nameStr);
|
||||||
int thisLen = strLen;
|
int thisLen = strLen;
|
||||||
int firstSz, secondSz, seqSz, setSz;
|
int firstSz, secondSz, seqSz, setSz;
|
||||||
|
|
||||||
@ -3461,7 +3461,7 @@ static int SetName(byte* output, CertName* name)
|
|||||||
0x01, 0x09, 0x01, 0x16 };
|
0x01, 0x09, 0x01, 0x16 };
|
||||||
/* email joint id */
|
/* email joint id */
|
||||||
XMEMCPY(names[i].encoded + idx, EMAIL_OID, sizeof(EMAIL_OID));
|
XMEMCPY(names[i].encoded + idx, EMAIL_OID, sizeof(EMAIL_OID));
|
||||||
idx += sizeof(EMAIL_OID);
|
idx += (int)sizeof(EMAIL_OID);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* joint id */
|
/* joint id */
|
||||||
|
@ -1491,7 +1491,7 @@ int rsa_test(void)
|
|||||||
keyFile = fopen("./key.der", "wb");
|
keyFile = fopen("./key.der", "wb");
|
||||||
if (!keyFile)
|
if (!keyFile)
|
||||||
return -303;
|
return -303;
|
||||||
ret = fwrite(der, derSz, 1, keyFile);
|
ret = (int)fwrite(der, derSz, 1, keyFile);
|
||||||
fclose(keyFile);
|
fclose(keyFile);
|
||||||
|
|
||||||
pemSz = DerToPem(der, derSz, pem, sizeof(pem), PRIVATEKEY_TYPE);
|
pemSz = DerToPem(der, derSz, pem, sizeof(pem), PRIVATEKEY_TYPE);
|
||||||
@ -1501,7 +1501,7 @@ int rsa_test(void)
|
|||||||
pemFile = fopen("./key.pem", "wb");
|
pemFile = fopen("./key.pem", "wb");
|
||||||
if (!pemFile)
|
if (!pemFile)
|
||||||
return -305;
|
return -305;
|
||||||
ret = fwrite(pem, pemSz, 1, pemFile);
|
ret = (int)fwrite(pem, pemSz, 1, pemFile);
|
||||||
fclose(pemFile);
|
fclose(pemFile);
|
||||||
|
|
||||||
InitRsaKey(&derIn, 0);
|
InitRsaKey(&derIn, 0);
|
||||||
@ -1556,7 +1556,7 @@ int rsa_test(void)
|
|||||||
derFile = fopen("./cert.der", "wb");
|
derFile = fopen("./cert.der", "wb");
|
||||||
if (!derFile)
|
if (!derFile)
|
||||||
return -403;
|
return -403;
|
||||||
ret = fwrite(derCert, certSz, 1, derFile);
|
ret = (int)fwrite(derCert, certSz, 1, derFile);
|
||||||
fclose(derFile);
|
fclose(derFile);
|
||||||
|
|
||||||
pemSz = DerToPem(derCert, certSz, pem, sizeof(pem), CERT_TYPE);
|
pemSz = DerToPem(derCert, certSz, pem, sizeof(pem), CERT_TYPE);
|
||||||
@ -1566,7 +1566,7 @@ int rsa_test(void)
|
|||||||
pemFile = fopen("./cert.pem", "wb");
|
pemFile = fopen("./cert.pem", "wb");
|
||||||
if (!pemFile)
|
if (!pemFile)
|
||||||
return -405;
|
return -405;
|
||||||
ret = fwrite(pem, pemSz, 1, pemFile);
|
ret = (int)fwrite(pem, pemSz, 1, pemFile);
|
||||||
fclose(pemFile);
|
fclose(pemFile);
|
||||||
|
|
||||||
|
|
||||||
@ -1634,7 +1634,7 @@ int rsa_test(void)
|
|||||||
derFile = fopen("./othercert.der", "wb");
|
derFile = fopen("./othercert.der", "wb");
|
||||||
if (!derFile)
|
if (!derFile)
|
||||||
return -410;
|
return -410;
|
||||||
ret = fwrite(derCert, certSz, 1, derFile);
|
ret = (int)fwrite(derCert, certSz, 1, derFile);
|
||||||
fclose(derFile);
|
fclose(derFile);
|
||||||
|
|
||||||
pemSz = DerToPem(derCert, certSz, pem, sizeof(pem), CERT_TYPE);
|
pemSz = DerToPem(derCert, certSz, pem, sizeof(pem), CERT_TYPE);
|
||||||
@ -1644,7 +1644,7 @@ int rsa_test(void)
|
|||||||
pemFile = fopen("./othercert.pem", "wb");
|
pemFile = fopen("./othercert.pem", "wb");
|
||||||
if (!pemFile)
|
if (!pemFile)
|
||||||
return -412;
|
return -412;
|
||||||
ret = fwrite(pem, pemSz, 1, pemFile);
|
ret = (int)fwrite(pem, pemSz, 1, pemFile);
|
||||||
fclose(pemFile);
|
fclose(pemFile);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_NTRU
|
#ifdef HAVE_NTRU
|
||||||
|
@ -1875,7 +1875,7 @@ int CyaSSL_PemCertToDer(const char* fileName, unsigned char* derBuf, int derSz)
|
|||||||
dynamic = 1;
|
dynamic = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (ret = XFREAD(fileBuf, sz, 1, file)) < 0)
|
if ( (ret = (int)XFREAD(fileBuf, sz, 1, file)) < 0)
|
||||||
ret = SSL_BAD_FILE;
|
ret = SSL_BAD_FILE;
|
||||||
else
|
else
|
||||||
ret = PemToDer(fileBuf, sz, CA_TYPE, &converted, 0, &info, &ecc);
|
ret = PemToDer(fileBuf, sz, CA_TYPE, &converted, 0, &info, &ecc);
|
||||||
|
Loading…
Reference in New Issue
Block a user