Add the OSSL_PROVIDER_get_capabilities() API function
[oweals/openssl.git] / crypto / dsa / dsa_sign.c
index d09aaea6dbcaeab348d83eb8bcedc5c84992f185..71a60bb39b301b97eec8b31f1a8b737927d3e492 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -7,6 +7,12 @@
  * https://www.openssl.org/source/license.html
  */
 
+/*
+ * DSA low level APIs are deprecated for public use, but still ok for
+ * internal use.
+ */
+#include "internal/deprecated.h"
+
 #include <openssl/bn.h>
 #include "internal/cryptlib.h"
 #include "dsa_local.h"
@@ -115,7 +121,7 @@ int DSA_size(const DSA *dsa)
     int ret;
     DSA_SIG sig;
 
-    sig.r = sig.s = dsa->q;
+    sig.r = sig.s = dsa->params.q;
     ret = i2d_DSA_SIG(&sig, NULL);
 
     if (ret < 0)
@@ -142,16 +148,16 @@ int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s)
     return 1;
 }
 
-int dsa_sign_int(OPENSSL_CTX *libctx, int type, const unsigned char *dgst,
+int dsa_sign_int(int type, const unsigned char *dgst,
                  int dlen, unsigned char *sig, unsigned int *siglen, DSA *dsa)
 {
     DSA_SIG *s;
 
     /* legacy case uses the method table */
-    if (libctx == NULL || dsa->meth != DSA_get_default_method())
+    if (dsa->libctx == NULL || dsa->meth != DSA_get_default_method())
         s = DSA_do_sign(dgst, dlen, dsa);
     else
-        s = dsa_do_sign_int(libctx, dgst, dlen, dsa);
+        s = dsa_do_sign_int(dgst, dlen, dsa);
     if (s == NULL) {
         *siglen = 0;
         return 0;
@@ -164,7 +170,7 @@ int dsa_sign_int(OPENSSL_CTX *libctx, int type, const unsigned char *dgst,
 int DSA_sign(int type, const unsigned char *dgst, int dlen,
              unsigned char *sig, unsigned int *siglen, DSA *dsa)
 {
-    return dsa_sign_int(NULL, type, dgst, dlen, sig, siglen, dsa);
+    return dsa_sign_int(type, dgst, dlen, sig, siglen, dsa);
 }
 
 /* data has already been hashed (probably with SHA or SHA-1). */