| 6 | // |
| 7 | // https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 |
| 15 | #include <stdio.h> |
| 16 |
| 17 | #include <openssl/asn1t.h> |
| 18 | #include <openssl/x509.h> |
| 19 |
| 20 |
| 21 | struct X509_sig_st { |
| 22 | X509_ALGOR *algor; |
| 23 | ASN1_OCTET_STRING *digest; |
| 24 | } /* X509_SIG */; |
| 25 |
| 26 | ASN1_SEQUENCE(X509_SIG) = { |
| 27 | ASN1_SIMPLE(X509_SIG, algor, X509_ALGOR), |
| 28 | ASN1_SIMPLE(X509_SIG, digest, ASN1_OCTET_STRING), |
| 29 | } ASN1_SEQUENCE_END(X509_SIG) |
| 30 |
| 31 | IMPLEMENT_ASN1_FUNCTIONS_const(X509_SIG) |
| 32 |
| 33 | void X509_SIG_get0(const X509_SIG *sig, const X509_ALGOR **out_alg, |
| 34 | const ASN1_OCTET_STRING **out_digest) { |
| 35 | if (out_alg != NULL) { |
| 36 | *out_alg = sig->algor; |
| 37 | } |
| 38 | if (out_digest != NULL) { |
| 39 | *out_digest = sig->digest; |
| 40 | } |
| 41 | } |
| 42 |
| 43 | void X509_SIG_getm(X509_SIG *sig, X509_ALGOR **out_alg, |
| 44 | ASN1_OCTET_STRING **out_digest) { |
| 45 | if (out_alg != NULL) { |
| 46 | *out_alg = sig->algor; |
| 47 | } |
| 48 | if (out_digest != NULL) { |
| 49 | *out_digest = sig->digest; |
| 50 | } |
| 51 | } |
| 52 |