diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/pkcs12/p12_mutl.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/lib/libcrypto/pkcs12/p12_mutl.c b/src/lib/libcrypto/pkcs12/p12_mutl.c index 7474bf5ff3..5c9cea90db 100644 --- a/src/lib/libcrypto/pkcs12/p12_mutl.c +++ b/src/lib/libcrypto/pkcs12/p12_mutl.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: p12_mutl.c,v 1.30 2022/07/25 05:06:06 tb Exp $ */ | 1 | /* $OpenBSD: p12_mutl.c,v 1.31 2022/08/03 20:16:06 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 1999. | 3 | * project 1999. |
| 4 | */ | 4 | */ |
| @@ -72,6 +72,39 @@ | |||
| 72 | #include "hmac_local.h" | 72 | #include "hmac_local.h" |
| 73 | #include "x509_lcl.h" | 73 | #include "x509_lcl.h" |
| 74 | 74 | ||
| 75 | int | ||
| 76 | PKCS12_mac_present(const PKCS12 *p12) | ||
| 77 | { | ||
| 78 | return p12->mac != NULL; | ||
| 79 | } | ||
| 80 | |||
| 81 | void | ||
| 82 | PKCS12_get0_mac(const ASN1_OCTET_STRING **pmac, const X509_ALGOR **pmacalg, | ||
| 83 | const ASN1_OCTET_STRING **psalt, const ASN1_INTEGER **piter, | ||
| 84 | const PKCS12 *p12) | ||
| 85 | { | ||
| 86 | if (p12->mac == NULL) { | ||
| 87 | if (pmac != NULL) | ||
| 88 | *pmac = NULL; | ||
| 89 | if (pmacalg != NULL) | ||
| 90 | *pmacalg = NULL; | ||
| 91 | if (psalt != NULL) | ||
| 92 | *psalt = NULL; | ||
| 93 | if (piter != NULL) | ||
| 94 | *piter = NULL; | ||
| 95 | return; | ||
| 96 | } | ||
| 97 | |||
| 98 | if (pmac != NULL) | ||
| 99 | *pmac = p12->mac->dinfo->digest; | ||
| 100 | if (pmacalg != NULL) | ||
| 101 | *pmacalg = p12->mac->dinfo->algor; | ||
| 102 | if (psalt != NULL) | ||
| 103 | *psalt = p12->mac->salt; | ||
| 104 | if (piter != NULL) | ||
| 105 | *piter = p12->mac->iter; | ||
| 106 | } | ||
| 107 | |||
| 75 | /* Generate a MAC */ | 108 | /* Generate a MAC */ |
| 76 | int | 109 | int |
| 77 | PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen, | 110 | PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen, |
