Lines 346-352
static int openssl_pkcs7_dataFinal(PKCS7 *p7, BIO *bio)
Link Here
|
346 |
os = p7->d.signed_and_enveloped->enc_data->enc_data; |
346 |
os = p7->d.signed_and_enveloped->enc_data->enc_data; |
347 |
if (!os) |
347 |
if (!os) |
348 |
{ |
348 |
{ |
349 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L |
349 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) |
350 |
os = M_ASN1_OCTET_STRING_new(); |
350 |
os = M_ASN1_OCTET_STRING_new(); |
351 |
#else |
351 |
#else |
352 |
os = ASN1_OCTET_STRING_new(); |
352 |
os = ASN1_OCTET_STRING_new(); |
Lines 364-370
static int openssl_pkcs7_dataFinal(PKCS7 *p7, BIO *bio)
Link Here
|
364 |
os = p7->d.enveloped->enc_data->enc_data; |
364 |
os = p7->d.enveloped->enc_data->enc_data; |
365 |
if (!os) |
365 |
if (!os) |
366 |
{ |
366 |
{ |
367 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L |
367 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) |
368 |
os = M_ASN1_OCTET_STRING_new(); |
368 |
os = M_ASN1_OCTET_STRING_new(); |
369 |
#else |
369 |
#else |
370 |
os = ASN1_OCTET_STRING_new(); |
370 |
os = ASN1_OCTET_STRING_new(); |
Lines 383-389
static int openssl_pkcs7_dataFinal(PKCS7 *p7, BIO *bio)
Link Here
|
383 |
/* If detached data then the content is excluded */ |
383 |
/* If detached data then the content is excluded */ |
384 |
if (PKCS7_type_is_data(p7->d.sign->contents) && p7->detached) |
384 |
if (PKCS7_type_is_data(p7->d.sign->contents) && p7->detached) |
385 |
{ |
385 |
{ |
386 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L |
386 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) |
387 |
M_ASN1_OCTET_STRING_free(os); |
387 |
M_ASN1_OCTET_STRING_free(os); |
388 |
#else |
388 |
#else |
389 |
ASN1_OCTET_STRING_free(os); |
389 |
ASN1_OCTET_STRING_free(os); |
Lines 398-404
static int openssl_pkcs7_dataFinal(PKCS7 *p7, BIO *bio)
Link Here
|
398 |
/* If detached data then the content is excluded */ |
398 |
/* If detached data then the content is excluded */ |
399 |
if (PKCS7_type_is_data(p7->d.digest->contents) && p7->detached) |
399 |
if (PKCS7_type_is_data(p7->d.digest->contents) && p7->detached) |
400 |
{ |
400 |
{ |
401 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L |
401 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) |
402 |
M_ASN1_OCTET_STRING_free(os); |
402 |
M_ASN1_OCTET_STRING_free(os); |
403 |
#else |
403 |
#else |
404 |
ASN1_OCTET_STRING_free(os); |
404 |
ASN1_OCTET_STRING_free(os); |
Lines 474-480
static int openssl_pkcs7_dataFinal(PKCS7 *p7, BIO *bio)
Link Here
|
474 |
goto err; |
474 |
goto err; |
475 |
if (!EVP_DigestFinal_ex(mdc, md_data, &md_len)) |
475 |
if (!EVP_DigestFinal_ex(mdc, md_data, &md_len)) |
476 |
goto err; |
476 |
goto err; |
477 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L |
477 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) |
478 |
M_ASN1_OCTET_STRING_set(p7->d.digest->digest, md_data, md_len); |
478 |
M_ASN1_OCTET_STRING_set(p7->d.digest->digest, md_data, md_len); |
479 |
#else |
479 |
#else |
480 |
ASN1_OCTET_STRING_set(p7->d.digest->digest, md_data, md_len); |
480 |
ASN1_OCTET_STRING_set(p7->d.digest->digest, md_data, md_len); |
Lines 577-583
int PKCS7_signatureVerify_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si, X509 *x509,
Link Here
|
577 |
|
577 |
|
578 |
md_type = OBJ_obj2nid(si->digest_alg->algorithm); |
578 |
md_type = OBJ_obj2nid(si->digest_alg->algorithm); |
579 |
md = EVP_get_digestbynid(md_type); |
579 |
md = EVP_get_digestbynid(md_type); |
580 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L |
580 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) |
581 |
if (!md || !data || (hash && len != (size_t) md->ctx_size) ) |
581 |
if (!md || !data || (hash && len != (size_t) md->ctx_size) ) |
582 |
goto err; |
582 |
goto err; |
583 |
|
583 |
|
Lines 1137-1143
static LUA_FUNCTION(openssl_pkcs7_sign_digest)
Link Here
|
1137 |
os = p7->d.signed_and_enveloped->enc_data->enc_data; |
1137 |
os = p7->d.signed_and_enveloped->enc_data->enc_data; |
1138 |
if (!os) |
1138 |
if (!os) |
1139 |
{ |
1139 |
{ |
1140 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L |
1140 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) |
1141 |
os = M_ASN1_OCTET_STRING_new(); |
1141 |
os = M_ASN1_OCTET_STRING_new(); |
1142 |
#else |
1142 |
#else |
1143 |
os = ASN1_OCTET_STRING_new(); |
1143 |
os = ASN1_OCTET_STRING_new(); |
Lines 1155-1161
static LUA_FUNCTION(openssl_pkcs7_sign_digest)
Link Here
|
1155 |
os = p7->d.enveloped->enc_data->enc_data; |
1155 |
os = p7->d.enveloped->enc_data->enc_data; |
1156 |
if (!os) |
1156 |
if (!os) |
1157 |
{ |
1157 |
{ |
1158 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L |
1158 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) |
1159 |
os = M_ASN1_OCTET_STRING_new(); |
1159 |
os = M_ASN1_OCTET_STRING_new(); |
1160 |
#else |
1160 |
#else |
1161 |
os = ASN1_OCTET_STRING_new(); |
1161 |
os = ASN1_OCTET_STRING_new(); |
Lines 1174-1180
static LUA_FUNCTION(openssl_pkcs7_sign_digest)
Link Here
|
1174 |
/* If detached data then the content is excluded */ |
1174 |
/* If detached data then the content is excluded */ |
1175 |
if (PKCS7_type_is_data(p7->d.sign->contents) && p7->detached) |
1175 |
if (PKCS7_type_is_data(p7->d.sign->contents) && p7->detached) |
1176 |
{ |
1176 |
{ |
1177 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L |
1177 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) |
1178 |
M_ASN1_OCTET_STRING_free(os); |
1178 |
M_ASN1_OCTET_STRING_free(os); |
1179 |
#else |
1179 |
#else |
1180 |
ASN1_OCTET_STRING_free(os); |
1180 |
ASN1_OCTET_STRING_free(os); |
Lines 1189-1195
static LUA_FUNCTION(openssl_pkcs7_sign_digest)
Link Here
|
1189 |
/* If detached data then the content is excluded */ |
1189 |
/* If detached data then the content is excluded */ |
1190 |
if (PKCS7_type_is_data(p7->d.digest->contents) && p7->detached) |
1190 |
if (PKCS7_type_is_data(p7->d.digest->contents) && p7->detached) |
1191 |
{ |
1191 |
{ |
1192 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L |
1192 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) |
1193 |
M_ASN1_OCTET_STRING_free(os); |
1193 |
M_ASN1_OCTET_STRING_free(os); |
1194 |
#else |
1194 |
#else |
1195 |
ASN1_OCTET_STRING_free(os); |
1195 |
ASN1_OCTET_STRING_free(os); |
Lines 1217-1223
static LUA_FUNCTION(openssl_pkcs7_sign_digest)
Link Here
|
1217 |
|
1217 |
|
1218 |
if (hash) |
1218 |
if (hash) |
1219 |
{ |
1219 |
{ |
1220 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L |
1220 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) |
1221 |
if (l == (size_t) mdc->digest->ctx_size) |
1221 |
if (l == (size_t) mdc->digest->ctx_size) |
1222 |
{ |
1222 |
{ |
1223 |
memcpy(mdc->md_data, data, l); |
1223 |
memcpy(mdc->md_data, data, l); |
Lines 1272-1278
static LUA_FUNCTION(openssl_pkcs7_sign_digest)
Link Here
|
1272 |
unsigned int md_len; |
1272 |
unsigned int md_len; |
1273 |
md = EVP_get_digestbynid(OBJ_obj2nid(p7->d.digest->md->algorithm)); |
1273 |
md = EVP_get_digestbynid(OBJ_obj2nid(p7->d.digest->md->algorithm)); |
1274 |
EVP_DigestInit_ex(mdc, md, NULL); |
1274 |
EVP_DigestInit_ex(mdc, md, NULL); |
1275 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L |
1275 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) |
1276 |
if (l == (size_t) mdc->digest->ctx_size) |
1276 |
if (l == (size_t) mdc->digest->ctx_size) |
1277 |
{ |
1277 |
{ |
1278 |
memcpy(mdc->md_data, data, l); |
1278 |
memcpy(mdc->md_data, data, l); |