diff options
| author | tb <> | 2022-08-03 20:16:06 +0000 |
|---|---|---|
| committer | tb <> | 2022-08-03 20:16:06 +0000 |
| commit | a32a61a3aa20740d1ab3245e6e33400a7dcfd2ee (patch) | |
| tree | 2050ca3c5df6f38c2b64ca740e75145adf5ebc5a /src/lib/libcrypto/pkcs12/p12_mutl.c | |
| parent | ea6323b575f9fa3c9246e238f0b70fa2e38bc064 (diff) | |
| download | openbsd-a32a61a3aa20740d1ab3245e6e33400a7dcfd2ee.tar.gz openbsd-a32a61a3aa20740d1ab3245e6e33400a7dcfd2ee.tar.bz2 openbsd-a32a61a3aa20740d1ab3245e6e33400a7dcfd2ee.zip | |
Prepare to provide PKCS12 accessors
In order to be able to make pkcs12/ opaque, we need an entire family of
accessors. These are in a particularly nasty tangle since this was done
in about a dozen steps while sprinkling const, renaming functions, etc.
The public API also adds backward compat macros for functions that were
in the tree for half a day and then renamed. Of course some of them got
picked up by some ports.
Some of the gruesome hacks in here will go away with the next bump, but
that doesn't mean that the pkcs12 directory will be prettier afterward.
ok jsing
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, |
