px5g-wolfssl: Fix certificate signature
Certificate signature algorithm was being set after call to `wc_MakeCert`, resulting in a mismatch between specified signature in certificate and the actual signature type. Signed-off-by: Jeffrey Elms <jeff@wolfssl.com> [fix commit subject, use COMMITCOUNT] Signed-off-by: Paul Spooren <mail@aparcar.org>
This commit is contained in:
		
				
					committed by
					
						
						Paul Spooren
					
				
			
			
				
	
			
			
			
						parent
						
							01e4274c21
						
					
				
				
					commit
					ff2087d9a9
				
			@@ -5,7 +5,7 @@
 | 
				
			|||||||
include $(TOPDIR)/rules.mk
 | 
					include $(TOPDIR)/rules.mk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PKG_NAME:=px5g-wolfssl
 | 
					PKG_NAME:=px5g-wolfssl
 | 
				
			||||||
PKG_RELEASE:=1
 | 
					PKG_RELEASE:=$(COMMITCOUNT)
 | 
				
			||||||
PKG_LICENSE:=GPL-2.0-or-later
 | 
					PKG_LICENSE:=GPL-2.0-or-later
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PKG_USE_MIPS16:=0
 | 
					PKG_USE_MIPS16:=0
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -232,8 +232,10 @@ int selfsigned(WC_RNG *rng, char **arg) {
 | 
				
			|||||||
          subject, fstr, tstr);
 | 
					          subject, fstr, tstr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (type == EC_KEY_TYPE) {
 | 
					  if (type == EC_KEY_TYPE) {
 | 
				
			||||||
 | 
					    newCert.sigType = CTC_SHA256wECDSA;
 | 
				
			||||||
    ret = wc_MakeCert(&newCert, derBuf, sizeof(derBuf), NULL, &ecKey, rng);
 | 
					    ret = wc_MakeCert(&newCert, derBuf, sizeof(derBuf), NULL, &ecKey, rng);
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
 | 
					    newCert.sigType = CTC_SHA256wRSA;
 | 
				
			||||||
    ret = wc_MakeCert(&newCert, derBuf, sizeof(derBuf), &rsaKey, NULL, rng);
 | 
					    ret = wc_MakeCert(&newCert, derBuf, sizeof(derBuf), &rsaKey, NULL, rng);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (ret <= 0) {
 | 
					  if (ret <= 0) {
 | 
				
			||||||
@@ -242,11 +244,9 @@ int selfsigned(WC_RNG *rng, char **arg) {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (type == EC_KEY_TYPE) {
 | 
					  if (type == EC_KEY_TYPE) {
 | 
				
			||||||
    newCert.sigType = CTC_SHA256wECDSA;
 | 
					 | 
				
			||||||
    ret = wc_SignCert(newCert.bodySz, newCert.sigType, derBuf, sizeof(derBuf),
 | 
					    ret = wc_SignCert(newCert.bodySz, newCert.sigType, derBuf, sizeof(derBuf),
 | 
				
			||||||
                      NULL, &ecKey, rng);
 | 
					                      NULL, &ecKey, rng);
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    newCert.sigType = CTC_SHA256wRSA;
 | 
					 | 
				
			||||||
    ret = wc_SignCert(newCert.bodySz, newCert.sigType, derBuf, sizeof(derBuf),
 | 
					    ret = wc_SignCert(newCert.bodySz, newCert.sigType, derBuf, sizeof(derBuf),
 | 
				
			||||||
                      &rsaKey, NULL, rng);
 | 
					                      &rsaKey, NULL, rng);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user